diff --git a/lib/.pear2registry b/lib/.pear2registry
index 8aff1f02c7a83050f6d5c15374aeca9fe81b832c..ad7c1ff64c68787256d4fbfba757837292d2bf75 100644
Binary files a/lib/.pear2registry and b/lib/.pear2registry differ
diff --git a/lib/.xmlregistry/packages/pear.php.net/Archive_Tar/1.3.3-info.xml b/lib/.xmlregistry/packages/pear.php.net/Archive_Tar/1.3.3-info.xml
deleted file mode 100644
index bb61382f7e88f8fe61c7ab10af1c68c8c3eccadb..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/Archive_Tar/1.3.3-info.xml
+++ /dev/null
@@ -1,248 +0,0 @@
-<?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.0RC1" 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>Archive_Tar</name>
- <channel>pear.php.net</channel>
- <summary>Tar file management class</summary>
- <description>This class provides handling of tar files in PHP.
-It supports creating, listing, extracting and adding to tar files.
-Gzip support is available if PHP has the zlib extension built-in or
-loaded. Bz2 compression is also supported with the bz2 extension loaded.</description>
- <lead>
-  <name>Gregory Beaver</name>
-  <user>cellog</user>
-  <email>cellog@php.net</email>
-  <active>yes</active>
- </lead>
- <lead>
-  <name>Vincent Blavet</name>
-  <user>vblavet</user>
-  <email>vincent@phpconcept.net</email>
-  <active>no</active>
- </lead>
- <helper>
-  <name>Stig Bakken</name>
-  <user>ssb</user>
-  <email>stig@php.net</email>
-  <active>no</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.3.3</release>
-  <api>1.3.1</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
- <notes>
-Change the license to New BSD license
-
-   minor bugfix release
-   * fix Bug #9921 compression with bzip2 fails [cellog]
-   * fix Bug #11594 _readLongHeader leaves 0 bytes in filename [jamessas]
-   * fix Bug #11769 Incorrect symlink handing [fajar99]
- </notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="/" md5sum="29b03715377b18b1fafcff98a99cc9a7" name="docs/Archive_Tar.txt" role="doc"/>
-   <file baseinstalldir="/" md5sum="d6c6633566e7484aff188f798529b061" name="Archive/Tar.php" role="php"/>
-  </dir>
- </contents>
- <compatible>
-  <name>PEAR</name>
-  <channel>pear.php.net</channel>
-  <min>1.4.0</min>
-  <max>1.5.0RC2</max>
- </compatible>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.5.4</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.3.2</release>
-     <api>1.3.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-01-03</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Correct Bug #4016
-Remove duplicate remove error display with '@'
-Correct Bug #3909 : Check existence of OS_WINDOWS constant
-Correct Bug #5452 fix for &quot;lone zero block&quot; when untarring packages
-Change filemode (from pear-core/Archive/Tar.php v.1.21)
-Correct Bug #6486 Can not extract symlinks
-Correct Bug #6933 Archive_Tar (Tar file management class) Directory traversal
-Correct Bug #8114 Files added on-the-fly not storing date
-Correct Bug #9352 Bug on _dirCheck function over nfs path
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>1.3.1</release>
-     <api>1.3.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-17</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Correct Bug #3855
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>1.3.0</release>
-     <api>1.3.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-06</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Bugs correction (2475, 2488, 2135, 2176)
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2</release>
-     <api>1.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-05-08</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Add support for other separator than the space char and bug
-	correction
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1</release>
-     <api>1.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-05-28</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-* Add support for BZ2 compression
-* Add support for add and extract without using temporary files : methods addString() and extractInString()
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0</release>
-     <api>1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-01-24</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Change status to stable
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>0.10-b1</release>
-     <api>0.10-b1</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2003-01-08</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Add support for long filenames (greater than 99 characters)
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>0.9</release>
-     <api>0.9</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-05-27</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Auto-detect gzip'ed files
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>0.4</release>
-     <api>0.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-05-20</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Windows bugfix: use forward slashes inside archives
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2</release>
-     <api>0.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-02-18</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-From initial commit to stable
-   </notes>
-   </release>
-   <release>
-    <version>
-     <release>0.3</release>
-     <api>0.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-04-13</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>
-Windows bugfix: used wrong directory separators
-   </notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/Console_Getopt/1.2.3-info.xml b/lib/.xmlregistry/packages/pear.php.net/Console_Getopt/1.2.3-info.xml
deleted file mode 100644
index 17c00f955a92a1942a0f85311442798e484927df..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/Console_Getopt/1.2.3-info.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?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.6.1" 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>Console_Getopt</name>
- <channel>pear.php.net</channel>
- <summary>Command-line option parser</summary>
- <description>This is a PHP implementation of &quot;getopt&quot; supporting both
-short and long options.</description>
- <lead>
-  <name>Andrei Zmievski</name>
-  <user>andrei</user>
-  <email>andrei@php.net</email>
-  <active>yes</active>
- </lead>
- <developer>
-  <name>Stig Bakken</name>
-  <user>ssb</user>
-  <email>stig@php.net</email>
-  <active>no</active>
- </developer>
- <helper>
-  <name>Greg Beaver</name>
-  <user>cellog</user>
-  <email>cellog@php.net</email>
-  <active>yes</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.2.3</release>
-  <api>1.2.1</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://www.php.net/license">PHP License</license>
- <notes>* fix Bug #11068: No way to read plain &quot;-&quot; option [cardoe]</notes>
- <contents>
-  <dir name="/">
-   <file md5sum="f2175a45c5e5bc7c97e174bdae55b671" name="Console/Getopt.php" role="php"/>
-  </dir>
- </contents>
- <compatible>
-  <name>PEAR</name>
-  <channel>pear.php.net</channel>
-  <min>1.4.0</min>
-  <max>1.6.0</max>
- </compatible>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.3</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.2.2</release>
-     <api>1.2.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-02-17</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>* fix Bug #4475: An ambiguous error occurred when specifying similar longoption name.
-* fix Bug #10055: Not failing properly on short options missing required values</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.1</release>
-     <api>1.2.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-12-08</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Fixed bugs #4448 (Long parameter values truncated with longoption parameter) and #7444 (Trailing spaces after php closing tag)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2</release>
-     <api>1.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-12-11</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Fix to preserve BC with 1.0 and allow correct behaviour for new users</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0</release>
-     <api>1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-09-13</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Stable release</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.11</release>
-     <api>0.11</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-05-26</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>POSIX getopt compatibility fix: treat first element of args
-        array as command name</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.10</release>
-     <api>0.10</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-05-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Packaging fix</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.9</release>
-     <api>0.9</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-05-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Initial release</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/DB/1.7.13-info.xml b/lib/.xmlregistry/packages/pear.php.net/DB/1.7.13-info.xml
deleted file mode 100644
index b36e59fdd8c4dc519358419bef111ed051c3b35e..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/DB/1.7.13-info.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?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.6.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>DB</name>
- <channel>pear.php.net</channel>
- <summary>Database Abstraction Layer</summary>
- <description>DB is a database abstraction layer providing:
-* an OO-style query API
-* portability features that make programs written for one DBMS work with other DBMS's
-* a DSN (data source name) format for specifying database servers
-* prepare/execute (bind) emulation for databases that don't support it natively
-* a result object for each query response
-* portable error codes
-* sequence emulation
-* sequential and non-sequential row fetching as well as bulk fetching
-* formats fetched rows as associative arrays, ordered arrays or objects
-* row limit support
-* transactions support
-* table information interface
-* DocBook and phpDocumentor API documentation
-
-DB layers itself on top of PHP's existing
-database extensions.
-
-Drivers for the following extensions pass
-the complete test suite and provide
-interchangeability when all of DB's
-portability options are enabled:
-
-  fbsql, ibase, informix, msql, mssql,
-  mysql, mysqli, oci8, odbc, pgsql,
-  sqlite and sybase.
-
-There is also a driver for the dbase
-extension, but it can't be used
-interchangeably because dbase doesn't
-support many standard DBMS features.
-
-DB is compatible with both PHP 4 and PHP 5.</description>
- <lead>
-  <name>Daniel Convissor</name>
-  <user>danielc</user>
-  <email>danielc@php.net</email>
-  <active>yes</active>
- </lead>
- <lead>
-  <name>Adam Harvey</name>
-  <user>aharvey</user>
-  <email>aharvey@php.net</email>
-  <active>yes</active>
- </lead>
- <developer>
-  <name>Stig Bakken</name>
-  <user>ssb</user>
-  <email>stig@php.net</email>
-  <active>yes</active>
- </developer>
- <developer>
-  <name>Tomas V.V.Cox</name>
-  <user>cox</user>
-  <email>cox@idecnet.com</email>
-  <active>yes</active>
- </developer>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.7.13</release>
-  <api>1.7.13</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://www.php.net/license">PHP License</license>
- <notes>This release of DB fixes a number of minor issues reported since the release of DB 1.7.12.
-
-All drivers:
-* Replaced instances of '=&amp; new Foo' with '= new Foo' to make DB (slightly) more E_STRICT friendly.  Request 11581.
-
-mysql:
-* Added an explicit call to select the database to fix calls to tableInfo() without a preceding query.  Bug 11580.
-
-mysqli:
-* Added an explicit call to select the database to fix calls to tableInfo() without a preceding query.  Bug 11580.
-
-sqlite:
-* Altered fetchInto() to remove extraneous quotes returned by SQLite.  Bug 11716.</notes>
- <contents>
-  <dir name="/">
-   <file md5sum="00fc796571e167a2bd17f6691a2ddffe" name="tests/transactions.inc" role="test"/>
-   <file md5sum="13b1c3a21e4d9f24fe1b33d306ad8fe0" name="tests/skipif.inc" role="test"/>
-   <file md5sum="312e6618fa82a872c9e65d998da9561e" name="tests/simplequery.inc" role="test"/>
-   <file md5sum="b30a53c29b829a3932c5e8479bd2deb4" name="tests/sequences.inc" role="test"/>
-   <file md5sum="aac444f47ed3ad1642013539d99f5757" name="tests/run.cvs" role="test"/>
-   <file md5sum="de177b83e1681d1d08e0c92aec168cd9" name="tests/prepexe.inc" role="test"/>
-   <file md5sum="9967a99a3c500d771b8c15faa86ad416" name="tests/numrows.inc" role="test"/>
-   <file md5sum="10c25427ebeca0daf1fb7ed33fdc2682" name="tests/numcols.inc" role="test"/>
-   <file md5sum="4cd93255482abcf60d9deaf7888760aa" name="tests/limit.inc" role="test"/>
-   <file md5sum="2a932aca6e775e98689b689ae54d2b50" name="tests/include.inc" role="test">
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-   </file>
-   <file md5sum="7cb25802942e04e59001e85663a7ab0e" name="tests/fetchmode_object.inc" role="test"/>
-   <file md5sum="2cb4b6b013652415d29a2b71417cef18" name="tests/fetchmodes.inc" role="test"/>
-   <file md5sum="086b838cc170101e636af2e3b73b46b8" name="tests/errors.inc" role="test"/>
-   <file md5sum="3016dba4918a322d440dbb688bce024a" name="tests/driver/skipif.inc" role="test"/>
-   <file md5sum="18a9d3f6895859bb74e9d380c600d4cd" name="tests/driver/setup.inc.cvs" role="test">
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-   </file>
-   <file md5sum="7023d979e8bcb94a93d48597d864feb3" name="tests/driver/run.cvs" role="test"/>
-   <file md5sum="8dc5f2d2be9b916e9940825f4511b533" name="tests/driver/multiconnect.php" role="test"/>
-   <file md5sum="b1d4a722f5c583a77bba51d4e9749ab2" name="tests/driver/mktable.inc" role="test"/>
-   <file md5sum="c3933292049fa189b319daa0c1f008c9" name="tests/driver/droptable.inc" role="test"/>
-   <file md5sum="68c43e8c27b78bc7c731a89958882301" name="tests/driver/connect.inc" role="test"/>
-   <file md5sum="281055f0d5ab507718a2c7501edb3a18" name="tests/driver/21freeResult.phpt" role="test"/>
-   <file md5sum="4655d272211dc5d60904796d6d7e1f99" name="tests/driver/20locale.phpt" role="test"/>
-   <file md5sum="de354d5fe32f0b9fbbcaed1bada7e7a2" name="tests/driver/19getlistof.phpt" role="test"/>
-   <file md5sum="096f764b8519e18c0ad2eeaef6229ee1" name="tests/driver/18get.phpt" role="test"/>
-   <file md5sum="816de230b3ff9b0fdf57bf8a1a7700cf" name="tests/driver/17query.phpt" role="test"/>
-   <file md5sum="50b6ad0cbea649854ea4e09e524d2641" name="tests/driver/16tableinfo.phpt" role="test"/>
-   <file md5sum="2cf853766a1c1dc21f0b38988cd5a406" name="tests/driver/15quote.phpt" role="test"/>
-   <file md5sum="3ca3ee12cfe59a146caa21e65c4b32e1" name="tests/driver/14fetchmode_object.phpt" role="test"/>
-   <file md5sum="b440536baa35dcd7f40f41f26a0ba184" name="tests/driver/13limit.phpt" role="test"/>
-   <file md5sum="1ad007b069ba4ee8af4e0faa2d1d38e9" name="tests/driver/11transactions.phpt" role="test"/>
-   <file md5sum="b2e481fc6f310db41e249a1e53f353c2" name="tests/driver/10errormap.phpt" role="test"/>
-   <file md5sum="7efee695096e0cf6e243e5590915b6fc" name="tests/driver/09numrows.phpt" role="test"/>
-   <file md5sum="b2e5ebe28916e63d8502845d58f74d49" name="tests/driver/08affectedrows.phpt" role="test"/>
-   <file md5sum="8d651d2da580619ed5abeaaa9e1f71ad" name="tests/driver/06prepexec.phpt" role="test"/>
-   <file md5sum="1b52edb34978a8929f4315b7ec2f5445" name="tests/driver/05sequences.phpt" role="test"/>
-   <file md5sum="a5ecf473f648022af5dc9fbb2f33e371" name="tests/driver/04numcols.phpt" role="test"/>
-   <file md5sum="b671efeac9fd34b83309de8413531317" name="tests/driver/03simplequery.phpt" role="test"/>
-   <file md5sum="06b9bb0bec3cbfbd2e463d2782d5f05a" name="tests/driver/02fetch.phpt" role="test"/>
-   <file md5sum="81f3cb01442148ff75a752f68b946df0" name="tests/driver/01connect.phpt" role="test"/>
-   <file md5sum="a470ea13cb74d88619f08b1308054975" name="tests/db_parsedsn.phpt" role="test"/>
-   <file md5sum="da74e7939fe22d9c526939e978ace61c" name="tests/db_ismanip.phpt" role="test"/>
-   <file md5sum="79e88e6db0c25ca1ee5e2aac35a24d6c" name="tests/db_factory.phpt" role="test"/>
-   <file md5sum="5f5068a8a1a3742ff0810be61b57288d" name="tests/db_error2.phpt" role="test"/>
-   <file md5sum="2e7f987503b8b5e2a7fc4c3c30e79c13" name="tests/db_error.phpt" role="test"/>
-   <file md5sum="31f276d6ff710a1f048c50cd533ffe5c" name="doc/TESTERS" role="doc"/>
-   <file md5sum="30bc4ceeccd51413ab81fa98c1fb9aa8" name="doc/STATUS" role="doc"/>
-   <file md5sum="8c5779871e07720a032615177403b691" name="doc/MAINTAINERS" role="doc"/>
-   <file md5sum="651a644b6f3495fc39279d75b8099372" name="doc/IDEAS" role="doc"/>
-   <file md5sum="4fc3ffb31c807f7b92d7b3c00535e883" name="DB/sybase.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="bb7f96b3f78bbd481b31127bab61537a" name="DB/storage.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="4ec65c56336e956b953b22f48c48b796" name="DB/sqlite.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="347ce374b54195a000ec4b268dc656a9" name="DB/pgsql.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="fcee078e70107d665ba624b1ce7a7ef4" name="DB/odbc.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="39189815c39dc0167a451654ead3c99b" name="DB/oci8.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="177df43a04dbb4cc3840fb02e4ccf0bb" name="DB/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="57bc68e9050730676272e33dbec065e7" name="DB/mysql.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="f30b7dfbf00343edb6de00624595b102" name="DB/mssql.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7a1ad0f98c396944f449649dad6662d5" name="DB/msql.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="c87ed59a6cd174706980d42a6f359ade" name="DB/ifx.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a06866d7621a2077a091741c3d3d026e" name="DB/ibase.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="3683c44821ef40a97b82dbe0ead9d9e5" name="DB/fbsql.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="9f1e6803eb8d056d0d9c5dbd62a535c9" name="DB/dbase.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="79bf960987c22987845f8b4fa3aa8716" name="DB/common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="38ae3509ec733b5a7a6a41a585f991d1" name="DB.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.2.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>PEAR</name>
-    <channel>pear.php.net</channel>
-    <min>1.0b1</min>
-   </package>
-  </required>
- </dependencies>
- <phprelease/>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/DB_DataObject/1.9.3-info.xml b/lib/.xmlregistry/packages/pear.php.net/DB_DataObject/1.9.3-info.xml
deleted file mode 100644
index db9f627ee901c46acc271c619825c69898f438dd..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/DB_DataObject/1.9.3-info.xml
+++ /dev/null
@@ -1,1524 +0,0 @@
-<?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.7.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>DB_DataObject</name>
- <channel>pear.php.net</channel>
- <summary>An SQL Builder, Object Interface to Database Tables</summary>
- <description>DataObject performs 2 tasks:
-  1. Builds SQL statements based on the objects vars and the builder methods.
-  2. acts as a datastore for a table row.
-  The core class is designed to be extended for each of your tables so that you put the
-  data logic inside the data classes.
-  included is a Generator to make your configuration files and your base classes.</description>
- <lead>
-  <name>Alan Knowles</name>
-  <user>alan_k</user>
-  <email>alan@akbkhome.com</email>
-  <active>yes</active>
- </lead>
- <date>2010-05-04</date>
- <time>08:41:38</time>
- <version>
-  <release>1.9.3</release>
-  <api>1.9.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
- <notes>Fix broken release (1.9.1 and 1.9.2)
-
-fetchAll() / whereAddIn() Release version.
-
-This version adds two new utility methods, that can speed up usage,
-fetchAll()  - does the $do-&gt;find() / while($do-&gt;fetch()) $ar[] = clone($do) loop, and more.
-whereAddIn() - allows you to quickly build IN queries, with correct escaping.</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="DB" md5sum="cdcc4ead8ef5e06df4381ca0976dcdad" name="scripts/DB_DataObject_createTables.bat" role="script"/>
-   <file baseinstalldir="DB" md5sum="9d98e006265435a3e6e8a3e08a659c3b" name="docs/example.ini" role="doc"/>
-   <file baseinstalldir="DB" md5sum="b88cad42760b2d12489ebea8e9da47dc" name="DataObject/Generator.php" role="php"/>
-   <file baseinstalldir="DB" md5sum="06e890beb94da0cfd9782b220989f25f" name="DataObject/Error.php" role="php"/>
-   <file baseinstalldir="DB" md5sum="8f7382a61580d5be68e31a7544d454d7" name="DataObject/createTables.php" role="php"/>
-   <file baseinstalldir="DB" md5sum="b50c79d3a19d9e156c7bfd9a221fab55" name="DataObject/Cast.php" role="php"/>
-   <file baseinstalldir="DB" md5sum="cf030d2f3184d09d99f41fa54d1607b0" name="DataObject.php" role="php">
-    <tasks:replace from="@version@" to="version" type="package-info"/>
-   </file>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>DB</name>
-    <channel>pear.php.net</channel>
-    <min>1.7.0</min>
-   </package>
-   <package>
-    <name>Date</name>
-    <channel>pear.php.net</channel>
-    <min>1.4.3</min>
-   </package>
-  </required>
-  <optional>
-   <package>
-    <name>MDB2</name>
-    <channel>pear.php.net</channel>
-    <min>2.0.0RC1</min>
-   </package>
-   <package>
-    <name>Validate</name>
-    <channel>pear.php.net</channel>
-    <min>0.1.1</min>
-   </package>
-  </optional>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <date>2010-01-15</date>
-    <version>
-     <release>1.9.1</release>
-     <api>1.9.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
-    <notes>fetchAll() / whereAddIn() Release version.
-
-This version adds two new utility methods, that can speed up usage,
-fetchAll()  - does the $do-&gt;find() / while($do-&gt;fetch()) $ar[] = clone($do) loop, and more.
-whereAddIn() - allows you to quickly build IN queries, with correct escaping.</notes>
-   </release>
-   <release>
-    <date>2009-12-03</date>
-    <version>
-     <release>1.9.0</release>
-     <api>1.9.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
-    <notes>Modular Release version.
-
-This version was designed to support multiple locations of DataObjects for use with
-modular applications. - NOTE the change to ini_DATABASENAME may fixes the previous behaviour to 
-match the documented behaviour - however this may break existing installations.
-
-New Features:
-#-------  class_location accepts multiple locations with PATH_SEPARATOR 
-#-------  class_prefix accepts multiple prefixes with PATH_SEPARATOR 
-#-------  ini_DATABASENAME merges all found ini files in paths (seperated by PATH_SEPARATOR)
-            previous behaviour was just to read the first. - this applies to matching links.ini files.
-#12550 -  disable_null_strings=full -- see the bug report for details - it is highly recommended not to use this feature,
-          as it may result in data being deleted from your database if not used carefully.
-
-Notes:
-#-------  staticGet now marked depreciated.
-#-------  links_DATABASENAME does not support multiple paths
-#-------  staticAutoloadTable (depreciated) and staticGet (depreciated) do not support this feature</notes>
-   </release>
-   <release>
-    <date>2009-08-12</date>
-    <version>
-     <release>1.8.12</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
-    <notes>Licence upgrade Release
-#----- - Changed Error and Cast Licence to 3.01 to keep Debian/Ubuntu happy.</notes>
-   </release>
-   <release>
-    <date>2009-07-16</date>
-    <version>
-     <release>1.8.11</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
-    <notes>Licence upgrade Release
-#----- - Licence changed to 3.01 to keep Debian/Ubuntu happy.
-#----- - Change order of preference for links in JoinAdd - prefer called table links over jointo table.
-#----- - Retry support for connection failure on queries
-#----- - Factory now uses '/' for database/table seperator (experimental)
-#----- - Fix INSERT on Postresql with empty data.</notes>
-   </release>
-   <release>
-    <date>2009-03-19</date>
-    <version>
-     <release>1.8.10</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license/3_01.txt">PHP License 3.01</license>
-    <notes>Annual Release - Minor Bugfixs / Extra Features
- 
-	#----- - Fix factory error with database name not found
-#----- - Change factory multi-database call to use '/' rather than '.' so 
-         that it can work with postgres (also syncs with what the original notes said)</notes>
-   </release>
-   <release>
-    <date>2009-03-12</date>
-    <version>
-     <release>1.8.9</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Annual Release - Minor Bugfixs / Extra Features
- 
-	#15066 - limited support for POINT (at least generator creates something)
-	#14976 - add option generator_omit_database_var to prevent creation of
-		  $database lines (Troy Anderson)
-	#13995 - incorrect test in sequence key for postgres
-	#14252 - doc comments on delete() corrected to say return value is no. of 
-		 rows affected on success
-
-	###### - ensure that tableinfo uses quote_identifiers_tableinfo
-	###### - add sqlite support to Cast blobs
-	###### - old skipEmpty check broke formating on setFrom
-	###### - remove previous checks on database dsn lookup - move it to factory. 
-	###### - Fix count check for no keys. - By Jeffrey  Pfau
-	###### - Add multidatabase factory() support - eg.
-		  DB_DataObject::factory(&quot;mydatabase.mytable&quot;);  
-	###### - Added checks to ensure that database names match requested ones.
-	#13773 - delete(true) honours join conditions
-	#13788 - test for error before re-writing definition table for MDB2 in Generator
- 	#13789 - honour user specified MDB2 options in Generator
-	#13790 - support CLOB oracle
-	#12993 - add new option generator_secondary_key_match - set to false, to
-		  disable key matching for secondary key types</notes>
-   </release>
-   <release>
-    <date>2008-01-30</date>
-    <version>
-     <release>1.8.8</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix / Feature Release 
- 
-Pre-chinese new year release (with lots of 8's...)
-
-Bug Fixes
-    #12556 - Generator - pregmatch appears broken for replacing class name on updating files
-    #10112 - additional config option quote_identifiers_tableinfo for use with tableinfo on generator
-             Fixes issues with Oracle and quoting identifiers.
-    #11773 - problems with object-&gt;array[prop] setting on PHP5.2.3
-            ** this may also have been fixed twice by fix for #11775
-    #12858 - MDB2 and postgres missing db_driver variable
-    #9902 - default portability options for MDB2 to not fix case.
-    #9658 - postgres DECIMAL using DB backend incorrectly
-            flagged as unknown - changed warning to suggest using MDB2
-    #11091 - count attempted to read quote identifiers before config was loaded
-    #11804 - insert with postgres/msql return wrong error message
-    #9364  - fix postgres native sequences with MDB
-    #11775 - unsetting of $this-&gt;_query causes overload setters/getters to  
-             handle later uses of _query and break due to lack of array accessor support
-    #11634 - Windows fails to rename files if they exist - affecting Generator  
-            (try and fix it so unix is still atomic)</notes>
-   </release>
-   <release>
-    <date>2007-07-12</date>
-    <version>
-     <release>1.8.7</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix Release 
-     
-Bug Fixes:
-    #11586 - missing default value in Generator for class_prefix caused warning
-    #11584 - typo in Generator caused permissions to be incorrectly set on ini file.</notes>
-   </release>
-   <release>
-    <date>2007-07-10</date>
-    <version>
-     <release>1.8.6</release>
-     <api>1.8.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix and Minor Feature addition release
-     
-Bug Fixes:
-    #11483 - show an error if pcre limits are not correctly set and generator tries to generate empty files
-    #11528 - sending like queries to escape does not escape % and _ - added additional parameter to
-            escape : [bool $likeEscape] is optional and can be used to force escaping of these characters
-    #10573 - fix permissions on generated files
-    #10573 - write Generated files to temp directory, then rename into place. - fixing locking issues
-    #10531 - correct fix for bug #9628 (support MDB2 for defaults())
-    #10454 - mssql uses wrong variable name for options.
-    #10175 - MDB2 does not return length value 
-    #9573 - enable disable_null_strings to turn of &quot;null&quot;-&gt; NULL replacements
-    #9625 - MDB2 support for MSSQL sequencies
-    #9644 - incorrect constant in foriegn key generation.
-    #9628 - support MDB2 for defaults()
-    #9839 - Invalid column names can not be supported, so warning is generated
-    #9834 - SQL2003 standards on Joins - adds brackets around ON()
-    #4266 - minor fix to appendJoin code
-    #9755 - generator showed php error if connection failed
-    #9730 - quote identifiers on composite joins
-
-    * feature request 
-    #4266 - joins with multiple keys
-    #2216 - JOIN ON conversion of Where condition into ON arguments - patch by David Sanders
-    #----   add in docbook hooks to generator - as requested/coded by Vyacheslav Iutin</notes>
-   </release>
-   <release>
-    <date>2006-12-15</date>
-    <version>
-     <release>1.8.5</release>
-     <api>1.8.5</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix and Minor Feature addition release
-    * #8876 - call free() after count - hopefully this will not break anything!
-    * #8736 - auto_increment check for MDB2 backend
-    * #8628 - tableInfo fix for MDB2
-    * #7792 - add integer[] and boolean[] support
-    * #7702 - memory leaks on getLinks() , free() is called
-        within    getLinks(), - you still need to call free() after doing a
-        getLink() - as I suspect automagically doing that would cause
-        problems..
-    * #7409 - ibase support for filename based database names - not sure if this works, but 
-         will ask reporter to test it..
-    * #7353 - postgres incorrect testing of t/f for booleans
-    * #7114 = generator of sequence keys and defaults using generator_no_ini
-    * #3773 - change last_value to currval - need to confirm this is the correct fix.
-    * #3152 -  joinAdd requires join column to be in links.ini file
-    
-    Feature Requests:
-    * Feature Request #4266 - Allow joins with multiple keys
-    
-    Minor Changes:
-    * dont flush on debugging html output
-    * links.ini code generation based on schema (mysql[i] only) -
-        option:generate_links=true - thanks to Pacal Schoni    
-    * add warning about unknown types in generator.
-    * only prefix database name, in joins when the two objects are of different databases
-    * nicer error message for !isreadable - thx to Euan Maxwell
-    * use class exists loader, so that relative test relative paths in
-        tests work, (also means that autoload may work...)
-    * remove pass by reference - why on earth that was there in the first place is totally beyond me...    
-    * give derivedHookFunctions the ability to use the original input data
-    * add methods 
-        getClassNameFromTableName(),
-        getFileNameFromTableName(), 
-        getMethodNameFromColumnName(), 
-        which allow you to set up your own mapping system by overriding them in
-        your extended generator.. it however needs some support in dataobjects so currently 
-        flagged as EXPERIMENTAL</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.8.4</release>
-     <api>1.8.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-03-06</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix and Minor Feature addition release
-
-Bugs
-----
-#7006 - fix links due to removal of databaseStructure call in 1.8.3, added call
-        to connect();
-#7012 - joinAdd fixed due to checking of wrong variable when buidling query on 
-        mysql.
-             
-    
-Features
---------
-      - Add support for defaults() generation in createTables/Generator,
-        when using the flag generator_add_defaults = yes or generator_no_ini = yes
-        a method defaults() is created in the table class, which contains
-        the default values for the table generated from the database.
-        Note: EXPERIMENTAL and only works with Mysql[i] at present.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.8.3</release>
-     <api>1.8.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-03-03</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix and Minor Feature addition release
-
-Bugs
-----
-      - Remove Warning if class_prefix is not set, and allow it not to be set.
-      - joinAdd() support for DB_DataObject::cast() objects (Daniel Braga)
-      - MDB2 fixes for undefined constants (bate)
-      - 
-#6772 - Support for FLOAT4 type in postgres
-#6953 - Changed memory allocation of stored column values for SQL return when
-        Fetching last item of an object. Fixing problem of missing columns on
-        Last fetch from Join being broken when used with toArray().
-#6928 - Defaulting to prefixing database name in joins for Mysql and Mysqli
-        backends, so multiple joins across multiple databases work.
-      
-    
-Features
---------
-      - Add support for option 'generator_no_ini =&gt; true', which generates class 
-        files with schema defined inside the table(), keys() and sequenceKeys()
-        (based on work and suggestions by Didler Galland and Justin Patrin)
-      - SQL output for debugging now has line breaks to make it easier to read.
-      
-      - SelectAs uses quote itendifiers for target format.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.8.2</release>
-     <api>1.8.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-01-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release
-
-Bugs
-----
-#6543 - Generator broke due to MDB changes.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.8.1</release>
-     <api>1.8.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-01-20</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bugs
-----
-#6153 - dont call autoload on PHP5 - kludgy wrapper around class_exists()
-#6458 - clear staticGet cache when calling free()        
-#6442 - validation not working correctly on DB_DataObject_Cast Objects
-Changes/New Features
---------------------
-* fix warning if setFrom called with object.. 
-* make createTables honour debug level in ini file.
-* Added support in generator, for MDB2 backend to generate the class files (bate)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.8.0</release>
-     <api>1.8.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-12-28</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Major Bug Fix &amp; Feature release.
-
-Bugs:
-
-#4871 - remove warning when value is not found in table
-#4834 - case sensitive checks for db_dataobject_cast fail
-#4894 - Validate methods can return PEAR Errors, or even
-        messages now.. - only true indicates success
-#4938 - support MONEY type for MSSQL
-#4968 - count() will not be affected by changing default
-        db fetchmode
-#5036 - make sure DB is loaded before using it
-#5264 - add optional dep on MDB
-#5416 - use tablea AS tableb only for postgress/mysql -
-        oracle doesnt need the AS bit - and I guess a few others too..
-        available and first fetch fails
-        conditions
-#5614 - joinAdd check to see if object being joined is
-        really a dataobject
-#5065 - count returns number cast to an integer (even
-        though database may return a string)
-#5800 - generator will continue creating other tables if we find one
-        that fails...
-#5881 - wrap conditions with extra brackets
-        remaining checks in validate
-#5393 - flag up unique only keys as &quot;U&quot;, rather than &quot;K&quot;
-        (or &quot;N&quot; for native) to allow anything calling keys() to find more
-        detailed information - should have no effect on the dataobject
-        class, as only sequence keys looks for &quot;K&quot;
-
-Feature Requests:
-
-#5146 - option: generator_var_keyword,
-        to specify if you want to use var or public
-
-Other Changes
-
-    default behaviour.. so it shouldnt really have affected anyone..
-    amazed no one picked this up before..
-* make WHERE stripping better  = well spotted Justin
-* catch errors returned from nextID - like permission denied etc.,
-    add warnings in debug mode if we are using objects  or arrays for
-    some reason, fix error messages
-* correct the dependancy on packages
-* the dont die here causes a recursive error and segfaults
-    everything if it doesnt return..
-* use is_a, rather than PEAR, as one day we may remove that dep...
-* fix PHP4.4* issues with returning by reference..
-* make debugging schema loading errors a bit easier
-* test for bug #5931 added to test 91
-* update($dataobject), change check for changes to strict checking,
-    so that 0001 -&gt; 00001 works, along with many other situations..,
-    remove extra ; from code
-* fix null detection on postgres, - patch by Alistair MacDonald
-* free result columns as well as results after fetching all rows.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.15</release>
-     <api>1.7.15</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-07-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release 
-* fix bug #4760 - DB_DataObject_Cast blobs broke in last release</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.14</release>
-     <api>1.7.14</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-06-25</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bugfix release (Mostly)
-Special thanks to Dan Rossi for the MDB Backend work on this release.
-
-Key changes:
-  - SQLlite support for files.
-  - MDB Backend support (experimental) use:  
-      db_driver = MDB
-      as a config option.
-      NOTE: the generator will probably not work.
-     
-  - toArray() has an extra argument (bool)hideEmpty, 
-    which prevents it returning key/value pair when the value is empty 
-  - DB_DataObject_Cast object was redesigned to enable better quoting of 
-    blobs
-  - PostgresSQL schema  for tablenames can be removed with the 
-      generator_strip_schema = 1
-  - Fetch return value and  object-&gt;N are now &quot;true&quot;, rather than 1 
-    when numRows is not supported, (also document it on find())
- 
- 
-Bugs Fixed. 
-  * fix bug #4672 - query(COMMIT) relays return value from DB-&gt;commit()
-  * fix bug #4535 - fix update/select etc. for postgres with boolean values.
-  * fix bug #4601 - wrong method used to test if file for sqlite
-  * fix bug #4193 - sqlite names causing invalid .ini files
-  * fix bug #4518 - escape and transactions fixed for MDB backend
-  * fix bug #4431 - add hideEmpty to toArray() - not sure if I really
-                    like this.. - adding args to methods, the root of all evil ;)
-  * fix bug #4383 - generator getListOf() call now expects pear errors
-  * fix bug #4235
-            #4203 - schema mess with postgres.
-                    generator_strip_schema=1
-                    will strip the schema part from the name of the table.
-  * fix bug #4168 - if connection test is sucessfull, dont try and
-                    connect.. (performance improvement)
-  * fix bug #4040 - prevent toArray from calling getLink and getLinks
-  * fix bug #4019 - createTables uses sets up options for DB
-                    compatibility mode 
-  * fix bug #4000 - better checking for php 4.3.10
-  * fix bug #3944 - support for informix autoincrements
-  * fix bug #4182 - better string and blob support on mysql in cast
-  * fix bug #4135 - boolean values borked in condition building..</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.13</release>
-     <api>1.7.13</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-24</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release
-#3943 - postgres booleans broke again due to last fix for mysqli.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.12</release>
-     <api>1.7.12</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-03-23</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Daily Bugfix release. ;)
-#3898 - mysqli quote bug fixed. (Greg Beaver)
-#------ provisional support for mysql blobs in Cast object (Antony Jankelowitz)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.11</release>
-     <api>1.7.11</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-22</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release. 
-#3898 - fix count , which got broken by previous distinct argument changes
-#------ support $x IS NOT NULL using $obj-&gt;value = DB_DataObject_Cast::sql(&quot;NOT NULL&quot;);</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.10</release>
-     <api>1.7.10</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release. 
-#3829 - joinAdd fix for database prefixing (yet again)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.9</release>
-     <api>1.7.9</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release. 
-#3764 - toValue(), and hence toArray() cast booleans to true|false. (previous fix was buggy)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.8</release>
-     <api>1.7.8</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix release. 
-#3764 - toValue(), and hence toArray() cast booleans to true|false.
-#3763 - createTables.php defines NO_OVERLOAD to prevent warnings on PHP4.3.10.
-
-#3768 - Hopefully last fix to joinAdd() / database prefixing and  quoteIdentifiers
-#3761 - Fixed DB_DataObject::datetime() bad code.
-#3783 - count('distinct') builds the query distinct [primary_key], should help in some situations
-        using joinAdd + group By etc.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.7</release>
-     <api>1.7.7</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor bug fix release - join add with table fixes broke for mysql with last release
-Bug Fixes:
-#---- - Joins incorrectly prefect database name for mysql/mysqli
-(Thanks to Mark Mitchenall for spotting this)
-#---- used wrong variable for checking prefixes.
-(Stephane Gully)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.6</release>
-     <api>1.7.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-05</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Nothing like a big release to create bugs..
-
-Note: the last release also included method creation for setters and getters, 
-  which got missed out from the changelog.
-Bug Fixes:
-  #3708 - Generator did not clear last files contents when generating new files.
-  #3706 - Joins broke on everything except mysql (database prefix now only added to mysql)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.5</release>
-     <api>1.7.5</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-03-02</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>A few releases where skipped, this should be the amalgamated upgrade!
-
-Note: php4.3.10 will exit with an error if you dont define NO_OVERLOAD, rather 
-than segfaulting..
-
-Generator is buggy with 5.0.3 - upgrade DB or PHP..
-
-Bug Fixes:
-  #3584 - Cast now supports time and datetime, (theiron)
-  #3645 - PHP4 clone FC hack now calls $obj-&gt;__clone() in a similar way to PHP5
-  #2928 - lastError contains the last error when query bugs out now.
-  #2674 - column names null / true /false etc. now halt createtables
-  #2778 - more informative warning shown when postgres bug is found.
-  #---- - experimental multidatabase join support
-  #2739 - sleep is relayed into __call - bug in PHP5
-  #2565 - oci8 NUMBER type recoginzed 
-  #---- - new option generate_add_validate_stubs = 1, creates validate stubs.
-  #---- - more comprehensive limit support (Lutz Thomas)
-  #---- - allow access to columns starting with _ eg. set_xxx() &amp; get_xxx()
-          (Sandro)
-  #---- - Generator write E_STRICT code for PHP5 now
-  #2441 - Debugging code removed.
-  
-  #---- - multiple HAVING calls now supported.
-  #2468 - remove warning hider.
-  #2318 - update($do) when no changes detected returns true.
-  #2319 - joinAdd does not use AS when table and target have same name.
-  #---- - Dia diagram generation tools available in CVS (build diagrams from dataobjects)
-  
-  #2267 - additional debugging information available at connect time</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.2</release>
-     <api>1.7.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-08-28</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor bug fix / Minor feature addition release
-  
-  
-Bug Fixes:
-  #1835 - more fixes to ensure that joinAdd works correctly.
-  #2106 - Update with old object having no changes does not raise an error
-  #---- - fixed problem of call() code producing parse error on PHP5.0.1 
-  #2205 - fixed case sensitivity of PHP5 call() 
-  #---- - fixed undefined index in delete after a fetch()
-  
-Features Added:
-  #2086 - Support for buliding dataobjects for Views (use option build_view=1)
-  #2240 - factory() called on a dataobject returns a new instance of that object.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.1</release>
-     <api>1.7.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-08-09</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor bug fix release
-  
-  
-Bug Fixes:
-  #2088 - class_prefix may be left out.
-  #------ php4.2 compatibility should work as advertised in last realease
-  #------ Generator didnt have DB loaded due to lazy load changes.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.7.0</release>
-     <api>1.7.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-06-03</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Major bug fix release, Minor features added.  
-  
-  
-Bug Fixes:
-  #1559 - __FUNCTION__ remove, so dependancy on php 4.2 may still be valid.
-  #1595 - regex include/exclude working correctly (Thanks to Stephane Gully)
-  #1664 - configuration line links_{databasename} now available 
-  #1726 - enable orderby and limit can be used with delete()   
-  #1697 - prevent generator from adding an extra line created after definition.
-  #1704 - update only adds null when the column is not marked 'not null'
-  #1778 - toArray() returns a merge of defined table and actual results
-  #1828 - Generator will die, if tableinfo is not supported.      
-  #1833 - links() now returns an empty array (no links) or null (no links.ini)
-      so it can be used generically with : $ar = (array) $do-&gt;links();
-  #1835 - getLinks, getLink etc. now use -&gt;links(), so you can define your
-      own links() to return table links, rather than use links.ini files.
-  #1923 - removed all @ silencers, and replace with empty/isset.
-  #1935 - selectAs() - removed double quoteIdentifiers
-  #2068 - workaround for DB bug, postgres nextval() being rawurlencoded
-  #1980 - logic error when using quoteIdentifiers
-  
-Changes:
-  * DebugLevel(1) now displays native errors from database when queries fail.
-  * Result Field names now stored seperately from Result Object
-  * free() method added, to clean up memory instantly, if you are doing alot of queries.
-      = Cleans Result Fields, Result Object, NumRows returned in Connection object.
-  * include path is used to do file hunting if factory fails to find file.
-  * DB is lazy loaded on connection.b</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.6.1</release>
-     <api>1.6.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-06-03</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bug Fix
-
-* fixed count() breaks when countWhat used.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.6.0</release>
-     <api>1.6.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-04-24</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Feature Release and many bug fixes..
-
-* DB_DataObject_Error added to enable testing for dataobject errors
-* Date fixes - needs latest date package.
-* Generator fails with clear message if backend doesnt support tableInfo
-* added cidr, inet, macaddr for postgres
-* new options to filter generation of classes
-  generator_include_regex = /foo_.*/i
-  generator_exclude_regex = /tmp_.*/i
-* result column list is now stored for all queries (in the result object)
-  so toArray() allways relates to the query.
-* php version correted in package file.
-* getLinks called before other database call fixed.
-* Updating without changing things, no longer raises a pear error,
-  it just returns 0 (eg. no rows affected)
-* now Depends on 1.4 DB - escapeSimple is now used
-* extra option to disable assumtions to use pear db's nextID
-  dont_use_pear_sequences = true
-* DebugLevel($val) if $val is not an integer - it is assumed to be a callback.
-* fixed clearing of data results after last fetch (reduces memory consumption 
-  when doing many queries)
-* strtolower any class name tests.
-* count accepts 1 or 2 arguments
-  $countWhat or $whereAddonly, or $countWhat and $whereAddonly
-  eg. $countWhat = &quot;distinct id&quot;
-  eg. $countWhat = true (means $whereAdd = true)
-* selectAdd() returns existing value, so you can modify it.
-* most debugging &amp; raiseError calls are dynamic, so you can overload them.
-* numbers allowed in tablenames.
-* ini filename uses database_{projectname} =&gt; {projectname}.ini so
-  database names are portable, and multiple projects are theoretically feasible.
-* __clone is replaced with clone() for PHP5 compaitiblity.
-* use PEAR::getStaticProperty(&quot;DB&quot;,&quot;options&quot;) for oracle portablity settings.
-* null checked against not null spec.
-
-And probably a few more - as it's been quite a while since the last release..</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.3</release>
-     <api>1.5.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-01-29</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bug fix release.
-
-Changes:
-  - fixed toValue()
-   ** previously did not work correclty..
-   ** getXXX($format) correctly relays into toValue - see strftime / Data::format or sprintf
-     for formats, depending on column type.
-  
-Fixes
-* fix bug #630 - correct handling of YEAR (it's an int)
-* fix bug #630 - mysql timestamps are ingored for updated and insert (use query() if you want to change
-  them manually.
-* fix bug #620 - limit accepts floats and doubles, as long as they are really integers..</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.2</release>
-     <api>1.5.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-01-24</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bug fix release.
-
-Changes:
-  - removed automatic strtotime() in setters and setFrom
-   ** this is closer to the previous behaviour (it caused too many problems with strange dates
-   ** if you set a date/time column with a number, it assumes it is a unixtimestamp
-   -- enables you to write setters like 
-    function setSome_Date($value) { $this-&gt;fromValue('some_date',strtotime($value)); }
-  
-Fixes
-* $DB_DataObject-&gt;getDatabaseConnection() will return a pear error if dont_die is set,
-so it can be used to test connections.
-* note changed on databaseStructure, it can be called statically and dynamically.
-* fix bug #612 databaseStructure('databasename') will output the ini file structure array , with __keys
-* fix bug #611 corrected comment about NO_OVERLOAD
-* fix bug #603 to prevent clearing of queries after fetch, use the option keep_query_after_fetch = 1
-* fix bug #359 (again) - _link_loaded array should only contain links that where sucessfully loaded</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.1</release>
-     <api>1.5.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-01-22</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bug fix release.
-Fixes
-* fixed fromValue had problems with null and DataOBject_Cast objects
-* NOT NULL checking enabled in fromValue (eg. setters)
-* fix bug #605 - ability to specify sequence names
-  option sequence_{tablename} = {column} // default {tablename}_seq
-  option sequence_{tablename} = {column}:{sequence_name}
-* Dependancy on Date added. (it is used by the setter/getters)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5</release>
-     <api>1.5</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-01-20</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>New Features / Fixes
-* proxy and auto schema building
-  - you can use dataobjects wihout running create tables.
-  - schema is created on the fly if no schema file exists
-  - using config option proxy=full, a class is generated on the fly to
-    represent the tables.
-* toValue and fromValue added as getter and setter providers
-  - they include date formating tools - eg.
-  $do-&gt;getBirthDay('%d/%m/%Y') will work with overload and PEAR::Date 
-  to provide formated dates. (works with date/time and datetime)
-  - set*() will also call strtotime and PEAR::Date to try and read dates.\
-  setFrom will relay into fromValue() - hence auto fixing date entries
-* make native key recognision a little better - changes ini file
-  format (key=N|K) - native or key. - BC protected... - ignores it
-  when it finds a number.. (Fixes bug #532)
-* allow multiple updates on the same object - without adding lots
-  of id=.... on the end..
-* transactions support works transparently by sending
-  $do-&gt;query('BEGIN'), $do-&gt;query('COMMIT'),$do-&gt;query('ROLLBACK')
-  will automatically relay into the DB methods.
-* re-add support for sequence_{tablename} - prefered method is still
-  overriding sequenceKey, and returning correct values.
-
-Bug Fixes
-* fix bug #595 - replace non letters in class names with underscore..
-* fix bug #532 - better recoginsion of sequence keys
-* fix bug #528/#476 - typo fix (E_NOTICE error on $valu)
-* fix bug #473 - query can return a DB_Error 
-* fix bug #501 - autoload/factory  now uses full path (not require path)
-* fix bug #507 - sequences broken</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4</release>
-     <api>1.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-12-20</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes/>
-   </release>
-   <release>
-    <version>
-     <release>1.3</release>
-     <api>1.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-11-14</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>New Features
-- Inserts and updates do not use keys in the data creation part of the query
-  (Markus Wolff)
-
-- MsSQL native get_last_insert ID using SELECT @@IDENTITY
-  ** you may want to consider using this with transactions eg.
-  $dataobject-&gt;query('BEGIN') and $dataobject-&gt;query('COMMIT')
-  to ensure thread safety. (Markus Wolff)
-  
-- DB_DataObject_Cast - a experimental generic casting feature for assigning variables
-  * Common usages:
-    // blobs
-    $dataObject-&gt;someblobfield = DB_DataObject_Cast::blob(file_get_contents('xxx.jpg'));
-    $dataObject-&gt;someblobfield = DB_DataObject_Cast::string('xxxxx');
-    
-  
-     // dates?
-    $dataObject-&gt;at_date = DB_DataObject_Cast::date('12/12/2000'); //Human
-    $dataObject-&gt;at_date = DB_DataObject_Cast::date('2000-12-12'); //ISO
-    $dataObject-&gt;at_date = DB_DataObject_Cast::date(2000,12,12); //YYYY,dd,mm
-    $d2 = DB_DataObject_Cast::date(); // today!
-    // some addition
-    $dataObject-&gt;expires = DB_DataObject_Cast::date($d1-&gt;year, $d1-&gt;month+30, $d1-&gt;day+30);
-     
-  
-    // raw sql????
-    $dataObject-&gt;maxids = DB_DataObject_Cast::sql('max(id) &gt; 12');
-    $dataObject-&gt;emptyfield = DB_DataObject_Cast::sql('NULL');
-    
-    You can extend this object to provide your own datatypes..
-     
-  
-- PHP5 Compatibility
-  Return values should work with PHP5beta2
-  Overload (__call) should work with PHP5beta2
-
-- table() and keys() Allow setting of data with a value
-  (so you can use dataobjects without extended instances.)
-  
-- factory/ getLinks and autoloading
-  Will use the full path location in config to check if the file exists,
-  after that it is included without warnings turned off..
-  (autoloading check to see if class exists first - should be faster)
-
-Fixes:
-- Validate is an optional dependency (Arnaud Limbourg)
-- Bug #228, BOOL type on postgresql correctly quoted.
-- Bug #133, No error is raised when calling fetch with no data returned, 
-  just produces a debug warning now
-- Bug #172,Turning of Overload
-  If you define DB_DATAOBJECT_NO_OVERLOAD to any value, then dataobjects will not be overloaded,
-  This is usefull when working with ZendOptimizer, that may segfault with certain optimization levels</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2</release>
-     <api>1.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-08-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>New Features:
-- A Number of the private methods have been made Public,
-  changes:
-    - _get_table()  = table()
-    - _get_keys()   = keys()
-  additions
-    - tableName()  = returns or assign the table name
-    - database()   = returns or assign the database name
-  changes by Markus Wolff
-POSSIBLE BC IMPLICATIONS: If you define _get_table or _get_keys manually (rather than using the ini file)
-  you should rename your methods table() and keys()
-Fixes:
-- Generator is now more tollerant of editors that alter the spaces before
-  the autocode markers ### (Andreas Ljunggren)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1</release>
-     <api>1.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-08-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Bug Fixes
-- limit argument testing now accepts &quot;10&quot; (a string with an integer
-in it, as a valid argument) (Demian Turner)
-New Features
-- JoinAdd has additional Argument $joinCol, so you can specify
-  multiple targets links of the  same table, eg. user-&gt;friend,
-  user-&gt;parent both connect to the user table..  (Andy Crain)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.2</release>
-     <api>1.0.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-07-31</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix Release
-- Fix static Get call, case sensitivity properly.</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.1</release>
-     <api>1.0.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-07-18</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Minor Bugfix Release
-- Fix Select defaults back to * after an fetch
-- Fix Update with NULL values</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0</release>
-     <api>1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-07-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Gold 1.0 Release.. - final stable release in this series. Future versions
-  (eg. 1.1.*(dev)-&gt;1.2.*(release)) series will be generally API compatible,
-  however is likely to use MDB rather than DB.
-- fix bug #23983 - argument checking on whereAdd, orderBy, limit and a few others
-  (Mike Carter)
-- fix bug with cache clearing not working with staticGet and update/insert
-- null comparison for $object-&gt;var = 'null' will generate IS NULL query
-- null insert/update  works when using 'null' as a value.
-- getLinks returns true on success
-- getLinks now has a formatter eg. '_%s' is default to allow user to define the
-  format of variables to assign child objects to.
-- generator uses UNIQUE only if no primary/autoincrement type field is found.
-- added support for $object-&gt;having('sum(value) &gt; 10');
-- fetch will remove some query lines (so if you want to see how the query was built
-  you will have to print_r() the object after find(), and before fetch(), or just use
-  debugLevel(1)
-- overload calls from setFrom and toArray do method checks, as overload is still proving to
-  be a little unstable especially with Zend Encoder. (Note: if DataObjects causes crashes
-  , remove the overload code at the bottom of DataObjects.php)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.19</release>
-     <api>0.19</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-05-22</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- fix bug #23712 - deleting (and probably updating as well) an object while
-  being fetched. (Michael McCarthy for spotting this)
-- fix generator overwriting code when file was edited in a Windows editor
-  (Robert Janeczek)
-- validation will not produce errors on empty numeric data by default.
-- overload extension enabled to relay setFrom and toArray calls to get*, set*
-  methods, which are predefined as
-  getXXX = returns $object-&gt;XXX
-  setXXX($V) = returns true (or an error string if you create your own)
-  (only affects php-4.3.2RC2 or later..)
-- selectAs($dataobject,'prefix_%s') to help control the way join queries return
-  their data * doing selectAs() - clears the select and sets it to table.id as id ... etc.
-- joinAdd has 2 extra optional arguments
-  $dataObject-&gt;joinAdd($otherDataObject, $joinType, $joinAs)
-  existing behaviour (INNER Joins) is default (eg. no value)
-  $joinType can be:
-    INNER,LEFT,RIGHT = eg. INNER JOIN ... etc.
-    '' = just added with a , and the link conditions are added with a WHERE statement.
-  $joinAs can be used to name the table differently in the join eg.
-    SELECT .. FROM person INNER JOIN address as homeaddress ......
-- setFrom has an extra optional parameter for formating: eg.
-  $object-&gt;setFrom($_POST,'prefix_%s') would map prefix_name to $object-&gt;name
-  the default is '%s' which is the same as the previous behaviour
-- added option dont_die (default no) to ini file
-  default (no) means that DataObjects will emit a PEAR_ERROR_DIE on configuration and
-  programming errors
-  true or 1 means that you can write a PEAR::error handler to catch the errors and
-  display a nice it's not working message</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.18</release>
-     <api>0.18</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-05-17</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- add table prefix to autobuilt queries (assist in ambigous querys for joins)
-  (Daniel Von Fange)
-- change update and delete to return the number of rows affected or false on failure
-- various code tidy ups - standards etc. (Arnaud Limbourg)
-- fix generator for postgres and mdb - use unique keys and look for 'nextval' as keys.
-- fix no key insert bug (G Moxley Kempster)
-- fix empty table bug in generator (Robert Janeczek)
-- staticAutoloadTable(), now handles parse errors in included files alot cleaner
-- added dependancies on PHP4.3, DB 1.3 and Validate (although Validate is optional)
-- added table prefix to count query (Richard Wallace)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.17</release>
-     <api>0.17</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-03-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Usual post feature bug fix release
-- fix loading of links.ini for joinAdd, getLinks etc. (Geoff Hopson)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.16</release>
-     <api>0.16</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-03-06</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- replaced config storage  - should improve performance
-- removed production option (not required due to improved config storage)
-- bugfix : added checks for is_array on ignore_sequence_keys (Hermen Heinen)
-- add toArray($format) which supports sprintf to enable easy integration with
-  Quickforms etc. (Demian Turner)
-- add optional dataobject as variable to update(), so you can update will
-  only create an update based on what has changed. (Geoff Hopson)
-- add join condition to count() (Daniel Von Fange)
-- modify limit() to work with postgresql and make it emit a fatal error if you
-  try this on databases that do not directly support limit queries. (Geoff Hopson)
-  * I'm open on better ideas for this - probably wrapping the find() select call</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.15</release>
-     <api>0.15</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-02-13</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- modified find(true), so that it calls fetch rather than fetchrow
-  so that overriding fetch will affect get() calls.
-  (probably depreciates fetchrow now .. shout if anyone is using it)
-- added escape method as a quasi quote wrapper into pear::DB - useful for
-  building your own queries - eg. like requests.. (does not add quotes)
-- fixed bug with delete not using primary key if it was set. (Ian Eure)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.14</release>
-     <api>0.14</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-02-06</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- added get affected rows to update/insert/delete
-  they will return false if no data is affected and set
-  the Objects lastError value.
-  Note: databases that do not support affectedRows(), will always
-  return false.</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.13</release>
-     <api>0.13</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-01-23</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- bug fix release - debug_ignore_updates worked in reverse.. (Alexander Mazurov)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.12</release>
-     <api>0.12</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-01-22</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Usual post release bug fix.
-- fixes *.links.ini incorrectly using *.links (Damian Turner)
-- Adds the ability to get PEAR Connection and result objects
-  getDatabaseConnection() and getDatabaseResult() (jason rust)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.11</release>
-     <api>0.11</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-01-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- changed connecition and result caching to use global private variable, rather
-  than getStaticProperty
-- results objects are not stored on insert/update/delete (speed increase
-  on large inserts can be as much as 10x faster)
-- bug fix - Checks that primary keys are integers (Anthony Juou)
-- typo on No data returned warning
-- unit tests in CVS
-- new configuration option for whether to use insert id's and sequences.
-- Generator no creates boolean bit (mitchell perilstein)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.10</release>
-     <api>0.10</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-12-09</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- bug fix - Generator incorrectly set _database, causing generation of database.ini files to fail
-- change addslashes to PEAR::DB::quote()
-- generator now only replaces DB_DataObjects with extends variable if set,
-  you can use generator_rewrite_class to set what is a valid replacement.</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.9</release>
-     <api>0.9</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-12-06</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- bug fix release - dsn was not set correctly</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.8</release>
-     <api>0.8</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2002-09-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- changed to stable status as it appears to be pretty stable now.
-- update and insert now return FALSE on error conditions (Peter Gebauer)
-  which can be checked using === FALSE, and the error obtained using $object-&gt;_lastError
-- delete will only use primary keys if they are set, otherwise it will use all object
-  variables to build the condition. (Daniel Ferreira)
-- Added derivedHookFunctions(), and derivedHookVar() to enable extensions to generator to
-  make user defined methods. (Michael Lund Rasmussen)
-- support for INT4, BPCHAR, TIMESTAMPTZ  and postres Primary keys (Xavier)
-- better PEAR CS complience (tabs and TRUE -&gt; true), removed short open tags in generator (Thomas Volkmar Worm)
-- experimental addJoin method (Stijn de Reede)
-- Allow active options array (eg. dynamic changing of database config) (Sergey Lipnevich)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.6</release>
-     <api>0.6</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-09-10</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- bug fix release on insert (broke due to compatibility fixes)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.5</release>
-     <api>0.5</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-09-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- fixed database.links.ini file loading in wrong location (Jens Fischer)
-- fixed type on extends (Jens Fischer)
-- added __clone() support to pre- php5 classes
-- added multiple linked table support</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.4</release>
-     <api>0.4</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-08-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Bug fix release - createTables used wrong argv</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.3</release>
-     <api>0.3</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-08-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fixed Globals requirement in createTables,</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2</release>
-     <api>0.2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-07-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Removed list method, First upload as pear package. - Documentation now in PEAR Manual</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.1</release>
-     <api>0.1</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2002-06-25</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>PEARified</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/Date/1.4.7-info.xml b/lib/.xmlregistry/packages/pear.php.net/Date/1.4.7-info.xml
deleted file mode 100644
index af69566cdd2447a523336c9bd9911d7bec442169..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/Date/1.4.7-info.xml
+++ /dev/null
@@ -1,321 +0,0 @@
-<?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.5.0a1" 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>Date</name>
- <channel>pear.php.net</channel>
- <summary>Generic date/time handling class for PEAR</summary>
- <description>Generic classes for representation and manipulation of
-dates, times and time zones without the need of timestamps,
-which is a huge limitation for php programs.  Includes time zone data,
-time zone conversions and many date/time conversions.
-It does not rely on 32-bit system date stamps, so
-you can display calendars and compare dates that date
-pre 1970 and post 2038. This package also provides a class
-to convert date strings between Gregorian and Human calendar formats.</description>
- <lead>
-  <name>Baba Buehler</name>
-  <user>baba</user>
-  <email>baba@babaz.com</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Pierre-Alain Joye</name>
-  <user>pajoye</user>
-  <email>pajoye@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Monte Ohrt</name>
-  <user>mohrt</user>
-  <email>mohrt@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Firman Wandayandi</name>
-  <user>firman</user>
-  <email>firman@php.net</email>
-  <active>yes</active>
- </lead>
- <developer>
-  <name>Alan Knowles</name>
-  <user>alan_k</user>
-  <email>alan@akbkhome.com</email>
-  <active>yes</active>
- </developer>
- <helper>
-  <name>Leonardo Dutra</name>
-  <user>scar</user>
-  <email>scar@php.net</email>
-  <active>yes</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.4.7</release>
-  <api>1.4</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
- <notes>* Fix bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows
-* Fix bug #9409: Date_Calc, fatal error using a non-array variable as an array
-* Fix bug #9414: Date::addSeconds() fails to work properly with negative numbers
-* Many cosmetics update
-* Moved bug test files to tests/bugs/
-* Removed unused files</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="/" md5sum="a135be6cd4aeb32476423fa9dc95161a" name="tests/test_date_methods_span.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="3b1c6a3a35becde95e4a927fb38763ab" name="tests/test_calc.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="38622d9cb41342d3a177c354cca38599" name="tests/testunit_date_span.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="36b8cac1feadd070a07f9f9f9575b5d8" name="tests/testunit_date.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="42ace22a7887e03ff8b123a312108236" name="tests/testunit.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="5eabf24b94fd57853db681488367aead" name="tests/calc.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="15dff9b119740d565e01523a275d1849" name="tests/bugs/bug-9414.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="22f4db22add37ceea0154b2117a11f45" name="tests/bugs/bug-9213.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="6e5dcc10156aec6362d3153acc0dc7a4" name="tests/bugs/bug-8912.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="143559162ff847244ed67c6cb18f82d6" name="tests/bugs/bug-967.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="7cfadcdc81dc8ecbc39e77cb0606dae6" name="tests/bugs/bug-727-4.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="9a3303542fdf2ae5257e1e3fd0953660" name="tests/bugs/bug-727-3.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="cbb62477c108692400aafe6410015be1" name="tests/bugs/bug-727-2.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="e86d8aa9ce00382fa2b0e05c45d1e9ea" name="tests/bugs/bug-727-1.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="d9dc6385c9bc6a55b48f870f5cfea3e4" name="tests/bugs/bug-674.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="e6424a28cb7c83ddee0dea62c6b9a9aa" name="docs/TODO" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="792b333b7e7b6a591da410c2f7ca4897" name="docs/LICENSE" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="2514e3fa6ec6a6513791f4553a734eb2" name="Date/TimeZone.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="9130fcdb3b4e5a69a1bafdbdc96176ca" name="Date/Span.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="d51dd0ba154020045e37a26ff58b489b" name="Date/Human.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="9a89cb40a6498eaa592fe9b0e3c2c9c3" name="Date/Calc.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="383b9c4665b91a8d351fec78fb4ac0bc" name="Date.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.4.7</release>
-     <api>1.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-11-22</date>
-    <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
-    <notes>* Fix bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows
-* Fix bug #9409: Date_Calc, fatal error using a non-array variable as an array
-* Fix bug #9414: Date::addSeconds() fails to work properly with negative numbers
-* Many cosmetics update
-* Moved bug test files to tests/bugs/
-* Removed unused files</notes>
-   </release>
-   <release>
-    <date>2005-11-15</date>
-    <version>
-     <release>1.4.6</release>
-     <api>1.4.6</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <notes>- Change license from PHP License to new BSD License
-- Bug #5715 fypo, missing s in $GLOBALS</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.5</release>
-     <api>1.4.5</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-10-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>Same code base as 1.4.4-beta
-See 1.4.4 changelog for details</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.4</release>
-     <api>1.4.4</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-05-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Establish the DATE_CALC_FORMAT constant
-  and use it as the default value for each
-  of the Date_Calc class' method's $format
-  parameter.
-- Add beginOfMonthBySpan() and
-  endOfMonthBySpan() methods to Date_Calc.
-- Use integers for the parameters in
-  Date_Calc instead of strings.
-- Tweak Date_Calc::NWeekdayOfMonth() so it
-  can calculate the 'last' given weekday of
-  a month.
-- Fix Bug 1640. Make sure all longname's are also
-  keys in $GLOBALS['_DATE_TIMEZONE_DATA'].  Makes
-  Date_TimeZone work under more operating systems.
-- #5420, missing CEST
-- #3846, getYear, getMonth returns integer
-- #2652, add %h and %i support (rob at wildlime dot com
-- #5494, force dot as decimal separator
-- #3022, allow to specify the weekday abbrevation length used in ::format()
-- #4878, %s padding fix when &lt; 10 ( aashley at optimiser dot com)
-- #3059, use GLOBALS in date_span</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.3</release>
-     <api>1.4.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-05-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fix #1250, wrong name for Bangladesh TZ
-- Fix #1390, add XML Schema datetime support
-  (aashley at optimiser dot com)
-  See http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#dateTime</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.3</release>
-     <api>1.4.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-05-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fix #1250, wrong name for Bangladesh TZ
-- Fix #1390, add XML Schema datetime support
-  (aashley at optimiser dot com)
-  See http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#dateTime</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.2</release>
-     <api>1.4.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-03-14</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fix #976 TimeZone default bad global usage
-  only _DATE_TIMEZONE_DEFAULT is used now
-- Fix #683, add optional length argumet to getDayName()
-- Fix PHP5 problems with get_class functions</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.1</release>
-     <api>1.4.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2005-10-02</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fix #674 endOfWeek() beginOfWeek()
-- Fix #727, weeksInMonth (wrong result with some dates)
-- Fix #674 (and old system #22549), check arguments in Date_Span</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4</release>
-     <api>1.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-12-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- improvements in input date parsing
-- add Date methods addSpan() and subtractSpan()
-- added two more ISO8601 date/time output formats DATE_FORMAT_ISO_BASIC and DATE_FORMAT_ISO_EXTENDED
-- improve Date_Calc isLeapYear() and daysInMonth() for year 1582
-- add gregorianToISO() method to Date_Calc
-- add dateSeason() method to Date_Calc
-- add Date_Span class
-- bugfix in Date_Calc when century ends in 00, only define DATE_CALC_BEGIN_WEEKDAY if not already defined
-- bugfix in beginOfNextWeek(), beginOfPreviousWeek() (thx to andreas dot kossmeier at bergfex dot at)
-- bugfix in nextDayOfWeek and prevDayOfWeek (thx to koan at gmx dot at)
-- bugfix for bug 62: getDate(DATE_FORMAT_UNIXTIME) off because of DST
-- bugfix for bug 65: format(e) returns zero-padded day
-- bugfix for bug 195: Suppress a notice in setDate()
-- bugfix for bug 271: Date_Calc weeksInMonth() returns wrong number
-- fix abstraction bug, Date constructor accepts now object that extends Date
-- add tests to release package
-- Fix notices and mins calc in to toUTCbyOffset()</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/MDB2/2.5.0b2-info.xml b/lib/.xmlregistry/packages/pear.php.net/MDB2/2.5.0b2-info.xml
deleted file mode 100644
index ebd8d07de162582879e8073d61eee56ce037cc2a..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/MDB2/2.5.0b2-info.xml
+++ /dev/null
@@ -1,1601 +0,0 @@
-<?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.7.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>MDB2</name>
- <channel>pear.php.net</channel>
- <extends>MDB</extends>
- <summary>database abstraction layer</summary>
- <description>PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers.
-
-It provides a common API for all supported RDBMS. The main difference to most
-other DB abstraction packages is that MDB2 goes much further to ensure
-portability. MDB2 provides most of its many features optionally that
-can be used to construct portable SQL statements:
-* Object-Oriented API
-* A DSN (data source name) or array format for specifying database servers
-* Datatype abstraction and on demand datatype conversion
-* Various optional fetch modes to fix portability issues
-* Portable error codes
-* Sequential and non sequential row fetching as well as bulk fetching
-* Ability to make buffered and unbuffered queries
-* Ordered array and associative array for the fetched rows
-* Prepare/execute (bind) named and unnamed placeholder emulation
-* Sequence/autoincrement emulation
-* Replace emulation
-* Limited sub select emulation
-* Row limit emulation
-* Transactions/savepoint support
-* Large Object support
-* Index/Unique Key/Primary Key support
-* Pattern matching abstraction
-* Module framework to load advanced functionality on demand
-* Ability to read the information schema
-* RDBMS management methods (creating, dropping, altering)
-* Reverse engineering schemas from an existing database
-* SQL function call abstraction
-* Full integration into the PEAR Framework
-* PHPDoc API documentation</description>
- <lead>
-  <name>Lukas Kahwe Smith</name>
-  <user>lsmith</user>
-  <email>smith@pooteeweet.org</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Lorenzo Alberton</name>
-  <user>quipo</user>
-  <email>l.alberton@quipo.it</email>
-  <active>yes</active>
- </lead>
- <contributor>
-  <name>Paul Cooper</name>
-  <user>pgc</user>
-  <email>pgc@ucecom.com</email>
-  <active>no</active>
- </contributor>
- <helper>
-  <name>Daniel Convissor</name>
-  <user>danielc</user>
-  <email>danielc@php.net</email>
-  <active>yes</active>
- </helper>
- <helper>
-  <name>David Coallier</name>
-  <user>davidc</user>
-  <email>david@jaws.com.mx</email>
-  <active>yes</active>
- </helper>
- <helper>
-  <name>Ali Fazelzadeh</name>
-  <user>afz</user>
-  <email>afz@dev-code.com</email>
-  <active>yes</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:57:35</time>
- <version>
-  <release>2.5.0b2</release>
-  <api>2.5.0b2</api>
- </version>
- <stability>
-  <release>beta</release>
-  <api>beta</api>
- </stability>
- <license>BSD License</license>
- <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #12912: replace() documentation
-- fixed bug #13811: _skipDelimitedStrings() fails on empty strings
-- fixed bug #13898: more tolerant check for 'new_link' DSN option
-- request #13929: added 'default_fk_action_ondelete' and 'default_fk_action_onupdate'
-  options for default FOREIGN KEY constraints actions
-- fixed bug #14124: _skipDelimitedStrings() and prepare() fail with sql comments
-  inside quoted strings
-- fixed bug #14179: declaration of MDB2_Driver_Common::raiseError() must be
-  compatible with that of PEAR::raiseError()
-- fixed doc bug #14290: connect should mention the type of object returned
-- fixed bug #14831: $ignores in _skipDelimitedStrings() [patch by Aleksander Machniak]
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), etc.)
-- add support for database/table/row LOCKs
-- add support for CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- handle LOBs in buffered result sets (Request #8793)</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="/" md5sum="c30bfb476b678d53c7f5e158bde7d9a9" name="tests/test_setup.php.dist" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="841447ae8672a6779166791d0bf6ec03" name="tests/testUtils.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="3c4d2c9d89398c5692d36299d98f9c6e" name="tests/tests.css" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="dc05c6cc4540981d350ccac2005c2578" name="tests/testchoose.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="a2c50ccea24f7bdd5439b366608d59d5" name="tests/test.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="ca453d042076964cbd3350902ad25fa6" name="tests/README" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="b51595b4713c262bb9edc9e96da599b6" name="tests/MDB2_usage_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="2925fd7431313d5df54e068544f8982f" name="tests/MDB2_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="5830541f8688756ad7ec430957fed9ad" name="tests/MDB2_reverse_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="54882586bf87e9f3b5d5ab9a20e3e5f7" name="tests/MDB2_nonstandard_sqlite.php" role="test"/>
-   <file baseinstalldir="/" md5sum="3e790ed8bf0b3b91ec518cdab9eba271" name="tests/MDB2_nonstandard_pgsql.php" role="test"/>
-   <file baseinstalldir="/" md5sum="d8c9287b3614da53d818ef86bfc9ef86" name="tests/MDB2_nonstandard_oci8.php" role="test"/>
-   <file baseinstalldir="/" md5sum="14f12bd33f7212d51b400e0a3ea9dff9" name="tests/MDB2_nonstandard_mysqli.php" role="test"/>
-   <file baseinstalldir="/" md5sum="1766c43f50ce08418b524a6047462e4d" name="tests/MDB2_nonstandard_mysql.php" role="test"/>
-   <file baseinstalldir="/" md5sum="dee3b6f3069fe286c304ca32b77dbe99" name="tests/MDB2_nonstandard_mssql.php" role="test"/>
-   <file baseinstalldir="/" md5sum="32504b5dd5ff479da628abd6f96753c3" name="tests/MDB2_nonstandard_ibase.php" role="test"/>
-   <file baseinstalldir="/" md5sum="92fcbe9e6c2efc8290437d3c87507583" name="tests/MDB2_nonstandard.php" role="test"/>
-   <file baseinstalldir="/" md5sum="22be0efc5b2b81bd6cd6ebe31747445e" name="tests/MDB2_native_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="11d77a1de12eab42ebf776669ed0293b" name="tests/MDB2_manager_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="a6e35fa7d253e5d9426fdefc0e9f2cb6" name="tests/MDB2_internals_testcase.php" role="test"/>
-   <file baseinstalldir="/" md5sum="31a90d80a1a2da0dcdb57cd412e005e1" name="tests/MDB2_function_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="52612ab88c430f08e108d146b46a57d2" name="tests/MDB2_extended_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="6180571aff0f56a569f42c100aa8ffde" name="tests/MDB2_datatype_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="f8534befe37efc7f35beb0897b75f951" name="tests/MDB2_Connect_Test.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="9ddc66748dd375105b4ffda677f57e41" name="tests/MDB2_bugs_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="3eb7f35634d7df3de5eb120da63651c7" name="tests/MDB2_api_testcase.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="ff346ecb984d644ec23584ddb02527b5" name="tests/import.schema.php" role="test"/>
-   <file baseinstalldir="/" md5sum="d46a8f267dbd54f0c7ff55e479d33e7e" name="tests/HTML_TestListener.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="e1c8488c950b5c55440cb06344b989f1" name="tests/driver_test.schema.xml" role="test"/>
-   <file baseinstalldir="/" md5sum="2a2c534ab4afb0c05ca9d7ca47815bf5" name="tests/Console_TestListener.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="c90cdd55233d9ef470150c06a946d213" name="tests/config.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="d67ccf96fabd2e95fa57a7ea76549349" name="tests/clitest.php" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="01d41e566bdb62c7bcb432c8039dda9a" name="tests/basic.phpt" role="test">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="bd83458d9b7a044cb44956244a584849" name="MDB2/LOB.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="023c4bda6db2d8f277d8d3c76dc8f850" name="MDB2/Iterator.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="609260a4c185d579e05755814d092059" name="MDB2/Extended.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="78a2568b3a7d3aa19ee924802a2decc7" name="MDB2/Driver/Reverse/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="b39a72d463db838a5635954e4d6517c2" name="MDB2/Driver/Native/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="6ec44c256b313bffb6848c46cb448a1b" name="MDB2/Driver/Manager/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="20f28774a2ce11a63ed63e9259089f00" name="MDB2/Driver/Function/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="df546ebe47bac7f9bffc0507bd4b9fb8" name="MDB2/Driver/Datatype/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="af81dd360b2d2d09f8c978214b06a553" name="MDB2/Date.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="bb931c6bfff1e98f6dc045c6b82310cb" name="MDB2.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="a5019765abfd14334f25231c61c568ef" name="LICENSE" role="data"/>
-   <file baseinstalldir="/" md5sum="ec0c4383ddfd3af69d577344d0d5b4dd" name="docs/TODO" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="f9858c9327499e60db66621a817c66a4" name="docs/STATUS" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="c7b68ea23aa2ae6d91913703a2246f15" name="docs/README" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="a70b17bcd8e56911f74a4dff61a3ff8d" name="docs/MAINTAINERS" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="74b2bb45de61eccbffed7d75d5268af9" name="docs/examples/metapear_test_db.schema" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="dd25c9a1d24d945ef0c3cb2fc889a070" name="docs/examples/example_php5.php" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="b5cd8d01a36258caa0c4eb7e3478c219" name="docs/examples/example.php" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="cc1befe78146094be02f89bbb201b4ab" name="docs/datatypes.html" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="a253b37e185622112acfef6c94b79aef" name="docs/CONTRIBUTORS" role="doc">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3.2</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>PEAR</name>
-    <channel>pear.php.net</channel>
-    <min>1.3.6</min>
-   </package>
-  </required>
-  <group hint="Frontbase SQL driver for MDB2" name="fbsql">
-   <subpackage>
-    <name>MDB2_Driver_fbsql</name>
-    <channel>pear.php.net</channel>
-    <min>0.3.0</min>
-   </subpackage>
-  </group>
-  <group hint="Interbase/Firebird driver for MDB2" name="ibase">
-   <subpackage>
-    <name>MDB2_Driver_ibase</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="MS SQL Server driver for MDB2" name="mssql">
-   <subpackage>
-    <name>MDB2_Driver_mssql</name>
-    <channel>pear.php.net</channel>
-    <min>1.3.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="MySQL driver for MDB2" name="mysql">
-   <subpackage>
-    <name>MDB2_Driver_mysql</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="MySQLi driver for MDB2" name="mysqli">
-   <subpackage>
-    <name>MDB2_Driver_mysqli</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="Oracle driver for MDB2" name="oci8">
-   <subpackage>
-    <name>MDB2_Driver_oci8</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="PostgreSQL driver for MDB2" name="pgsql">
-   <subpackage>
-    <name>MDB2_Driver_pgsql</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
-  <group hint="Querysim driver for MDB2" name="querysim">
-   <subpackage>
-    <name>MDB2_Driver_querysim</name>
-    <channel>pear.php.net</channel>
-    <min>0.6.0</min>
-   </subpackage>
-  </group>
-  <group hint="SQLite2 driver for MDB2" name="sqlite">
-   <subpackage>
-    <name>MDB2_Driver_sqlite</name>
-    <channel>pear.php.net</channel>
-    <min>1.5.0b2</min>
-   </subpackage>
-  </group>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>2.5.0b2</release>
-     <api>2.5.0b2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2009-01-14</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #12912: replace() documentation
-- fixed bug #13811: _skipDelimitedStrings() fails on empty strings
-- fixed bug #13898: more tolerant check for 'new_link' DSN option
-- request #13929: added 'default_fk_action_ondelete' and 'default_fk_action_onupdate'
-  options for default FOREIGN KEY constraints actions
-- fixed bug #14124: _skipDelimitedStrings() and prepare() fail with sql comments
-  inside quoted strings
-- fixed bug #14179: declaration of MDB2_Driver_Common::raiseError() must be
-  compatible with that of PEAR::raiseError()
-- fixed doc bug #14290: connect should mention the type of object returned
-- fixed bug #14831: $ignores in _skipDelimitedStrings() [patch by Aleksander Machniak]
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), etc.)
-- add support for database/table/row LOCKs
-- add support for CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.5.0b1</release>
-     <api>2.5.0b1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2008-03-15</date>
-    <license>BSD License</license>
-    <notes>- request #12731: added truncateTable() in the Manager module
-- request #12732: added vacuum() in the Manager module for OPTIMIZE/VACUUM TABLE abstraction
-- request #12800: added alterDatabase() in the Manager module [afz]
-- fixed bug #12924: correctly handle internal expected errors even with custom error handling
-- fixed bug #12991: new error code in errorInfo() [afz]
-- added databaseExists() method [afz]
-- request #13106: added unixtimestamp() in the Function module
-- added max_identifiers_length option
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), etc.)
-- add support for database/table/row LOCKs
-- add support for CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.5.0a2</release>
-     <api>2.5.0a2</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2007-12-06</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #12358: E_STRICT changes in latest alpha broke PHP4 compatibility
-- fixed bug #12351: wrong case for function PEAR::isError() in the Reverse module
-  [was: IsError()]
-- fixed bug #12530: MDB2_Extended::autoPrepare() gives error if $types is null
-- request #12012: added charset/collation support in createDatabase() for the
-  drivers that support this feature
-- added bindname_format option (this is the regexp used to recognize named
-  placeholders in prepared statements)
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), etc.)
-- add support for database/table/row LOCKs
-- add support for CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.5.0a1</release>
-     <api>2.5.0a1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2007-10-28</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #10024: Security fix for LOBs. Added an option to turn lob_allow_url_include off by default
-- fixed bug #11179: prepared statements with named placeholders fail if extra values are provided
-- request #11297: added support for &quot;schema.table&quot; (or &quot;owner.table&quot;) notation in the Reverse module
-- initial support for FOREIGN KEY and CHECK constraints in the Reverse and Manager modules
-- fixed bug #11428: propagate quote() errors with invalid data types
-- added new test cases in the test suite
-- added LENGTH() function in the Function module
-- fixed bug #11612: raiseError() must be compatible with PEAR::raiseError() [PHP6]
-- fixed bug #11790: avoid array_diff() because it has a memory leak in PHP 5.1.x
-- fixed bug #11906: quoteIdentifier fails for names with dots
-- fixed bug #11975: Extended::autoExecute() does not work with Oracle when using LOBs
-  (patch by Pieter Meulen, van der)
-- fixed some E_STRICT errors with PHP5
-- fixed bug #12083: createTable() in the Manager module now returns MDB2_OK on success,
-  as documented
-- fixed bug #12246: wrong check in MDB2::isStatement() (thanks to zaa@zaa.pp.ru)
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), etc.)
-- add support for database/table/row LOCKs
-- add support for CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- add charset and collation support to field declaration in all drivers
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.4.1</release>
-     <api>2.4.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-05-03</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #10407: propagate errors in MDB2_Statement_Common::execute()
-- fixed bug #10452: error in getDeclaration() with custom datatype_map and no
-  datatype_map_callback function
-- fixed bug #10521: quote($val,'decimal') and quote($val,'float') pass unsafe characters
-- return length as &quot;precision,scale&quot; for NUMERIC and DECIMAL fields in mapNativeDatatype()
-- fixed bug #10537: safer check for valid MDB2 connection in singleton() [fornax]
-- fixed bug #10598: MDB2::singleton() not working in some rare conditions [fornax]
-- in getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse
-  module, also return the field position in the index/constraint
-- exec() now returns a reference instead of a copy to prevent memory leaks
-- request #10787: MDB2_Driver_Common::$phptype and $dbsyntax properties are now public
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support for database/table/row LOCKs
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- add charset and collation support to field declaration in all drivers
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.4.0</release>
-     <api>2.4.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-03-13</date>
-    <license>BSD License</license>
-    <notes>- propagate errors in getTableFieldDefinition() in the Reverse module
-- internally use MDB2::classExists() wrapper instead of directly calling class_exists()
-- fixed bug #9502: query result misbehaves when the number of returned columns
-  is greater than the number of passed types
-- fixed bug #9748: Table name is not quoted in Extended.php buildManipSQL()
-- fixed bug #9800: when the php extension for the driver fails to load, the
-  error is not propagated correctly and the script dies
-- propagate errors in the Datatype module
-- implemented guid() in the Function module [globally unique identifier]
-  (thanks to mario dot adam at schaeffler dot com)
-- fixed bug #4854: Oracle Easy Connect syntax only works with array DSN
-- fixed bug #10105: inTransaction() was returning an incorrect value after a call
-  to disconnect() or __destruct()
-- implemented a fallback mechanism within getTableIndexDefinition() and
-  getTableConstraintDefinition() in the Reverse module to ignore the 'idxname_format'
-  option and use the index name as provided in case of failure before returning
-  an error
-- added a 'nativetype_map_callback' option to map native data declarations back to
-  custom data types (thanks to Andrew Hill).
-- fixed bug #10234 and bug #10233: MDB2_Driver_Datatype_Common::mapNativeDatatype()
-  must ensure that it returns the correct length value, or null
-- added support for TEMPORARY tables (patch by Andrew Hill)
-- phpdoc fixes
-- fixed tests to be compatible with PHP4
-- added new tests, including some MDB2 internals tests by Andrew Hill and Monique Szpak
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support for database/table/row LOCKs
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- add charset and collation support to field declaration in all drivers
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.3.0</release>
-     <api>2.3.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-11-03</date>
-    <license>BSD License</license>
-    <notes>- added charset and collation support to field declaration
-- added SQL comments and quoted identifier handling inside prepared statement parser
-- expanded length/scale support for numeric types (Request #7170)
-- added statement_format option to make it possible to define the name used for
-  native statements if supported
-- fixed bug when setting MDB2_PREPARE_RESULT in autoExecute()
-- fixed notice in exec() call in autoExecute()
-- reversed if logic in MDB2::fileExists checking to be more fool proof with
-  safe_mode restrictions (Bug #8296)
-- moved CREATE TABLE query generation in a separate method for reuse in the drivers
-- added testLOBRead to test multiple LOB reads
-- fixed getColumnNames() optional parameter handling (Bug #8857)
-- phpdoc fix for fetchCol/fetchAll
-- added an extra if in the autoExecute method of the Extended driver (Bug #8878)
-- expanded tableInfo() tests
-- expanded prepare() tests
-- fix the incorrect use of currID() for lastInsertID() emulation (Bug #9107)
-- add test for lastInsertID()
-- also output php version in test results
-- added supported 'new_link'
-- dropped use of track_errors because 5.2.0 causes php_errormsg to not get
-  populated if a custom error handler is set and it was causing issues for
-  safe_mode users anyways
-- added some error handling into the bindValues()/bindParams() methods (Bug #9133)
-- bindValue() does not need values by reference
-- fix issue in execute() when parameter is a scalar integer of 0 (Bug #9158)
-- implemented stream_stat() method (Bug #9092)
-- better deal with non scalar arguments in test helper function as 5.2.0 explodes otherwise
-- extracted _skipDelimitedStrings() method from prepare()
-- added test for _skipDelimitedStrings() method
-- migrated to package.xml version 2
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- expand charset support in schema management and result set handling (Request #4666)
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support for database/table/row LOCKs
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- explore use of install groups (pear install MDB2#mysql)
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)
-- add a getTableFieldsDefinitions() method to be used in tableInfo()
-- drop ILIKE from matchPattern() and instead add a second parameter to
-  handle case sensitivity with arbitrary operators
-- add charset and collation support to field declaration in all drivers
-- handle LOBs in buffered result sets (Request #8793)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.2.2</release>
-     <api>2.2.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-09-03</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- flip positions property array in prepared statement objects to make it
-  possible to optionally use the same named placeholder in multiple places
-  inside a single prepared statement
-- expanded prepare tests to cover more edge cases
-- renamed valid_types property to valid_default_values in the Datatype module
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- expand charset support in schema management and result set handling (Request #4666)
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- expand length/scale support for numeric types (Request #7170)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support for database/table/row LOCKs
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add a package2.xml and explore use of install groups (pear install MDB2#mysql)
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected
-- handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.2.1</release>
-     <api>2.2.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-08-21</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed missing code in tableInfo() (Bug #8289)
-- fixed handling of indexes and constraints and types in tableInfo() (fixes BC break)
-- do not set nested transaction error if error is expected
-- explictly default to NULL when the column is NULLable and no default is set
-  (related to Bug #8359)
-- added support for case insensitive matching via ILIKE in matchPattern()
-- added getAsKeyword() for generating &quot;AS&quot; keyword as required by the RDBMS
-- return an error if a named placeholder name is used twice inside a single statement
-- add support for multi column PRIMARY KEYs in createTable()
-- added lower() and upper() to the function module
-- moved escaping tests to datatype tests
-- added summary at the end of a test run for each RDBMS
-- explicitly pass the php_type var in all internal loadModule() calls
-- added support for 'primary' option in createTable()
-- expanded NULL tests
-- fixed handling return values when disable_query is set in _doQuery() and _execute()
-- check if safe_mode is enabled in fileExists() to determine what algo to use (Bug #8296)
-- added a test case for updating LOBs
-- added rtrim test case for LOBs
-- if result types are specified only rtrim() type 'text' fields (otherwise
-  it will mean that for some drivers LOB's would get rtrimmed)
-- phpdoc fixes to the convertResult*() methods
-- added execParam() method and code tweaks for get*() methods in the Extended module
-- removed redundant assertions when testing if a given feature is unsupported
-- removed tests of portability off (users should just set the given portability
-  setting they want to test in their test_setup.php)
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- expand charset support in schema management and result set handling (Request #4666)
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- expand length/scale support for numeric types (Request #7170)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support for database/table/row LOCKs
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- generate STATUS file from test suite results and allow users to submit test results
-- add a package2.xml and explore use of install groups (pear install MDB2#mysql)
-- add support for full text index creation and querying
-- add tests to check if the RDBMS specific handling with portability options
-  disabled behaves as expected</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.2.0</release>
-     <api>2.2.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-07-23</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- added MDB2_AUTOQUERY_SELECT (Request #7817)
-- added nested transaction support (inspired by ADODB's smart transactions) but
-  expanded to optionally use SAVEPOINTs *EXPERIMENTAL*
-  beginNestedTransaction(), completeNestedTransaction(),
-  failNestedTransaction(), getNestedTransactionError()
-- inTransaction() will now return an integer with the nested transaction depth
-  if a nested transaction has been started
-- added setTransactionIsolation()
-- added savepoint support to beginTransaction(), commit() and rollback()
-- added Native base class for consistency
-- added missing colnum parameter to queryOne() [used by getOne()]
-- added new tests for get*() Extended module methods
-- fixed missing db variable from getValidTypes()
-- added testing of a prepared statement with no parameters
-- added handling of empty result sets to result set verification in the test suite
-- oci8 and ibase (and possibly other rdbms) do not like freeing the statement
-  before reading the result set (Bug #8068):
-  * moved statement freeing after reading the result set in get*() Extended methods
-  * bypass prepared statement API for queries without parameters in autoExecute()
-  (this means you cannot use parameters with SELECT statements in autoExecute()
-  on the above mentioned platforms)
-- use data type callback in getValidTypes()
-- fixed identifier quoting in buildManipSQL() for SELECT statements (thx Kailoran)
-- phpdoc and cosmetic fixes in limitQuery()
-- added matchPattern() and patternEscapeString(), escapePattern() *EXPERIMENTAL*
-- added ability to escape wildcard characters in escape() and quote()
-- added debug() call at the end of a query/prepare/execute calling (Request #7933)
-- added context array parameter to debug() and make use of it whereever sensible
-- added optional method name parameter to raiseError() and use whereever possible
-- added a new option &quot;debug_expanded_output&quot; which needs to be set to true to
-  get additional context information and to get &quot;post&quot; callback calls
-- added testPortabilityOptions()
-- set length of 8 and fixed for user_password in the test suite
-- reworked tableInfo() to use a common implementation based on getTableFieldDefinition()
-  when a table name is passed (Bug #8124)
-- disconnect after changing database/DSN (otherwise transactions may be left open)
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add length handling to LOB reverse engineering
-- expand charset support in schema management and result set handling (Request #4666)
-- add EXPLAIN abstraction
-- add cursor support along the lines of PDO (Request #3660 etc.)
-- expand length/scale support for numeric types (Request #7170)
-- add PDO based drivers, especially a driver to support SQLite 3 (Request #6907)
-- add support to export/import in CSV format
-- add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.)
-- add support to generating &quot;AS&quot; keyword if required
-- add support for database/table/row LOCKs
-- add ActiveRecord implementation (probably as a separate package)
-- add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints
-- extended to support for case insensitive matching via ILIKE/collate in matchPattern()
-- generate STATUS file from test suite results and allow users to submit test results</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.1.0</release>
-     <api>2.1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-06-15</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- removed bogus code from execute()
-- new test case for floats/decimals and locale
-- reworked fix for float/decimal handling
-- expanded scientific notation handling
-- fixed several minor issues with the datatype tests
-- removed use of &quot;*&quot; in all places in the test suite that are followed by a fetch
-- tweaked handling of free() for prepared statements
-- return error if a prepared statement is attempted to be free'ed or executed again
-- added result_wrap_class param to limitQuery()
-- added parameter to not quote return value of getBeforeId()
-- added setCharset()
-- enable transactions by default
-- added decimal reverse engineering test
-- fixed parameter order in assertions in reverse engineering fields tests
-- generalized quoteIdentifier() with a property
-- switched most array_key_exists() calls to !empty() to improve readability and performance
-- fixed a few edge cases and potential warnings
-- added ability to rewrite queries for query(), exec() and prepare() using a debug handler callback
-- added 'datatype_map' option (Request #7797)
-- added reverse parameter to getColumnNames()
-- added 'datatype_map_callback' option
-- added getValidTypes() method to handle additional types from the 'datatype_map' option
-- set last_query in _execute() to prepared statement (Bug #7856)
-- adding random function emulation to generate a float between 0 and 1
-- explicitly fetch row id = 1 in LOB tests
-- cosmetic fix to prepare() (Bug #7883)
-- bumped PHP dependency to 4.3.2 because of LOB stream support
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add support for ADODB style &quot;smart transactions&quot;:
-  http://phplens.com/lens/adodb/docs-adodb.htm#ex11
-- add length handling to LOB reverse engineering</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.3</release>
-     <api>2.0.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-05-22</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fix float/decimal handling (Request #3021)
-- default to decimal for double (instead of float)
-- serialize arrays when no type is explicitly given
-- phpdoc fixes
-- expanded FLOAT test
-- added support for identifier quoting (Request #7671)
-- added test class for the Extended module
-- added support for DELETE in auto*() methods (Request #5345)
-- added &quot;emulate_prepared&quot; option to force prepared statement emulation
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add support for ADODB style &quot;smart transactions&quot;:
-  http://phplens.com/lens/adodb/docs-adodb.htm#ex11
-- add length handling to LOB reverse engineering</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.2</release>
-     <api>2.0.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-05-14</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- phpdoc and folding mark fixes (thx Laurent and Stoyan)
-- added getTriggerDefinition() in the Reverse module
-- added listTableViews() in the Manager module
-- explicitly set is_manip parameter to false for transaction debug calls
-- various minor tweaks to error messages, phpdoc and adding stub methods to the
-  common driver
-- added row seeking support to fetchOne()
-- added ability to hint that a constraint is a primary key in dropConstraint()
-- since we no longer complain about primary keys not being called primary we can
-  remove the necessary hacks in the test suite
-- improved LOB tests in the test suite
-- do not require Manager module for core API tests
-- added support for fixed and variable types for 'text' in declarations,
-  as well as in reverse engineering (Request #1523)
-- updated MAINTAINERS to current status
-- readded STATUS document, still needs to be filled with content
-- tweaked handling of error objects inside raiseError()
-- made _doQuery() return a reference
-- added userinfo's to all raiseError calls that previously had none
-- added bindValueArray()
-- use bindValueArray() instead of bindParamArray() in all internal calls
-- removed the skeleton drivers, since its too much work to maintain them
-  and there are plenty of sample drivers to look at
-- fixed example due to API change in MDB2_Schema (Bug #7575)
-- added 'prepared_statements' supported meta data setting
-- do not retrieve lob in the stream constructor and streams_eof()
-- strip of file:// prefix in writeLOBToFile()
-- typo fix ressource/resource in LOB array
-- removed lob property from the LOB streams wrapper (references are always
-  shaky business in PHP so lets use them as little as possible)
-- fixed _destroyLOB() API to match other private LOB methods
-- fixed phpdoc comments of all private LOB methods
-- typo fix in autoincrement test
-- reworked index/constraint creation to not affected unnecessary reverse tests
-
-Note: Due to changes in generation of declaration statements you may need to
-update your test databases (for example by rerunning the MDB2_Schema
-installation using the CVS version or a release greater than 0.5.0)
-
-open todo items:
-- handle autoincrement fields in alterTable()
-- add support for ADODB style &quot;smart transactions&quot;:
-  http://phplens.com/lens/adodb/docs-adodb.htm#ex11</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.1</release>
-     <api>2.0.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-04-16</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- added new comprehensive tests for the Reverse module
-- fixed testcases to pass for mysql[i] (needs pk's to be called &quot;primary&quot;) ..
-  sqlite is probably severely broken for these tests
-- added ability to specify port number when using unix sockets in
-  MDB2::parseDSN() (bug #5982)
-- added test for multi_query option
-- typo fix in get constraint test
-- use ugly fopen() hack in fileExists()
-  http://marc.theaimsgroup.com/?l=pear-dev&amp;m=114148949106207&amp;w=2
-- allow &quot;.&quot; and &quot;$&quot; in sequence name (bug #7081)
-- aligned _modifyQuery() signature and phpdoc
-- added inTransaction() to determine if a transaction is currently open
-- added support for tabe options in createTable() (bug ##7079)
-- make it possible to overwrite the error code-message map
-- added sample sqlite in memory dsn to php5 example
-- added 'result_introspection' supported metadata support
-- added bindValue() method
-- use MDB2_PREPARE_MANIP where we previously were using false
-- fixed default values for date and timestamp
-- if MDB2_PORTABILITY_EMPTY_TO_NULL is set change '' to ' ' in _getDeclaration()
-- refactored class loading into MDB2::loadClass()
-- properly quote CURRENT_* for temporal types (bug #6416)
-- added connected_server_info to cache server info in getServerInfo()
-- reset all connection related properties in disconnect()
-- separated result_buffering and prefetching by adding the new result_prefetching option
-- set error code in all raiseError() calls
-- added support for length in reverse engineering of integer fields
-- improve test suite documentation
-
-open todo items:
-- handle autoincremement fields in alterTable()</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0</release>
-     <api>2.0.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-02-09</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- handle null as resource when disable_query option is enabled in result object</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0RC5</release>
-     <api>2.0.0RC5</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2006-02-05</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- expanded testing of prepared queries (out of order binding, escape characters
-  inside the string, lobs without named parameters that match the field name)
-- removed ugly hack for quote parameter in quote() since it was insufficient
-  (escaping also needs to be prevented)
-- added support for out of order parameter binding in prepared queries
-- expanded testing of prepared queries (out of order binding, escape characters
-  inside the string, lobs without named parameters that match the field name)
-- reset row_limit and row_offset after calling prepare() just like we do for query() and exec()
-- cosmetic fix (removed &quot;row_&quot; prefix from &quot;row_limit&quot; and &quot;row_offset&quot;)
-- now using INT/TINYINT/SMALLINT by default instead of CHAR(1) for the boolean datatype
-  (BC BREAK!)
-- added MDB2_datatype_testcase to test suite
-- support an arbitrary number of arguments in concat()
-- add property phpdoc comments to LOB.php</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0RC4</release>
-     <api>2.0.0RC4</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2006-01-13</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- explicitly pass if the module is phptype specific in all loadModule calls (bug #6226)
-- some cleanups in loadModule()
-- eliminate possible warnings in execute() and _assignBindColumns()
-- do not silence includes when debug option is enabled
-- fixed serious bug in autoincrement test
-- added dbsyntax to getDSN() string output (feature request #6463)
-- fixed signature of executeStoredProc()
-- nextResult() returns false if there are no more result sets to read
-- renamed _isIndexName() to _fixIndexName()
-- _fixIndexName() now just attempts to remove possible formatting
-- renamed _isSequenceName() to _fixSequenceName()
-- _fixSequenceName() now just attempts to remove possible formatting, and only
-  returns a boolean if no formatting was applied when the new &quot;check&quot; parameter is set to true</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0RC3</release>
-     <api>2.0.0RC3</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-12-30</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- added error handling when result set introspection is not supported in _wrapResult()
-- fixed example
-- removed peardb wrapper (its broken, unmaintained and probably unused)
-- added new example using php5 only features
-- MDB2_OK is now a boolean true, instead of integer 1
-- types can now always be keyed by name or by order
-- renamed setResultTypes() in the datatype module to checkResultTypes()
-  and modified the signature accordingly
-- removed no longer used MDB2::isManip()</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0RC2</release>
-     <api>2.0.0RC2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-12-28</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed testNow() to use the datatype abstraction
-- fixed testGetTableFieldDefinition() to use a blob column instead of a clob
-  since we default to blob when we cannot differntiate between blob and clob
-- split up alterTable() testing into two separate test methods
-- removed errorNative() was never implemented, use errorInfo() instead
-- fixed major bug in _fixResultArrayValues() that would lead to performance or
-  incorrect application of portability features
-- phpdoc fixes in LOB.php, Iterator.php, Date.php and Extended.php
-- removed not required prev() and hasPrev() from the SeekableIterator implementation</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0RC1</release>
-     <api>2.0.0RC1</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-12-21</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- added numerous testcases in the manager and reverse module
-- unified case fixing in the list*() methods
-- case-insensitive comparison in _isSequenceName()
-- added getConnection() to fetch a native connection resource
-- split index and constraint handling
-- quote identifiers where possible inside the manager methods depending on
-  the new 'quote_identifier' option (defaults to off)
-- refactored get*Declaration() methods to use getTypeDeclaration()
-- setting in_transaction to false on disconnect
-- store if type has changed in compareDefinition()
-- added new Function modules to handle difference in SQL functions
-- added verious new test cases
-- refactored test cases to use an MDB2_testcase base class
-- allow empty field parameter in get*ID() methods (bug #5791)
-- tweaked error messages for file loads
-- split off manipulation queries into exec() method from the query() method *BC BREAK*
-- only if result_types is set to false in prepare() method the query will be
-  handled as a DML statement *BC BREAK*
-- use a proper default value if a field is set to not null in _getDeclaration*() (bug #5930)
-- added getServerVersion()
-- renamed defaultOutput() to getDefaultOutput() *BC BREAK*
-- use tableInfo() to automatically determine the result types if type is set to true
-- reworked file loading to work around issues in safe_mode with MDB2::fileExists() (bug #6226)
-- no need to return by reference in getConnection() (it even seems to work for
-  mysqli that has objects and not resource connections)
-- added &quot;idxname_format&quot; as option similar to &quot;seqname_format&quot;
-- fixed bug in API calls inside autoExecute() (bug #6286)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta6</release>
-     <api>2.0.0beta6</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-10-16</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>Warning: this release features numerous BC breaks!
-
-There have been considerable improvements to the datatype, manager and reverse
-modules. Furthermore preliminary support for auto increment and primary keys
-has been added. Please note that making a field auto increment implies a single
-column primary key on this field.
-
-- increased php dependency to 4.3.0 due to the usage of the streams API since beta5
-- moved logic from MDB2::connect() to MDB2::factory(), the only difference is
-  that MDB2::connect will immediatly try to connect to the database
-- MDB2::singleton now uses MDB2::factory()
-- added support for auto increment and primary key in schema. (mysql[i])
-- alterTable now needs the full definition to work (use getTableFieldDefinition
- from Reverse module if you do not have a definition at hand) this eliminates the need
- of the declaration part in the alterTable array.
-- nicer test chooser. Added some js magic to [un]select all the tests in a group
-- fixed typo in _getTextDeclaration()
-- fix PHP4.4 breakage
-- ensure that types and result_types property in the statement class is an array (bug #4695)
-- added support for fetchmode in the iterator class and for any other result wrapper class (bug #4685)
-- moved getInsertID() into core as lastInsertID()
-- moved getBeforeID() and getAfterID() from core into the extended module
-- added base class for all modules (which provides getDBInstance())
-- added free() method to remove an instance from the global instance array
-- removed schema manager related error codes from MDB2::errorMessage()
-- dont set the include path in test suite (people can do that in test_setup.php)
-- added missing default numRows() method
-- added hack into stream_eof() to handle the BC break in 5.0.x
-- removed uncessary duplicate quoting in quote() in the peardb wrapper (bug #5195)
-- warning fix in BC hack of connect() in the peardb wrapper
-- tweaked error message in setResultTypes()
-- removed PDO compatibility code in bindParam and bindCol, now using 0-index numeric keys again
-- expect keys in type arrays the same way as they are passed for the values in execute() and bindParamArray()
-- add s pattern modifier to preg_replace() call for parameter searches in prepare() (bug #5362)
-- moved all private fetch mode fix methods into _fixResultArrayValues() for performance reasons
-- added new portability fetch mode MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES (to remove database/table qualifiers from assoc indexes)
-- renamed MDB2_PORTABILITY_LOWERCASE to MDB2_PORTABILITY_FIX_CASE and use 'field_case' option to determine if to upper- or lowercase (CASE_LOWER/CASE_UPPER)
-- ensure that fetchAll always returns an array() even if the result set was empty
-- use array_key_exists() instead of isset() where possible
-- changed structure of field add/remove/change in alterTable() to match MDB2_Schema
-- added default values for supported property
-- reworked supports() to return the given value and also return errors for non existant support feature
-- reworked subSelect() to use the 'emulated' supports() return value
-- removed implementation of createIndex() (now every driver needs to implement it themselves)
-- sync fileExists with the LiveUser one, explode instead of split and is_readable instead of file_exists.
-- tweaked compare method family to better deal with optional properties
-
-open todo items:
-- add test cases for the various module methods
-- add getServerVersion()</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta5</release>
-     <api>2.0.0beta5</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-06-08</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>Warning: this release features numerous BC breaks to make the MDB2 API be as
-similar as possible as the ext/pdo API! The next release is likely to also break
-BC for the same reason. Check php.net/pdo for information on the pdo API.
-
-- refactored LOB support (BC breaks)
-- moved all drivers into separate packages MDB2_Driver_* (BC break)
-- bindParam() and bindColumn() are now 1-indexed (BC break)
-- removed special handling for day light saving time (bug #4341) (BC break)
-- ensure SQL injection protection in all _quote() methods
-  (was missing in some decimal, float, time, date and timestamp implementations)
-- renamed getRowCount() to rowCount() for PDO compliance (BC break)
-  (doesnt take into account the offset anymore)
-- added new quote() parameter to remove quotes (ugly hack will get cleaned up)
-- renamed execute() to _execute() since common provides some common functionality via execute()
-- fixed some issues regarding limit/offset in prepared statements
-- fixed bug in _assignBindColumns() when using associative fetches
-- support numeric and string keys in types array for prepared queries
-- call trigger error if __call() is unable to find a method in any of the modules
-- work around php5 bugs in the test suite</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta4</release>
-     <api>2.0.0beta4</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-04-29</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>Warning: this release features numerous BC breaks to make the MDB2 API be as
-similar as possible as the ext/pdo API! The next release is likely to also break
-BC for the same reason. Check php.net/pdo for information on the pdo API.
-
-- fixed bugs in MDB2_Extended::buildManipSQL() introduced in latest tweaks (bug #3725)
-- mysqli has connection objects instead of resources
-- fix mssql tableInfo() so flags are returned (bug #3691)
-- fixed bug in handling of force_array when 2 or less columns are fetched in fetchAll()
-- added map error message for sqlite multi-column unique constraints.
-- added listUsers(), listViews(), listFunctions() to oracle manager
-- added listFunctions() to pgsql manager
-- updated listViews() in pgsql manager
-- added __call() support for module handling
-- mysql driver now uses mysqli implementations where feasible
-- ensure that internal calls to query dont wrap the result
-- for some reason mysqli didnt like SELECT LAST_INSERT_ID()
-- fixed bug in table alteration when only an index was added
-- updated pgsql API calls to 4.2.0 recommended names (bug #3904)
-- moved logic to compareDefinitions from the Manager into the Datatype module
-  to increase flexibility
-- extended MDB2::isError() to be able to handle an array or codes
-- added error handling into autoPrepare() and autoExecute()
-- migrade all MDB2::isError calls that dont check for specific errors codes to PEAR::isError
-- don't pass new_link to mysql_pconnect() (bug #3993)
-- use MDB2::raiseError() instead of MDB2_Driver_Common::raiseError()
-- do not disable result wrapping when doing internal calls to query() (bug #3997)
-- _wrapResult() now ensures that the result class is an instance of MDB2_Result_Common
-- unbundled the MDB2_Tools_Manager into a separate package PEAR::MDB2_Schema
-- improved getTableFieldDefinition() and moved native type mapping to the
-  datatype module mapNativeDatatype() method (mysql, sqlite, pgsql and ibase drivers)
-- fixes for listTables() in sqlite and pgsql driver
-- ensure that mysql drivers use the dummy_primary_key property
-- severely reworked how data is fetched and buffered and freed in the iterator
-- added mapNativeDatatype() to ibase driver
-- getTypeDeclaration() =&gt; _getTypeDeclaration() in ibase driver
-- cosmetic fixes and tweaks (replace(). fetchOne() ..)
-- renamed 'seqname_col_name' option to 'seqcol_name'
-- moved schema documentation, xml_reverse_engineering.php, MDB.dtd
-  and MDB.xls to MDB_Schema package
-- Mysqli: implicit sequence is named as table by default
-- Mysqli: text types now map to clob first
-- ensure that types are numerically keyed in setResultTypes()
-- added caching to getColumnNames()
-- added bindColumn() support
-- use MDB2_Schema::factory()
-- phpdoc fixes in regards to flipped fetchmode
-- remove renegate mysql code in sqlite driver</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta3</release>
-     <api>2.0.0beta3</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-03-06</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>Warning: this release features numerous BC breaks to make the MDB2 API be as
-similar as possible as the ext/pdo API! The next release is likely to also break
-BC for the same reason. Check php.net/pdo for information on the pdo API.
-
-Oracle NULL in LOB fields is broken.
-The fbsql and mssql drivers are likely to be broken as they are largely untested.
-
-MDB2 static class:
-- &quot;xxx&quot; out password on connect error in MDB2::connect()
-- MDB2::isError now also optionally accepts and error code to check for
-- added LOAD DATA (port from DB) and SET to MDB2::isManip()
-
-All drivers:
-- use __construct() (PHP4 BC hacks are provided)
-- allow null values to be set for options
-- ensure we are returning a reference in all relevant places
-
-- allow errorInfo() to be called when no connection has been established yet
-- use MDB2_ERROR_UNSUPPORTED instead of MDB2_ERROR_NOT_CAPABLE in common implementations
-- readded MDB2_Error as the baseclass for all MDB2 error objects
-- updated error mappings from DB
-
-- added MDB2_Driver_Common::getDatabase();
-- reworked dsn default handling
-- added ability to &quot;xxx&quot; out password in getDSN()
-
-- use _close() method in several places where they previously were not used
-- removed redundant code in _close() that dealt with transaction closing already
-  done in disconnect()
-- if the dbsyntax is set in the dsn it will be set in the dbsyntax property
-- only disconnect persistant connections if disconnect() has been explicitly
-  called by the user
-- instead of having a generic implemention of disconnect() we will rename
-  _close() to disconnect() to overwrite the generic implementation
-- added support for 'new_link' dsn option for all supported drivers (mysql, oci8, pgsql)
-
-- transaction API moved over to PDO: removed autoCommit(), added beginTransaction()
-  and refactored commit() (it doesn't start a new transaction automatically anymore)
-- reworked handling of uncommited transaction for persistant connections when
-  a given connection is no longer in use
-
-- added 'disable_query' option to be able to disable the execution of all queries
- (this might be useful in conjuntion with a custom debug handler to be able to
- dump all queries into a file instead of executing them)
-- removed affectedRows() method in favor of returning affectedRows() on query if relevant
-- added generic implementation of query() and moved driver specific code into _doQuery()
-- added _modifyQuery() to any driver that did not yet have it yet
-- standaloneQuery() now also supports SELECT querys
-- remove redundant call to commit() since setting autoCommit() already commits in MDB2::replace()
-- refactored standaloneQuery(), query(), _doQuery(), _wrapResult(); the most important change are:
-  result are only wrapped if it is explicitly requested
-  standaloneQuery() now works just as query() does but with its own connection
-- allowing limits of 0 in setLimit()
-
-- explicitly specify colum name in sequence emulation queries
-- added getBeforeId() and getAfterId()
-- added new supported feature 'auto_increment'
-
-- added default implementation for quoteCLOB() and quoteBLOB()
-- reworked quote handling: moved all implementation details into the extension,
-  made all quote methods private except for quote() itself, honor portability
-  MDB2_PORTABILITY_EMPTY_TO_NULL in quote(), removed MDB2_TYPE_* constants
-- reworked get*Declaration handling: moved all implementation details into the extension,
-  made all quote methods private except for quote() itself
-- placed convert methods after the portability conversions to ensure that the
-  proper type is maintained after the conversion methods
-- dont convert fetched null values in the Datatype module
-
-- removed executeParams() and moved executeMultiple() from extended module
-
-- updated tableInfo() code from DB
-
-- made LIMIT handling more robust by taking some code from DB
-
-All drivers result:
-- performance tweak in fetchCol()
-- added MDB2_FETCHMODE_OBJECT
-- added MDB2_Driver_Result_Common::getRowCounter()
-- added rownum handling to fetchRow()
-- removed fetch() and resultIsNull()
-
-All drivers prepared statements
-- moved prepare/execute API towards PDO
-- setParamsArray() can now handle non ordered arrays
-- removed requirement for LOB inserts to pass the parameters as an array
-- placeholders are now numbered starting from 0 (BC break in setParam() !)
-- queries inside the prepared_queries property now start counting at 1 (performance tweak)
-- refactored handling of filename LOB values (prefix with 'file://')
-- removed _executePrepared(), drivers need to overwrite execute() for now on
-- add support for oracle style named parameters and modified test suite accordingly
-
-MySQL driver:
-- improved handling of MDB2_PORTABILITY_LOWERCASE in all the reverse
-  methods inside the mysql driver to work coherently
-- fixed several issues in the listTablefields() method of manager drivers
-
-MSSQL driver:
-- added code in MDB2_Driver_mssql::connect() to better handle date values
-  independant of ini and locale settings inside the server
-- use comma, rather than colon, to delimit port in MDB2_driver_mssql::connect().
-  Bug 2140. (danielc)
-- unified mssql standalone query with sqlite, mysql and others (not tested on
-  mssql yet, but since mssql automatically reuses connections per dsn the old
-  way could gurantee anything different from happening)
-
-PgSQL driver:
-- use track_errors to capture error messages in MDB2_driver_pgsql::connect().
-  Bug 2011. (danielc)
-- add port to connect string when protocol is unix in MDB2_driver_pgsql::connect().
-  Bug 1919. (danielc)
-- accommodate changes made to PostgreSQL so &quot;no such field&quot; errors get properly
-  indicated rather than being mislabeled as &quot;no such table.&quot; (danielc)
-- added &quot;permission denied&quot; to error regex in pgsql driver.
-  Bug 2417. (stewart_linux-org-au)
-
-OCI8 driver:
-- fixed typo in MDB2_Driver_Manager_oci8::listTables() (fix for bug #2434)
-- added emulate_database option (default true) to the Oracle driver that handles
-  if the database_name should be used for connections of the username
-- oci8 driver now uses native bind support for all types in prepare()/execute()
-
-Interbase driver:
-- completely revised ibase driver, now passing all tests under php5
-
-Frontbase driver:
-- fbsql: use correct error codes. Was using MySQL's codes by mistake.
-
-MySQLi driver:
-- added mysqli driver (passes all tests, but doesnt use native prepare yet)
-
-DB wrapper
-- fixed a large number of compatibility issues in the PEAR::DB wrapper
-
-Iterator
-- fixed several bugs and updated the interface to match the final php5 iterator API
-- buffered result sets now implements seekable
-- removed unnecessary returns
-- throw pear error on rewind in unbuffered result set
-- renamed size() to count() to match the upcoming Countable interface
-
-Extended module:
-- modified the signature of the auto*() methods to be compatible with DB (bug #3720)
-- tweaked buildManipSQL() to not use loops (bug #3721)
-
-MDB_Tools_Manager
-- updated raiseError method in the Manager to be compatible with
-  XML_Parser 1.1.x and return useful error message (fix bug #2055)
-- major refactoring of MDB2_Manager resulting in several new methods being available
-- fixed error in MDB2_Manager::_escapeSpecialCharacter() that would lead to
-  incorrect handling of integer values (this needs to be explored in more detail)
-- several typo fixes and minor logic errors (among others a fix for bug #2057)
-- moved xml dumping in MDB2_Tools_Manager into separate Writer class
-- fixed bugs in start value handling in create sequence (bug #3077)</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta2</release>
-     <api>2.0.0beta2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2004-04-25</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>The core of MDB2 is now fairly stable API-wise. The modules, especially the
-manager and reverse module, might see some API refinement before the first
-stable release.
-- added listTables() and listTableFields() methods to MDB2_Driver_Manager_mssql
-  and MDB2_Driver_Manager_oci8
-- reversed parameter order of getValue(), type parameter is now optional and
-  will then be autodetected (BC break!)
-- renamed get*Value() to quote*() (BC break!)
-- fixed LOB management in MDB2_Driver_ibase
-- moved getOne, getRow, getCol, getAll back into the exteneded module (most
-  users should be able to move to the queryOne, queryRow, queryCol and queryAll
-  equivalent) (BC break!)
-- added getAssoc to the extended module
-- fixed bug in MDB2_Driver_Datatype_Common::implodeArray()
-- added sequence_col_name option to make the column name inside sequence
-  emulation tables configurable
-- fixed a bug in the MDB2_Driver_oci8 and MDB2_Driver_ibase buffering emulation
-  when using limit queries
-- removed MDB2_PORTABILITY_NULL_TO_EMPTY in favor of MDB2_PORTABILITY_EMPTY_TO_NULL
-  this means that DB and MDB2 work exactly the opposite now, but it seems more
-  efficient to do things the way Oracle does since this is the RDBMS which
-  creates the original issue to begin with (BC break!)
-- fixed a typos in getAll, getAssoc and getCol
-- test suite: moved set_time_limit() call to the setup script to be easier to customize
-- renamed hasMore() to valid() due to changes in the PHP5 iterator API (BC break!)
-- renamed toString() to __toString() in order to take advantage of new PHP5
-  goodness and made it public
-- MDB2_Driver_Datatype_Common::setResultTypes() can now handle missing elements
-  inside type arrays: array(2 =&gt; 'boolean', 4 =&gt; 'timestamp')
-- fixed potential warning due to manipulation query detection in the query*()
-  and the get*() query+fetch methods
-- added tests for fetchAll() and fetchCol()
-- performance tweaks for fetchAll() and fetchCol()
-- fixed MDB2_Driver_Manager_mysql::listTableIndexes()
-- fixed MDB2_Driver_Common::debug()
-- renamed MDB2::isResult() to MDB2::isResultCommon()
-- added base result class MDB2_Result from which all result sets should be
-  inherited and added MDB2::isResult() which checks if a given object extends from it
-- added 'result_wrap_class' option and optional parameter to query() to enable
-  wrapping of result classes into an arbitrary class
-- added $result_class param to all drivers where it was missing from the
-  query() and _executePrepared() methods
-- applied several fixes to the PEAR::DB wrapper
-- fixed a typo in MDB2_Driver_Reverse_pgsql::tableInfo()</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0beta1</release>
-     <api>2.0.0beta1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2004-03-12</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed bug in MDB2::singleton
-- fixed minor bugs in prepare/execute
-- added PEAR::DB wrapper (not working yet)
-- fixed several bugs in the ibase driver
-- fixed several PHP5 related issues
-- fixed bug in sequence creation on MySQL
-- fixed issues with nextid() ondemand handling in conjunction with currId()
-- added native currId() implementation for the Oracle driver
-- fixed sqlite driver (passes all but the REPLACE test due to a conformance issue in sqlite itself)
-- removed decimal_factor property to allow changing of decimal_places option
-- using native escape string methods in sqlite and mysql driver
-- fixed minor conformance issues in tableInfo() in the oci8 and mysql driver
-- removed optimize option and added portability option instead (ported from DB)
-- added quoteIdentifier() method (ported from DB)
-- added STATUS document to make the status of the drivers more transparent
-- fixed a few bugs in querysim driver
-- fixed issue in mysql reverse engineering: ensuring the correct case is used when
-  doing assoc fetches based on portability flag setting
-- updated reverse engineering script to the new MDB2 API
-- removed broken implementations of currId() in the mssql and fbsql driver
-- fixed a few instances of MDB_Common to the new class name of MDB_Driver_Common</notes>
-   </release>
-   <release>
-    <version>
-     <release>2.0.0alpha1</release>
-     <api>2.0.0alpha1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2004-01-05</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>This is the first alpha release of MDB2 2.0.
-
-MDB2 2.x breaks backwards compatibility in many ways in order to simplify
-the API for both users and drivers developers.
-
-Please note that currently only the MySQL, the PostGreSQL and the Oracle driver
-have been tested to pass the test suite.
-
-Here follows a short list of the most important changes:
-- all code that is not necessary for basic operation is now separateed
-  into separate modules which can be loaded with the loadModule() method
-- all datatype related methods have been moved to a dataype module with
-  the notable exception of getValue() and the newly introduced getDeclaration()
-- added extended module for highlevel methods
-- all manager method are no longer available in the core class and or
-  now only available in the manager module
-- all reverse engineering methods have been taken from the manager class
-  and are now available through the reverse module
-- a new module has been added to allow the addition of methods with
-  RDBMS specific functionality (like getting the last autoincrement ID)
-- LOB handling has been greatly simplified
-- several methods names have been shortend
-- the fetch.+() methods do not free the result set anymore
-- the Manager and the reverse_engineer_xml_schema have been moved into
-  a Tools directory
-- all parameters are now lowercased with underscores as separators
-- all drivers now support all of the dsn options that PEAR DB supports
-- several methods have been removed because they offered redundant functionality
-- changed prepare API type is now passed to prepare and not to setParam*()
-- results are now wrapped inside objects and all methods which operate
-  on resultsets have been moved into respecitive classes
-- there are two types of result object: buffered (default) and unbuffered
-- totally rewrote buffering and limit emulation</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/MDB2_Driver_mysqli/1.5.0b2-info.xml b/lib/.xmlregistry/packages/pear.php.net/MDB2_Driver_mysqli/1.5.0b2-info.xml
deleted file mode 100644
index 66d2d227a4d5458dc5ccd6620648bef6259d0a6f..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/MDB2_Driver_mysqli/1.5.0b2-info.xml
+++ /dev/null
@@ -1,643 +0,0 @@
-<?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.7.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>MDB2_Driver_mysqli</name>
- <channel>pear.php.net</channel>
- <summary>mysqli MDB2 driver</summary>
- <description>This is the MySQLi MDB2 driver.</description>
- <lead>
-  <name>Lukas Kahwe Smith</name>
-  <user>lsmith</user>
-  <email>smith@pooteeweet.org</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Lorenzo Alberton</name>
-  <user>quipo</user>
-  <email>l.alberton@quipo.it</email>
-  <active>yes</active>
- </lead>
- <date>2010-05-04</date>
- <time>08:57:53</time>
- <version>
-  <release>1.5.0b2</release>
-  <api>1.5.0b2</api>
- </version>
- <stability>
-  <release>beta</release>
-  <api>beta</api>
- </stability>
- <license>BSD License</license>
- <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #13412: sometimes getTableConstraintDefinition() fails for FOREIGN KEYs
-- fixed bug #13581: wrong query in beginTransaction() for certain MySQL versions
-- fixed bug #13928: Invalid triggers created for 'ON UPDATE'
-- fixed bug #15051: Cannot create constraints with field length
-- add index on FK column(s) or a FK constraint cannot be created in some cases
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="/" md5sum="14f12bd33f7212d51b400e0a3ea9dff9" name="tests/MDB2_nonstandard_mysqli.php" role="test"/>
-   <file baseinstalldir="/" md5sum="2230d22996ea3d741859ad0e4cd580e7" name="package_mysqli.xml" role="data"/>
-   <file baseinstalldir="/" md5sum="1a93d3c16c6c035089d174f1e274919e" name="MDB2/Driver/Reverse/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="f85ab0986d5b8068de46cb274e8628cb" name="MDB2/Driver/Native/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="e17e45a9705741f7940d32d794a3fc58" name="MDB2/Driver/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="4a3db0eef4e91422e627db75134af300" name="MDB2/Driver/Manager/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="90805fd47d1c2f6c913e0685e857350c" name="MDB2/Driver/Function/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="e864f782acec62683204fbdb31560673" name="MDB2/Driver/Datatype/mysqli.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>5.0.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>MDB2</name>
-    <channel>pear.php.net</channel>
-    <min>2.5.0b2</min>
-   </package>
-   <extension>
-    <name>mysqli</name>
-   </extension>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.5.0b2</release>
-     <api>1.5.0b2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2009-01-14</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #13412: sometimes getTableConstraintDefinition() fails for FOREIGN KEYs
-- fixed bug #13581: wrong query in beginTransaction() for certain MySQL versions
-- fixed bug #13928: Invalid triggers created for 'ON UPDATE'
-- fixed bug #15051: Cannot create constraints with field length
-- add index on FK column(s) or a FK constraint cannot be created in some cases
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.0b1</release>
-     <api>1.5.0b1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2008-03-15</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #11831: createTable() now supports tables with a multi-field PRIMARY KEY
-  where one field is defined as AUTO_INCREMENT
-- request #11204: support AUTO_INCREMENT for FLOAT data type and UNSIGNED option
-  for FLOAT and DECIMAL data type [afz]
-- fixed bug #11692: value of $db-&gt;supports('transactions') changes after query [afz]
-- request #12731: added truncateTable() in the Manager module
-- request #12732: added vacuum() in the Manager module for OPTIMIZE/VACUUM TABLE abstraction
-- request #12800: added alterDatabase() in the Manager module [afz]
-- fixed quoting in createDatabase() in the Manager module
-- fixed bug #12924: correctly handle internal expected errors even with custom error handling
-- added standaloneQuery() and databaseExists()
-- request #13106: added unixtimestamp() in the Function module
-- fixed regexp in listTableConstraints() in the Manager module to list FOREIGN KEY constraints
-- fixed bug #13180: MySQL driver tells SAVEPOINT is supported for MyISAM tables
-- fixed bug #13283: replace() doesn't respect quote_identifiers option
-- request #13313: setCharSet() supports 'COLLATE' too
-- fixed bug #13370: some capabilities depend on user options, so check them after
-  a setOption() call
-- when triggers are supported, two triggers are created to emulate ON UPDATE / ON DELETE actions
-  for FOREIGN KEY constraints. Known limitation: since mysql doesn't support multiple triggers
-  with the same action time and event for one table, if there are multiple table referencing
-  the same table, only the first one will have the triggers created.
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.0a2</release>
-     <api>1.5.0a2</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2007-12-06</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #12516: error in FK constraint creation query
-- request #12012: added charset/collation support in createDatabase()
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.5.0a1</release>
-     <api>1.5.0a1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2007-10-28</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #10024: Added new option 'lob_allow_url_include' (default false) to
-  [dis]allow inserting a LOB from an url (file, http, ...).
-- fixed bug #10986: Using more random statement names (request #11625)
-- fixed bug #11055: Using placeholders with := variable assignment fails [bekarau]
-- initial support for FOREIGN KEY constraints in the Manager and Reverse modules
-- request #11389: added many new MySQL 5.1 error codes in errorInfo()
-- fixed bug #11428: propagate quote() errors with invalid data types
-- fixed bug in _modifyQuery() when using SELECT FOR UPDATE or similar queries
-- fixed bug #11590: _getServerCapabilities() has to be called once per connection
-- fixed bug #11790: avoid array_diff() because it has a memory leak in PHP 5.1.x
-- fixed some E_STRICT errors with PHP5
-- fixed bug #12010: MDB2_PORTABILITY_RTRIM option was ignored
-- fixed bug #12083: createTable() in the Manager module now returns MDB2_OK on success,
-  as documented
-- request #12213: usage of mysqli_options 'MYSQLI_SET_CHARSET_NAME' and mysqli_set_charset()
-  when available (patch by Carsten Wiedmann)
-- fixed bug #12242: missing charset info in the Reverse module (patch by Carsten Wiedmann)
-- fixed bug #12269: tableInfo() in the Reverse module detect 'clob' data type
-  as first option
-- fixed bug #12336: supply default value for NOT NULL timestamp fields
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.1</release>
-     <api>1.4.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-05-03</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #10378: incorrect query rewrite in setLimit() when using &quot;FOR UPDATE&quot;
-  or &quot;LOCK IN SHARE MODE&quot; (thanks to priyadi) or &quot;INTO OUTFILE&quot; or &quot;INTO DUMPFILE&quot;
-- fixed bug #10384: in setCharset(), use mysqli_real_escape_string() instead of
-  mysql_real_escape_string()
-- return length as &quot;precision,scale&quot; for NUMERIC and DECIMAL fields in mapNativeDatatype()
-- in getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse
-  module, also return the field position in the index/constraint
-- fixed bug #10636: transactions broken in release 2.4.0 because of some properties
-  being reset (thanks to Conor Kerr)
-- fixed bug #10748: failed connections don't return native error code [urkle]
-- fixed bug #10895: setLimit() does not work properly when a subquery uses LIMIT
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.4.0</release>
-     <api>1.4.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-03-13</date>
-    <license>BSD License</license>
-    <notes>- fixed bug #9283: missing support for BINARY/VARBINARY data types (thanks to Tom Hendrikx)
-- propagate errors in getTableFieldDefinition() in the Reverse module
-- implemented getTriggerDefinition() in the Reverse module (mysql &gt; 5.0.2) [experimental]
-- implemented listTableTriggers() in the Manager module (mysql &gt; 5.0.2)
-- implemented listFunctions() in the Manager module
-- setCharset() now uses &quot;SET NAMES&quot; instead of &quot;SET character_set_client&quot;
-- select the mysql database in listUsers() in the Manager module
-- added error codes for MySQL 5 (patch by Adam Harvey)
-- implemented guid() in the Function module [globally unique identifier]
-- fixed bug #10033: beginTransaction() does not know server capabilities
-- fixed bug #10057: createConstraint() returns an error when the definition is incomplete
-- request #9451: you can set charset, collation, engine and comments in createSequence()
-- implemented a fallback mechanism within getTableIndexDefinition() and
-  getTableConstraintDefinition() in the Reverse module to ignore the 'idxname_format'
-  option and use the index name as provided in case of failure before returning
-  an error
-- fixed bug #10181: propagate error when an invalid type is passed to prepare()
-- added a 'nativetype_map_callback' option to map native data declarations back to
-  custom data types (thanks to Andrew Hill).
-- fixed bug #10239: execute() misinterprets MySQL's user defined variables
-- phpdoc fixes
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.3.0</release>
-     <api>2.3.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-11-03</date>
-    <license>BSD License</license>
-    <notes>- added charset and collation support to field declaration
-- fixed bug #9024: typo in error checking
-- fixed parameter order in charset setting fallback (Bug #8807)
-- fix typos in error handling in a few places (bug #9024)
-- typo fix in tableInfo (Bug #8925)
-- do not skip id generation in nextId() when creating a sequence on demand
-  because this prevents lastInsertID() from working
-- migrated to package.xml version 2</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.2</release>
-     <api>1.2.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-09-03</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed single quote handling inside non emulated prepared statements (Bug #8538)
-- flip positions property array in prepared statement objects to make it
-  possible to optionally use the same named placeholder in multiple places
-  inside a single prepared statement</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.1</release>
-     <api>1.2.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-08-21</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed issue in tableInfo() that originates in getTableFieldDefinition() which
-  led to returning incorrect type values (Bug #8291)
-- quote identifiers in the reverse module when 'quote_identifiers' is enabled (Bug #8309)
-- use version_compare() to fix complex version comparisons (Bug #8355)
-- do not use quote() in setCharset() since it is supposed to set the charset in
-  the connection that was passed to it
-- return an error if a named placeholder name is used twice inside a single statement
-- do not list empty contraints and indexes
-- added support for 'primary' option in createTable()
-- fixed notnull reverse engineering on mysql 4.x (Bug #8415)
-- do not set a default if type is a LOB (Request #8074)
-- if a default value is set, then we need to use VARCHAR instead of TEXT
-- removed _verifyTableType() since it just adds overhead, is hard to do reliably
-  and you will get an error if the table type is not supported anyways
-- fixed handling return values when disable_query is set in _doQuery() and _execute()
-- only call RELEASE SAVEPOINT if the server version if 5.0.3 or higher
-- increased MDB2 dependency too 2.2.1</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.0</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-07-23</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- added ability to escape wildcard characters in escape() and quote()
-- added setTransactionIsolation()
-- added savepoint support to beginTransaction(), commit() and rollback()
-- added debug() call at the end of a query/prepare/execute calling (Request #7933)
-- added context array parameter to debug() and make use of it whereever sensible
-- added optional method name parameter to raiseError() and use whereever possible
-- added ability to escape wildcard characters in escape() and quote()
-- added debug() call at the end of a query/prepare/execute calling (Request #7933)
-- added 'nativetype' output to tableInfo() and getTableFieldDefinition()
-- added 'mdb2type' output to getTableFieldDefinition()
-- reworked tableInfo() to use a common implementation based on getTableFieldDefinition()
-  when a table name is passed (Bug #8124)
-- fixed incorrect regex in mapNativeDatatype() (Bug #8256) (thx ioz at ionosfera dot com)
-- use old dsn when rolling back open transactions in disconnect()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1.0</release>
-     <api>1.1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-06-15</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- tweaked handling of free() for prepared statements
-- return error if a prepared statement is attempted to be freed twice
-- removed use of addslashes() for BLOB quoting
-  (this might result in SQL injection vulnerability)
-- added setCharset()
-- use setCharset() in connect()/_doConnect()
-- set transaction enabled engine as default
-- generalized quoteIdentifier() with a property
-- use general implementation of quoteIdentifier() (Bug #7738)
-- fixed warning in replace() if type is not set (Bug #7740)
-- cosmetic performance tweak in getTableFieldDefinition()
-- switched most array_key_exists() calls to !empty() to improve readability and performance
-- fixed a few edge cases and potential warnings
-- added ability to rewrite queries for query(), exec() and prepare() using a debug handler callback
-- pass limit and offset to the result object constructor in _execute() for read statements
-- check if result/connection has not yet been freed/dicsonnected before
-  attempting to free a result set(Bug #7790)
-- fixed unbuffered query support
-- revert change that would prefer 'clob' over 'text' for TEXT fields
-  (this was breaking runtime instrospection)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.3</release>
-     <api>1.0.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-05-22</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed unsigned handling and minor tweaks to type mapping in mapNativeDatatype()
-- use emulated prepared statements on mysql 4.0 or lower
-- added &quot;emulate_prepared&quot; option to force prepared statement emulation</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.2</release>
-     <api>1.0.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-05-14</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- optimized listTables() and listViews()
-- optimized show related queries
-- merged in some features and fixes from the mysql driver
-- explicitly set is_manip parameter to false for transaction debug calls
-- pass parameter array as debug() all with scope &quot;parameters&quot; in every execute()
-  call (bug #4119)
-- silently change name of primary key contraints to PRIMARY
-- added ability to hint that a constraint is a primary key in dropConstraint()
-- typo fixes in phpdoc (thx Stoyan)
-- added support for fixed and variable types for 'text' in declarations,
-  as well as in reverse engineering (Request #1523)
-- made _doQuery() return a reference
-- added userinfo's to all raiseError calls that previously had none
-- use native prepared queries for prepared SELECT statements
-- only use native prepared queries of mysql 4.1 or higher
-- added 'prepared_statements' supported meta data setting
-- fixed issue with free() returning void
-- added missing supported parameter to prepare() signature</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.1</release>
-     <api>1.0.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-04-16</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- fixed length handling in tableInfo() (bug #6887)
-- aligned _modifyQuery() signature and phpdoc
-- added support for tabe options in createTable() (bug ##7079)
-- added optional database parameter to listTables() and listSequences()
-- added 'result_introspection' supported metadata support
-- properly quote table names in tableInfo() (related to bug #6573)
-- use connected_server_info in getServerVersion() as a cache cache
-- use parent::disconnect() in disconnect()
-- added support for length in integer reverse engineering
-- some fixes regarding boolean reverse engineering
-- added listViews() and hide views in listTables()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.0</release>
-     <api>1.0.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-02-09</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- handle null as resource when disable_query option is enabled in result object
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.4</release>
-     <api>0.2.4</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2006-02-05</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- typo fix in getTableConstraintDefinition() (bug #6487)
-- added support for length in integer and decimal columns
-- removed ugly hack for quote parameter in quote() since it was insufficient
-  (escaping also needs to be prevented)
-- added support for out of order parameter binding in prepared queries
-- reset row_limit and row_offset after calling prepare() just like we do for query() and exec()
-- cosmetic fix (removed &quot;row_&quot; prefix from &quot;row_limit&quot; and &quot;row_offset&quot;)
-- now using TINYINT(1) by default instead of CHAR(1) for the boolean datatype (BC BREAK!)
-- typo fix in error message in createTable()
-- improved parsing in getServerInfo() (bug #6550)
-- fixed subselect emulation
-- support an arbitrary number of arguments in concat()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.3</release>
-     <api>0.2.3</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2006-01-13</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- explicitly pass if the module is phptype specific in all loadModule calls (bug #6226)
-- properly handle PRIMARY keys in listTableConstraints()
-- apply _isIndexName() on non primary keys in getTableConstraintDefinition()
-- initial implementation of multi_query option (bug #6418)
-- added error handling in prepare()
-- use multi_query option in executeStoredProc() (bug #6418)
-- fixed signature of quoteIdentifier() to make second param optional
-- fixed signature of executeStoredProc()
-- typo fixes in error handling of nextResult() and numRows() calls
-- added @ in front of a few more mysqli calls
-- _fixIndexName() now just attempts to remove possible formatting
-- renamed _isSequenceName() to _fixSequenceName()
-- _fixSequenceName() now just attempts to remove possible formatting, and only
-  returns a boolean if no formatting was applied when the new &quot;check&quot; parameter is set to true
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.2</release>
-     <api>0.2.2</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2005-12-30</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- moved state to beta
-- fixed typo in sub select detection
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.1</release>
-     <api>0.2.1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2005-12-28</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- use emulated prepared queries for non manip prepared queries
-- proper quote new table name in alterTable()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.0</release>
-     <api>0.2.0</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2005-12-21</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>- do not fix case in listUsers()
-- unified case fixing in the list*() methods
-- fixed change and rename in alterTable()
-- primary key must be called primary
-- use getConnection() to access connection property
-- split index and constraint handling
-- quote identifiers where possible inside the manager methods depending on
-  the new 'quote_identifier' option (defaults to off)
-- refactored get*Declaration() methods to use getTypeDeclaration()
-- setting in_transaction to false on disconnect
-- hide constraints from indexes and vice versa in the list methods
-- added new Function modules to handle difference in SQL functions
-- force rollback() with open transactions on disconnect
-- fixed table renaming
-- escape floats to make sure they do not contain evil characters (bug #5608)
-- do not check with === if ssl is enabled
-- fixed LOB handling
-- support column length in create index (mysql only feature, but a nice touch,
-  emulating it with substring is not feasible though)
-- split off manipulation queries into exec() method from the query() method *BC BREAK*
-- if result_types is set to false in prepare() method the query will be handled as a DML statement *BC BREAK*
-- use a proper default value if a field is set to not null in _getDeclaration*() (bug #5930)
-- added ability to determine unsigned in mapNativeDatatype()
-  (only really implemented in the mysql(i) drivers) (bug #6054)
-- use MDB2_ERROR_NOT_FOUND in getTableConstraintDefinition() and getTableIndexDefinition() (bug #6055)
-- use lastInsertID() method in nextID()
-- added getServerVersion() and use it to determine sub select support
-- unified array structure in mapNativeDatatype() *BC BREAK*
-- added 'mdbtype' to tableInfo() output that is generated from mapNativeDatatype()
-- changed 'len' to 'length' in tableInfo() output *BC BREAK*</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.1.1</release>
-     <api>0.1.1</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2005-10-10</date>
-    <license uri="http://www.example.com">BSD License</license>
-    <notes>Warning: this release features numerous BC breaks!
-
-There have been considerable improvements to the datatype, manager and reverse
-modules. Furthermore preliminary support for auto increment and primary keys
-has been added. Please note that making a field auto increment implies a single
-column primary key on this field.
-
-- added support for auto increment and primary key in schema.
-- alterTable now needs the full definition to work (use getTableFieldDefinition
- from Reverse module if you do not have a definition at hand) this eliminates the need
- of the declaration part in the alterTable array.
-- removed support for dummy_primary_key
-- fix PHP4.4 breakage
-- moved getInsertID() into core as lastInsertID()
-- all non LOB values were quoted twice in execute()
-- clobs only need to be mapped to binary when using mysqli_stmt_send_long_data()
-  which is handled independently
-- use !empty() instead of isset() in fetchRow to determine if result cols were bound or result types were set
-- expect keys in type arrays the same way as they are passed for the values in execute() and bindParamArray()
-- add s pattern modifier to preg_replace() call for parameter searches in prepare() (bug #5362)
-- moved all private fetch mode fix methods into _fixResultArrayValues() for performance reasons
-- renamed MDB2_PORTABILITY_LOWERCASE to MDB2_PORTABILITY_FIX_CASE and use 'field_case' option to determine if to upper- or lowercase (CASE_LOWER/CASE_UPPER)
-- count() -&gt; !empty() where possible
-- use array_map() instead of array_flip(array_change_key_case(array_flip())) to fix case of array values
-- use array_key_exists() instead of isset() where possible
-- changed structure of field add/remove/change in alterTable() to match MDB2_Schema
-- removed subSelect() implementation (now in already included in common)
-- return 0 for manipulation queries when disable_query is enabled
-- tweaked getTableFieldDefinition() in reverse module
-
-open todo items:
-- fixed LOB support</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/PEAR/1.9.0-info.xml b/lib/.xmlregistry/packages/pear.php.net/PEAR/1.9.0-info.xml
deleted file mode 100644
index 8dbd588ac18ff7048d043d8d2a6cd2c8c6ffeaf1..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/PEAR/1.9.0-info.xml
+++ /dev/null
@@ -1,802 +0,0 @@
-<?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.0RC4" 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>PEAR</name>
- <channel>pear.php.net</channel>
- <summary>PEAR Base System</summary>
- <description>The PEAR package contains:
- * the PEAR installer, for creating, distributing
-   and installing packages
- * the PEAR_Exception PHP5 error handling mechanism
- * the PEAR_ErrorStack advanced error handling mechanism
- * the PEAR_Error error handling mechanism
- * the OS_Guess class for retrieving info about the OS
-   where PHP is running on
- * the System class for quick handling of common operations
-   with files and directories
- * the PEAR base class
-  Features in a nutshell:
-  * full support for channels
-  * pre-download dependency validation
-  * new package.xml 2.0 format allows tremendous flexibility while maintaining BC
-  * support for optional dependency groups and limited support for sub-packaging
-  * robust dependency support
-  * full dependency validation on uninstall
-  * remote install for hosts with only ftp access - no more problems with
-    restricted host installation
-  * full support for mirroring
-  * support for bundling several packages into a single tarball
-  * support for static dependencies on a url-based package
-  * support for custom file roles and installation tasks</description>
- <lead>
-  <name>Greg Beaver</name>
-  <user>cellog</user>
-  <email>cellog@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Pierre-Alain Joye</name>
-  <user>pajoye</user>
-  <email>pierre@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Stig Bakken</name>
-  <user>ssb</user>
-  <email>stig@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Tomas V.V.Cox</name>
-  <user>cox</user>
-  <email>cox@idecnet.com</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Helgi Thormar</name>
-  <user>dufuz</user>
-  <email>dufuz@php.net</email>
-  <active>yes</active>
- </lead>
- <developer>
-  <name>Tias Guns</name>
-  <user>tias</user>
-  <email>tias@php.net</email>
-  <active>yes</active>
- </developer>
- <helper>
-  <name>Tim Jackson</name>
-  <user>timj</user>
-  <email>timj@php.net</email>
-  <active>no</active>
- </helper>
- <helper>
-  <name>Bertrand Gugger</name>
-  <user>toggg</user>
-  <email>toggg@php.net</email>
-  <active>no</active>
- </helper>
- <helper>
-  <name>Martin Jansen</name>
-  <user>mj</user>
-  <email>mj@php.net</email>
-  <active>no</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.9.0</release>
-  <api>1.9.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
- <notes>
-* Fix  Bug #16547: The phar for PEAR installer uses ereg() which is deprecated [dufuz]
- </notes>
- <contents>
-  <dir name="/">
-   <file md5sum="acd010e3bc43c0f72df584acde7b9158" name="template.spec" role="data"/>
-   <file md5sum="8bf4cfb58d10d72b5082c3022c887710" name="System.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="/" md5sum="320849b646e4cdaeca543af666524e73" name="scripts/peclcmd.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="@pear_version@" to="version" type="package-info"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-   </file>
-   <file baseinstalldir="/" md5sum="d00c55f2aa48052c25db271e044e7551" name="scripts/pecl.sh" role="script">
-    <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="@pear_version@" to="version" type="package-info"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:unixeol/>
-   </file>
-   <file baseinstalldir="/" md5sum="34c1cb834dd1c03c9e40998b201d52e0" name="scripts/pecl.bat" role="script">
-    <tasks:replace from="@bin_dir@" to="bin_dir" type="pear-config"/>
-    <tasks:replace from="@php_bin@" to="php_bin" type="pear-config"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:windowseol/>
-   </file>
-   <file baseinstalldir="/" md5sum="c69b7eb6cf9198ef8f03a19dcb57ca42" name="scripts/peardev.sh" role="script">
-    <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="@pear_version@" to="version" type="package-info"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:unixeol/>
-   </file>
-   <file baseinstalldir="/" md5sum="92cafd038c7d6a212111c84ca4907a13" name="scripts/peardev.bat" role="script">
-    <tasks:replace from="@bin_dir@" to="bin_dir" type="pear-config"/>
-    <tasks:replace from="@php_bin@" to="php_bin" type="pear-config"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:windowseol/>
-   </file>
-   <file baseinstalldir="/" md5sum="55426bdbfd8e1bc050a79e3c6095d8e5" name="scripts/pearcmd.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="@pear_version@" to="version" type="package-info"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-   </file>
-   <file baseinstalldir="/" md5sum="5b495a3de3c6092bfbd93806937a0e4e" name="scripts/pear.sh" role="script">
-    <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="@pear_version@" to="version" type="package-info"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:unixeol/>
-   </file>
-   <file baseinstalldir="/" md5sum="bd65b087b7707463525e9f0092337793" name="scripts/pear.bat" role="script">
-    <tasks:replace from="@bin_dir@" to="bin_dir" type="pear-config"/>
-    <tasks:replace from="@php_bin@" to="php_bin" type="pear-config"/>
-    <tasks:replace from="@include_path@" to="php_dir" type="pear-config"/>
-    <tasks:windowseol/>
-   </file>
-   <file md5sum="d3b517006b304817731eb77cc2154258" name="README" role="doc"/>
-   <file md5sum="1a8f67d58009372a6cbcddd638b128cf" name="PEAR5.php" role="php"/>
-   <file md5sum="c6de49d413a1cf97a1f8a4668766e3ab" name="PEAR/XMLParser.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a18f1a10bb85cc988f7c2de9914c1e9f" name="PEAR/Validator/PECL.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="c5ea781c8abb14ff62b04b6db5e10e0f" name="PEAR/Validate.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a5545cfac22a53d0aad99f4acdbee50c" name="PEAR/Task/Windowseol/rw.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="33bc10b55f7c90425054024b42d0e944" name="PEAR/Task/Windowseol.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="0787e483b91cb6842b9cfedbb486aabf" name="PEAR/Task/Unixeol/rw.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="85ee9fd0fa58d4aef2161d5ac5d9b539" name="PEAR/Task/Unixeol.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="d4f525ae7d94c48662d45769643abada" name="PEAR/Task/Replace/rw.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="0fecedc2f99e5f010b327650c353e4db" name="PEAR/Task/Replace.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="bff16b5498aa831d106061ebbaba484c" name="PEAR/Task/Postinstallscript/rw.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="34d4c4f16734388faca7e418ab206f68" name="PEAR/Task/Postinstallscript.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="e61537de629cb2f7f7e1bc497038902e" name="PEAR/Task/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="34a0d9008da01b3987a610d94837a80c" name="PEAR/RunTest.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="897908bf87ac9ae617a0a42e13f8e0cd" name="PEAR/REST/13.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="41f230e5d3282221e6b55466cb0510d3" name="PEAR/REST/11.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="b0b343c594552895492692d52561bc52" name="PEAR/REST/10.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="28e5f3b905280051309e65d3e85d0b15" name="PEAR/REST.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a58437db39d3d71bb93f44a660334720" name="PEAR/Registry.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="821b72d18cbdc2e8b9c5087bc9b99854" name="PEAR/Packager.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="cf2b5655d9accc025e5cf5f0476302a8" name="PEAR/PackageFile/v2/Validator.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="9a159d7f8e70bf9f57f9ade64dd5e377" name="PEAR/PackageFile/v2/rw.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7026083ae0b038045dc117d68dc32a0a" name="PEAR/PackageFile/v2.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7736b857a1153b02453d42dd476d6f8a" name="PEAR/PackageFile/v1.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a5f847fdba24116593efc223425a9609" name="PEAR/PackageFile/Parser/v2.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7d3828c0f41aadc34d948f5215c4cd66" name="PEAR/PackageFile/Parser/v1.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="f7ed15b3d6d1aab0b6f8ee2fe0d9d3db" name="PEAR/PackageFile/Generator/v2.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="cd8b1ef4c311e0e4f5a00e5e36d48d43" name="PEAR/PackageFile/Generator/v1.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="df9c5cc34b6fbbf661d534cecb315c9f" name="PEAR/PackageFile.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7641e71c5785bb33a4261ebe25ed0fd7" name="PEAR/Installer/Role/Www.xml" role="php"/>
-   <file md5sum="8ab36d60bc9eb361885d7d901b107c0c" name="PEAR/Installer/Role/Www.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a24b596ec987aa5688fc19e8ed4e97ea" name="PEAR/Installer/Role/Test.xml" role="php"/>
-   <file md5sum="5601a755c633dafb639a8fbd1abe0261" name="PEAR/Installer/Role/Test.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="e147d63f168ea156fc2be38caaa63804" name="PEAR/Installer/Role/Src.xml" role="php"/>
-   <file md5sum="656ad25a2fa1a13f53aad6121edfba91" name="PEAR/Installer/Role/Src.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="746461dc3b48af6d24094cb0211608f2" name="PEAR/Installer/Role/Script.xml" role="php"/>
-   <file md5sum="eb20ad9051db4db53a1c30e9f1b0dab5" name="PEAR/Installer/Role/Script.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="ef88f0321d3e481c2130c95122cf76d8" name="PEAR/Installer/Role/Php.xml" role="php"/>
-   <file md5sum="9e4a34e2a332b704417590cb734ffc93" name="PEAR/Installer/Role/Php.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="af71c0ad42d16a323afe24a4f884ef15" name="PEAR/Installer/Role/Ext.xml" role="php"/>
-   <file md5sum="b3c70e10e63273ef1f2e5cd0a2bd33e8" name="PEAR/Installer/Role/Ext.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="b1ce0fe105251c3b75209d6518ee69ac" name="PEAR/Installer/Role/Doc.xml" role="php"/>
-   <file md5sum="5c0b53e95ae25306da82cf6dd87da4dc" name="PEAR/Installer/Role/Doc.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="89a4a2a286e842d45a98974f40a0565c" name="PEAR/Installer/Role/Data.xml" role="php"/>
-   <file md5sum="2cb74a7dd5fdfce5b78717e1847d463c" name="PEAR/Installer/Role/Data.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="d3c3a546ced9a12889eda5e368583944" name="PEAR/Installer/Role/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="d8c62e6275e3aaa7784290912406092c" name="PEAR/Installer/Role/Cfg.xml" role="php"/>
-   <file md5sum="a3bb43296f00bd5459a0fbf8314f8917" name="PEAR/Installer/Role/Cfg.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="0dab463a3402a0401616c7a1630bebcb" name="PEAR/Installer/Role.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="45f4c064607a7d3d4f68b0f06f98db5c" name="PEAR/Installer.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="e613fdf2c8090bf8f7289dbeaa06a97c" name="PEAR/Frontend/CLI.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="52c3acdba716110657f7bf86ca2012e1" name="PEAR/Frontend.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="e0e4cbcec4a972fbad779d0f9d323120" name="PEAR/FixPHP5PEARWarnings.php" role="php"/>
-   <file md5sum="f364e75223744d460a6bb08420ac94f9" name="PEAR/Exception.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="33ce30b4478cdb76e29bd75058c842e3" name="PEAR/ErrorStack.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="73a70ef0ac6d521fcbc972de10341bbe" name="PEAR/Downloader/Package.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="2185eb7a493f863ea3d3510195e7c901" name="PEAR/Downloader.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="c161acaf73f7938ea48b3165d891998b" name="PEAR/DependencyDB.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="b0d1ee5d0acd02ca9351e076f73cc9da" name="PEAR/Dependency2.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="5080a36f685fcef9b160617e8cb02870" name="PEAR/Config.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="7c0ff45e0ee9df0ddbaa9b8c4c31b2fd" name="PEAR/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="a50c32015005e0761cc3b04679b29ed0" name="PEAR/Command/Test.xml" role="php"/>
-   <file md5sum="01252c8d6c005f53f250344bb4453a59" name="PEAR/Command/Test.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="29c02e823879b4e3e291f6b36fb339f1" name="PEAR/Command/Remote.xml" role="php"/>
-   <file md5sum="374366b6f361c401ae22edc5b76b7a90" name="PEAR/Command/Remote.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="49b046cfc14747f0365e02e9c3f0e6dc" name="PEAR/Command/Registry.xml" role="php"/>
-   <file md5sum="567687617b7f406bd1ba55e37060edf8" name="PEAR/Command/Registry.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="28dc842ea725d8787b9f9c3dbca5aa22" name="PEAR/Command/Pickle.xml" role="php"/>
-   <file md5sum="6a794c2a0545fff7300217dd6e133c17" name="PEAR/Command/Pickle.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="6c3061a594644e49b0648798dce6de32" name="PEAR/Command/Package.xml" role="php"/>
-   <file md5sum="2d4e5f5200fdbdbb5f1c2bf0a27ab754" name="PEAR/Command/Package.php" role="php">
-    <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config"/>
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="5cb62a04c0a268f4edd64a49a3895c92" name="PEAR/Command/Mirror.xml" role="php"/>
-   <file md5sum="8bc9265e1046ec67a85571557515bb1b" name="PEAR/Command/Mirror.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="2db0386b865d3f9a29f9126728722ece" name="PEAR/Command/Install.xml" role="php"/>
-   <file md5sum="034593b2194bf8feb689722833e1c9b0" name="PEAR/Command/Install.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="91f189cb9423b5e87ee0abc5ea1a2be3" name="PEAR/Command/Config.xml" role="php"/>
-   <file md5sum="f0c106b4ba5e12236c59b161b75f4182" name="PEAR/Command/Config.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="dc4961036d632859bb1bda5e32a8c346" name="PEAR/Command/Common.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="6d5aab4d4308c3005b5f584c7783a031" name="PEAR/Command/Channels.xml" role="php"/>
-   <file md5sum="63a395cf6c752e8121e1fa2ae1f9ac28" name="PEAR/Command/Channels.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="73602fd7f051eaf8d37452d0e3063bdb" name="PEAR/Command/Build.xml" role="php"/>
-   <file md5sum="99e6dae6555a272f16f1cf2265d221c0" name="PEAR/Command/Build.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="8fd87e64002e11fd86eb2f3fbfee6599" name="PEAR/Command/Auth.xml" role="php"/>
-   <file md5sum="7d3f1696902faf5442059393e541ad2d" name="PEAR/Command/Auth.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="150c15a2fb2fd57166ca8276e29cb74b" name="PEAR/Command.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="e839d4a327219441507bd5de7409ee5b" name="PEAR/ChannelFile/Parser.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="f9d18b3c198a2a0f0771036c6b0404f7" name="PEAR/ChannelFile.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="d9d3b94e0d1bf2f2c377a5cd8201481c" name="PEAR/Builder.php" role="php">
-    <tasks:replace from="@PEAR-VER@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="b6d6b167ca1514d0765533d4abafca1d" name="PEAR/Autoloader.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="4e4941a59ed97ca61c93deb6a7ff918c" name="PEAR.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="4a49bc83a392934e57af45c70a589fda" name="package.dtd" role="data"/>
-   <file md5sum="f063d5b84d03538b85f05cde9aae8037" name="OS/Guess.php" role="php">
-    <tasks:replace from="@package_version@" to="version" type="package-info"/>
-   </file>
-   <file md5sum="45b44486d8090de17b2a8b4211fab247" name="LICENSE" role="doc"/>
-   <file md5sum="45b1a9dcc368539cb8f2a65c30b2f453" name="INSTALL" role="doc"/>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.4.0</min>
-    <exclude>5.0</exclude>
-    <exclude>5.1.0</exclude>
-    <exclude>5.1.1</exclude>
-    <exclude>5.1.2</exclude>
-    <exclude>5.1.3</exclude>
-    <exclude>5.1.4</exclude>
-    <exclude>5.1.5</exclude>
-   </php>
-   <pearinstaller>
-    <min>1.4.3</min>
-   </pearinstaller>
-   <package>
-    <name>Archive_Tar</name>
-    <channel>pear.php.net</channel>
-    <min>1.1</min>
-    <recommended>1.3.3</recommended>
-    <exclude>1.3.0</exclude>
-   </package>
-   <package>
-    <name>Structures_Graph</name>
-    <channel>pear.php.net</channel>
-    <min>1.0.2</min>
-    <recommended>1.0.2</recommended>
-   </package>
-   <package>
-    <name>Console_Getopt</name>
-    <channel>pear.php.net</channel>
-    <min>1.2</min>
-    <recommended>1.2.3</recommended>
-   </package>
-   <package>
-    <name>XML_Util</name>
-    <channel>pear.php.net</channel>
-    <min>1.2.0</min>
-    <recommended>1.2.1</recommended>
-   </package>
-   <package>
-    <name>PEAR_Frontend_Web</name>
-    <channel>pear.php.net</channel>
-    <max>0.4</max>
-    <conflicts/>
-   </package>
-   <package>
-    <name>PEAR_Frontend_Gtk</name>
-    <channel>pear.php.net</channel>
-    <max>0.4.0</max>
-    <exclude>0.4.0</exclude>
-    <conflicts/>
-   </package>
-   <extension>
-    <name>xml</name>
-   </extension>
-   <extension>
-    <name>pcre</name>
-   </extension>
-  </required>
-  <group hint="PEAR's web-based installer" name="webinstaller">
-   <package>
-    <name>PEAR_Frontend_Web</name>
-    <channel>pear.php.net</channel>
-    <min>0.5.1</min>
-   </package>
-  </group>
-  <group hint="PEAR's PHP-GTK-based installer" name="gtkinstaller">
-   <package>
-    <name>PEAR_Frontend_Gtk</name>
-    <channel>pear.php.net</channel>
-    <min>0.4.0</min>
-   </package>
-  </group>
-  <group hint="PEAR's PHP-GTK2-based installer" name="gtk2installer">
-   <package>
-    <name>PEAR_Frontend_Gtk2</name>
-    <channel>pear.php.net</channel>
-   </package>
-  </group>
- </dependencies>
- <phprelease>
-  <installconditions>
-   <os>
-    <name>windows</name>
-   </os>
-  </installconditions>
-  <filelist>
-   <install as="pear.bat" name="scripts/pear.bat"/>
-   <install as="pearcmd.php" name="scripts/pearcmd.php"/>
-   <install as="peardev.bat" name="scripts/peardev.bat"/>
-   <install as="pecl.bat" name="scripts/pecl.bat"/>
-   <install as="peclcmd.php" name="scripts/peclcmd.php"/>
-   <ignore name="scripts/pear.sh"/>
-   <ignore name="scripts/peardev.sh"/>
-   <ignore name="scripts/pecl.sh"/>
-  </filelist>
- </phprelease>
- <phprelease>
-  <filelist>
-   <install as="pear" name="scripts/pear.sh"/>
-   <install as="pearcmd.php" name="scripts/pearcmd.php"/>
-   <install as="peardev" name="scripts/peardev.sh"/>
-   <install as="pecl" name="scripts/pecl.sh"/>
-   <install as="peclcmd.php" name="scripts/peclcmd.php"/>
-   <ignore name="scripts/pear.bat"/>
-   <ignore name="scripts/peardev.bat"/>
-   <ignore name="scripts/pecl.bat"/>
-  </filelist>
- </phprelease>
- <changelog>
-  <release>
-   <version>
-    <release>1.8.0alpha1</release>
-    <api>1.8.0</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>stable</api>
-   </stability>
-   <date>2009-03-09</date>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz]
-* Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz]
-* Implement Request #10825: Only display the &quot;invalid or missing package file&quot;-error if it makes sense [dufuz]
-* Implement Request #11170: script to generate Command/[command].xml [dufuz]
-* Implement Request #11176: improve channel ... has updated its protocols message [dufuz]
-* Implement Request #12706: pear list -a hard to read [dufuz]
-* Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz]
-* Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos]
-* Implement Request #13927: install-pear.php should have option to set www_dir [timj]
-* Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz]
-* Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz]
-  - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate
-    better what other package managers are doing. upgrade-all will still work as intended.
-* Implement Request #14504: add a channel parameter support to the upgrade function [dufuz]
-  - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for
-    channel specific upgrades
-* Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske]
-* Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle]
-
-* Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog]
-* Fix PHP Bug #47323: strotime warnings in make install [dufuz]
-
-* Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz]
-* Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj]
-* Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit]
-* Fix Bug #13953: config-set/config-show with channel alias fail [cellog]
-* Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz]
-* Fix Bug #14041: Unpredictable unit test processing sequence [dufuz]
-* Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz]
-* Fix Bug #14210: pear list -ia brings warnings [dufuz]
-* Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz]
-* Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz]
-* Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos]
-* Fix Bug #14437: openbasedir warning when loading config [dufuz]
-* Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske]
-* Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali]
-* Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz]
-* Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz]
-* Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz]
-* Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz]
-
-NOTE!
-Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment
-to migrate over to one of the alternatives that have ben provided:
-* PEAR_Common-&gt;downloadHttp (use PEAR_Downloader-&gt;downloadHttp instead)
-* PEAR_Common-&gt;infoFromTgzFile (use PEAR_PackageFile-&gt;fromTgzFile instead)
-* PEAR_Common-&gt;infoFromDescriptionFile (use PEAR_PackageFile-&gt;fromPackageFile instead)
-* PEAR_Common-&gt;infoFromString (use PEAR_PackageFile-&gt;fromXmlstring instead)
-* PEAR_Common-&gt;infoFromArray (use PEAR_PackageFile-&gt;fromAnyFile instead)
-* PEAR_Common-&gt;xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead)
-* PEAR_Common-&gt;validatePackageInfo (use the validation of PEAR_PackageFile objects)
-* PEAR_Common-&gt;analyzeSourceCode (use a PEAR_PackageFile_v* object instead)
-* PEAR_Common-&gt;detectDependencies (use PEAR_Downloader_Package-&gt;detectDependencies instead)
-* PEAR_Common-&gt;buildProvidesArray (use PEAR_PackageFile_v1-&gt;_buildProvidesArray or
-  PEAR_PackageFile_v2_Validator-&gt;_buildProvidesArray)
-
-PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls
-pear upgrade -f PEAR will allow people with lower versions
-to upgrade to this release but no guarantees will be made that it will work properly.
-
-Support for XML RPC channels has been dropped - The only ones that used it
-(pear.php.net and pecl.php.net) have used the REST interface for years now.
-SOAP support also removed as it was only proof of concept.
-
-Move codebase from the PHP License to New BSD 2 clause license
-   </notes>
-  </release>
-  <release>
-   <date>2009-03-27</date>
-   <version>
-    <release>1.8.0RC1</release>
-    <api>1.8.0</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz]
-* Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz]
-
-* Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz]
-* Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz]
-   </notes>
-  </release>
-  <release>
-   <date>2009-04-10</date>
-   <version>
-    <release>1.8.0</release>
-    <api>1.8.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-Changes since RC1:
-  * Fix Bug #14792: Bad md5sum for files with replaced content [dufuz]
-  * Fix Bug #16057:-r is limited to 4 directories in depth [dufuz]
-  * Fix Bug #16077: PEAR5::getStaticProperty does not return a reference to the property [dufuz]
-
-  Remove custom XML_Util class in favor of using upstream XML_Util package as dependency
-
-RC1 Release Notes:
-  * Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz]
-  * Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz]
-
-  * Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz]
-  * Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz]
-
-Alpha1 Release Notes:
-  * Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz]
-  * Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz]
-  * Implement Request #10825: Only display the &quot;invalid or missing package file&quot;-error if it makes sense [dufuz]
-  * Implement Request #11170: script to generate Command/[command].xml [dufuz]
-  * Implement Request #11176: improve channel ... has updated its protocols message [dufuz]
-  * Implement Request #12706: pear list -a hard to read [dufuz]
-  * Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz]
-  * Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos]
-  * Implement Request #13927: install-pear.php should have option to set www_dir [timj]
-  * Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz]
-  * Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz]
-    - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate
-      better what other package managers are doing. upgrade-all will still work as intended.
-  * Implement Request #14504: add a channel parameter support to the upgrade function [dufuz]
-    - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for
-      channel specific upgrades
-  * Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske]
-  * Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle]
-
-  * Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog]
-  * Fix PHP Bug #47323: strotime warnings in make install [dufuz]
-
-  * Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz]
-  * Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj]
-  * Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit]
-  * Fix Bug #13953: config-set/config-show with channel alias fail [cellog]
-  * Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz]
-  * Fix Bug #14041: Unpredictable unit test processing sequence [dufuz]
-  * Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz]
-  * Fix Bug #14210: pear list -ia brings warnings [dufuz]
-  * Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz]
-  * Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz]
-  * Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos]
-  * Fix Bug #14437: openbasedir warning when loading config [dufuz]
-  * Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske]
-  * Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali]
-  * Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz]
-  * Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz]
-  * Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz]
-  * Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz]
-
-  NOTE!
-  Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment
-  to migrate over to one of the alternatives that have ben provided:
-  * PEAR_Common-&gt;downloadHttp (use PEAR_Downloader-&gt;downloadHttp instead)
-  * PEAR_Common-&gt;infoFromTgzFile (use PEAR_PackageFile-&gt;fromTgzFile instead)
-  * PEAR_Common-&gt;infoFromDescriptionFile (use PEAR_PackageFile-&gt;fromPackageFile instead)
-  * PEAR_Common-&gt;infoFromString (use PEAR_PackageFile-&gt;fromXmlstring instead)
-  * PEAR_Common-&gt;infoFromArray (use PEAR_PackageFile-&gt;fromAnyFile instead)
-  * PEAR_Common-&gt;xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead)
-  * PEAR_Common-&gt;validatePackageInfo (use the validation of PEAR_PackageFile objects)
-  * PEAR_Common-&gt;analyzeSourceCode (use a PEAR_PackageFile_v* object instead)
-  * PEAR_Common-&gt;detectDependencies (use PEAR_Downloader_Package-&gt;detectDependencies instead)
-  * PEAR_Common-&gt;buildProvidesArray (use PEAR_PackageFile_v1-&gt;_buildProvidesArray or
-    PEAR_PackageFile_v2_Validator-&gt;_buildProvidesArray)
-
-  PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls
-  pear upgrade -f PEAR will allow people with lower versions
-  to upgrade to this release but no guarantees will be made that it will work properly.
-
-  Support for XML RPC channels has been dropped - The only ones that used it
-  (pear.php.net and pecl.php.net) have used the REST interface for years now.
-  SOAP support also removed as it was only proof of concept.
-
-  Move codebase from the PHP License to New BSD 2 clause license
-   </notes>
-  </release>
-  <release>
-   <date>2009-04-15</date>
-   <version>
-    <release>1.8.1</release>
-    <api>1.8.1</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Fix Bug #16099 	PEAR crash on PHP4 (parse error) [dufuz]
-   </notes>
-  </release>
-  <release>
-   <date>2009-08-18</date>
-   <version>
-    <release>1.9.0RC1</release>
-    <api>1.9.0RC1</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Implement Request #16213: add alias to list-channels output [dufuz]
-* Implement Request #16378: pear svntag [dufuz]
-* Implement Request #16386: PEAR_Config::remove() does not support specifying a channel [timj]
-* Implement Request #16396: package-dependencies should allow package names [dufuz]
-
-* Fix Bug #11181: pear requests channel.xml from main server instead from mirror [dufuz]
-* Fix Bug #14493: pear install --offline doesn't print out errors [dufuz]
-* Fix Bug #11348: pear package-dependencies isn't well explained [dufuz]
-* Fix Bug #16108: PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all [dufuz]
-* Fix Bug #16113: Installing certain packages fails due incorrect encoding handling [dufuz]
-* Fix Bug #16122: PEAR RunTest failed to run as expected [dufuz]
-* Fix Bug #16366: compiling 5.2.10 leads to non-functioning pear [dufuz]
-* Fix Bug #16387: channel-logout does not support logging out from a non-default channel [timj]
-* Fix Bug #16444: Setting preferred mirror fails [dufuz]
-* Fix the shutdown functions where a index might not exist and thus raise a notice [derick]
-   </notes>
-  </release>
-  <release>
-   <date>2009-08-20</date>
-   <version>
-    <release>1.9.0RC2</release>
-    <api>1.9.0RC2</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* REST 1.4 file was occasionally being included but REST 1.4 is not intended for this release cycle [dufuz]
-   </notes>
-  </release>
-  <release>
-   <date>2009-08-21</date>
-   <version>
-    <release>1.9.0RC3</release>
-    <api>1.9.0RC3</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Improved svntag support to handle packages like PEAR it self [dufuz]
-   </notes>
-  </release>
-  <release>
-   <date>2009-08-23</date>
-   <version>
-    <release>1.9.0RC4</release>
-    <api>1.9.0RC4</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Fixed a problem where the original channel could not be set as a preferred_mirror again [dufuz]
-* Make sure channel aliases can't be made to start with - [dufuz]
-* Output issues with pear search [dufuz]
-* Fixed couple of stray notices [dufuz]
-   </notes>
-  </release>
-  <release>
-   <date>2009-09-03</date>
-   <version>
-    <release>1.9.0</release>
-    <api>1.9.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
-   <notes>
-* Fix  Bug #16547: The phar for PEAR installer uses ereg() which is deprecated [dufuz]
-   </notes>
-  </release>
- </changelog>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/Structures_Graph/1.0.2-info.xml b/lib/.xmlregistry/packages/pear.php.net/Structures_Graph/1.0.2-info.xml
deleted file mode 100644
index 1e590932176459b3deb5a58db35a68b345cdc25d..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/Structures_Graph/1.0.2-info.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?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.5.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>Structures_Graph</name>
- <channel>pear.php.net</channel>
- <summary>Graph datastructure manipulation library</summary>
- <description>Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed
-and undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing
-as well as for characteristic extraction from the graph topology.</description>
- <lead>
-  <name>Sérgio Carvalho</name>
-  <user>sergiosgc</user>
-  <email>sergio.carvalho@portugalmail.com</email>
-  <active>yes</active>
- </lead>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.0.2</release>
-  <api>1.0.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://opensource.org/licenses/lgpl-license.php">LGPL</license>
- <notes>- Bug #9682 only variables can be returned by reference
-- fix Bug #9661 notice in Structures_Graph_Manipulator_Topological::sort()</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="" md5sum="63dfc6f0f14e18c13d8a8415c3fe049d" name="tests/testCase/BasicGraph.php" role="test"/>
-   <file baseinstalldir="" md5sum="d41d8cd98f00b204e9800998ecf8427e" name="tests/README" role="test"/>
-   <file baseinstalldir="" md5sum="1b9e35896d229b84601e6754cd44e339" name="tests/all-tests.php" role="test"/>
-   <file baseinstalldir="" md5sum="7e28e01ebfa273e5df2eb1ef7a356635" name="Structures/Graph/Node.php" role="php"/>
-   <file baseinstalldir="" md5sum="0492e677436d29228df93dca23629e06" name="Structures/Graph/Manipulator/TopologicalSorter.php" role="php"/>
-   <file baseinstalldir="" md5sum="f0aff5a1efd188d63b4b8b9e9e840b97" name="Structures/Graph/Manipulator/AcyclicTest.php" role="php"/>
-   <file baseinstalldir="" md5sum="4f25a6275af156f6f8e7b4309cb9f40d" name="Structures/Graph.php" role="php"/>
-   <file baseinstalldir="" md5sum="b81f67f7b5600231735243be73625e54" name="publish.sh" role="data"/>
-   <file baseinstalldir="" md5sum="6e782f281c7d0ce27e54b574247073cb" name="package.sh" role="data"/>
-   <file baseinstalldir="" md5sum="7fbc338309ac38fefcd64b04bb903e34" name="LICENSE" role="data"/>
-   <file baseinstalldir="" md5sum="ab23406ec7bfbb2029ca536378ff57db" name="genpackage.xml.pl" role="data"/>
-   <file baseinstalldir="" md5sum="628eb6532a8047bf5962fe24c1c245df" name="docs/tutorials/Structures_Graph/Structures_Graph.pkg" role="doc"/>
-   <file baseinstalldir="" md5sum="a7a1b748bbda6dfa1632bf6078fc8bb6" name="docs/html/todolist.html" role="doc"/>
-   <file baseinstalldir="" md5sum="78e1e7ec43a6e754cf4d5dace48fe18c" name="docs/html/Structures_Graph/_Structures_Graph_php.html" role="doc"/>
-   <file baseinstalldir="" md5sum="09cb6d17f96553bfb66b99c502676844" name="docs/html/Structures_Graph/_Structures_Graph_Node_php.html" role="doc"/>
-   <file baseinstalldir="" md5sum="c45890d45dd42dc56adb71988c3a45c1" name="docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html" role="doc"/>
-   <file baseinstalldir="" md5sum="c46e6566be5249811667ddc7decf405f" name="docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html" role="doc"/>
-   <file baseinstalldir="" md5sum="3fa477998b281061361c4d98fb78c3a8" name="docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html" role="doc"/>
-   <file baseinstalldir="" md5sum="afb0e3afb91beafd1bc16a07ac31c826" name="docs/html/Structures_Graph/Structures_Graph_Node.html" role="doc"/>
-   <file baseinstalldir="" md5sum="fefb65755d57a87d2736e058a1095b03" name="docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html" role="doc"/>
-   <file baseinstalldir="" md5sum="1ed0ac55530b7504c00df35f335e7ef3" name="docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html" role="doc"/>
-   <file baseinstalldir="" md5sum="a17210dd27171316f5cb446a5bef59ab" name="docs/html/Structures_Graph/Structures_Graph.html" role="doc"/>
-   <file baseinstalldir="" md5sum="005081a4c5d60afcbabc1f4909ebfcad" name="docs/html/packages.html" role="doc"/>
-   <file baseinstalldir="" md5sum="8ff124484e8a009f94a8d0b4d9b8b1cd" name="docs/html/media/stylesheet.css" role="doc"/>
-   <file baseinstalldir="" md5sum="039cb8781dae7b5f5661dc2892fb53b5" name="docs/html/media/banner.css" role="doc"/>
-   <file baseinstalldir="" md5sum="4ec087627323546610b64d69a6aafca6" name="docs/html/li_Structures_Graph.html" role="doc"/>
-   <file baseinstalldir="" md5sum="db3206e7d176ae78fd04f22acead5ffa" name="docs/html/index.html" role="doc"/>
-   <file baseinstalldir="" md5sum="ae809f6ebbf632351648c340d2d6acd4" name="docs/html/errors.html" role="doc"/>
-   <file baseinstalldir="" md5sum="19dd287d44163d2abde1a1d8d52521f8" name="docs/html/elementindex_Structures_Graph.html" role="doc"/>
-   <file baseinstalldir="" md5sum="898dd26ccc1c1572d36e9879afcb5d39" name="docs/html/elementindex.html" role="doc"/>
-   <file baseinstalldir="" md5sum="d0ada99c3b7e95b23461cc3e713f0c3d" name="docs/html/classtrees_Structures_Graph.html" role="doc"/>
-   <file baseinstalldir="" md5sum="ce2da39dbb75e21074eb5e96231a3379" name="docs/generate.sh" role="doc"/>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.2.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.3</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.0.2</release>
-     <api>1.0.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2007-01-07</date>
-    <license uri="http://opensource.org/licenses/lgpl-license.php">LGPL</license>
-    <notes>- Bug #9682 only variables can be returned by reference
-- fix Bug #9661 notice in Structures_Graph_Manipulator_Topological::sort()</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/.xmlregistry/packages/pear.php.net/XML_Util/1.2.1-info.xml b/lib/.xmlregistry/packages/pear.php.net/XML_Util/1.2.1-info.xml
deleted file mode 100644
index 8ecb77b13183b087c181ec47d57bae5ce052292c..0000000000000000000000000000000000000000
--- a/lib/.xmlregistry/packages/pear.php.net/XML_Util/1.2.1-info.xml
+++ /dev/null
@@ -1,404 +0,0 @@
-<?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.7.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>XML_Util</name>
- <channel>pear.php.net</channel>
- <summary>XML utility class</summary>
- <description>Selection of methods that are often needed when working with XML documents.  Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more.</description>
- <lead>
-  <name>Chuck Burgess</name>
-  <user>ashnazg</user>
-  <email>ashnazg@php.net</email>
-  <active>yes</active>
- </lead>
- <lead>
-  <name>Stephan Schmidt</name>
-  <user>schst</user>
-  <email>schst@php-tools.net</email>
-  <active>no</active>
- </lead>
- <helper>
-  <name>Davey Shafik</name>
-  <user>davey</user>
-  <email>davey@php.net</email>
-  <active>no</active>
- </helper>
- <date>2010-05-04</date>
- <time>08:41:39</time>
- <version>
-  <release>1.2.1</release>
-  <api>1.2.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
- <notes>Fixed Bug #14760: Bug in getDocTypeDeclaration() [ashnazg|fpospisil]</notes>
- <contents>
-  <dir name="/">
-   <file baseinstalldir="XML" md5sum="9bb265dafaaf06c86ca5c48f50368ded" name="Util.php" role="php">
-    <tasks:replace from="@version@" to="version" type="package-info"/>
-   </file>
-   <file baseinstalldir="XML" md5sum="b4127883df40a4b0d1736ad42215ee25" name="tests/testBug_5392.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="1850856692ff6c6df5e8acb16e1080ce" name="tests/testBug_4950.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="ab035534463cae8cc903e907aead8ffe" name="tests/testBasic_splitQualifiedName.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="431856aa83a23396a9f00915dd2be192" name="tests/testBasic_reverseEntities.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="e6717d43001775cccd52bd5195cf02e0" name="tests/testBasic_replaceEntities.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="300a6192f7cc6f7bc3d8f2576b51e4b0" name="tests/testBasic_raiseError.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="a727860d55c14194fdaffa839a59a540" name="tests/testBasic_isValidName.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="5bc1926a488a6b63ec6366bfcf06a50a" name="tests/testBasic_getXmlDeclaration.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="817882a0ab33e60f17ee71874ad975f0" name="tests/testBasic_getDocTypeDeclaration.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="d2792da0d9c5f0987ee4587912017aa9" name="tests/testBasic_createTagFromArray.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="5f453edadebaa3435c8e6f09a3aaaa9c" name="tests/testBasic_createTag.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="ad786fb687e1eea1f6890a7424709c79" name="tests/testBasic_createStartElement.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="ba75d66c2f0fb0010c71f3bcd1f64eb2" name="tests/testBasic_createEndElement.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="c101844768f146653c59c81978060158" name="tests/testBasic_createComment.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="4c87fda94fdfb7a78ba84998d6e28f45" name="tests/testBasic_createCDataSection.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="dc4202f1451bbeb62a5bc7d56a7c774c" name="tests/testBasic_collapseEmptyTags.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="4b17c0df7fbfb1bb2f3f636ebd6c2cbd" name="tests/testBasic_attributesToString.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="73088689d58b71cd4f86013c88b72216" name="tests/testBasic_apiVersion.phpt" role="test"/>
-   <file baseinstalldir="XML" md5sum="0af0cff09232a6c275803bb36213cdd9" name="tests/AllTests.php" role="test"/>
-   <file baseinstalldir="XML" md5sum="77355702c9e861d3fc0a5318ea689eee" name="examples/example2.php" role="doc"/>
-   <file baseinstalldir="XML" md5sum="06b6662b91b1a466e7b5113f37d4725f" name="examples/example.php" role="doc"/>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.3</min>
-   </pearinstaller>
-   <extension>
-    <name>pcre</name>
-   </extension>
-  </required>
- </dependencies>
- <phprelease>
-  <changelog>
-   <release>
-    <version>
-     <release>1.2.1</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2008-12-07</date>
-    <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
-    <notes>Fixed Bug #14760: Bug in getDocTypeDeclaration() [ashnazg|fpospisil]</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.0</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2008-07-26</date>
-    <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
-    <notes>Changed license to New BSD License (Req #13826 [ashnazg])
-Added a test suite against all API methods [ashnazg]
-Switch to package.xml v2 [ashnazg]
-Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry]
-Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg]
-Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry]
--- (this fix differs from the one in v1.2.0a1)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.0RC1</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2008-07-12</date>
-    <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
-    <notes>Changed license to New BSD License (Req #13826 [ashnazg])
-Added a test suite against all API methods [ashnazg]
-Switch to package.xml v2 [ashnazg]
-Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry]
-Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg]
-Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry]
--- (this fix differs from the one in v1.2.0a1)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.0a2</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2008-05-22</date>
-    <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
-    <notes>Changed license to New BSD License (Req #13826 [ashnazg])
-Added a test suite against all API methods [ashnazg]
-Switch to package.xml v2 [ashnazg]
-Added Req #13839: Missing XHTML empty tags to collapse [ashnazg|drry]
-Fixed Bug #5392: encoding of ISO-8859-1 is the only supported encoding [ashnazg]
-Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|drry]
--- (this fix differs from the one in v1.2.0a1)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.2.0a1</release>
-     <api>1.2.0</api>
-    </version>
-    <stability>
-     <release>alpha</release>
-     <api>alpha</api>
-    </stability>
-    <date>2008-05-04</date>
-    <license uri="http://opensource.org/licenses/bsd-license">BSD License</license>
-    <notes>Changed license to New BSD License (Req #13826 [ashnazg])
-Added a test suite against all API methods [ashnazg]
-Switch to package.xml v2 [ashnazg]
-Fixed Bug #4950: Incorrect CDATA serializing [ashnazg|ja.doma]</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1.4</release>
-     <api>1.1.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-12-16</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fixed bug #9561: Not allowing underscores in middle of tags</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1.2</release>
-     <api>1.1.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2006-12-01</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- fixed bug #5419: isValidName() now checks for character classes
-- implemented request #8196: added optional parameter to influence array sorting to createTag() createTagFromArray() and createStartElement()</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1.1</release>
-     <api>1.1.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-12-23</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- fixed bug in replaceEntities() and reverseEntities() in conjunction with XML_UTIL_ENTITIES_HTML
-- createTag() and createTagFromArray() now accept XML_UTIL_ENTITIES_XML, XML_UTIL_ENTITIES_XML_REQUIRED, XML_UTIL_ENTITIES_HTML, XML_UTIL_ENTITIES_NONE and XML_UTIL_CDATA_SECTION as $replaceEntities parameter</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.1.0</release>
-     <api>1.1.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-11-19</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Added collapseEmptyTags (patch by Sebastian Bergmann and Thomas Duffey)</notes>
-   </release>
-   <release>
-    <version>
-     <release>1.0.0</release>
-     <api>1.0.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-10-28</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Added reverseEntities() (request #2639)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.6.1</release>
-     <api>0.6.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-10-28</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Added check for tag name (either as local part or qualified name) in createTagFromArray() (bug #1083)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.6.0</release>
-     <api>0.6.0</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2004-06-07</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey)
-- added optional parameter to replaceEntities() to define the set of entities to replace
-- added optional parameter to attributesToString() to define, whether entities should be replaced (requested by Sebastian Bergmann)
-- allowed second parameter to XML_Util::attributesToString() to be an array containing options (easier to use, if you only need to set the last parameter)
-- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.6.0beta1</release>
-     <api>0.6.0beta1</api>
-    </version>
-    <stability>
-     <release>beta</release>
-     <api>beta</api>
-    </stability>
-    <date>2004-05-24</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>- Fixed bug 1438 (namespaces not accepted for isValidName()) (thanks to davey)
-- added optional parameter to replaceEntities() to define the set of entities to replace
-- added optional parameter to attributesToString() to define, whether entities should be replaced (requested by Sebastian Bergmann)
-- allowed second parameter to XML_Util::attributesToString() to be an array containing options (easier to use, if you only need to set the last parameter)
-- introduced XML_Util::raiseError() to avoid the necessity of including PEAR.php, will only be included on error</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.5.2</release>
-     <api>0.5.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-11-22</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>now creates XHTML compliant empty tags (Davey),
-minor whitespace fixes (Davey)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.5.1</release>
-     <api>0.5.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-09-26</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>added default namespace parameter (optional) in splitQualifiedName() (requested by Sebastian Bergmann)</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.5</release>
-     <api>0.5</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-09-23</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>added support for multiline attributes in attributesToString(), createTag*() and createStartElement (requested by Yavor Shahpasov for XML_Serializer),
-added createComment</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.4</release>
-     <api>0.4</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-09-21</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>added createCDataSection(),
-added support for CData sections in createTag* methods,
-fixed bug #23,
-fixed bug in splitQualifiedName()</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.3</release>
-     <api>0.3</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-09-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>added createStartElement() and createEndElement()</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2.1</release>
-     <api>0.2.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-09-05</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>fixed bug with zero as tag content in createTagFromArray and createTag</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.2</release>
-     <api>0.2</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-08-12</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>added XML_Util::getDocTypeDeclaration()</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.1.1</release>
-     <api>0.1.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-08-02</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>bugfix: removed bug in createTagFromArray</notes>
-   </release>
-   <release>
-    <version>
-     <release>0.1</release>
-     <api>0.1</api>
-    </version>
-    <stability>
-     <release>stable</release>
-     <api>stable</api>
-    </stability>
-    <date>2003-08-01</date>
-    <license uri="http://www.php.net/license">PHP License</license>
-    <notes>inital release</notes>
-   </release>
-  </changelog>
- </phprelease>
-</package>
diff --git a/lib/bin/DB/scripts/DB_DataObject_createTables.bat b/lib/bin/DB/scripts/DB_DataObject_createTables.bat
deleted file mode 100755
index 3c3d60c06e93f0f33b0ea9a95b7d39751b6666b4..0000000000000000000000000000000000000000
--- a/lib/bin/DB/scripts/DB_DataObject_createTables.bat
+++ /dev/null
@@ -1,15 +0,0 @@
-@ECHO OFF
-REM $Id: DB_DataObject_createTables.bat,v 1.1 2003-09-08 20:43:31 arnaud Exp $
-REM BATCH FILE TO EXECUTE PEAR::DB_DATAOBJECT createTables.php script
-
-IF '%1' == '' (
-    ECHO **************************************************
-    ECHO * Please pass the name of the ini file
-    ECHO * to process at the only parameter
-    ECHO *
-    ECHO * e.g.: DB_DataObject_createTables my_ini_file.ini
-    ECHO **************************************************
-    GOTO :EOF
-)
-
-%PHP_PEAR_PHP_BIN% %PHP_PEAR_INSTALL_DIR%\DB\DataObject\createTables.php %1
\ No newline at end of file
diff --git a/lib/bin/pear.bat b/lib/bin/pear.bat
deleted file mode 100755
index 3750096d90c839ab3cd1146ebebaf70f45ecd5fb..0000000000000000000000000000000000000000
--- a/lib/bin/pear.bat
+++ /dev/null
@@ -1,115 +0,0 @@
-@ECHO OFF
-
-REM ----------------------------------------------------------------------
-REM PHP version 5
-REM ----------------------------------------------------------------------
-REM Copyright (c) 1997-2004 The PHP Group
-REM ----------------------------------------------------------------------
-REM  This source file is subject to version 3.0 of the PHP license, 
-REM  that is bundled with this package in the file LICENSE, and is
-REM  available at through the world-wide-web at
-REM  http://www.php.net/license/3_0.txt. 
-REM  If you did not receive a copy of the PHP license and are unable to
-REM  obtain it through the world-wide-web, please send a note to
-REM  license@php.net so we can mail you a copy immediately.
-REM ----------------------------------------------------------------------
-REM  Authors:     Alexander Merz (alexmerz@php.net)
-REM ----------------------------------------------------------------------
-REM
-REM  Last updated 12/29/2004 ($Id$ is not replaced if the file is binary)
-
-REM change this lines to match the paths of your system
-REM -------------------
-
-
-REM Test to see if this is a raw pear.bat (uninstalled version)
-SET TMPTMPTMPTMPT=@includ
-SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
-FOR %%x IN ("/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
-
-REM Check PEAR global ENV, set them if they do not exist
-IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php"
-IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=/Users/bbieber/workspace/UNL_GraduateBulletin/lib/bin"
-IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/usr/local/bin/php"
-GOTO :INSTALLED
-
-:NOTINSTALLED
-ECHO WARNING: This is a raw, uninstalled pear.bat
-
-REM Check to see if we can grab the directory of this file (Windows NT+)
-IF %~n0 == pear (
-FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
-SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
-echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
-"%PHP_PEAR_PHP_BIN%" -v
-GOTO :NEXTTEST
-))
-GOTO :FAILAUTODETECT
-:NEXTTEST
-IF "%PHP_PEAR_PHP_BIN%" NEQ "" (
-
-REM We can use this PHP to run a temporary php file to get the dirname of pear
-
-echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
-"%PHP_PEAR_PHP_BIN%" ~~getloc.php
-set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
-DEL ~a.a
-DEL ~~getloc.php
-set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"
-
-REM Make sure there is a pearcmd.php at our disposal
-
-IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
-IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-)
-)
-GOTO :INSTALLED
-) ELSE (
-REM Windows Me/98 cannot succeed, so allow the batch to fail
-)
-:FAILAUTODETECT
-echo WARNING: failed to auto-detect pear information
-:INSTALLED
-
-REM Check Folders and files
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
-IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
-IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
-REM launch pearcmd
-GOTO RUN
-:PEAR_INSTALL_ERROR
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_INSTALL_ERROR2
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO pearcmd.php could not be found there.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_BIN_ERROR
-ECHO PHP_PEAR_BIN_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_BIN_DIR%
-GOTO END
-:PEAR_PHPBIN_ERROR
-ECHO PHP_PEAR_PHP_BIN is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_PHP_BIN%
-GOTO END
-:RUN
-"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
-:END
-@ECHO ON
\ No newline at end of file
diff --git a/lib/bin/peardev.bat b/lib/bin/peardev.bat
deleted file mode 100755
index 3d76ba103b5e12e2fb052dcc76956ca8a9cc440c..0000000000000000000000000000000000000000
--- a/lib/bin/peardev.bat
+++ /dev/null
@@ -1,115 +0,0 @@
-@ECHO OFF
-
-REM ----------------------------------------------------------------------
-REM PHP version 5
-REM ----------------------------------------------------------------------
-REM Copyright (c) 1997-2004 The PHP Group
-REM ----------------------------------------------------------------------
-REM  This source file is subject to version 3.0 of the PHP license, 
-REM  that is bundled with this package in the file LICENSE, and is
-REM  available at through the world-wide-web at
-REM  http://www.php.net/license/3_0.txt. 
-REM  If you did not receive a copy of the PHP license and are unable to
-REM  obtain it through the world-wide-web, please send a note to
-REM  license@php.net so we can mail you a copy immediately.
-REM ----------------------------------------------------------------------
-REM  Authors:     Alexander Merz (alexmerz@php.net)
-REM ----------------------------------------------------------------------
-REM
-REM  $Id: peardev.bat,v 1.6 2007-09-03 03:00:17 cellog Exp $
-
-REM change this lines to match the paths of your system
-REM -------------------
-
-
-REM Test to see if this is a raw pear.bat (uninstalled version)
-SET TMPTMPTMPTMPT=@includ
-SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
-FOR %%x IN ("/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
-
-REM Check PEAR global ENV, set them if they do not exist
-IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php"
-IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=/Users/bbieber/workspace/UNL_GraduateBulletin/lib/bin"
-IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/usr/local/bin/php"
-GOTO :INSTALLED
-
-:NOTINSTALLED
-ECHO WARNING: This is a raw, uninstalled pear.bat
-
-REM Check to see if we can grab the directory of this file (Windows NT+)
-IF %~n0 == pear (
-FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
-SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
-echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
-"%PHP_PEAR_PHP_BIN%" -v
-GOTO :NEXTTEST
-))
-GOTO :FAILAUTODETECT
-:NEXTTEST
-IF "%PHP_PEAR_PHP_BIN%" NEQ "" (
-
-REM We can use this PHP to run a temporary php file to get the dirname of pear
-
-echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
-"%PHP_PEAR_PHP_BIN%" ~~getloc.php
-set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
-DEL ~a.a
-DEL ~~getloc.php
-set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"
-
-REM Make sure there is a pearcmd.php at our disposal
-
-IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
-IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-)
-)
-GOTO :INSTALLED
-) ELSE (
-REM Windows Me/98 cannot succeed, so allow the batch to fail
-)
-:FAILAUTODETECT
-echo WARNING: failed to auto-detect pear information
-:INSTALLED
-
-REM Check Folders and files
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
-IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
-IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
-REM launch pearcmd
-GOTO RUN
-:PEAR_INSTALL_ERROR
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_INSTALL_ERROR2
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO pearcmd.php could not be found there.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_BIN_ERROR
-ECHO PHP_PEAR_BIN_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_BIN_DIR%
-GOTO END
-:PEAR_PHPBIN_ERROR
-ECHO PHP_PEAR_PHP_BIN is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_PHP_BIN%
-GOTO END
-:RUN
-"%PHP_PEAR_PHP_BIN%" -C -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d open_basedir="" -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
-:END
-@ECHO ON
\ No newline at end of file
diff --git a/lib/bin/pecl.bat b/lib/bin/pecl.bat
deleted file mode 100755
index 1b976df77d0033633e926a8677b242a8f1f1d9de..0000000000000000000000000000000000000000
--- a/lib/bin/pecl.bat
+++ /dev/null
@@ -1,115 +0,0 @@
-@ECHO OFF
-
-REM ----------------------------------------------------------------------
-REM PHP version 5
-REM ----------------------------------------------------------------------
-REM Copyright (c) 1997-2004 The PHP Group
-REM ----------------------------------------------------------------------
-REM  This source file is subject to version 3.0 of the PHP license, 
-REM  that is bundled with this package in the file LICENSE, and is
-REM  available at through the world-wide-web at
-REM  http://www.php.net/license/3_0.txt. 
-REM  If you did not receive a copy of the PHP license and are unable to
-REM  obtain it through the world-wide-web, please send a note to
-REM  license@php.net so we can mail you a copy immediately.
-REM ----------------------------------------------------------------------
-REM  Authors:     Alexander Merz (alexmerz@php.net)
-REM ----------------------------------------------------------------------
-REM
-REM  Last updated 02/08/2004 ($Id$ is not replaced if the file is binary)
-
-REM change this lines to match the paths of your system
-REM -------------------
-
-
-REM Test to see if this is a raw pear.bat (uninstalled version)
-SET TMPTMPTMPTMPT=@includ
-SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
-FOR %%x IN ("/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
-
-REM Check PEAR global ENV, set them if they do not exist
-IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php"
-IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=/Users/bbieber/workspace/UNL_GraduateBulletin/lib/bin"
-IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/usr/local/bin/php"
-GOTO :INSTALLED
-
-:NOTINSTALLED
-ECHO WARNING: This is a raw, uninstalled pear.bat
-
-REM Check to see if we can grab the directory of this file (Windows NT+)
-IF %~n0 == pear (
-FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
-SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
-echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
-"%PHP_PEAR_PHP_BIN%" -v
-GOTO :NEXTTEST
-))
-GOTO :FAILAUTODETECT
-:NEXTTEST
-IF "%PHP_PEAR_PHP_BIN%" NEQ "" (
-
-REM We can use this PHP to run a temporary php file to get the dirname of pear
-
-echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
-"%PHP_PEAR_PHP_BIN%" ~~getloc.php
-set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
-DEL ~a.a
-DEL ~~getloc.php
-set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"
-
-REM Make sure there is a pearcmd.php at our disposal
-
-IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
-IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
-)
-)
-GOTO :INSTALLED
-) ELSE (
-REM Windows Me/98 cannot succeed, so allow the batch to fail
-)
-:FAILAUTODETECT
-echo WARNING: failed to auto-detect pear information
-:INSTALLED
-
-REM Check Folders and files
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
-IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
-IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
-IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
-REM launch pearcmd
-GOTO RUN
-:PEAR_INSTALL_ERROR
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_INSTALL_ERROR2
-ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
-ECHO pearcmd.php could not be found there.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_INSTALL_DIR%
-GOTO END
-:PEAR_BIN_ERROR
-ECHO PHP_PEAR_BIN_DIR is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_BIN_DIR%
-GOTO END
-:PEAR_PHPBIN_ERROR
-ECHO PHP_PEAR_PHP_BIN is not set correctly.
-ECHO Please fix it using your environment variable or modify
-ECHO the default value in pear.bat
-ECHO The current value is:
-ECHO %PHP_PEAR_PHP_BIN%
-GOTO END
-:RUN
-"%PHP_PEAR_PHP_BIN%" -C -n -d output_buffering=1 -d safe_mode=0 -d include_path="%PHP_PEAR_INSTALL_DIR%" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
-:END
-@ECHO ON
\ No newline at end of file
diff --git a/lib/data/MDB2/LICENSE b/lib/data/MDB2/LICENSE
deleted file mode 100644
index 27b97278195aa723d4108af0c5a760e17fc00e8f..0000000000000000000000000000000000000000
--- a/lib/data/MDB2/LICENSE
+++ /dev/null
@@ -1,38 +0,0 @@
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
\ No newline at end of file
diff --git a/lib/data/MDB2_Driver_mysqli/package_mysqli.xml b/lib/data/MDB2_Driver_mysqli/package_mysqli.xml
deleted file mode 100644
index 6935ea3caa071a7801fae282cb9e57f4c9885c92..0000000000000000000000000000000000000000
--- a/lib/data/MDB2_Driver_mysqli/package_mysqli.xml
+++ /dev/null
@@ -1,658 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.7.2" version="2.0" 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" 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>MDB2_Driver_mysqli</name>
- <channel>pear.php.net</channel>
- <summary>mysqli MDB2 driver</summary>
- <description>This is the MySQLi MDB2 driver.</description>
- <lead>
-  <name>Lukas Kahwe Smith</name>
-  <user>lsmith</user>
-  <email>smith@pooteeweet.org</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Lorenzo Alberton</name>
-  <user>quipo</user>
-  <email>l.alberton@quipo.it</email>
-  <active>yes</active>
- </lead>
- <date>2009-01-14</date>
- <time>15:41:35</time>
- <version>
-  <release>1.5.0b2</release>
-  <api>1.5.0b2</api>
- </version>
- <stability>
-  <release>beta</release>
-  <api>beta</api>
- </stability>
- <license>BSD License</license>
- <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #13412: sometimes getTableConstraintDefinition() fails for FOREIGN KEYs
-- fixed bug #13581: wrong query in beginTransaction() for certain MySQL versions
-- fixed bug #13928: Invalid triggers created for &apos;ON UPDATE&apos;
-- fixed bug #15051: Cannot create constraints with field length
-- add index on FK column(s) or a FK constraint cannot be created in some cases
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
- <contents>
-  <dir baseinstalldir="/" name="/">
-   <dir name="MDB2">
-    <dir name="Driver">
-     <dir name="Datatype">
-      <file name="mysqli.php" role="php">
-       <tasks:replace from="@package_version@" to="version" type="package-info" />
-      </file>
-     </dir> <!-- /MDB2/Driver/Datatype -->
-     <dir name="Function">
-      <file name="mysqli.php" role="php">
-       <tasks:replace from="@package_version@" to="version" type="package-info" />
-      </file>
-     </dir> <!-- /MDB2/Driver/Function -->
-     <dir name="Manager">
-      <file name="mysqli.php" role="php">
-       <tasks:replace from="@package_version@" to="version" type="package-info" />
-      </file>
-     </dir> <!-- /MDB2/Driver/Manager -->
-     <dir name="Native">
-      <file name="mysqli.php" role="php">
-       <tasks:replace from="@package_version@" to="version" type="package-info" />
-      </file>
-     </dir> <!-- /MDB2/Driver/Native -->
-     <dir name="Reverse">
-      <file name="mysqli.php" role="php">
-       <tasks:replace from="@package_version@" to="version" type="package-info" />
-      </file>
-     </dir> <!-- /MDB2/Driver/Reverse -->
-     <file name="mysqli.php" role="php">
-      <tasks:replace from="@package_version@" to="version" type="package-info" />
-     </file>
-    </dir> <!-- /MDB2/Driver -->
-   </dir> <!-- /MDB2 -->
-   <dir name="tests">
-    <file name="MDB2_nonstandard_mysqli.php" role="test" />
-   </dir> <!-- /tests -->
-   <file name="package_mysqli.xml" role="data" />
-  </dir> <!-- / -->
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>5.0.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>MDB2</name>
-    <channel>pear.php.net</channel>
-    <min>2.5.0b2</min>
-   </package>
-   <extension>
-    <name>mysqli</name>
-   </extension>
-  </required>
- </dependencies>
- <phprelease />
- <changelog>
-  <release>
-   <version>
-    <release>1.5.0b2</release>
-    <api>1.5.0b2</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>beta</api>
-   </stability>
-   <date>2009-01-14</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #12117: disconnect() does not work as documented
-- fixed bug #13412: sometimes getTableConstraintDefinition() fails for FOREIGN KEYs
-- fixed bug #13581: wrong query in beginTransaction() for certain MySQL versions
-- fixed bug #13928: Invalid triggers created for &apos;ON UPDATE&apos;
-- fixed bug #15051: Cannot create constraints with field length
-- add index on FK column(s) or a FK constraint cannot be created in some cases
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.5.0b1</release>
-    <api>1.5.0b1</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2008-03-15</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #11831: createTable() now supports tables with a multi-field PRIMARY KEY
-  where one field is defined as AUTO_INCREMENT
-- request #11204: support AUTO_INCREMENT for FLOAT data type and UNSIGNED option
-  for FLOAT and DECIMAL data type [afz]
-- fixed bug #11692: value of $db-&gt;supports(&apos;transactions&apos;) changes after query [afz]
-- request #12731: added truncateTable() in the Manager module
-- request #12732: added vacuum() in the Manager module for OPTIMIZE/VACUUM TABLE abstraction
-- request #12800: added alterDatabase() in the Manager module [afz]
-- fixed quoting in createDatabase() in the Manager module
-- fixed bug #12924: correctly handle internal expected errors even with custom error handling
-- added standaloneQuery() and databaseExists()
-- request #13106: added unixtimestamp() in the Function module
-- fixed regexp in listTableConstraints() in the Manager module to list FOREIGN KEY constraints
-- fixed bug #13180: MySQL driver tells SAVEPOINT is supported for MyISAM tables
-- fixed bug #13283: replace() doesn&apos;t respect quote_identifiers option
-- request #13313: setCharSet() supports &apos;COLLATE&apos; too
-- fixed bug #13370: some capabilities depend on user options, so check them after
-  a setOption() call
-- when triggers are supported, two triggers are created to emulate ON UPDATE / ON DELETE actions
-  for FOREIGN KEY constraints. Known limitation: since mysql doesn&apos;t support multiple triggers
-  with the same action time and event for one table, if there are multiple table referencing
-  the same table, only the first one will have the triggers created.
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.5.0a2</release>
-    <api>1.5.0a2</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2007-12-06</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #12516: error in FK constraint creation query
-- request #12012: added charset/collation support in createDatabase()
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.5.0a1</release>
-    <api>1.5.0a1</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2007-10-28</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #10024: Added new option &apos;lob_allow_url_include&apos; (default false) to
-  [dis]allow inserting a LOB from an url (file, http, ...).
-- fixed bug #10986: Using more random statement names (request #11625)
-- fixed bug #11055: Using placeholders with := variable assignment fails [bekarau]
-- initial support for FOREIGN KEY constraints in the Manager and Reverse modules
-- request #11389: added many new MySQL 5.1 error codes in errorInfo()
-- fixed bug #11428: propagate quote() errors with invalid data types
-- fixed bug in _modifyQuery() when using SELECT FOR UPDATE or similar queries
-- fixed bug #11590: _getServerCapabilities() has to be called once per connection
-- fixed bug #11790: avoid array_diff() because it has a memory leak in PHP 5.1.x
-- fixed some E_STRICT errors with PHP5
-- fixed bug #12010: MDB2_PORTABILITY_RTRIM option was ignored
-- fixed bug #12083: createTable() in the Manager module now returns MDB2_OK on success,
-  as documented
-- request #12213: usage of mysqli_options &apos;MYSQLI_SET_CHARSET_NAME&apos; and mysqli_set_charset()
-  when available (patch by Carsten Wiedmann)
-- fixed bug #12242: missing charset info in the Reverse module (patch by Carsten Wiedmann)
-- fixed bug #12269: tableInfo() in the Reverse module detect &apos;clob&apos; data type
-  as first option
-- fixed bug #12336: supply default value for NOT NULL timestamp fields
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.4.1</release>
-    <api>1.4.1</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2007-05-03</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #10378: incorrect query rewrite in setLimit() when using &quot;FOR UPDATE&quot;
-  or &quot;LOCK IN SHARE MODE&quot; (thanks to priyadi) or &quot;INTO OUTFILE&quot; or &quot;INTO DUMPFILE&quot;
-- fixed bug #10384: in setCharset(), use mysqli_real_escape_string() instead of
-  mysql_real_escape_string()
-- return length as &quot;precision,scale&quot; for NUMERIC and DECIMAL fields in mapNativeDatatype()
-- in getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse
-  module, also return the field position in the index/constraint
-- fixed bug #10636: transactions broken in release 2.4.0 because of some properties
-  being reset (thanks to Conor Kerr)
-- fixed bug #10748: failed connections don&apos;t return native error code [urkle]
-- fixed bug #10895: setLimit() does not work properly when a subquery uses LIMIT
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.4.0</release>
-    <api>1.4.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2007-03-13</date>
-   <license>BSD License</license>
-   <notes>- fixed bug #9283: missing support for BINARY/VARBINARY data types (thanks to Tom Hendrikx)
-- propagate errors in getTableFieldDefinition() in the Reverse module
-- implemented getTriggerDefinition() in the Reverse module (mysql &gt; 5.0.2) [experimental]
-- implemented listTableTriggers() in the Manager module (mysql &gt; 5.0.2)
-- implemented listFunctions() in the Manager module
-- setCharset() now uses &quot;SET NAMES&quot; instead of &quot;SET character_set_client&quot;
-- select the mysql database in listUsers() in the Manager module
-- added error codes for MySQL 5 (patch by Adam Harvey)
-- implemented guid() in the Function module [globally unique identifier]
-- fixed bug #10033: beginTransaction() does not know server capabilities
-- fixed bug #10057: createConstraint() returns an error when the definition is incomplete
-- request #9451: you can set charset, collation, engine and comments in createSequence()
-- implemented a fallback mechanism within getTableIndexDefinition() and
-  getTableConstraintDefinition() in the Reverse module to ignore the &apos;idxname_format&apos;
-  option and use the index name as provided in case of failure before returning
-  an error
-- fixed bug #10181: propagate error when an invalid type is passed to prepare()
-- added a &apos;nativetype_map_callback&apos; option to map native data declarations back to
-  custom data types (thanks to Andrew Hill).
-- fixed bug #10239: execute() misinterprets MySQL&apos;s user defined variables
-- phpdoc fixes
-
-open todo items:
-- use a trigger to emulate setting default now()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.3.0</release>
-    <api>2.3.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-11-03</date>
-   <license>BSD License</license>
-   <notes>- added charset and collation support to field declaration
-- fixed bug #9024: typo in error checking
-- fixed parameter order in charset setting fallback (Bug #8807)
-- fix typos in error handling in a few places (bug #9024)
-- typo fix in tableInfo (Bug #8925)
-- do not skip id generation in nextId() when creating a sequence on demand
-  because this prevents lastInsertID() from working
-- migrated to package.xml version 2</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.2.2</release>
-    <api>1.2.2</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-09-03</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- fixed single quote handling inside non emulated prepared statements (Bug #8538)
-- flip positions property array in prepared statement objects to make it
-  possible to optionally use the same named placeholder in multiple places
-  inside a single prepared statement</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.2.1</release>
-    <api>1.2.1</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-08-21</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- fixed issue in tableInfo() that originates in getTableFieldDefinition() which
-  led to returning incorrect type values (Bug #8291)
-- quote identifiers in the reverse module when &apos;quote_identifiers&apos; is enabled (Bug #8309)
-- use version_compare() to fix complex version comparisons (Bug #8355)
-- do not use quote() in setCharset() since it is supposed to set the charset in
-  the connection that was passed to it
-- return an error if a named placeholder name is used twice inside a single statement
-- do not list empty contraints and indexes
-- added support for &apos;primary&apos; option in createTable()
-- fixed notnull reverse engineering on mysql 4.x (Bug #8415)
-- do not set a default if type is a LOB (Request #8074)
-- if a default value is set, then we need to use VARCHAR instead of TEXT
-- removed _verifyTableType() since it just adds overhead, is hard to do reliably
-  and you will get an error if the table type is not supported anyways
-- fixed handling return values when disable_query is set in _doQuery() and _execute()
-- only call RELEASE SAVEPOINT if the server version if 5.0.3 or higher
-- increased MDB2 dependency too 2.2.1</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.2.0</release>
-    <api>1.2.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-07-23</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- added ability to escape wildcard characters in escape() and quote()
-- added setTransactionIsolation()
-- added savepoint support to beginTransaction(), commit() and rollback()
-- added debug() call at the end of a query/prepare/execute calling (Request #7933)
-- added context array parameter to debug() and make use of it whereever sensible
-- added optional method name parameter to raiseError() and use whereever possible
-- added ability to escape wildcard characters in escape() and quote()
-- added debug() call at the end of a query/prepare/execute calling (Request #7933)
-- added &apos;nativetype&apos; output to tableInfo() and getTableFieldDefinition()
-- added &apos;mdb2type&apos; output to getTableFieldDefinition()
-- reworked tableInfo() to use a common implementation based on getTableFieldDefinition()
-  when a table name is passed (Bug #8124)
-- fixed incorrect regex in mapNativeDatatype() (Bug #8256) (thx ioz at ionosfera dot com)
-- use old dsn when rolling back open transactions in disconnect()</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.1.0</release>
-    <api>1.1.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-06-15</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- tweaked handling of free() for prepared statements
-- return error if a prepared statement is attempted to be freed twice
-- removed use of addslashes() for BLOB quoting
-  (this might result in SQL injection vulnerability)
-- added setCharset()
-- use setCharset() in connect()/_doConnect()
-- set transaction enabled engine as default
-- generalized quoteIdentifier() with a property
-- use general implementation of quoteIdentifier() (Bug #7738)
-- fixed warning in replace() if type is not set (Bug #7740)
-- cosmetic performance tweak in getTableFieldDefinition()
-- switched most array_key_exists() calls to !empty() to improve readability and performance
-- fixed a few edge cases and potential warnings
-- added ability to rewrite queries for query(), exec() and prepare() using a debug handler callback
-- pass limit and offset to the result object constructor in _execute() for read statements
-- check if result/connection has not yet been freed/dicsonnected before
-  attempting to free a result set(Bug #7790)
-- fixed unbuffered query support
-- revert change that would prefer &apos;clob&apos; over &apos;text&apos; for TEXT fields
-  (this was breaking runtime instrospection)</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.0.3</release>
-    <api>1.0.3</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-05-22</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- fixed unsigned handling and minor tweaks to type mapping in mapNativeDatatype()
-- use emulated prepared statements on mysql 4.0 or lower
-- added &quot;emulate_prepared&quot; option to force prepared statement emulation</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.0.2</release>
-    <api>1.0.2</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-05-14</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- optimized listTables() and listViews()
-- optimized show related queries
-- merged in some features and fixes from the mysql driver
-- explicitly set is_manip parameter to false for transaction debug calls
-- pass parameter array as debug() all with scope &quot;parameters&quot; in every execute()
-  call (bug #4119)
-- silently change name of primary key contraints to PRIMARY
-- added ability to hint that a constraint is a primary key in dropConstraint()
-- typo fixes in phpdoc (thx Stoyan)
-- added support for fixed and variable types for &apos;text&apos; in declarations,
-  as well as in reverse engineering (Request #1523)
-- made _doQuery() return a reference
-- added userinfo&apos;s to all raiseError calls that previously had none
-- use native prepared queries for prepared SELECT statements
-- only use native prepared queries of mysql 4.1 or higher
-- added &apos;prepared_statements&apos; supported meta data setting
-- fixed issue with free() returning void
-- added missing supported parameter to prepare() signature</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.0.1</release>
-    <api>1.0.1</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-04-16</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- fixed length handling in tableInfo() (bug #6887)
-- aligned _modifyQuery() signature and phpdoc
-- added support for tabe options in createTable() (bug ##7079)
-- added optional database parameter to listTables() and listSequences()
-- added &apos;result_introspection&apos; supported metadata support
-- properly quote table names in tableInfo() (related to bug #6573)
-- use connected_server_info in getServerVersion() as a cache cache
-- use parent::disconnect() in disconnect()
-- added support for length in integer reverse engineering
-- some fixes regarding boolean reverse engineering
-- added listViews() and hide views in listTables()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>1.0.0</release>
-    <api>1.0.0</api>
-   </version>
-   <stability>
-    <release>stable</release>
-    <api>stable</api>
-   </stability>
-   <date>2006-02-09</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- handle null as resource when disable_query option is enabled in result object
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.2.4</release>
-    <api>0.2.4</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>beta</api>
-   </stability>
-   <date>2006-02-05</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- typo fix in getTableConstraintDefinition() (bug #6487)
-- added support for length in integer and decimal columns
-- removed ugly hack for quote parameter in quote() since it was insufficient
-  (escaping also needs to be prevented)
-- added support for out of order parameter binding in prepared queries
-- reset row_limit and row_offset after calling prepare() just like we do for query() and exec()
-- cosmetic fix (removed &quot;row_&quot; prefix from &quot;row_limit&quot; and &quot;row_offset&quot;)
-- now using TINYINT(1) by default instead of CHAR(1) for the boolean datatype (BC BREAK!)
-- typo fix in error message in createTable()
-- improved parsing in getServerInfo() (bug #6550)
-- fixed subselect emulation
-- support an arbitrary number of arguments in concat()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.2.3</release>
-    <api>0.2.3</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>beta</api>
-   </stability>
-   <date>2006-01-13</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- explicitly pass if the module is phptype specific in all loadModule calls (bug #6226)
-- properly handle PRIMARY keys in listTableConstraints()
-- apply _isIndexName() on non primary keys in getTableConstraintDefinition()
-- initial implementation of multi_query option (bug #6418)
-- added error handling in prepare()
-- use multi_query option in executeStoredProc() (bug #6418)
-- fixed signature of quoteIdentifier() to make second param optional
-- fixed signature of executeStoredProc()
-- typo fixes in error handling of nextResult() and numRows() calls
-- added @ in front of a few more mysqli calls
-- _fixIndexName() now just attempts to remove possible formatting
-- renamed _isSequenceName() to _fixSequenceName()
-- _fixSequenceName() now just attempts to remove possible formatting, and only
-  returns a boolean if no formatting was applied when the new &quot;check&quot; parameter is set to true
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.2.2</release>
-    <api>0.2.2</api>
-   </version>
-   <stability>
-    <release>beta</release>
-    <api>beta</api>
-   </stability>
-   <date>2005-12-30</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- moved state to beta
-- fixed typo in sub select detection
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.2.1</release>
-    <api>0.2.1</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2005-12-28</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- use emulated prepared queries for non manip prepared queries
-- proper quote new table name in alterTable()
-
-open todo item:
-- use native prepared queries for prepared SELECT statements</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.2.0</release>
-    <api>0.2.0</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2005-12-21</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>- do not fix case in listUsers()
-- unified case fixing in the list*() methods
-- fixed change and rename in alterTable()
-- primary key must be called primary
-- use getConnection() to access connection property
-- split index and constraint handling
-- quote identifiers where possible inside the manager methods depending on
-  the new &apos;quote_identifier&apos; option (defaults to off)
-- refactored get*Declaration() methods to use getTypeDeclaration()
-- setting in_transaction to false on disconnect
-- hide constraints from indexes and vice versa in the list methods
-- added new Function modules to handle difference in SQL functions
-- force rollback() with open transactions on disconnect
-- fixed table renaming
-- escape floats to make sure they do not contain evil characters (bug #5608)
-- do not check with === if ssl is enabled
-- fixed LOB handling
-- support column length in create index (mysql only feature, but a nice touch,
-  emulating it with substring is not feasible though)
-- split off manipulation queries into exec() method from the query() method *BC BREAK*
-- if result_types is set to false in prepare() method the query will be handled as a DML statement *BC BREAK*
-- use a proper default value if a field is set to not null in _getDeclaration*() (bug #5930)
-- added ability to determine unsigned in mapNativeDatatype()
-  (only really implemented in the mysql(i) drivers) (bug #6054)
-- use MDB2_ERROR_NOT_FOUND in getTableConstraintDefinition() and getTableIndexDefinition() (bug #6055)
-- use lastInsertID() method in nextID()
-- added getServerVersion() and use it to determine sub select support
-- unified array structure in mapNativeDatatype() *BC BREAK*
-- added &apos;mdbtype&apos; to tableInfo() output that is generated from mapNativeDatatype()
-- changed &apos;len&apos; to &apos;length&apos; in tableInfo() output *BC BREAK*</notes>
-  </release>
-  <release>
-   <version>
-    <release>0.1.1</release>
-    <api>0.1.1</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2005-10-10</date>
-   <license uri="http://www.example.com">BSD License</license>
-   <notes>Warning: this release features numerous BC breaks!
-
-There have been considerable improvements to the datatype, manager and reverse
-modules. Furthermore preliminary support for auto increment and primary keys
-has been added. Please note that making a field auto increment implies a single
-column primary key on this field.
-
-- added support for auto increment and primary key in schema.
-- alterTable now needs the full definition to work (use getTableFieldDefinition
- from Reverse module if you do not have a definition at hand) this eliminates the need
- of the declaration part in the alterTable array.
-- removed support for dummy_primary_key
-- fix PHP4.4 breakage
-- moved getInsertID() into core as lastInsertID()
-- all non LOB values were quoted twice in execute()
-- clobs only need to be mapped to binary when using mysqli_stmt_send_long_data()
-  which is handled independently
-- use !empty() instead of isset() in fetchRow to determine if result cols were bound or result types were set
-- expect keys in type arrays the same way as they are passed for the values in execute() and bindParamArray()
-- add s pattern modifier to preg_replace() call for parameter searches in prepare() (bug #5362)
-- moved all private fetch mode fix methods into _fixResultArrayValues() for performance reasons
-- renamed MDB2_PORTABILITY_LOWERCASE to MDB2_PORTABILITY_FIX_CASE and use &apos;field_case&apos; option to determine if to upper- or lowercase (CASE_LOWER/CASE_UPPER)
-- count() -&gt; !empty() where possible
-- use array_map() instead of array_flip(array_change_key_case(array_flip())) to fix case of array values
-- use array_key_exists() instead of isset() where possible
-- changed structure of field add/remove/change in alterTable() to match MDB2_Schema
-- removed subSelect() implementation (now in already included in common)
-- return 0 for manipulation queries when disable_query is enabled
-- tweaked getTableFieldDefinition() in reverse module
-
-open todo items:
-- fixed LOB support</notes>
-  </release>
- </changelog>
-</package>
diff --git a/lib/data/PEAR/package.dtd b/lib/data/PEAR/package.dtd
deleted file mode 100644
index 5b471b7fec6cf214b3564cd8a62c18e2cb6e5f77..0000000000000000000000000000000000000000
--- a/lib/data/PEAR/package.dtd
+++ /dev/null
@@ -1,103 +0,0 @@
-<!--
-     $Id: package.dtd,v 1.38 2005-11-12 02:23:07 cellog Exp $
-
-     This is the PEAR package description, version 1.0.
-     It should be used with the informal public identifier:
-
-         "-//PHP Group//DTD PEAR Package 1.0//EN//XML"
-
-     Copyright (c) 1997-2005 The PHP Group             
-
-     This source file is subject to version 3.00 of the PHP license,
-     that is bundled with this package in the file LICENSE, and is
-     available at through the world-wide-web at
-     http://www.php.net/license/3_0.txt. 
-     If you did not receive a copy of the PHP license and are unable to
-     obtain it through the world-wide-web, please send a note to
-     license@php.net so we can mail you a copy immediately.
-
-     Authors:
-         Stig S. Bakken <ssb@fast.no>
-         Gregory Beaver <cellog@php.net>
-
-  -->
-<!ENTITY % NUMBER "CDATA">
-<!ELEMENT package (name,summary,description,license?,maintainers,release,changelog?)>
-<!ATTLIST package type    (source|binary|empty) "empty"
-                  version CDATA                 #REQUIRED
-                  packagerversion CDATA         #IMPLIED>
-
-<!ELEMENT name (#PCDATA)>
-
-<!ELEMENT summary (#PCDATA)>
-
-<!ELEMENT license (#PCDATA)>
-
-<!ELEMENT description (#PCDATA)>
-
-<!ELEMENT maintainers (maintainer)+>
-
-<!ELEMENT maintainer (user|role|name|email)+>
-
-<!ELEMENT user (#PCDATA)>
-
-<!ELEMENT role (#PCDATA)>
-
-<!ELEMENT email (#PCDATA)>
-
-<!ELEMENT changelog (release)+>
-
-<!ELEMENT release (version,date,license,state,notes,warnings?,provides*,deps?,configureoptions?,filelist?)>
-
-<!ELEMENT version (#PCDATA)>
-
-<!ELEMENT date (#PCDATA)>
-
-<!ELEMENT state (#PCDATA)>
-
-<!ELEMENT notes (#PCDATA)>
-
-<!ELEMENT warnings (#PCDATA)>
-
-<!ELEMENT deps (dep*)>
-
-<!ELEMENT dep (#PCDATA)>
-<!ATTLIST dep type    (pkg|ext|php) #REQUIRED
-	                       rel     (has|eq|lt|le|gt|ge)                          #IMPLIED
-	                       version CDATA                                     #IMPLIED
-	                       optional (yes|no)     'no'>
-
-<!ELEMENT configureoptions (configureoption)+>
-
-<!ELEMENT configureoption EMPTY>
-<!ATTLIST configureoption name CDATA #REQUIRED
-                                           default CDATA #IMPLIED
-                                           prompt CDATA #REQUIRED>
-
-<!ELEMENT provides EMPTY>
-<!ATTLIST provides type (ext|prog|class|function|feature|api) #REQUIRED
-                                name CDATA #REQUIRED
-                                extends CDATA #IMPLIED>
-<!ELEMENT filelist (dir|file)+>
-
-<!ELEMENT dir (dir|file)+>
-<!ATTLIST dir name           CDATA #REQUIRED
-              role           (php|ext|src|test|doc|data|script) 'php'
-              baseinstalldir CDATA #IMPLIED>
-
-<!ELEMENT file (replace*)>
-<!ATTLIST file role           (php|ext|src|test|doc|data|script) 'php'
-               debug          (na|on|off)        'na'
-               format         CDATA              #IMPLIED
-               baseinstalldir CDATA              #IMPLIED
-               platform       CDATA              #IMPLIED
-               md5sum         CDATA              #IMPLIED
-               name           CDATA              #REQUIRED
-               install-as     CDATA              #IMPLIED>
-
-<!ELEMENT replace EMPTY>
-<!ATTLIST replace type (php-const|pear-config|package-info) #REQUIRED
-                              from CDATA #REQUIRED
-                              to CDATA #REQUIRED>
-
-
diff --git a/lib/data/PEAR/template.spec b/lib/data/PEAR/template.spec
deleted file mode 100644
index 37b477f8f0ad5751989c40a3474690132c3fce22..0000000000000000000000000000000000000000
--- a/lib/data/PEAR/template.spec
+++ /dev/null
@@ -1,72 +0,0 @@
-Summary: PEAR: @summary@
-Name: @rpm_package@
-Version: @version@
-Release: 1
-License: @release_license@
-Group: Development/Libraries
-Source: http://@master_server@/get/@package@-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-root
-URL: http://@master_server@/package/@package@
-Prefix: %{_prefix}
-BuildArchitectures: @arch@
-@extra_headers@
-
-%description
-@description@
-
-%prep
-rm -rf %{buildroot}/*
-%setup -c -T
-# XXX Source files location is missing here in pear cmd
-pear -v -c %{buildroot}/pearrc \
-        -d php_dir=%{_libdir}/php/pear \
-        -d doc_dir=/docs \
-        -d bin_dir=%{_bindir} \
-        -d data_dir=%{_libdir}/php/pear/data \
-        -d test_dir=%{_libdir}/php/pear/tests \
-        -d ext_dir=%{_libdir} \@extra_config@
-        -s
-
-%build
-echo BuildRoot=%{buildroot}
-
-%postun
-# if refcount = 0 then package has been removed (not upgraded)
-if [ "$1" -eq "0" ]; then
-    pear uninstall --nodeps -r @possible_channel@@package@
-    rm @rpm_xml_dir@/@package@.xml
-fi
-
-
-%post
-# if refcount = 2 then package has been upgraded
-if [ "$1" -ge "2" ]; then
-    pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml
-else
-    pear install --nodeps -r @rpm_xml_dir@/@package@.xml
-fi
-
-%install
-pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \
-        $RPM_SOURCE_DIR/@package@-%{version}.tgz
-rm %{buildroot}/pearrc
-rm %{buildroot}/%{_libdir}/php/pear/.filemap
-rm %{buildroot}/%{_libdir}/php/pear/.lock
-rm -rf %{buildroot}/%{_libdir}/php/pear/.registry
-if [ "@doc_files@" != "" ]; then
-     mv %{buildroot}/docs/@package@/* .
-     rm -rf %{buildroot}/docs
-fi
-mkdir -p %{buildroot}@rpm_xml_dir@
-tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package@package2xml@.xml
-cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml
-
-#rm -rf %{buildroot}/*
-#pear -q install -R %{buildroot} -n package@package2xml@.xml
-#mkdir -p %{buildroot}@rpm_xml_dir@
-#cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml
-
-%files
-    %defattr(-,root,root)
-    %doc @doc_files@
-    /
diff --git a/lib/data/Structures_Graph/LICENSE b/lib/data/Structures_Graph/LICENSE
deleted file mode 100644
index b1e3f5a2638797271cbc9b91b856c05ed6942c8f..0000000000000000000000000000000000000000
--- a/lib/data/Structures_Graph/LICENSE
+++ /dev/null
@@ -1,504 +0,0 @@
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-		  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/lib/data/Structures_Graph/genpackage.xml.pl b/lib/data/Structures_Graph/genpackage.xml.pl
deleted file mode 100644
index 3b54fe7ee276832ff625b43efd5a071446daec32..0000000000000000000000000000000000000000
--- a/lib/data/Structures_Graph/genpackage.xml.pl
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-while (<>) {
-    if (!/FILESGOHERE/) {
-        print $_;
-    } else {
-        open FILELIST,'find Structures -type f | grep -v .arch-ids |';
-        while (<FILELIST>) {
-	    $md5sum = `md5sum $_`;
-	    chomp($md5sum);
-	    $md5sum = substr $md5sum, 0, 32;
-#    $_ =~ s/\//\\\//g;
-            chomp($_);
-            print "    <file role=\"php\" md5sum=\"$md5sum\" name=\"$_\" />\n";
-        }
-    }
-}
diff --git a/lib/data/Structures_Graph/package.sh b/lib/data/Structures_Graph/package.sh
deleted file mode 100644
index 11c36c2dde2a5bcb5c3e39fd0b8e4b4c76119c68..0000000000000000000000000000000000000000
--- a/lib/data/Structures_Graph/package.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-VERSION=`tla tree-version 2>&1 | sed "s/^.*\([0-9][0-9]*\.[0-9][0-9]*\)$/\1/g"`
-TARGET_DIR=BUILD/
-TARGET_DIRS=`find Structures -type d | grep -v .arch-ids`
-mkdir -p $TARGET_DIR
-./genpackage.xml.pl > BUILD/package.xml << EOF
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<package version="1.0">
- <name>Structures_Graph</name>
- <summary>Graph datastructure manipulation library</summary>
- <license>LGPL</license>
- <description>
- Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed
- and undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing
- as well as for characteristic extraction from the graph topology.
- </description>
- <maintainers>
-  <maintainer>
-   <user>sergiosgc</user>
-   <name>S�rgio Carvalho</name>
-   <email>sergio.carvalho@portugalmail.com</email>
-   <role>lead</role>
-  </maintainer>
- </maintainers>
-
- <release>
-  <version>1.0.3</version>
-  <date>2007-01-30</date>
-  <state>stable</state>
-  <notes>
-  Version 1.0.3 is functionally equivalent to 1.0.2, but released with a v1.0 package.xml to deal with bug #9965:installation problem
-  </notes>
-  <filelist>
-FILESGOHERE
-  </filelist>
- </release>
- <deps>
-  <dep type="pkg" rel="ge" version="1.2">PEAR</dep>
- </deps>
-</package>
-EOF
-for dir in $TARGET_DIRS
-do
-    mkdir -p $TARGET_DIR/$dir
-    cp `find $dir -maxdepth 1 -type f | grep -v .arch-ids` $TARGET_DIR/$dir
-done
-cp LICENSE BUILD
-(cd BUILD; pear package)
-rm -Rf BUILD/package.xml BUILD/LICENSE BUILD/Structures
-
-
diff --git a/lib/data/Structures_Graph/publish.sh b/lib/data/Structures_Graph/publish.sh
deleted file mode 100644
index 1632e23353d5e80ef3cfe81c7c8c59741fc41fe4..0000000000000000000000000000000000000000
--- a/lib/data/Structures_Graph/publish.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-./package.sh
-scp BUILD/*.tgz root@sergiocarvalho.com:/home/httpd/vhosts/com/sergiocarvalho/pear-base/pear
-(cd docs; ./generate.sh)
-scp -r docs/html/* root@iluvatar.portugalmail.pt:/home/httpd/vhosts/com/sergiocarvalho/pear-base/pear/docs/Structures_Graph
diff --git a/lib/docs/Archive_Tar/docs/Archive_Tar.txt b/lib/docs/Archive_Tar/docs/Archive_Tar.txt
deleted file mode 100644
index 623cafe6aa68c8d82c6dd0524fafbd553d87feba..0000000000000000000000000000000000000000
--- a/lib/docs/Archive_Tar/docs/Archive_Tar.txt
+++ /dev/null
@@ -1,461 +0,0 @@
-Documentation for class Archive_Tar
-===================================
-Last update : 2001-08-15
-
-
-
-Overview :
-----------
-
-  The Archive_Tar class helps in creating and managing GNU TAR format
-  files compressed by GNU ZIP or not. 
-  The class offers basic functions like creating an archive, adding
-  files in the archive, extracting files from the archive and listing
-  the archive content. 
-  It also provide advanced functions that allow the adding and
-  extraction of files with path manipulation. 
-
-
-Sample :
---------
-
-  // ----- Creating the object (uncompressed archive)
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
-
-  // ----- Creating the archive
-  $v_list[0]="file.txt";
-  $v_list[1]="data/";
-  $v_list[2]="file.log";
-  $tar_object->create($v_list);
-
-  // ----- Adding files
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/";
-  $v_list[2]="log/file.log";
-  $tar_object->add($v_list);
-
-  // ----- Adding more files
-  $tar_object->add("release/newfile.log release/readme.txt");
-
-  // ----- Listing the content
-  if (($v_list  =  $tar_object->listContent()) != 0)
-    for ($i=0; $i<sizeof($v_list); $i++)
-    {
-      echo "Filename :'".$v_list[$i][filename]."'<br>";
-      echo " .size :'".$v_list[$i][size]."'<br>";
-      echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
-      echo " .mode :'".$v_list[$i][mode]."'<br>";
-      echo " .uid :'".$v_list[$i][uid]."'<br>";
-      echo " .gid :'".$v_list[$i][gid]."'<br>";
-      echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
-    }
-
-  // ----- Extracting the archive in directory "install"
-  $tar_object->extract("install");
-
-
-Public arguments :
-------------------
-
-None
-
-
-Public Methods :
-----------------
-
-Method : Archive_Tar($p_tarname, $compress = null)
-Description :
-  Archive_Tar Class constructor. This flavour of the constructor only
-  declare a new Archive_Tar object, identifying it by the name of the
-  tar file.
-  If the compress argument is set the tar will be read or created as a
-  gzip or bz2 compressed TAR file. 
-Arguments :
-  $p_tarname : A valid filename for the tar archive file.
-  $p_compress : can be null, 'gz' or 'bz2'. For
-                compatibility reason it can also be true. This
-                parameter indicates if gzip or bz2 compression
-                is required. 
-Return value :
-  The Archive_Tar object.
-Sample :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object_compressed = new Archive_Tar("tarname.tgz", true);
-How it works :
-  Initialize the object.
-
-Method : create($p_filelist)
-Description :
-  This method creates the archive file and add the files / directories
-  that are listed in $p_filelist. 
-  If the file already exists and is writable, it is replaced by the
-  new tar. It is a create and not an add. If the file exists and is
-  read-only or is a directory it is not replaced. The method return
-  false and a PEAR error text. 
-  The $p_filelist parameter can be an array of string, each string
-  representing a filename or a directory name with their path if
-  needed. It can also be a single string with names separated by a
-  single blank. 
-  See also createModify() method for more details.
-Arguments :
-  $p_filelist : An array of filenames and directory names, or a single
-  string with names separated by a single blank space. 
-Return value :
-  true on success, false on error.
-Sample 1 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->setErrorHandling(PEAR_ERROR_PRINT);  // Optional error handling
-  $v_list[0]="file.txt";
-  $v_list[1]="data/"; (Optional '/' at the end)
-  $v_list[2]="file.log";
-  $tar_object->create($v_list);
-Sample 2 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->setErrorHandling(PEAR_ERROR_PRINT);  // Optional error handling
-  $tar_object->create("file.txt data/ file.log");
-How it works :
-  Just calling the createModify() method with the right parameters.
-
-Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
-Description :
-  This method creates the archive file and add the files / directories
-  that are listed in $p_filelist. 
-  If the file already exists and is writable, it is replaced by the
-  new tar. It is a create and not an add. If the file exists and is
-  read-only or is a directory it is not replaced. The method return
-  false and a PEAR error text. 
-  The $p_filelist parameter can be an array of string, each string
-  representing a filename or a directory name with their path if
-  needed. It can also be a single string with names separated by a
-  single blank. 
-  The path indicated in $p_remove_dir will be removed from the
-  memorized path of each file / directory listed when this path
-  exists. By default nothing is removed (empty path "") 
-  The path indicated in $p_add_dir will be added at the beginning of
-  the memorized path of each file / directory listed. However it can
-  be set to empty "". The adding of a path is done after the removing
-  of path. 
-  The path add/remove ability enables the user to prepare an archive
-  for extraction in a different path than the origin files are. 
-  See also addModify() method for file adding properties.
-Arguments :
-  $p_filelist : An array of filenames and directory names, or a single
-                string with names separated by a single blank space.
-  $p_add_dir : A string which contains a path to be added to the
-               memorized path of each element in the list. 
-  $p_remove_dir : A string which contains a path to be removed from
-                  the memorized path of each element in the list, when
-		  relevant.
-Return value :
-  true on success, false on error.
-Sample 1 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->setErrorHandling(PEAR_ERROR_PRINT);  // Optional error handling
-  $v_list[0]="file.txt";
-  $v_list[1]="data/"; (Optional '/' at the end)
-  $v_list[2]="file.log";
-  $tar_object->createModify($v_list, "install");
-  // files are stored in the archive as :
-  //   install/file.txt
-  //   install/data
-  //   install/data/file1.txt
-  //   install/data/... all the files and sub-dirs of data/
-  //   install/file.log
-Sample 2 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->setErrorHandling(PEAR_ERROR_PRINT);  // Optional error handling
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/"; (Optional '/' at the end)
-  $v_list[2]="log/file.log";
-  $tar_object->createModify($v_list, "install", "dev");
-  // files are stored in the archive as :
-  //   install/file.txt
-  //   install/data
-  //   install/data/file1.txt
-  //   install/data/... all the files and sub-dirs of data/
-  //   install/log/file.log
-How it works :
-  Open the file in write mode (erasing the existing one if one),
-  call the _addList() method for adding the files in an empty archive,
-  add the tar footer (512 bytes block), close the tar file.
-
-
-Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
-Description :
-  This method add the files / directories listed in $p_filelist at the
-  end of the existing archive. If the archive does not yet exists it
-  is created.
-  The $p_filelist parameter can be an array of string, each string
-  representing a filename or a directory name with their path if
-  needed. It can also be a single string with names separated by a
-  single blank. 
-  The path indicated in $p_remove_dir will be removed from the
-  memorized path of each file / directory listed when this path
-  exists. By default nothing is removed (empty path "") 
-  The path indicated in $p_add_dir will be added at the beginning of
-  the memorized path of each file / directory listed. However it can
-  be set to empty "". The adding of a path is done after the removing
-  of path. 
-  The path add/remove ability enables the user to prepare an archive
-  for extraction in a different path than the origin files are. 
-  If a file/dir is already in the archive it will only be added at the
-  end of the archive. There is no update of the existing archived
-  file/dir. However while extracting the archive, the last file will
-  replace the first one. This results in a none optimization of the
-  archive size. 
-  If a file/dir does not exist the file/dir is ignored. However an
-  error text is send to PEAR error. 
-  If a file/dir is not readable the file/dir is ignored. However an
-  error text is send to PEAR error. 
-  If the resulting filename/dirname (after the add/remove option or
-  not) string is greater than 99 char, the file/dir is
-  ignored. However an error text is send to PEAR error. 
-Arguments :
-  $p_filelist : An array of filenames and directory names, or a single
-                string with names separated by a single blank space. 
-  $p_add_dir : A string which contains a path to be added to the
-               memorized path of each element in the list. 
-  $p_remove_dir : A string which contains a path to be removed from
-                  the memorized path of each element in the list, when
-		  relevant.
-Return value :
-  true on success, false on error.
-Sample 1 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  [...]
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/"; (Optional '/' at the end)
-  $v_list[2]="log/file.log";
-  $tar_object->addModify($v_list, "install");
-  // files are stored in the archive as :
-  //   install/file.txt
-  //   install/data
-  //   install/data/file1.txt
-  //   install/data/... all the files and sub-dirs of data/
-  //   install/file.log
-Sample 2 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  [...]
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/"; (Optional '/' at the end)
-  $v_list[2]="log/file.log";
-  $tar_object->addModify($v_list, "install", "dev");
-  // files are stored in the archive as :
-  //   install/file.txt
-  //   install/data
-  //   install/data/file1.txt
-  //   install/data/... all the files and sub-dirs of data/
-  //   install/log/file.log
-How it works :
-  If the archive does not exists it create it and add the files.
-  If the archive does exists and is not compressed, it open it, jump
-  before the last empty 512 bytes block (tar footer) and add the files
-  at this point.
-  If the archive does exists and is compressed, a temporary copy file
-  is created. This temporary file is then 'gzip' read block by block
-  until the last empty block. The new files are then added in the
-  compressed file.
-  The adding of files is done by going through the file/dir list,
-  adding files per files, in a recursive way through the
-  directory. Each time a path need to be added/removed it is done
-  before writing the file header in the archive.
-
-Method : add($p_filelist)
-Description :
-  This method add the files / directories listed in $p_filelist at the
-  end of the existing archive. If the archive does not yet exists it
-  is created. 
-  The $p_filelist parameter can be an array of string, each string
-  representing a filename or a directory name with their path if
-  needed. It can also be a single string with names separated by a
-  single blank. 
-  See addModify() method for details and limitations.
-Arguments :
-  $p_filelist : An array of filenames and directory names, or a single
-  string with names separated by a single blank space. 
-Return value :
-  true on success, false on error.
-Sample 1 :
-  $tar_object = new Archive_Tar("tarname.tar");
-  [...]
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/"; (Optional '/' at the end)
-  $v_list[2]="log/file.log";
-  $tar_object->add($v_list);
-Sample 2 :
-  $tar_object = new Archive_Tar("tarname.tgz", true);
-  [...]
-  $v_list[0]="dev/file.txt";
-  $v_list[1]="dev/data/"; (Optional '/' at the end)
-  $v_list[2]="log/file.log";
-  $tar_object->add($v_list);
-How it works :
-  Simply call the addModify() method with the right parameters.
-
-Method : addString($p_filename, $p_string)
-Description :
-  This method add a single string as a file at the
-  end of the existing archive. If the archive does not yet exists it
-  is created.
-Arguments :
-  $p_filename : A string which contains the full filename path
-                that will be associated with the string.
-  $p_string :   The content of the file added in the archive.
-Return value :
-  true on success, false on error.
-Sample 1 :
-  $v_archive = & new Archive_Tar($p_filename);
-  $v_archive->setErrorHandling(PEAR_ERROR_PRINT);
-  $v_result = $v_archive->addString('data/test.txt', 'This is the text of the string');
-
-
-Method : extract($p_path = "")
-Description :
-  This method extract all the content of the archive in the directory
-  indicated by $p_path.If $p_path is optional, if not set the archive
-  is extracted in the current directory. 
-  While extracting a file, if the directory path does not exists it is
-  created. 
-  See extractModify() for details and limitations.
-Arguments :
-  $p_path : Optional path where the files/dir need to by extracted.
-Return value :
-  true on success, false on error.
-Sample :
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->extract();
-How it works :
-  Simply call the extractModify() method with appropriate parameters.
-
-Method : extractModify($p_path, $p_remove_path)
-Description :
-  This method extract all the content of the archive in the directory
-  indicated by $p_path. When relevant the memorized path of the
-  files/dir can be modified by removing the $p_remove_path path at the
-  beginning of the file/dir path. 
-  While extracting a file, if the directory path does not exists it is
-  created. 
-  While extracting a file, if the file already exists it is replaced
-  without looking for last modification date. 
-  While extracting a file, if the file already exists and is write
-  protected, the extraction is aborted. 
-  While extracting a file, if a directory with the same name already
-  exists, the extraction is aborted. 
-  While extracting a directory, if a file with the same name already
-  exists, the extraction is aborted. 
-  While extracting a file/directory if the destination directory exist
-  and is write protected, or does not exist but can not be created,
-  the extraction is aborted. 
-  If after extraction an extracted file does not show the correct
-  stored file size, the extraction is aborted. 
-  When the extraction is aborted, a PEAR error text is set and false
-  is returned. However the result can be a partial extraction that may
-  need to be manually cleaned. 
-Arguments :
-  $p_path : The path of the directory where the files/dir need to by
-            extracted. 
-  $p_remove_path : Part of the memorized path that can be removed if
-                   present at the beginning of the file/dir path. 
-Return value :
-  true on success, false on error.
-Sample :
-  // Imagine tarname.tar with files :
-  //   dev/data/file.txt
-  //   dev/data/log.txt
-  //   readme.txt
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->extractModify("install", "dev");
-  // Files will be extracted there :
-  //   install/data/file.txt
-  //   install/data/log.txt
-  //   install/readme.txt
-How it works :
-  Open the archive and call a more generic function that can extract
-  only a part of the archive or all the archive. 
-  See extractList() method for more details.
-
-Method : extractInString($p_filename)
-Description :
-  This method extract from the archive one file identified by $p_filename.
-  The return value is a string with the file content, or NULL on error. 
-Arguments :
-  $p_filename : The path of the file to extract in a string. 
-Return value :
-  a string with the file content or NULL.
-Sample :
-  // Imagine tarname.tar with files :
-  //   dev/data/file.txt
-  //   dev/data/log.txt
-  //   dev/readme.txt
-  $v_archive = & new Archive_Tar('tarname.tar');
-  $v_archive->setErrorHandling(PEAR_ERROR_PRINT);
-  $v_string = $v_archive->extractInString('dev/readme.txt');
-  echo $v_string;
-
-Method : listContent()
-Description :
-  This method returns an array of arrays that describe each
-  file/directory present in the archive. 
-  The array is not sorted, so it show the position of the file in the
-  archive. 
-  The file informations are :
-    $file[filename] : Name and path of the file/dir.
-    $file[mode] : File permissions (result of fileperms())
-    $file[uid] : user id
-    $file[gid] : group id
-    $file[size] : filesize
-    $file[mtime] : Last modification time (result of filemtime())
-    $file[typeflag] : "" for file, "5" for directory
-Arguments :
-Return value :
-  An array of arrays or 0 on error.
-Sample :
-  $tar_object = new Archive_Tar("tarname.tar");
-  if (($v_list  =  $tar_object->listContent()) != 0)
-    for ($i=0; $i<sizeof($v_list); $i++)
-    {
-      echo "Filename :'".$v_list[$i][filename]."'<br>";
-      echo " .size :'".$v_list[$i][size]."'<br>";
-      echo " .mtime :'".$v_list[$i][mtime]."' (".
-           date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
-      echo " .mode :'".$v_list[$i][mode]."'<br>";
-      echo " .uid :'".$v_list[$i][uid]."'<br>";
-      echo " .gid :'".$v_list[$i][gid]."'<br>";
-      echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
-    }
-How it works :
-  Call the same function as an extract however with a flag to only go
-  through the archive without extracting the files. 
-
-Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
-Description :
-  This method extract from the archive only the files indicated in the
-  $p_filelist. These files are extracted in the current directory or
-  in the directory indicated by the optional $p_path parameter. 
-  If indicated the $p_remove_path can be used in the same way as it is
-  used in extractModify() method. 
-Arguments :
-  $p_filelist : An array of filenames and directory names, or a single
-                string with names separated by a single blank space. 
-  $p_path : The path of the directory where the files/dir need to by
-            extracted. 
-  $p_remove_path : Part of the memorized path that can be removed if
-                   present at the beginning of the file/dir path. 
-Return value :
-  true on success, false on error.
-Sample :
-  // Imagine tarname.tar with files :
-  //   dev/data/file.txt
-  //   dev/data/log.txt
-  //   readme.txt
-  $tar_object = new Archive_Tar("tarname.tar");
-  $tar_object->extractList("dev/data/file.txt readme.txt", "install",
-                           "dev");
-  // Files will be extracted there :
-  //   install/data/file.txt
-  //   install/readme.txt
-How it works :
-  Go through the archive and extract only the files present in the
-  list. 
-
diff --git a/lib/docs/DB/doc/IDEAS b/lib/docs/DB/doc/IDEAS
deleted file mode 100644
index afa661a309570b90d2423eac3b149b4ee8df574f..0000000000000000000000000000000000000000
--- a/lib/docs/DB/doc/IDEAS
+++ /dev/null
@@ -1,90 +0,0 @@
-Abstracted Types (Stig)
------------------------
-
-DB needs a set of types representing the most commonly used types in
-all backends.  This type set could also be geared towards integration
-with things like XML-RPC/SOAP implementations, HTML form classes, etc.
-
-Real Query Parser (Stig)
-------------------------
-
-With a real query parser, DB can implement more of its portability
-based on the query, instead of having support functions for
-everything.  One example would be LIMIT, another "INSERT
-... RETURNING".
-
-Portable transactions (Stig)
-----------------------------
-
-If DB can parse queries enough to determine what tables are affected
-by queries, it should be possible to make a replayable transaction
-log.  GNOME uses an XML format for configuration data that lets you
-checkpoint state once in a while, and revert to that state later.
-With a similar approach for transactions in DB we can implement
-portable transactions and checkpointing even for the databases that
-don't support them.
-
-
-Error reporting clean-up/debug (Tomas)
--------------------------------------
-Now each driver has its own raiseError method, common has a raiseError and
-DB has a DB_error class and its own isError() method. This error stuff 
-overhead could be simplified with only one raiseError, droping the DB Error
-class and also the DB::isError() (use the PEAR.php ones instead).
-Other idea could be to add a system for allowing people access to all the
-queries sended by PEAR DB to the backend. Also a new PEAR_ERROR_DEBUG
-flag that automatically (show|triggers) debug info, perhaps
-with a new PEAR_(Warning|Debug) object.
-
-Quote clean-up (Stig)
----------------------
-1. Keep quote and quoteString, but move quoting of strings back into
-   quoteString and make quote call it for strings.
-
-2. Add an optional "operator" parameter to quote that is one of "=",
-   "<", ">" or "<>" that will be inserted in front of the quoted value
-   unless it is NULL, in which case it will be converted to "IS" (for
-   "=") or "IS NOT" (for the others).
-
-Auto free statements (Tomas)
-----------------------------
-By setting a param in query() or for the hole DB instance, PEAR DB
-could auto-free results in DB_result->fetch(Into|Row) when the driver
-returns false.
-
-Datatypes in prepare syntax (Tomas)
------------------------------------
-Extend the actual prepare/execute placeholders to support data types, both
-to check the data introduced to the query and to "cast" the result
-to native php data types. Ex:
-
-$sql = "INSERT INTO table VALUES ({{int(4)}}, {{bool}}, {{date('Y-m-d')}})";
-$row = $db->query($sql, array(8, 't', '2001-04-1'));
-
-Format: {{<data_type>(<param1>,<param2>)}}
-
-"param" could be the max lenght of the data, date formats, not_null
-checks or default values.
-
-Other ideas could be:
-
-1)
-$sql = "INSERT INTO table VALUES (?, ?, ?)";
-$sth = $db->prepare($sql, array('int(4)', 'bool', 'date');
-$res = $db->execute($sth, array($a, $b, $c);
-
-2)
-$sql = "INSERT INTO table VALUES (?, ?, ?)";
-$params = array(
-	0 => array($a, 'int(4)'),
-	1 => array($b, 'bool')
-);
-$res = $db->query($sql, $params);
-
-Auto connect feature (Tomas)
-----------------------------
-Add the ability to create for example a light and dump DB object which
-will only set up the connection when needed. With that people could
-create the DB object in a common prepend or default file without the
-need to waste system resources if the use of the database is finally
-not needed.
diff --git a/lib/docs/DB/doc/MAINTAINERS b/lib/docs/DB/doc/MAINTAINERS
deleted file mode 100644
index 750f6275f0a21e8240a2ff5ceba6d473c32e0cc3..0000000000000000000000000000000000000000
--- a/lib/docs/DB/doc/MAINTAINERS
+++ /dev/null
@@ -1,16 +0,0 @@
-Maintainers for DB database backends/drivers:
-
-dbase   : Daniel Convissor <danielc@php.net>
-fbsql   : Daniel Convissor <danielc@php.net>
-          Frank M. Kromann <frank@kromann.info>
-ibase   : Daniel Convissor <danielc@php.net>
-ifx     : Daniel Convissor <danielc@php.net>
-msql    : Daniel Convissor <danielc@php.net>
-mssql   : Daniel Convissor <danielc@php.net>
-mysql   : Daniel Convissor <danielc@php.net>
-mysqli  : Daniel Convissor <danielc@php.net>
-oci8    : Daniel Convissor <danielc@php.net>
-odbc    : Daniel Convissor <danielc@php.net>
-pgsql   : Daniel Convissor <danielc@php.net>
-sqlite  : Daniel Convissor <danielc@php.net>
-sybase  : Daniel Convissor <danielc@php.net>
diff --git a/lib/docs/DB/doc/STATUS b/lib/docs/DB/doc/STATUS
deleted file mode 100644
index cabaeef5631a55b60f95558db26eec4871f5b838..0000000000000000000000000000000000000000
--- a/lib/docs/DB/doc/STATUS
+++ /dev/null
@@ -1,93 +0,0 @@
-STATUS OF THE PEAR DB PACKAGE
-=============================
-
-$Id: STATUS,v 1.33 2005/02/22 15:45:36 danielc Exp $
-------------------------------------------------------------------------
-
-DB Driver Feature Matrix
-------------------------
-Symbols:
-  x  =  implemented, but without tests
-  t  =  implemented, but one or more tests fail
-  T  =  implemented, passing all tests
-  e  =  emulated, without tests
-  l  =  emulated, but one or more tests fail
-  E  =  emulated, passing all tests
-  n  =  returns "not capable"
-  -  =  no implementation of this feature or status unknown
-
-                    fbsql      ifx      mssql     mysqli     odbc     sqlite
-FEATURE        dbase  |  ibase  |  msql   |  mysql  |   oci8  |  pgsql  |  sybase
-simpleQuery      -    T    T    T    T    T    T    T    T    T    T    T    T
-numCols          x    T    T    T    T    T    T    T    T    T    T    T    T
-numRows          x    T    E    E    T    T    T    T    E    T    T    T    T
-errorNative      n    T    T    T    T    T    T    T    T    T    T    E    T
-prepare/execute  e    E    T    E    E    E    E    E    T    E    E    E    E
-sequences        n    T    T    n    T    T    T    T    T    E    T    E    T
-affectedRows     n    T    E    E    T    T    T    T    T    T    E    T    T
-fetch modes      x    T    T    T    T    T    T    T    T    T    T    T    T
-fetch row by no  x    x    n    n    x    x    x    x    n    x    x    x    x
-transactions     -    T    T    T    n    T    T    T    T    T    T    n    T
-auto-commit      n    T    E    E    n    E    E    E    E    T    E    n    E
-error mapping    -    T    T    T    T    T    T    T    T    T    T    T    T
-tableInfo        x    T    T    t    T    T    T    T    T    T    T    T    T
-
-getListOf() TYPES
-tables           -    T    T    T    T    T    T    T    T    T    T    T    T
-views            -    T    T    -    -    T    -    -    -    T    T    -    T
-users            -    T    T    -    -    -    T    T    -    -    T    -    -
-databases        -    -    -    -    T    -    T    T    -    T    T    -    -
-functions        -    T    -    -    -    -    -    -    -    -    T    -    -
-synonyms         -    -    -    -    -    -    -    -    T    -    -    -    -
-
-
-Test Conformance
-----------------
-Symbols:
-    o  =  Test passed
-    X  =  Test failed
-    L  =  Some portions of the test failed due to limitations in PHP or DBMS
-    n  =  Test returns "not capable"
-    -  =  Not tested
-
-                    fbsql      ifx      mssql     mysqli     odbc     sqlite
-               dbase  |  ibase  |  msql   |  mysql  |   oci8  |  pgsql  |  sybase
-01connect        o    o    o    o    o    o    o    o    o    o    o    o    o
-02fetch          -    o    o    o    o    o    o    o    o    o    o    o    o
-03simplequery    -    o    o    o    o    o    o    o    o    o    o    o    o
-04numcols        -    o    o    o    o    o    o    o    o    o    o    o    o
-05sequences      -    o    o    o    o    o    o    o    o    o    o    o    o
-06prepexec       -    o    o    o    L    o    o    o    o    o    o    o    o
-08affectedrows   -    o    o    o    o    o    o    o    o    o    o    o    o
-09numrows        -    o    o    o    o    o    o    o    o    o    o    o    o
-10errormap       -    o    o    o    o    o    o    o    o    o    o    o    o
-11transactions   -    o    o    o    n    o    o    o    o    o    o    n    o
-13limit          -    o    o    o    o    o    o    o    o    o    o    o    o
-14fetchmode_obje -    o    o    o    o    o    o    o    o    o    o    o    o
-15quote          -    o    o    o    o    o    o    o    o    o    o    o    o
-16tableinfo      -    o    o    L    o    o    o    o    o    o    o    o    o
-17query          -    o    o    o    o    o    o    o    o    o    o    o    o
-18get            -    o    o    o    o    o    o    o    o    o    o    o    o
-19getlistof      -    o    o    o    o    o    o    o    o    o    o    o    o
-
-
-DBMS Versions Tested
---------------------
-dbase   n/a
-fbsql   4.1.6
-ibase   Firebird 1.5.1  (PHP 5 only)
-ifx     7.2 Standard Edtition
-msql    3.6  (PHP snapshots dated 2005-02-18)
-mssql   8.0.760
-mysql   4.0.21
-mysqli  4.1.5  (PHP 5 only)
-oci8    9.2
-odbc    DB2 ESE 8.1 and MS Access 2000
-pgsql   7.4.1 and 8.0.1
-sqlite  PHP 5: extension.  PHP 4: PECL snapshot.
-sybase  ASE 12.5.3
-
-Tests were performed under both of the following PHP versions
-unles otherwise noted:
-    4.3.11-dev dated 2005-02-22
-    5.1.0-dev dated 2005-02-22
diff --git a/lib/docs/DB/doc/TESTERS b/lib/docs/DB/doc/TESTERS
deleted file mode 100644
index 0eb4b20f78918dc258111548c932033bb2f9da68..0000000000000000000000000000000000000000
--- a/lib/docs/DB/doc/TESTERS
+++ /dev/null
@@ -1,156 +0,0 @@
-===================
-HOW TO TEST PEAR DB
-===================
-
-$Id: TESTERS,v 1.20 2005/02/16 06:33:12 danielc Exp $
-
-
-INTRODUCTION
-============
-
-These are instructions for testing PEAR DB on a Windows machine using a
-Cygwin Bash shell.  Adjust the paths and commands to match your system.
-This configuration is used because these precise steps are known to work.
-
-NOTE:  You must log on as a user which has permissions to modify the
-contents of your PHP executable's directory.  This is necessary for both
-configuring AND running the test system.
-
-
-INSTALLATION
-============
-
-Obtain PHP's Test Framework
----------------------------
-If you don't have PHP's test framework, you need to obtain it.  These
-steps include changing the working directory, downloading run-tests.php
-via CVS and copying the file into place.  Change the revision flag in the
-CVS command as appropriate for your present version of PHP.
-
- cd c:/progra~1/php
- cvs -d :pserver:cvsread@cvs.php.net:/repository login   # password is phpfi
- cvs -d :pserver:cvsread@cvs.php.net:/repository co -r PHP_4_3 \
-     -d test php-src/run-tests.php
- cp test/run-tests.php .
- rm -rf test
-
-
-Obtain DB and its Test Framework
---------------------------------
-* IF PEAR DB IS ALREADY INSTALLED:
-
-  If you have PEAR DB installed already, good.  The test suite
-  is in place.  Open up a command/shell prompt and move into
-  the test directory.
-
-   cd <path to pear insall>/tests/DB/tests
-
-* VIA A NEW INSTALLATION USING THE PEAR INSTALLER:
-
-  Installing PEAR has gotten fairly easy.  Follow the instructions
-  from the manual:  http://pear.php.net/manual/en/installation.php
-  Once PEAR and DB are installed, move to the test directory.
-
-   cd pear/tests/DB/tests
-
-* VIA CVS:
-
-  Create a location to store the test installation of DB and its
-  test scripts.
-
-   mkdir d:/peartest
-   cd d:/peartest
-   cvs -d :pserver:cvsread@cvs.php.net:/repository co -P pear/DB
-
-  We assume you already have the PEAR base package installed.  If
-  you don't, you will need to do so, but the instructions for
-  doing that are beyond the scope of this document.  See
-  http://pear.php.net/manual/en/installation.php for more info.
-
-  Move to the test directory.
-
-   cd pear/DB/tests
-
-
-Copy the Starter Shell Script and Edit the Paths
-------------------------------------------------
-To make starting up each test run easier, we have included two shell
-scripts.  The original files are named "run.cvs".  They need to be
-renamed to "run" so CVS won't bother you with tracking them.  Then,
-the paths and file names in them need to be set to those used by
-your system.
-
- cp run.cvs run
- chmod 755 run
- vi run
-
- cd driver
- cp run.cvs run
- chmod 755 run
- vi run
-
-
-Copy the Setup File and Edit the DSN's
---------------------------------------
-The test suite contains a file that stores the DSN's needed to
-connect to your database.  The original file is "setup.inc.cvs"
-and it needs to be renamed "setup.inc" so CVS won't track it.
-Then you'll need to edit the DSN's in it.
-
- cp setup.inc.cvs setup.inc
- vi setup.inc
-
-
-RUN THE TESTS
-=============
-
-To run all tests:  ./run
-To run one test:   ./run <test file name>
-Example:           ./run db_parsedsn.phpt
-
-
-Test Types and Locations
-------------------------
-tests             Common PEAR DB tests
-tests/driver      Common tests for all the drivers
-
-
-Results and What To Do With Them
---------------------------------
-Each test that fails generates a .php (which you can execute), a .exp
-(the expected output), a .out (the test output) and a .diff (a diff -u
-from the .exp and .out files).
-
-If you run the tests, please report or fill the TEST CONFORMANCE table
-in the STATUS document.  Before any commit to CVS be sure to run the
-tests and nothing got broken with the change.
-
-If you get the message "SKIP", means that the test it's not executed.
-Look at the DB/tests/driver/skipif.inc to see what's the problem
-(probably a connection problem).
-
-
-DB TESTER MATRIX
-================
-                                fbsql    ifx    mssql   mysqli   odbc   sqlite
-TESTER                      dbase | ibase |  msql | mysql |  oci8 | pgsql | sybase
-John Horton                   -   -   -   X   -   -   -   -   -   -   -   -   -
-Tim Zickus                    -   -   -   -   -   -   -   -   X   -   -   -   -
-Tim Parkin                    -   -   -   -   -   -   -   -   X   -   -   -   -
-Paul Gardiner                 -   -   -   X   -   -   -   -   -   -   -   -   -
-peterwb@iafrica.com           -   -   -   X   -   -   -   -   -   -   -   -   -
-Daniel, Adam                  -   -   -   -   -   -   -   -   X   -   -   -   -
-szii@sziisoft.com             -   -   -   -   -   -   -   -   -   X�  -   -   -
-jmh3@linuxfreak.com           -   -   -   -   -   -   -   -   -   -   X   -   -
-Kevin Henrikson               -   -   -   -   -   -   -   -   X   -   -   -   -
-Stig Bakken                   -   -   -   -   -   -   X   -   -   -   X   -   -
-Chuck Hagenbuch               -   -   -   -   -   X   -   -   -   -   -   -   -
-Ludovico Magnocavallo         -   -   X   -   -   -   -   -   -   -   -   -   -
-Daniel Convissor              X   X   X   -   X   X   X   X   X   X�  X   X   X
-
-MISSING TESTERS               -   -   -   -   -   -   -   -   -   -   -   -   -
-
-Comments:
-
-[1]: ODBC using IBM DB2
-[2]: ODBC using IBM DB2 and MS Access
diff --git a/lib/docs/DB_DataObject/DB/docs/example.ini b/lib/docs/DB_DataObject/DB/docs/example.ini
deleted file mode 100644
index f1a523bd13458915cf56dbc690edc7d1b8dc9f9b..0000000000000000000000000000000000000000
--- a/lib/docs/DB_DataObject/DB/docs/example.ini
+++ /dev/null
@@ -1,201 +0,0 @@
-; Example INI File
-
-[DB]
-
-
-;portability = 15
-                ; if you are working with oracle (or plan to) - this will do things
-                ; like force lowercase table names (see the PEAR DB manual
-
-[DB_DataObject]
-
-database        = mysql://username:password@localhost/database
-                ; the default database dsn see pear spec for more details
-
- 
-
-schema_location = /home/me/Projects/myapplication/DataObjects
-                ;directory where the database ini files are..
-
-; ini_{databaseName} = /path/to/ini/file.ini:/path/to_another_ini/file.ini
-                ; you can also configure manually the ini_file location 
-                ; (and the links is expected to be in the
-                ; same location) for each database by using the syntax
-                ; use a PATH_SEPERATOR to load multiple files.
-                ; BEST USED WITH database_{databasename}  = dsn...
-
-
-; links_{databaseName} = /path/to/databases/links.ini
-                ; allows you to specify a specific links.ini file for a database
-                ; or project.
-
-class_location  = /home/me/Projects/myapplication/DataObjects
-                ; directory where the Table classes are..
-		; you can also use the format
-		; /home/me/Projects/myapplication/DataObjects_%s.php
-		; and %s gets replaced with the tablename.
-		; to use multiple search paths use the PATH_SEPERATOR
-
-require_prefix  = DataObjects/
-                ;  prefix for the 'require statement'
-
-class_prefix    = DataObjects_
-                ; Prefix Mapping of table name to PHP Class
-		; to use multiple prefixes seperate them with PATH_SEPERATOR
-
-;table_example   = example
-                ; use database example for table example
-
-;database_example = mysql://username:password@host/database
-                ; use this dsn for database example
-
-
-;db_driver = DB
-		; can be set to MDB2 or DB 
-		; uses MDB2 backend rather than PEAR DB
-		
-
-		
-;disable_null_strings = false
-		; DataObjects will convert the text value 'null' to NULL when building queries
-		; this may cause problems! Setting to true will turn off this feature.
-		; you can use DB_DataObject_Cast::SQL('NULL'); in where you have to turn this off.
-		; 
-		; can also be set to 'full' however - this may delete data quietly if properties are 
-		; not fetched and are set *** Highly recommended not to use this..
-
-; the generator settings (optional)
-
-;extends_location =      
-                ; string added to php file for 'include('DB/DataObject');'
-                ; usefull if you want to add an extra layer - eg. a table level auth scheme..
-                ; optional    :: default = DB/DataObject.php
-
-
-;extends =           
-                ; string used in Table_XXX extends YYYY {
-                ; usefull if you want to add an extra layer - eg. a table level auth scheme..
-                ; optional    :: default = DB_DataObject
-
-;generator_class_rewrite = 
-
-                ; alter the extends field when updating a class (defaults to only replacing DB_DataObject)
-                ; use ANY to will replace all extends with either DB_DataObject or the value of extends (above)
-                ; use specific_name to replace 'specific_name'  with either DB_DataObject or the value of extends (above)
-    
-
-
-;generator_novars = 
-                ; (True) prevents writing of private/var's so you can overload get/set 
-                ; note: this has the downside of making code less clear... (alot of magic!!)
-
-;generator_var_keyword = 'var'
-                ; var|public  - (or private if you want to break things)
-		; The variable prefix that is used when class properties are created
-		; the default is public for PHP5, and var for PHP4
-		
-
-;generator_add_validate_stubs =
-		; (True) will insert / (or add to existing files) stubs for validate methods
-		
-;generator_no_ini = 
-		; (True) will generate the methods table() ,keys(), sequenceKeys() and defaults()
-		; methods in the generated classes 
-		; and not generate any ini file to describe the table.
-
-;generator_add_defaults = 
-		; (True) will generate defaults() method in generated classes
-		; returning an array of the defaults column values for the table.
-
-;generator_omit_database_var
-		; (false) will prevent generation of $database line in generated files
-		
-		
-;generate_links = false
-		; (true) will create the links.ini from the table definition
-		; Only available with mysql / mysqli at present.
-
-;generate_setters = false
-		; (true) will generate setXXXX() methods for you.
-		
-
-;generate_getters = false
-		; (true) will generate getXXXX() methods for you.
-		
-
-		
-		
-		
-		
-debug = 0
-                ; default debugging level 
-
-debug_ignore_updates = 0
-                ; behaviour changed in > 0.10 so that you have to manually turn of updates
-                ; rather than it automatically being done by setting debug to  > 1
-
-
-dont_die = 0
-                ; if you set this to true or 1, then dataobjects will not die
-                ; on major errors like database connection etc. or programming errors
-                ; - you probably want to do this on a live server - and 
-                ; write a pear error handler.. - to send you an email!
-
-;quote_identifiers = 0
-                ; Quote table and column names when building queries - this relies on the 
-                ; quoteIdentifier method being available in PEAR::DB (it should be introduced in 1.5 final or 1.6)
-
-;quote_identifiers_tableinfo = 0
-                ; Quote table and column names when generator sends tableinfo to request schema
-                ; Note - this can be on for most databases, but must be off for Oracle (see bug #10112)
-
-
-;keep_query_after_fetch = 0
-                ; From 1.4 on the query building will be cleared after a fetch(1.5), or find(1.4)
-                ; To disable this behavior set this to 1
-
-
-
-
-dont_use_pear_sequences = 0
-                ; If a table does not have a Native (autoincrement etc.) - and it has a primary
-                ; key, it is assumed that the table should use pear's getNextID to 
-                ; emulate sequences.. - if this is not required set this to 1
-
-
-;generator_include_regex = /^FOO_.*/i
-;generator_exclude_regex = /^tmp_.*/i
-                ; include and exclude tables from being read by the generator
-
-build_views = 0
-                ;for postgres, you can build dataobjects for views as well 
-                ; I believe it postgres also supports updating on views (nice feature)
-                ; *** NOTE *** You will have to manually define keys() / sequenceKeys()
-                ; As the generator can not recognize these automatically 
-                
-
-;generator_strip_schema = 1
-		; postgres has a wierd concept of schema's which end up prefixed to
-		; the list of tables. - this makes a mess of class/schema generation
-		; setting this to 1, makes the generator strip the schema from the table name.
-
-;generator_secondary_key_match = primary|unique
-		; set to false to prevent generation of any unique or primary keys that are not autoincrement/nextval()
-		
-		
-; ---------- DEPRECIATED --------------
-
-
-;ignore_sequence_keys = 
-                ; THIS IS DEPRECIATED NOW - define the method sequenceKey() to return array(false,false)
-                ; to stop useage of sequence keys.
-                ; see sequenceKey Manual page for more details.
-
-
-;sequence_{tablename} = {column}
-                ; THIS IS DEPRECIATED NOW - define the method sequenceKey() to return array(false,false)
-                ; specify which column is autoincremented/nextval'd
-;sequence_{tablename} = {column}:{sequence_name}
-                ; THIS IS DEPRECIATED NOW - define the method sequenceKey() to return array(false,false)
-                ; specify which column is nextval'd, and the sequence name to use for the column.
-
diff --git a/lib/docs/Date/docs/LICENSE b/lib/docs/Date/docs/LICENSE
deleted file mode 100644
index 8aea43fa213e64656ec437ed7c5f46bc4d1aae04..0000000000000000000000000000000000000000
--- a/lib/docs/Date/docs/LICENSE
+++ /dev/null
@@ -1,30 +0,0 @@
-Copyright (c) 1997-2006 Baba Buehler, Pierre-Alain Joye
-All rights reserved
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in
-   the documentation and/or other materials provided with the
-   distribution.
-3. The names of Baba Buehler, Pierre-Alain Joye nor the names of
-   contributors may not be used to endorse or promote products
-   derived from this software without specific prior written
-   permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/lib/docs/Date/docs/TODO b/lib/docs/Date/docs/TODO
deleted file mode 100644
index 60de52e86ccf73c879473839f0178ae39312e2a0..0000000000000000000000000000000000000000
--- a/lib/docs/Date/docs/TODO
+++ /dev/null
@@ -1,12 +0,0 @@
-$Id: TODO,v 1.1 2006/11/21 05:40:20 firman Exp $
-
-TODO
-
-- Fix once the timezone problem
-- Once TZ works nicely, update the testunit_date and use
-  the real timezone and dct to check the expected time offset
-- Clean the test cases and atomic display instead of a global ok or failed
-- Write the docs....
-- More strict complaint againts ISO 8601
-- Complaint againts RFC 822 Date and Time Specification
-- Complaint againts ISO 3339
diff --git a/lib/docs/MDB2/docs/CONTRIBUTORS b/lib/docs/MDB2/docs/CONTRIBUTORS
deleted file mode 100644
index 27a5a16caa9018ef01c1858cc05a809d121b37c7..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/CONTRIBUTORS
+++ /dev/null
@@ -1,7 +0,0 @@
-PEAR DB                                     Stig Baekken, Tomas V. Cox
-Metabase                                    Manuel Lemos
-PEAR Error integration/XML Schema Parser    Christian Dickmann
-Code Formatting                             Brent Cook
-MsSQL/Frontbase Driver                      Frank Kormann
-PgSQL Driver                                Paul Cooper
-Interbase/Firebird                          Lorenzo Alberton
diff --git a/lib/docs/MDB2/docs/MAINTAINERS b/lib/docs/MDB2/docs/MAINTAINERS
deleted file mode 100644
index daabe6c451ac35856ae741bedef5c1b9cec1177f..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/MAINTAINERS
+++ /dev/null
@@ -1,11 +0,0 @@
-Maintainers for MDB2 database backends/drivers:
-
-ibase       : Lorenzo Alberton <l.alberton@quipo.it>
-mssql       : David Coallier <david@jaws.com.mx
-mysql       : Lukas Smith <smith@pooteeweet.org>
-mysqli      : Lukas Smith <smith@pooteeweet.org>
-oci8        : Lukas Smith <smith@pooteeweet.org>
-pgsql       : Lukas Smith <smith@pooteeweet.org>
-fbsql       : unmaintained
-sqlite      : Lukas Smith <smith@pooteeweet.org>
-querysim    : Lukas Smith <smith@pooteeweet.org>
diff --git a/lib/docs/MDB2/docs/README b/lib/docs/MDB2/docs/README
deleted file mode 100644
index 31dcc041f82f45eb8d52c4a26722f2a3ce8b276a..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/README
+++ /dev/null
@@ -1,183 +0,0 @@
-** Introduction:
-
-PEAR MDB2 is a project to merge PEAR DB and Metabase into one DB
-abstraction layer.
-
-You can get info on these at:
-  PEAR DB: http://pear.php.net
-  Metabase: http://phpclasses.upperdesign.com/browse.html/package/20/
-
-At these URLs you will also find the licensing information on these two
-projects along with the credits.
-
-Actually MDB2 is the second major version of MDB.
-The main differences between the new MDB2 and the old MDB version is
-that the API has been drastically refactored to clean up the API
-and improve performance.
-
-If you have any questions or suggestions you can contact me (Lukas Smith)
-at this email address:
-  smith@backendmedia.com
-Co-Author is Christopher Linn:
-  clinn@backendmedia.com
-
-Or even better post a message to pear-dev@lists.php.net mailinglist for
-development related questions of the MDB2 package itself. For questions
-using MDB2 pelase direct your questions at pear-general@lists.php.net.
-
-** Features
-
-MDB2 provides a common API for all support RDBMS. The main difference to most
-other DB abstraction packages is that MDB2 goes much further to ensure
-portability. Among other things MDB2 features:
-* An OO-style query API
-* A DSN (data source name) or array format for specifying database servers
-* Datatype abstraction and on demand datatype conversion
-* Portable error codes
-* Sequential and non sequential row fetching as well as bulk fetching
-* Ordered array and associative array for the fetched rows
-* Buffered and Unbuffered fetching
-* Prepare/execute (bind) emulation
-* Sequence emulation
-* Replace emulation
-* Limited Subselect emulation
-* Row limit support
-* Transactions support
-* Large Object support
-* Index/Unique support
-* Extension Framework to load advanced functionality on demand
-* Table information interface
-* RDBMS management methods (creating, dropping, altering)
-* RDBMS independent xml based schema definition management
-* Altering of a DB from a changed xml schema
-* Reverse engineering of xml schemas from an existing DB (currently MySQL and PgSQl)
-* Full integration into the PEAR Framework
-* PHPDoc API documentation
-
-** Getting started:
-
-I would first recommend taking a look at example.php.
-This should give you a general feel of how to interact with MDB2.
-
-After that you may want to take a look at the rather large API
-at www.backendmedia.com/MDB2/docs. There you will also find a document
-describing the xml schema format and a little tutorial (it was
-just recently ported from Metabase, so it may contain errors).
-
-** Current State:
-
-The current release can be found at the PEAR webpage:
-  http://pear.php.net/package-info.php?package=MDB2
-
-** Package Content:
-
-As a user the only php script you will need to include is MDB2.php which will
-install to your PEAR root directory. All other files and their containing
-classes will be included via MDB2::factory(), MDB2::connect(), MDB2::singleton().
-
-These will load additional classes. Most classes are loaded on demand.
-
-Furthermore MDB2 provides an extensive testing framework that works through a
-browser and command line interface. There are several other test that test the
-two wrappers. These files will install into your test dir found in the
-PEAR root dir.
-
-** Documentation:
-
-You can find the still incomplete documentation for MDB2 here:
-http://pear.php.net/manual/en/package.database.mdb2.php
-
-PHPDoc generated documentation can be found at:
-http://www.backendmedia.com/MDB2/docs/
-
-The entire "public" API and most of the "private" methods (except for some of
-the lob classes) have been documented with PHPDoc comments. Most of the API
-is borrowed from extPDO, so you can look there for detailed documentation.
-Since there are a large number of new methods available thanks to the Metabase
-heritage of MDB2 you will also have to take a look in the Metabase documentation
-(which can be found at the URL mentioned above, but does require that
-you register with phpclasses). Most of these Metabase functions have
-been renamed and changed considerably. The main things left are the datatypes
-and the manager module.
-
-For example ($db being an MDB2 object):
-  $converted_value = MetabaseGetTimestampFieldValue($database, $value);
-would now be
-  $converted_value = $db->quote($value, 'timestamp');
-
-If you want to help out with documentation please email me.
-
-** Testing:
-
-For most of the tests you can set the username/password/hostname in the relevant
-config file. The user will need to have the right to create new databases.
-
-test.php/clitest.php/testchoose.php: Is the native testing suite provided by
-MDB2. Please see the README in the tests directory for details.
-
-example.php: Several test calls to MDB2's native API. It require PEAR::VAR_Dump
-package and are configured to use the following settings:
-username = metapear
-password = funky
-hostname = localhost
-
-** How to write new Drivers:
-
-Skeleton drivers are provided in the docs directory of the MDB2 package.
-
-The best course of action would be to take a MDB2 driver and hack it to fit
-the new RDBMS. This will surely be faster and it will ensure that the new
-driver takes full advantage of the MDB2 framework. I would however recommend
-working with the existing Metabase driver for inspiration that RDBMS when
-doing those changes.
-
-In order to check compliance of the driver with MDB2 you can use the testing
-suite (see the "testing" section above)
-
-** History
-
-MDB was started after Manuel broad be into the discussion about getting the
-features of Metabase into PEAR that was going on (again) in December 2001. He
-suggested that I could take on this project. After alot of discussion about
-how when and if etc I started development in February 2002.
-
-MDB is based on Metabase but has been reworked severely to better match
-the PEAR DB API and PEAR CS. The approach I have taken so far is to take DB.php
-from PEAR DB and make it create a Metabase object. I have changed the
-Metabase structure slightly. The formatting has been reworked
-considerably to better fit the final structure (MDB standalone with a
-BC-wrapper for Metabase and PEAR DB), to fit the PEAR CS and to make it
-easier for other people to contribute.
-
-The metabase_interface.php was been renamed to metabase_wrapper.php and
-now only serves as a wrapper to keep BC with Metabase. A wrapper will
-have to be created for PEAR DB as well.
-
-Basically the result is a Metabase that is really close to the PEAR DB
-structure. I have also added any missing methods from PEAR DB. Work on
-moving the error handling to PEAR error handling is under way but still
-needs some work.
-
-In MDB2 the API was heavily refactored to be even more streamlined. Redundant
-features have been removed. Some features where moved out of the core into
-separate loadable modules. Instead of resources resultsets are now wrapped
-into objects similar to PEAR DB.
-
-** Credits (never to early for those huh? :-)  ):
-
-I would especially like to thank Manuel Lemos (Author of Metabase) for
-getting me involved in this and generally being around to ask questions.
-I would also like to thank Tomas Cox and Stig S. Bakken from the PEAR
-projects for help in undertstanding PEAR, solving problems and trusting
-me enough. Paul Cooper for the work on the pgsql driver. Furthermore I
-would like to thank Alex Black for being so enthusiastic about this
-project and offering binarycloud as a test bed for this project.
-Christian Dickmann for being the first to put MDB to some real use,
-making MDB use PEAR Error and working on the XML schema manager.
-
-Finally Peter Bowyer for starting the discussion that made people pick
-up this project again after the first versions of what was then called
-"metapear" have been ideling without much feedback. I guess I should
-also thank BackendMedia (my company :-)  ) for providing the necessary means
-to develop this on company time (actually for the most part my entire
-life is company time ... so it goes)
\ No newline at end of file
diff --git a/lib/docs/MDB2/docs/STATUS b/lib/docs/MDB2/docs/STATUS
deleted file mode 100644
index 1d8a1a960888f261b4c73c24b8d1bdc9108baeb8..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/STATUS
+++ /dev/null
@@ -1,50 +0,0 @@
-STATUS OF THE PEAR MDB2 PACKAGE
-=============================
-
-$Id: STATUS,v 1.15 2006/05/03 16:07:41 lsmith Exp $
-------------------------------------------------------------------------
-
-MDB2 Driver Feature Matrix
-------------------------
-Symbols:
-  x  =  implemented, but without tests
-  t  =  implemented, but one or more tests fail
-  T  =  implemented, passing all tests
-  e  =  emulated, without tests
-  l  =  emulated, but one or more tests fail
-  E  =  emulated, passing all tests
-  n  =  returns "not capable"
-  -  =  no implementation of this feature or status unknown
-
-                    fbsql     pgsql     mysqli    sqlite
-FEATURE        ibase  |  oci8  |  mysql  |  mssql  | querysim
-
-
-
-Test Conformance
-----------------
-Symbols:
-    o  =  Test passed
-    X  =  Test failed
-    L  =  Some portions of the test failed due to limitations in PHP or DBMS
-    n  =  Test returns "not capable"
-    -  =  Not tested
-
-                    fbsql     pgsql     mysqli    sqlite
-TEST           ibase  |  oci8  |  mysql  |  mssql  | querysim
-
-
-DBMS Versions Tested
---------------------
-fbsql    
-ibase    
-mssql    
-mysql    
-mysqli   
-oci8     
-pgsql    
-sqlite   
-querysim 
-
-Tests were performed under both of the following PHP versions
-unles otherwise noted:
diff --git a/lib/docs/MDB2/docs/TODO b/lib/docs/MDB2/docs/TODO
deleted file mode 100644
index c9fc4bd9773b1bfb7cd73027ddab566801047b61..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/TODO
+++ /dev/null
@@ -1 +0,0 @@
-see http://oss.backendmedia.com/index.php?area=MDB2&page=ToDo
diff --git a/lib/docs/MDB2/docs/datatypes.html b/lib/docs/MDB2/docs/datatypes.html
deleted file mode 100644
index 22b1bdd4bc9ba2f7770125e22cf14a65c20f3acc..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/datatypes.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<html>
-<head>
-<title>MDB2 data types</title>
-</head>
-<body>
-<center><h1>MDB2 data types</h1></center>
-<hr />
-<ul>
-<p><b>Author:</b> Manuel Lemos (<a href="mailto:mlemos@acm.org">mlemos@acm.org</a>)</p>
-<p><b>Version control:</b> <tt>@(#) $Id: datatypes.html,v 1.1 2004/01/05 20:47:15 lsmith Exp $</tt></p>
-<h2>Contents</h2>
-<li><a href="#4.0">Introduction</a></li>
-<ul>
-<li><a href="#5.1.1">Text data type</a></li>
-<li><a href="#5.1.2">Boolean data type</a></li>
-<li><a href="#5.1.3">Integer data type</a></li>
-<li><a href="#5.1.4">Decimal data type</a></li>
-<li><a href="#5.1.5">Float data type</a></li>
-<li><a href="#5.1.6">Date data type</a></li>
-<li><a href="#5.1.7">Time data type</a></li>
-<li><a href="#5.1.8">Time stamp data type</a></li>
-<li><a href="#5.1.9">Large object (file) data types</a></li>
-</ul>
-</ul>
-</ul>
-<hr />
-<h1><a name="4.0">Introduction</a></h1>
-<p>All <i>DBMS</i> provide multiple choice of data types for the information that can be stored in their database table fields.  However, the set of data types made available varies from <i>DBMS</i> to <i>DBMS</i>.</p>
-<p>To simplify the interface with the <i>DBMS</i> supported by <b>MDB2</b> it was defined a base set of data types that applications may access independently of the underlying <i>DBMS</i>.</p>
-<p>The <b>MDB2</b> applications programming interface takes care of mapping data types when managing database options.  It is also able to convert that is sent to and received from the underlying <i>DBMS</i> using the respective driver.</p>
-<h2><li><a name="5.1.1">Text data type</a></li></h2>
-<p>The text data type is available with two options for the length: one that is explicitly length limited and another of undefined length that should be as large as the database allows.</p>
-<p>The length limited option is the most recommended for efficiency reasons.  The undefined length option allows very large fields but may prevent the use of indexes and may not allow sorting on fields of its type.</p>
-<p>The fields of this type should be able to handle 8 bit characters.  Drivers take care of <i>DBMS</i> specific escaping of characters of special meaning with the values of the strings to be converted to this type.</p>
-<h2><li><a name="5.1.2">Boolean data type</a></li></h2>
-<p>The boolean data type represents only two values that can be either <tt>1</tt> or <tt>0</tt>.  Do not assume that these data types are stored as integers because some <i>DBMS</i> drivers may implement this type with single character text fields for a matter of efficient.  Ternary logic is possible by using <tt>null</tt> as the third possible value that may be assigned to fields of this type.</p>
-<h2><li><a name="5.1.3">Integer data type</a></li></h2>
-<p>The integer data type may store integer values as large as each <i>DBMS</i> may handle.  Fields of this type may be created optionally as unsigned integers but not all <i>DBMS</i> support it.  Therefore, such option may be ignored.  Truly portable applications should not rely on the availability of this option.</p>
-<h2><li><a name="5.1.4">Decimal data type</a></li></h2>
-<p>The decimal data type may store decimal numbers accurately with a fixed number of decimal places.  This data type is suitable for representing accurate values like currency amounts.</p>
-<p>Some <i>DBMS</i> drivers may emulate the decimal data type using integers.  Such drivers need to know in advance how many decimal places that should be used to perform eventual scale conversion when storing and retrieving values from a database. Despite this, applications may use arithmetic expressions and functions with the values stored on decimal type fields as long as any constant values that are used in the expressions are also converted with the respective <b>MDB2</b> conversion functions.</p>
-<p>The number of places that are used to the left and the right of the decimal point is pre-determined and fixed for all decimal values stored in the same database.  By default, <b>MDB2</b> uses 2 places to the right of the decimal point, but this may be changed when setting the database connection.  The number of places available to the right of the decimal point depend on the <i>DBMS</i>.</p>
-<p>It is not recommended to change the number places used to represent decimal values in database after it is installed. <b>MDB2</b> does not keep track of changes in the number of decimal places.</p>
-<h2><li><a name="5.1.5">Float data type</a></li></h2>
-<p>The float data type may store floating point decimal numbers. This data type is suitable for representing numbers within a large scale range that do not require high accuracy.  The scale and the precision limits of the values that may be stored in a database depends on the <i>DBMS</i> that it is used.</p>
-<h2><li><a name="5.1.6">Date data type</a></li></h2>
-<p>The date data type may represent dates with year, month and day.  <i>DBMS</i> independent representation of dates is accomplished by using text strings formatted according to the <i>IS0 8601</i> standard.</p>
-<p>The format defined by the <i>ISO 8601</i> standard for dates is <tt>YYYY-MM-DD</tt> where <tt>YYYY</tt> is the number of the year (<i>Gregorian</i> calendar), <tt>MM</tt> is the number of the month from 1 to 12 and <tt>DD</tt> is the number of the day from 1 to 31.  Months or days numbered below 10 should be padded on the left with <tt>0</tt>.</p>
-<p>Some <i>DBMS</i> have native support for date formats, but for others the <i>DBMS</i> driver may have to represent them as integers or text values.  In any case, it is always possible to make comparisons between date values as well sort query results by fields of this type.</p>
-<h2><li><a name="5.1.7">Time data type</a></li></h2>
-<p>The time data type may represent the time of a given moment of the day.  <i>DBMS</i> independent representation of the time of the day is also accomplished by using text strings formatted according to the <i>IS0 8601</i> standard.</p>
-<p>The format defined by the <i>ISO 8601</i> standard for the time of the day is <tt>HH:MI:SS</tt> where <tt>HH</tt> is the number of hour the day from 0 to 23 and <tt>MI</tt> and <tt>SS</tt> are respectively the number of the minute and of the second from 0 to 59.  Hours, minutes and seconds numbered below 10 should be padded on the left with <tt>0</tt>.</p>
-<p>Some <i>DBMS</i> have native support for time of the day formats, but for others the <i>DBMS</i> driver may have to represent them as integers or text values.  In any case, it is always possible to make comparisons between time values as well sort query results by fields of this type.</p>
-<h2><li><a name="5.1.8">Time stamp data type</a></li></h2>
-<p>The time stamp data type is a mere combination of the date and the time of the day data types.  The representation of values of the time stamp type is accomplished by joining the date and time string values in a single string joined by a space.  Therefore, the format template is <tt>YYYY-MM-DD HH:MI:SS</tt>.  The represented values obey the same rules and ranges described for the date and time data types.</p>
-<h2><li><a name="5.1.9">Large object (file) data types</a></li></h2>
-<p>The large object data types are meant to store data of undefined length that may be to large to store in text fields, like data that is usually stored in files.</p>
-<p><b>MDB2</b> supports two types of large object fields: Character Large OBjects (<i>CLOBs</i>) and Binary Large OBjects (<i>BLOBs</i>). <i>CLOB</i> fields are meant to store only data made of printable <i>ASCII</i> characters. <i>BLOB</i> fields are meant to store all types of data.</p>
-<p>Large object fields are usually not meant to be used as parameters of query search clause (<tt>WHERE</tt>) unless the underlying <i>DBMS</i> supports a feature usually known as <i>&quot;full text search&quot;</i>.</p>
-</ul>
-<hr />
-<address>Manuel Lemos (<a href="mailto:mlemos@acm.org">mlemos@acm.org</a>)</address>
-</body>
-</html>
diff --git a/lib/docs/MDB2/docs/examples/example.php b/lib/docs/MDB2/docs/examples/example.php
deleted file mode 100644
index 97023e3a1fc068bd7c4d436480c55042fc51ec54..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/examples/example.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-
-    // $Id: example.php,v 1.24 2006/05/31 14:38:06 lsmith Exp $
-    //
-    // MDB2 and MDB2_Schema example script.
-    //
-
-    ini_set('include_path', '../..'.PATH_SEPARATOR.ini_get('include_path'));
-
-    // require the MDB2 code
-    require_once 'MDB2.php';
-
-    // define and set a PEAR error handler
-    // will be called whenever an unexpected PEAR_Error occurs
-    function handle_pear_error ($error_obj)
-    {
-        print '<pre><b>PEAR-Error</b><br />';
-        echo $error_obj->getMessage().': '.$error_obj->getUserinfo();
-        print '</pre>';
-    }
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error');
-
-    // just for kicks you can mess up this part to see some pear error handling
-    $user = 'root';
-    $pass = '';
-    $host = 'localhost';
-    $mdb2_name = 'metapear_test_db';
-    $mdb2_type = !empty($_GET['db_type']) ? $_GET['db_type'] : 'mysql';
-    echo($mdb2_type.'<br>');
-
-    // Data Source Name: This is the universal connection string
-    $dsn['username'] = $user;
-    $dsn['password'] = $pass;
-    $dsn['hostspec'] = $host;
-    $dsn['phptype'] = $mdb2_type;
-    // MDB2::factory will return a PEAR::MDB2 instance on success
-    // or a Pear MDB2 error object on error
-    // You can alternatively build a dsn here
-    // $dsn = "$mdb2_type://$user:$pass@$host/$mdb2_name";
-    Var_Dump($dsn);
-    $mdb2 =& MDB2::factory($dsn);
-    // With PEAR::isError you can differentiate between an error or
-    // a valid connection.
-    if (PEAR::isError($mdb2)) {
-        die (__LINE__.$mdb2->getMessage());
-    }
-
-    // this loads the MDB2_Schema manager
-    // this is a separate package you must install
-    require_once 'MDB2/Schema.php';
-    // you can either pass a dsn string, a dsn array or an exisiting mdb2 connection
-    $schema =& MDB2_Schema::factory($mdb2);
-    $input_file = 'metapear_test_db.schema';
-    // lets create the database using 'metapear_test_db.schema'
-    // if you have allready run this script you should have 'metapear_test_db.schema.before'
-    // in that case MDB2 will just compare the two schemas and make any
-    // necessary modifications to the existing database
-    Var_Dump($schema->updateDatabase($input_file, $input_file.'.before'));
-    echo('updating database from xml schema file<br>');
-
-    echo('switching to database: '.$mdb2_name.'<br>');
-    $mdb2->setDatabase($mdb2_name);
-    // happy query
-    $query ='SELECT * FROM test';
-    echo('query for the following examples:'.$query.'<br>');
-    // run the query and get a result handler
-    $result = $mdb2->query($query);
-    // lets just get row:0 and free the result
-    $array = $result->fetchRow();
-    $result->free();
-    echo('<br>row:<br>');
-    echo(Var_Dump($array).'<br>');
-    $result = $mdb2->query($query);
-    // lets just get row:0 and free the result
-    $array = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
-    $result->free();
-    echo('<br>row (object:<br>');
-    echo(Var_Dump($array).'<br>');
-    // run the query and get a result handler
-    $result = $mdb2->query($query);
-    // lets just get row:0 and free the result
-    $array = $result->fetchRow();
-    $result->free();
-    echo('<br>row from object:<br>');
-    echo(Var_Dump($array).'<br>');
-    // run the query and get a result handler
-    $result = $mdb2->query($query);
-    // lets just get column:0 and free the result
-    $array = $result->fetchCol(2);
-    $result->free();
-    echo('<br>get column #2 (counting from 0):<br>');
-    echo(Var_Dump($array).'<br>');
-    // run the query and get a result handler
-    $result = $mdb2->query($query);
-    Var_Dump($mdb2->loadModule('Reverse', null, true));
-    echo('tableInfo:<br>');
-    echo(Var_Dump($mdb2->reverse->tableInfo($result)).'<br>');
-    $types = array('integer', 'text', 'timestamp');
-    $result->setResultTypes($types);
-    $array = $result->fetchAll(MDB2_FETCHMODE_FLIPPED);
-    $result->free();
-    echo('<br>all with result set flipped:<br>');
-    echo(Var_Dump($array).'<br>');
-    // save some time with this function
-    // lets just get all and free the result
-    $array = $mdb2->queryAll($query);
-    echo('<br>all with just one call:<br>');
-    echo(Var_Dump($array).'<br>');
-    // run the query with the offset 1 and count 1 and get a result handler
-    Var_Dump($mdb2->loadModule('Extended', null, false));
-    $result = $mdb2->extended->limitQuery($query, null, 1, 1);
-    // lets just get everything but with an associative array and free the result
-    $array = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
-    echo('<br>associative array with offset 1 and count 1:<br>');
-    echo(Var_Dump($array).'<br>');
-    // lets create a sequence
-    echo(Var_Dump($mdb2->loadModule('Manager', null, true)));
-    echo('<br>create a new seq with start 3 name real_funky_id<br>');
-    $err = $mdb2->manager->createSequence('real_funky_id', 3);
-    if (PEAR::isError($err)) {
-            echo('<br>could not create sequence again<br>');
-    }
-    echo('<br>get the next id:<br>');
-    $value = $mdb2->nextId('real_funky_id');
-    echo($value.'<br>');
-    // lets try an prepare execute combo
-    $alldata = array(
-                     array(1, 'one', 'un'),
-                     array(2, 'two', 'deux'),
-                     array(3, 'three', 'trois'),
-                     array(4, 'four', 'quatre')
-    );
-    $stmt = $mdb2->prepare('INSERT INTO numbers VALUES(?,?,?)', array('integer', 'text', 'text'), MDB2_PREPARE_MANIP);
-    foreach ($alldata as $row) {
-        echo('running execute<br>');
-        $stmt->bindValueArray($row);
-        $stmt->execute();
-    }
-    $array = array(4);
-    echo('<br>see getOne in action:<br>');
-    echo(Var_Dump($mdb2->extended->getOne('SELECT trans_en FROM numbers WHERE number = ?',null,$array,array('integer'))).'<br>');
-    $mdb2->setFetchmode(MDB2_FETCHMODE_ASSOC);
-    echo('<br>default fetchmode ist now MDB2_FETCHMODE_ASSOC<br>');
-    echo('<br>see getRow in action:<br>');
-    echo(Var_Dump($mdb2->extended->getRow('SELECT * FROM numbers WHERE number = ?',array('integer','text','text'),$array, array('integer'))));
-    echo('default fetchmode ist now MDB2_FETCHMODE_ORDERED<br>');
-    $mdb2->setFetchmode(MDB2_FETCHMODE_ORDERED);
-    echo('<br>see getCol in action:<br>');
-    echo(Var_Dump($mdb2->extended->getCol('SELECT * FROM numbers WHERE number != ?',null,$array,array('integer'), 1)).'<br>');
-    echo('<br>see getAll in action:<br>');
-    echo(Var_Dump($mdb2->extended->getAll('SELECT * FROM test WHERE test_id != ?',array('integer','text','text'), $array, array('integer'))).'<br>');
-    echo('<br>see getAssoc in action:<br>');
-    echo(Var_Dump($mdb2->extended->getAssoc('SELECT * FROM test WHERE test_id != ?',array('integer','text','text'), $array, array('integer'), MDB2_FETCHMODE_ASSOC)).'<br>');
-    echo('tableInfo on a string:<br>');
-    echo(Var_Dump($mdb2->reverse->tableInfo('numbers')).'<br>');
-    echo('<br>just a simple update query:<br>');
-    echo('<br>affected rows:<br>');
-    echo(Var_Dump($mdb2->exec('UPDATE numbers set trans_en ='.$mdb2->quote(0, 'integer'))).'<br>');
-    // subselect test
-    $sub_select = $mdb2->subSelect('SELECT test_name from test WHERE test_name = '.$mdb2->quote('gummihuhn', 'text'), 'text');
-    echo(Var_Dump($sub_select).'<br>');
-    $query_with_subselect = 'SELECT * FROM test WHERE test_name IN ('.$sub_select.')';
-    // run the query and get a result handler
-    echo($query_with_subselect.'<br>');
-    $result = $mdb2->query($query_with_subselect);
-    $array = $result->fetchAll();
-    $result->free();
-    echo('<br>all with subselect:<br>');
-    echo('<br>drop index (will fail if the index was never created):<br>');
-    echo(Var_Dump($mdb2->manager->dropIndex('test', 'test_id_index')).'<br>');
-    $index_def = array(
-        'fields' => array(
-            'test_id' => array(
-                'sorting' => 'ascending'
-            )
-        )
-    );
-    echo('<br>create index:<br>');
-    echo(Var_Dump($mdb2->manager->createIndex('test', 'test_id_index', $index_def)).'<br>');
-
-    if ($mdb2_type == 'mysql') {
-        $schema->db->setOption('debug', true);
-        $schema->db->setOption('log_line_break', '<br>');
-        // ok now lets create a new xml schema file from the existing DB
-        $database_definition = $schema->getDefinitionFromDatabase();
-        // we will not use the 'metapear_test_db.schema' for this
-        // this feature is especially interesting for people that have an existing Db and want to move to MDB2's xml schema management
-        // you can also try MDB2_MANAGER_DUMP_ALL and MDB2_MANAGER_DUMP_CONTENT
-        echo(Var_Dump($schema->dumpDatabase(
-            $database_definition,
-            array(
-                'output_mode' => 'file',
-                'output' => $mdb2_name.'2.schema'
-            ),
-            MDB2_SCHEMA_DUMP_STRUCTURE
-        )).'<br>');
-        if ($schema->db->getOption('debug') === true) {
-            echo($schema->db->getDebugOutput().'<br>');
-        }
-        // this is the database definition as an array
-        echo(Var_Dump($database_definition).'<br>');
-    }
-
-    echo('<br>just a simple delete query:<br>');
-    echo(Var_Dump($mdb2->exec('DELETE FROM numbers')).'<br>');
-    // You can disconnect from the database with:
-    $mdb2->disconnect()
-?>
diff --git a/lib/docs/MDB2/docs/examples/example_php5.php b/lib/docs/MDB2/docs/examples/example_php5.php
deleted file mode 100644
index ad2a1077f457337e2fc94820d37cd86670badd8f..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/examples/example_php5.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<pre>
-<?php
-
-/**************************************/
-/* a nice php5 only show case of MDB2 */
-/**************************************/
-
-require 'MDB2.php';
-
-// the database needs to be created manually beforehand
-$dsn = array(
-    'phptype'  => 'pgsql',
-    'username' => 'postgres',
-#    'phptype'  => 'mysql',
-#    'username' => 'root',
-    'password' => 'test',
-    'hostspec' => 'localhost',
-    'database' => 'driver_test',
-);
-#$dsn = 'sqlite:///:memory:';
-
-// create MDB2 instance
-$mdb2 = MDB2::factory($dsn);
-if (PEAR::isError($mdb2)) {
-    die($mdb2->getMessage());
-}
-
-// set the default fetchmode
-$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
-
-$fields = array(
-    'id' => array(
-        'type'     => 'integer',
-        'unsigned' => true,
-        'autoincrement'  => true,
-    ),
-    'somename' => array(
-        'type'     => 'text',
-        'length'   => 12,
-    ),
-    'somedate'  => array(
-        'type'     => 'date',
-    ),
-);
-$table = 'sometable';
-
-// create a table
-// since we are on php5 we can use the magic __call() method to:
-// - load the manager module: $mdb2->loadModule('Manager', null, true);
-// - redirect the method call to the manager module: $mdb2->manager->createTable('sometable', $fields);
-$mdb2->mgCreateTable($table, $fields);
-
-$query = "INSERT INTO $table (somename, somedate) VALUES (:name, :date)";
-// parameters:
-// 1) the query (notice we are using named parameters, but we could also use ? instead
-// 2) types of the placeholders (either keyed numerically in order or by name)
-// 3) MDB2_PREPARE_MANIP denotes a DML statement
-$stmt = $mdb2->prepare($query, array('text', 'date'), MDB2_PREPARE_MANIP);
-if (PEAR::isError($stmt)) {
-    die($stmt->getMessage());
-}
-
-// load Date helper class
-MDB2::loadFile('Date');
-
-$stmt->execute(array('name' => 'hello', 'date' => MDB2_Date::mdbToday()));
-// get the last inserted id
-echo 'last insert id: ';
-var_dump($mdb2->lastInsertId($table, 'id'));
-$stmt->execute(array('name' => 'world', 'date' => '2005-11-11'));
-// get the last inserted id
-echo 'last insert id: ';
-var_dump($mdb2->lastInsertId($table, 'id'));
-
-// load Iterator implementations
-MDB2::loadFile('Iterator');
-
-$query = 'SELECT * FROM '.$table;
-// parameters:
-// 1) the query
-// 2) true means MDB2 tries to determine the result set type automatically
-// 3) true is the default and means that internally a MDB2_Result instance should be created
-// 4) 'MDB2_BufferedIterator' means the MDB2_Result should be wrapped inside an SeekableIterator
-$result = $mdb2->query($query, true, true, 'MDB2_BufferedIterator');
-
-// iterate over the result set
-foreach ($result as $row) {
-    echo 'output row:<br>';
-    var_dump($row);
-}
-
-// call drop table, since dropTable is not implemented in our instance
-// but inside the loaded Manager module __call() will find it there and
-// will redirect the call accordingly
-// we could also have done:
-//  $mdb2->manager->dropTable($table); or
-//  $mdb2->mgDropTable($table);
-$mdb2->dropTable($table);
-
-?>
\ No newline at end of file
diff --git a/lib/docs/MDB2/docs/examples/metapear_test_db.schema b/lib/docs/MDB2/docs/examples/metapear_test_db.schema
deleted file mode 100644
index cdb67fd1aa7e81e04b324881091e9e572cbe2b61..0000000000000000000000000000000000000000
--- a/lib/docs/MDB2/docs/examples/metapear_test_db.schema
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<database>
-
- <name>metapear_test_db</name>
- <create>1</create>
- 
- <table>
-
-  <name>numbers</name>
-
-  <declaration>
-
-   <field>
-    <name>number</name>
-    <type>integer</type>
-    <notnull>1</notnull>
-    <default>0</default>
-   </field>
-
-   <field>
-    <name>trans_en</name>
-    <type>text</type>
-    <length>100</length>
-    <default></default>
-   </field>
-
-   <field>
-    <name>trans_fr</name>
-    <type>text</type>
-    <length>100</length>
-    <default></default>
-   </field>
-
-  </declaration>
-
- </table>
-
- <table>
-
-  <name>test</name>
-
-  <declaration>
-
-   <field>
-    <name>test_id</name>
-    <type>integer</type>
-    <notnull>1</notnull>
-    <default>0</default>
-   </field>
-
-   <field>
-    <name>test_name</name>
-    <type>text</type>
-    <length>30</length>
-    <notnull>1</notnull>
-    <default>no name</default>
-   </field>
-
-   <field>
-    <name>test_date</name>
-    <type>timestamp</type>
-    <notnull>1</notnull>
-    <default>0000-00-00 00:00:00</default>
-   </field>
-
-  </declaration>
-
-  <initialization>
-
-   <insert>
-
-   <field>
-     <name>test_id</name>
-     <value>1</value>
-   </field>
-
-   <field>
-     <name>test_name</name>
-     <value>test0r</value>
-   </field>
-
-   <field>
-     <name>test_date</name>
-     <value>2002-02-12 16:33:53</value>
-   </field>
-
-   </insert>
-
-   <insert>
-
-   <field>
-     <name>test_id</name>
-     <value>2</value>
-   </field>
-
-   <field>
-     <name>test_name</name>
-     <value>gummihuhn</value>
-   </field>
-
-   <field>
-     <name>test_date</name>
-     <value>2001-02-12 16:34:03</value>
-   </field>
-
-   </insert>
-
-  </initialization>
-
- </table>
-
-</database>
diff --git a/lib/docs/PEAR/INSTALL b/lib/docs/PEAR/INSTALL
deleted file mode 100644
index 1c60b75b77284bd247d0122ee1e515c9941005bb..0000000000000000000000000000000000000000
--- a/lib/docs/PEAR/INSTALL
+++ /dev/null
@@ -1,53 +0,0 @@
-PEAR - The PEAR Installer
-=========================
-Installing the PEAR Installer.
-
-You should install PEAR on a local development machine first.  Installing
-PEAR on a remote production machine should only be done after you are
-familiar with PEAR and have tested code using PEAR on your development
-machine.
-
-There are two methods of installing PEAR
- - PEAR bundled in PHP
- - go-pear
-
-We will first examine how to install PEAR that is bundled with PHP.
-
-Microsoft Windows
-=================
-If you are running PHP 5.2.0 or newer, simply download and
-run the windows installer (.msi) and PEAR can be automatically
-installed.
-
-Otherwise, for older PHP versions, download the .zip of windows,
-there is a script included with your PHP distribution that is called
-"go-pear".  You must open a command box in order to run it.  Click
-"start" then click "Run..." and type "cmd.exe" to open a command box.
-Use "cd" to change directory to the location of PHP where you unzipped it,
-and run the go-pear command.
-
-Unix
-====
-make sure you have enabled default extensions, and if you want faster
-downloads, enable the zlib extension.  You must also enable the CLI
-SAPI with the --enable-cli extension directive.  After this, simply run:
-
-make install-pear
-
-and PEAR will be automatically configured for you.
-
-go-pear
-=======
-For users who cannot perform the above steps, or who wish to obtain the
-latest PEAR with a slightly higher risk of failure, use go-pear.  go-pear
-is obtained by downloading http://go-pear.org and saving it as go-pear.php.
-After downloading, simply run "php go-pear.php" or open it in a web browser
-(windows only) to download and install PEAR.
-
-You can always ask general installation questions on pear-general@lists.php.net,
-a public mailing list devoted to support for PEAR packages and installation-
-related issues.
-
-Happy PHPing, we hope PEAR will be a great tool for your development work!
-
-$Id: INSTALL 220345 2006-09-22 03:31:36Z cellog $
\ No newline at end of file
diff --git a/lib/docs/PEAR/LICENSE b/lib/docs/PEAR/LICENSE
deleted file mode 100644
index a00a2421fd8cdcb99af083977c4188d70b3c838d..0000000000000000000000000000000000000000
--- a/lib/docs/PEAR/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 1997-2009,
- Stig Bakken <ssb@php.net>,
- Gregory Beaver <cellog@php.net>,
- Helgi Þormar Þorbjörnsson <helgi@php.net>,
- Tomas V.V.Cox <cox@idecnet.com>,
- Martin Jansen <mj@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/lib/docs/PEAR/README b/lib/docs/PEAR/README
deleted file mode 100644
index 59ead1d0fbbe622c5ec8fc26550acec5d1cd9fa3..0000000000000000000000000000000000000000
--- a/lib/docs/PEAR/README
+++ /dev/null
@@ -1,32 +0,0 @@
-PEAR - The PEAR Installer
-=========================
-
-What is the PEAR Installer?  What is PEAR?
-
-PEAR is the PHP Extension and Application Repository, found at
-http://pear.php.net.  The PEAR Installer is this software, which
-contains executable files and PHP code that is used to download
-and install PEAR code from pear.php.net.
-
-PEAR contains useful software libraries and applications such as
-MDB2 (database abstraction), HTML_QuickForm (HTML forms management),
-PhpDocumentor (auto-documentation generator), DB_DataObject
-(Data Access Abstraction), and many hundreds more.  Browse all
-available packages at http://pear.php.net, the list is constantly
-growing and updating to reflect improvements in the PHP language.
-
-DOCUMENTATION
-=============
-
-Documentation for PEAR can be found at http://pear.php.net/manual/.
-Installation documentation can be found in the INSTALL file included
-in this tarball.
-
-WARNING: DO NOT RUN PEAR WITHOUT INSTALLING IT - if you downloaded this
-tarball manually, you MUST install it.  Read the instructions in INSTALL
-prior to use.
-
-
-Happy PHPing, we hope PEAR will be a great tool for your development work!
-
-$Id: README 220345 2006-09-22 03:31:36Z cellog $
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/generate.sh b/lib/docs/Structures_Graph/docs/generate.sh
deleted file mode 100644
index 173d87c1adf5d67f6b3663636510d2d0d8be3b78..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/generate.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-(cd ..; tar czf docs/arch.tgz "{arch}")
-rm -Rf "../{arch}"
-rm -Rf ./html
-mkdir -p ./html
-phpdoc --directory ../Structures,./tutorials --target ./html --title "Structures_Graph Documentation" --output "HTML:frames" --defaultpackagename structures_graph --defaultcategoryname structures --pear 
-(cd ..; tar --absolute-names -xzf docs/arch.tgz)
-#rm arch.tgz
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph.html
deleted file mode 100644
index f73bb6cf621a32e32c6bee5026524f0dc5a96ebb..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs For Class Structures_Graph</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="class-name">Class Structures_Graph</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
-						
-			</div>
-	<div class="info-box-body">
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">The Structures_Graph class represents a graph data structure.</p>
-<p class="description"><p>A Graph is a data structure composed by a set of nodes, connected by arcs.  Graphs may either be directed or undirected. In a directed graph, arcs are  directional, and can be traveled only one way. In an undirected graph, arcs  are bidirectional, and can be traveled both ways.</p></p>
-	<ul class="tags">
-				<li><span class="field">copyright:</span> (c) 2004 by S�rgio Carvalho</li>
-				<li><span class="field">author:</span> S�rgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
-			</ul>
-		<p class="notes">
-			Located in <a class="field" href="_Structures_Graph_php.html">/Structures/Graph.php</a> (line <span class="field">56</span>)
-		</p>
-		
-				
-		<pre></pre>
-	
-			</div>
-</div>
-
-
-
-	<a name="sec-method-summary"></a>
-	<div class="info-box">
-		<div class="info-box-title">Method Summary</span></div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
-		</div>
-		<div class="info-box-body">			
-			<div class="method-summary">
-								
-				<div class="method-definition">
-											<span class="method-result">Structures_Graph</span>
-										<a href="#Structures_Graph" title="details" class="method-name">Structures_Graph</a>
-											([<span class="var-type">boolean</span>&nbsp;<span class="var-name">$directed</span> = <span class="var-default">true</span>])
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#addNode" title="details" class="method-name">addNode</a>
-											(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$newNode</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">array</span>
-										<a href="#getNodes" title="details" class="method-name">&amp;getNodes</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">boolean</span>
-										<a href="#isDirected" title="details" class="method-name">isDirected</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#removeNode" title="details" class="method-name">removeNode</a>
-											(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$node</span>)
-									</div>
-							</div>
-		</div>
-	</div>		
-
-	
-	<a name="sec-methods"></a>
-	<div class="info-box">
-		<div class="info-box-title">Methods</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-													<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
-						
-		</div>
-		<div class="info-box-body">
-			<A NAME='method_detail'></A>
-<a name="methodStructures_Graph" id="Structures_Graph"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">Constructor Structures_Graph</span> (line <span class="line-number">76</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Constructor</p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">Structures_Graph</span>
-		<span class="method-name">
-			Structures_Graph
-		</span>
-					([<span class="var-type">boolean</span>&nbsp;<span class="var-name">$directed</span> = <span class="var-default">true</span>])
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type">boolean</span>
-				<span class="var-name">$directed</span><span class="var-description">: Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true)</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodaddNode" id="addNode"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">addNode</span> (line <span class="line-number">102</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Add a Node to the Graph</p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			addNode
-		</span>
-					(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$newNode</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>
-				<span class="var-name">&$newNode</span><span class="var-description">: The node to be added.</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodgetNodes" id="getNodes"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">getNodes</span> (line <span class="line-number">151</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> The set of nodes in this graph</li>
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">array</span>
-		<span class="method-name">
-			&amp;getNodes
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodisDirected" id="isDirected"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">isDirected</span> (line <span class="line-number">89</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Return true if a graph is directed</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> true if the graph is directed</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">boolean</span>
-		<span class="method-name">
-			isDirected
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodremoveNode" id="removeNode"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">removeNode</span> (line <span class="line-number">138</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Remove a Node from the Graph</p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-				<li><span class="field">todo:</span> This is unimplemented</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			removeNode
-		</span>
-					(<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>&nbsp;<span class="var-name">&$node</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type"><a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></span>
-				<span class="var-name">&$node</span><span class="var-description">: The node to be removed from the graph</span>			</li>
-				</ul>
-		
-		
-	</div>
-						
-		</div>
-	</div>
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html
deleted file mode 100644
index 85e5054b69a33da63476a3de28470fa1134b8f79..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs For Class Structures_Graph_Manipulator_AcyclicTest</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="class-name">Class Structures_Graph_Manipulator_AcyclicTest</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
-						
-			</div>
-	<div class="info-box-body">
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator  which tests whether a graph contains a cycle.</p>
-<p class="description"><p>The definition of an acyclic graph used in this manipulator is that of a  DAG. The graph must be directed, or else it is considered cyclic, even when  there are no arcs.</p></p>
-	<ul class="tags">
-				<li><span class="field">copyright:</span> (c) 2004 by S�rgio Carvalho</li>
-				<li><span class="field">author:</span> S�rgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
-			</ul>
-		<p class="notes">
-			Located in <a class="field" href="_Structures_Graph_Manipulator_AcyclicTest_php.html">/Structures/Graph/Manipulator/AcyclicTest.php</a> (line <span class="field">55</span>)
-		</p>
-		
-				
-		<pre></pre>
-	
-			</div>
-</div>
-
-
-
-	<a name="sec-method-summary"></a>
-	<div class="info-box">
-		<div class="info-box-title">Method Summary</span></div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
-		</div>
-		<div class="info-box-body">			
-			<div class="method-summary">
-								
-				<div class="method-definition">
-											<span class="method-result">boolean</span>
-										<a href="#isAcyclic" title="details" class="method-name">isAcyclic</a>
-											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
-									</div>
-							</div>
-		</div>
-	</div>		
-
-	
-	<a name="sec-methods"></a>
-	<div class="info-box">
-		<div class="info-box-title">Methods</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-													<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
-						
-		</div>
-		<div class="info-box-body">
-			<A NAME='method_detail'></A>
-<a name="methodisAcyclic" id="isAcyclic"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">isAcyclic</span> (line <span class="line-number">126</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">isAcyclic returns true if a graph contains no cycles, false otherwise.</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> true iff graph is acyclic</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">boolean</span>
-		<span class="method-name">
-			isAcyclic
-		</span>
-					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
-			</div>
-	
-		
-		
-	</div>
-						
-		</div>
-	</div>
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html
deleted file mode 100644
index e13f495737ee63843bb4255f4623d11f124537ba..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs For Class Structures_Graph_Manipulator_TopologicalSorter</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="class-name">Class Structures_Graph_Manipulator_TopologicalSorter</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
-						
-			</div>
-	<div class="info-box-body">
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">The Structures_Graph_Manipulator_TopologicalSorter is a manipulator  which is able to return the set of nodes in a graph, sorted by topological  order.</p>
-<p class="description"><p>A graph may only be sorted topologically iff it's a DAG. You can test it  with the Structures_Graph_Manipulator_AcyclicTest.</p></p>
-	<ul class="tags">
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li>
-				<li><span class="field">copyright:</span> (c) 2004 by S�rgio Carvalho</li>
-				<li><span class="field">author:</span> S�rgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
-			</ul>
-		<p class="notes">
-			Located in <a class="field" href="_Structures_Graph_Manipulator_TopologicalSorter_php.html">/Structures/Graph/Manipulator/TopologicalSorter.php</a> (line <span class="field">58</span>)
-		</p>
-		
-				
-		<pre></pre>
-	
-			</div>
-</div>
-
-
-
-	<a name="sec-method-summary"></a>
-	<div class="info-box">
-		<div class="info-box-title">Method Summary</span></div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
-		</div>
-		<div class="info-box-body">			
-			<div class="method-summary">
-								
-				<div class="method-definition">
-											<span class="method-result">array</span>
-										<a href="#sort" title="details" class="method-name">sort</a>
-											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
-									</div>
-							</div>
-		</div>
-	</div>		
-
-	
-	<a name="sec-methods"></a>
-	<div class="info-box">
-		<div class="info-box-title">Methods</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-													<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
-						
-		</div>
-		<div class="info-box-body">
-			<A NAME='method_detail'></A>
-<a name="methodsort" id="sort"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">sort</span> (line <span class="line-number">133</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">sort returns the graph's nodes, sorted by topological order.</p>
-<p class="description"><p>The result is an array with  as many entries as topological levels. Each entry in this array is an array of nodes within  the given topological level.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> The graph's nodes, sorted by topological order.</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">array</span>
-		<span class="method-name">
-			sort
-		</span>
-					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$graph</span>)
-			</div>
-	
-		
-		
-	</div>
-						
-		</div>
-	</div>
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Node.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Node.html
deleted file mode 100644
index eabc923ae59f001f286e0e620f0155c62e5de84b..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Node.html
+++ /dev/null
@@ -1,549 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs For Class Structures_Graph_Node</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="class-name">Class Structures_Graph_Node</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
-						
-			</div>
-	<div class="info-box-body">
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">The Structures_Graph_Node class represents a Node that can be member of a  graph node set.</p>
-<p class="description"><p>A graph node can contain data. Under this API, the node contains default data,  and key index data. It behaves, thus, both as a regular data node, and as a  dictionary (or associative array) node.</p><p>Regular data is accessed via getData and setData. Key indexed data is accessed  via getMetadata and setMetadata.</p></p>
-	<ul class="tags">
-				<li><span class="field">copyright:</span> (c) 2004 by S�rgio Carvalho</li>
-				<li><span class="field">author:</span> S�rgio Carvalho &lt;<a href="mailto:sergio.carvalho@portugalmail.com">mailto:sergio.carvalho@portugalmail.com</a>&gt;</li>
-			</ul>
-		<p class="notes">
-			Located in <a class="field" href="_Structures_Graph_Node_php.html">/Structures/Graph/Node.php</a> (line <span class="field">57</span>)
-		</p>
-		
-				
-		<pre></pre>
-	
-			</div>
-</div>
-
-
-
-	<a name="sec-method-summary"></a>
-	<div class="info-box">
-		<div class="info-box-title">Method Summary</span></div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
-		</div>
-		<div class="info-box-body">			
-			<div class="method-summary">
-								
-				<div class="method-definition">
-											<span class="method-result">Structures_Graph_Node</span>
-										<a href="#Structures_Graph_Node" title="details" class="method-name">Structures_Graph_Node</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">boolean</span>
-										<a href="#connectsTo" title="details" class="method-name">connectsTo</a>
-											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$target</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#connectTo" title="details" class="method-name">connectTo</a>
-											(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$destinationNode</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">mixed</span>
-										<a href="#getData" title="details" class="method-name">&amp;getData</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
-										<a href="#getGraph" title="details" class="method-name">&amp;getGraph</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">mixed</span>
-										<a href="#getMetadata" title="details" class="method-name">&amp;getMetadata</a>
-											(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">boolean</span>&nbsp;<span class="var-name">$nullIfNonexistent</span> = <span class="var-default">false</span>])
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">array</span>
-										<a href="#getNeighbours" title="details" class="method-name">getNeighbours</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">integer</span>
-										<a href="#inDegree" title="details" class="method-name">inDegree</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">boolean</span>
-										<a href="#metadataKeyExists" title="details" class="method-name">metadataKeyExists</a>
-											(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">integer</span>
-										<a href="#outDegree" title="details" class="method-name">outDegree</a>
-										()
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">mixed</span>
-										<a href="#setData" title="details" class="method-name">setData</a>
-											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#setGraph" title="details" class="method-name">setGraph</a>
-											(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$graph</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#setMetadata" title="details" class="method-name">setMetadata</a>
-											(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
-									</div>
-								
-				<div class="method-definition">
-											<span class="method-result">void</span>
-										<a href="#unsetMetadata" title="details" class="method-name">unsetMetadata</a>
-											(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
-									</div>
-							</div>
-		</div>
-	</div>		
-
-	
-	<a name="sec-methods"></a>
-	<div class="info-box">
-		<div class="info-box-title">Methods</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-													<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
-						
-		</div>
-		<div class="info-box-body">
-			<A NAME='method_detail'></A>
-<a name="methodStructures_Graph_Node" id="Structures_Graph_Node"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">Constructor Structures_Graph_Node</span> (line <span class="line-number">78</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Constructor</p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">Structures_Graph_Node</span>
-		<span class="method-name">
-			Structures_Graph_Node
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodconnectsTo" id="connectsTo"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">connectsTo</span> (line <span class="line-number">275</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Test wether this node has an arc to the target node</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> True if the two nodes are connected</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">boolean</span>
-		<span class="method-name">
-			connectsTo
-		</span>
-					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">&$target</span>)
-			</div>
-	
-		
-		
-	</div>
-<a name="methodconnectTo" id="connectTo"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">connectTo</span> (line <span class="line-number">236</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Connect this node to another one.</p>
-<p class="description"><p>If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.</p></p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			connectTo
-		</span>
-					(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$destinationNode</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
-				<span class="var-name">&$destinationNode</span><span class="var-description">: Node to connect to</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodgetData" id="getData"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">getData</span> (line <span class="line-number">119</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node data getter.</p>
-<p class="description"><p>Each graph node can contain a reference to one variable. This is the getter for that reference.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Data stored in node</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">mixed</span>
-		<span class="method-name">
-			&amp;getData
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodgetGraph" id="getGraph"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">getGraph</span> (line <span class="line-number">90</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node graph getter</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Graph where node is stored</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
-		<span class="method-name">
-			&amp;getGraph
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodgetMetadata" id="getMetadata"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">getMetadata</span> (line <span class="line-number">171</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node metadata getter</p>
-<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an  associative array or in a dictionary. This method gets the data under the given key. If the key does  not exist, an error will be thrown, so testing using metadataKeyExists might be needed.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Metadata Data stored in node under given key</li>
-				<li><span class="field">access:</span> public</li>
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Node.html#methodmetadataKeyExists">Structures_Graph_Node::metadataKeyExists()</a></li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">mixed</span>
-		<span class="method-name">
-			&amp;getMetadata
-		</span>
-					(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">boolean</span>&nbsp;<span class="var-name">$nullIfNonexistent</span> = <span class="var-default">false</span>])
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type">string</span>
-				<span class="var-name">$key</span><span class="var-description">: Key</span>			</li>
-					<li>
-				<span class="var-type">boolean</span>
-				<span class="var-name">$nullIfNonexistent</span><span class="var-description">: nullIfNonexistent (defaults to false).</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodgetNeighbours" id="getNeighbours"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">getNeighbours</span> (line <span class="line-number">262</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Return nodes connected to this one.</p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Array of nodes</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">array</span>
-		<span class="method-name">
-			getNeighbours
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodinDegree" id="inDegree"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">inDegree</span> (line <span class="line-number">309</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Calculate the in degree of the node.</p>
-<p class="description"><p>The indegree for a node is the number of arcs entering the node. For non directed graphs,  the indegree is equal to the outdegree.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> In degree of the node</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">integer</span>
-		<span class="method-name">
-			inDegree
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodmetadataKeyExists" id="metadataKeyExists"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">metadataKeyExists</span> (line <span class="line-number">151</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Test for existence of metadata under a given key.</p>
-<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an  associative array or in a dictionary. This method tests whether a given metadata key exists for this node.</p></p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">boolean</span>
-		<span class="method-name">
-			metadataKeyExists
-		</span>
-					(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type">string</span>
-				<span class="var-name">$key</span><span class="var-description">: Key to test</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodoutDegree" id="outDegree"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">outDegree</span> (line <span class="line-number">333</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Calculate the out degree of the node.</p>
-<p class="description"><p>The outdegree for a node is the number of arcs exiting the node. For non directed graphs,  the outdegree is always equal to the indegree.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Out degree of the node</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">integer</span>
-		<span class="method-name">
-			outDegree
-		</span>
-				()
-			</div>
-	
-		
-		
-	</div>
-<a name="methodsetData" id="setData"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">setData</span> (line <span class="line-number">134</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node data setter</p>
-<p class="description"><p>Each graph node can contain a reference to one variable. This is the setter for that reference.</p></p>
-	<ul class="tags">
-				<li><span class="field">return:</span> Data to store in node</li>
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">mixed</span>
-		<span class="method-name">
-			setData
-		</span>
-					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
-			</div>
-	
-		
-		
-	</div>
-<a name="methodsetGraph" id="setGraph"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">setGraph</span> (line <span class="line-number">104</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node graph setter. This method should not be called directly. Use Graph::addNode instead.</p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph.html#methodaddNode">Structures_Graph::addNode()</a></li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			setGraph
-		</span>
-					(<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>&nbsp;<span class="var-name">&$graph</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type"><a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></span>
-				<span class="var-name">&$graph</span><span class="var-description">: Set the graph for this node.</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodsetMetadata" id="setMetadata"><!-- --></a>
-<div class="evenrow">
-	
-	<div class="method-header">
-		<span class="method-title">setMetadata</span> (line <span class="line-number">214</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Node metadata setter</p>
-<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an  associative array or in a dictionary. This method stores data under the given key. If the key already exists,  previously stored data is discarded.</p></p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			setMetadata
-		</span>
-					(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$data</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type">string</span>
-				<span class="var-name">$key</span><span class="var-description">: Key</span>			</li>
-					<li>
-				<span class="var-type">mixed</span>
-				<span class="var-name">$data</span><span class="var-description">: Data</span>			</li>
-				</ul>
-		
-		
-	</div>
-<a name="methodunsetMetadata" id="unsetMetadata"><!-- --></a>
-<div class="oddrow">
-	
-	<div class="method-header">
-		<span class="method-title">unsetMetadata</span> (line <span class="line-number">196</span>)
-	</div> 
-	
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Delete metadata by key</p>
-<p class="description"><p>Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an  associative array or in a dictionary. This method removes any data that might be stored under the provided key.  If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.</p></p>
-	<ul class="tags">
-				<li><span class="field">access:</span> public</li>
-			</ul>
-	
-	<div class="method-signature">
-		<span class="method-result">void</span>
-		<span class="method-name">
-			unsetMetadata
-		</span>
-					(<span class="var-type">string</span>&nbsp;<span class="var-name">$key</span>)
-			</div>
-	
-			<ul class="parameters">
-					<li>
-				<span class="var-type">string</span>
-				<span class="var-name">$key</span><span class="var-description">: Key</span>			</li>
-				</ul>
-		
-		
-	</div>
-						
-		</div>
-	</div>
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html
deleted file mode 100644
index d36821c8a83f0c75638b97a3f7f72fcb8704dcf1..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs for page AcyclicTest.php</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="file-name">/Structures/Graph/Manipulator/AcyclicTest.php</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-							<a href="#sec-classes">Classes</a>
-			|							<a href="#sec-includes">Includes</a>
-												</div>
-	<div class="info-box-body">	
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">This file contains the definition of the Structures_Graph_Manipulator_AcyclicTest graph manipulator.</p>
-	<ul class="tags">
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li>
-			</ul>
-		
-			</div>
-</div>
-		
-	<a name="sec-classes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Classes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-			<span class="disabled">Classes</span>
-			|							<a href="#sec-includes">Includes</a>
-																		</div>
-		<div class="info-box-body">	
-			<table cellpadding="2" cellspacing="0" class="class-table">
-				<tr>
-					<th class="class-table-header">Class</th>
-					<th class="class-table-header">Description</th>
-				</tr>
-								<tr>
-					<td style="padding-right: 2em; vertical-align: top">
-						<a href="../Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a>
-					</td>
-					<td>
-											The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator  which tests whether a graph contains a cycle.
-										</td>
-				</tr>
-							</table>
-		</div>
-	</div>
-
-	<a name="sec-includes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Includes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-							<a href="#sec-classes">Classes</a>
-				|						<span class="disabled">Includes</span>
-														</div>
-		<div class="info-box-body">	
-			<a name="_PEAR_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name">'PEAR.php'</span>)
-			(line <span class="line-number">35</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph_php"><!-- --></a>
-<div class="evenrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
-			(line <span class="line-number">37</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph/Node_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
-			(line <span class="line-number">39</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-		</div>
-	</div>
-	
-	
-	
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html
deleted file mode 100644
index e791325421fa850f2af2ad4d72fde39f22ebc14e..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs for page TopologicalSorter.php</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="file-name">/Structures/Graph/Manipulator/TopologicalSorter.php</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-							<a href="#sec-classes">Classes</a>
-			|							<a href="#sec-includes">Includes</a>
-												</div>
-	<div class="info-box-body">	
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">This file contains the definition of the Structures_Graph_Manipulator_TopologicalSorter class.</p>
-	<ul class="tags">
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li>
-			</ul>
-		
-			</div>
-</div>
-		
-	<a name="sec-classes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Classes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-			<span class="disabled">Classes</span>
-			|							<a href="#sec-includes">Includes</a>
-																		</div>
-		<div class="info-box-body">	
-			<table cellpadding="2" cellspacing="0" class="class-table">
-				<tr>
-					<th class="class-table-header">Class</th>
-					<th class="class-table-header">Description</th>
-				</tr>
-								<tr>
-					<td style="padding-right: 2em; vertical-align: top">
-						<a href="../Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a>
-					</td>
-					<td>
-											The Structures_Graph_Manipulator_TopologicalSorter is a manipulator  which is able to return the set of nodes in a graph, sorted by topological  order.
-										</td>
-				</tr>
-							</table>
-		</div>
-	</div>
-
-	<a name="sec-includes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Includes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-							<a href="#sec-classes">Classes</a>
-				|						<span class="disabled">Includes</span>
-														</div>
-		<div class="info-box-body">	
-			<a name="_PEAR_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name">'PEAR.php'</span>)
-			(line <span class="line-number">35</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph_php"><!-- --></a>
-<div class="evenrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
-			(line <span class="line-number">37</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph/Node_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
-			(line <span class="line-number">39</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph/Manipulator/AcyclicTest_php"><!-- --></a>
-<div class="evenrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html">'Structures/Graph/Manipulator/AcyclicTest.php'</a></span>)
-			(line <span class="line-number">41</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-		</div>
-	</div>
-	
-	
-	
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Node_php.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Node_php.html
deleted file mode 100644
index d1d3596a69af9677c5a08f6a1813f878888683dd..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Node_php.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs for page Node.php</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="file-name">/Structures/Graph/Node.php</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-							<a href="#sec-classes">Classes</a>
-			|							<a href="#sec-includes">Includes</a>
-												</div>
-	<div class="info-box-body">	
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">This file contains the definition of the Structures_Graph_Node class</p>
-	<ul class="tags">
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></li>
-			</ul>
-		
-			</div>
-</div>
-		
-	<a name="sec-classes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Classes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-			<span class="disabled">Classes</span>
-			|							<a href="#sec-includes">Includes</a>
-																		</div>
-		<div class="info-box-body">	
-			<table cellpadding="2" cellspacing="0" class="class-table">
-				<tr>
-					<th class="class-table-header">Class</th>
-					<th class="class-table-header">Description</th>
-				</tr>
-								<tr>
-					<td style="padding-right: 2em; vertical-align: top">
-						<a href="../Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a>
-					</td>
-					<td>
-											The Structures_Graph_Node class represents a Node that can be member of a  graph node set.
-										</td>
-				</tr>
-							</table>
-		</div>
-	</div>
-
-	<a name="sec-includes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Includes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-							<a href="#sec-classes">Classes</a>
-				|						<span class="disabled">Includes</span>
-														</div>
-		<div class="info-box-body">	
-			<a name="_PEAR_php"><!-- --></a>
-<div class="evenrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name">'PEAR.php'</span>)
-			(line <span class="line-number">35</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-<a name="_Structures/Graph_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_php.html">'Structures/Graph.php'</a></span>)
-			(line <span class="line-number">37</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-	
-</div>
-		</div>
-	</div>
-	
-	
-	
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_php.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_php.html
deleted file mode 100644
index cb74519cdb796d00e350d62e6b29989a43fc129a..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_php.html
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Docs for page Graph.php</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-<h2 class="file-name">/Structures/Graph.php</h2>
-
-<a name="sec-description"></a>
-<div class="info-box">
-	<div class="info-box-title">Description</div>
-	<div class="nav-bar">
-					<span class="disabled">Description</span> |
-							<a href="#sec-classes">Classes</a>
-			|							<a href="#sec-includes">Includes</a>
-			|							<a href="#sec-constants">Constants</a>
-										</div>
-	<div class="info-box-body">	
-		<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">The Graph.php file contains the definition of the Structures_Graph class</p>
-	<ul class="tags">
-				<li><span class="field">see:</span> <a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a></li>
-			</ul>
-		
-			</div>
-</div>
-		
-	<a name="sec-classes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Classes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-			<span class="disabled">Classes</span>
-			|							<a href="#sec-includes">Includes</a>
-				|										<a href="#sec-constants">Constants</a>
-															</div>
-		<div class="info-box-body">	
-			<table cellpadding="2" cellspacing="0" class="class-table">
-				<tr>
-					<th class="class-table-header">Class</th>
-					<th class="class-table-header">Description</th>
-				</tr>
-								<tr>
-					<td style="padding-right: 2em; vertical-align: top">
-						<a href="../Structures_Graph/Structures_Graph.html">Structures_Graph</a>
-					</td>
-					<td>
-											The Structures_Graph class represents a graph data structure.
-										</td>
-				</tr>
-							</table>
-		</div>
-	</div>
-
-	<a name="sec-includes"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Includes</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-							<a href="#sec-classes">Classes</a>
-				|						<span class="disabled">Includes</span>
-			|							<a href="#sec-constants">Constants</a>
-															</div>
-		<div class="info-box-body">	
-			<a name="_Structures/Graph/Node_php"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name"><a href="../Structures_Graph/_Structures_Graph_Node_php.html">'Structures/Graph/Node.php'</a></span>)
-			(line <span class="line-number">37</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">Graph Node</p>
-	
-</div>
-<a name="_PEAR_php"><!-- --></a>
-<div class="evenrow">
-	
-	<div>
-		<span class="include-title">
-			<span class="include-type">require_once</span>
-			(<span class="include-name">'PEAR.php'</span>)
-			(line <span class="line-number">35</span>)
-		</span>
-	</div>
-
-	<!-- ========== Info from phpDoc block ========= -->
-<p class="short-description">PEAR base classes</p>
-	
-</div>
-		</div>
-	</div>
-	
-	<a name="sec-constants"></a>	
-	<div class="info-box">
-		<div class="info-box-title">Constants</div>
-		<div class="nav-bar">
-			<a href="#sec-description">Description</a> |
-							<a href="#sec-classes">Classes</a>
-				|										<a href="#sec-includes">Includes</a>
-				|						<span class="disabled">Constants</span>
-											</div>
-		<div class="info-box-body">	
-			<a name="defineSTRUCTURES_GRAPH_ERROR_GENERIC"><!-- --></a>
-<div class="oddrow">
-	
-	<div>
-		<span class="const-title">
-			<span class="const-name">STRUCTURES_GRAPH_ERROR_GENERIC</span> = 100
-			(line <span class="line-number">40</span>)
-		</span>
-	</div>
-	
-	<!-- ========== Info from phpDoc block ========= -->
-	
-		
-</div>
-		</div>
-	</div>
-	
-	
-	
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html b/lib/docs/Structures_Graph/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html
deleted file mode 100644
index ffea0c907572e9f2e0186ae8d3d0abca62df374c..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Structures_Graph Tutorial</title>
-			<link rel="stylesheet" href="../media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="page-body">			
-
-<div><a name="package.database.structures_graph.tutorial"></a><div class="ref-title-box"><h1 class="ref-title">Structures_Graph Tutorial</h1>
-  <h2 class="ref-purpose">A first tour of graph datastructure manipulation</h2></div>
- <span><a name="package.database.structures_graph.tutorial.intro"></a><h2 class="title">Introduction</h2><p>Structures_Graph is a package for creating and manipulating graph datastructures. A graph is a set of objects, called nodes, connected by arcs. When used as a datastructure, usually nodes contain data, and arcs represent relationships between nodes. When arcs have a direction, and can be travelled only one way, graphs are said to be directed. When arcs have no direction, and can always be travelled both ways, graphs are said to be non directed.</p>
-  <p>Structures_Graph provides an object oriented API to create and directly query a graph, as well as a set of Manipulator classes to extract information from the graph.</p></span>
- <span><a name="package.database.structures_graph.tutorial.creation"></a><h2 class="title">Creating a Graph</h2><p>Creating a graph is done using the simple constructor:
-   <pre class="listing"><pre>
-require_once 'Structures/Graph.php';
-
-$directedGraph =&amp; new Structures_Graph(true);
-$nonDirectedGraph =&amp; new Structures_Graph(false);
-    </pre></pre>
-   and passing the constructor a flag telling it whether the graph should be directed. A directed graph will always be directed during its lifetime. It's a permanent characteristic.</p>
-  <p>To fill out the graph, we'll need to create some nodes, and then call Graph::addNode.
-   <pre class="listing"><pre>
-require_once 'Structures/Graph/Node.php';
-
-$nodeOne =&amp; new Structures_Graph_Node();
-$nodeTwo =&amp; new Structures_Graph_Node();
-$nodeThree =&amp; new Structures_Graph_Node();
-
-$directedGraph-&gt;addNode(&amp;$nodeOne);
-$directedGraph-&gt;addNode(&amp;$nodeTwo);
-$directedGraph-&gt;addNode(&amp;$nodeThree);
-    </pre></pre>
-   and then setup the arcs:
-   <pre class="listing"><pre>
-$nodeOne-&gt;connectTo($nodeTwo);
-$nodeOne-&gt;connectTo($nodeThree);
-    </pre></pre>
-   Note that arcs can only be created after the nodes have been inserted into the graph.</p></span>
- <span><a name="package.database.structures_graph.tutorial.nodesanddata"></a><h2 class="title">Associating Data</h2><p>Graphs are only useful as datastructures if they can hold data. Structure_Graph stores data in nodes. Each node contains a setter and a getter for its data.
-   <pre class="listing"><pre>
-$nodeOne-&gt;setData(&quot;Node One's Data is a String&quot;);
-$nodeTwo-&gt;setData(1976);
-$nodeThree-&gt;setData('Some other string');
-
-print(&quot;NodeTwo's Data is an integer: &quot; . $nodeTwo-&gt;getData());
-    </pre></pre></p>
-  <p>Structure_Graph nodes can also store metadata, alongside with the main data. Metadata differs from regular data just because it is stored under a key, making it possible to store more than one data reference per node. The metadata getter and setter need the key to perform the operation:
-   <pre class="listing"><pre>
-$nodeOne-&gt;setMetadata('example key', &quot;Node One's Sample Metadata&quot;);
-print(&quot;Metadata stored under key 'example key' in node one: &quot; . $nodeOne-&gt;getMetadata('example key'));
-$nodeOne-&gt;unsetMetadata('example key');
-    </pre></pre></p></span>
- <span><a name="package.database.structures_graph.tutorial.querying"></a><h2 class="title">Querying a Graph</h2><p>Structures_Graph provides for basic querying of the graph:
-   <pre class="listing"><pre>
-// Nodes are able to calculate their indegree and outdegree
-print(&quot;NodeOne's inDegree: &quot; . $nodeOne-&gt;inDegree());
-print(&quot;NodeOne's outDegree: &quot; . $nodeOne-&gt;outDegree());
-
-// and naturally, nodes can report on their arcs
-$arcs = $nodeOne-&gt;getNeighbours();
-for ($i=0;$i&lt;sizeof($arcs);$i++) {
-    print(&quot;NodeOne has an arc to &quot; . $arcs[$i]-&gt;getData());
-}
-    </pre></pre></p></span></div>
-
-
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</div></body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/classtrees_Structures_Graph.html b/lib/docs/Structures_Graph/docs/html/classtrees_Structures_Graph.html
deleted file mode 100644
index abb613f3b72858060115aeca41eaecb107fe300c..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/classtrees_Structures_Graph.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title></title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						
-<!-- Start of Class Data -->
-<H2>
-	
-</H2>
-<h2>Root class Structures_Graph</h2>
-<ul>
-<li><a href="Structures_Graph/Structures_Graph.html">Structures_Graph</a></li></ul>
-
-<h2>Root class Structures_Graph_Manipulator_AcyclicTest</h2>
-<ul>
-<li><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a></li></ul>
-
-<h2>Root class Structures_Graph_Manipulator_TopologicalSorter</h2>
-<ul>
-<li><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a></li></ul>
-
-<h2>Root class Structures_Graph_Node</h2>
-<ul>
-<li><a href="Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a></li></ul>
-
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:28 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/elementindex.html b/lib/docs/Structures_Graph/docs/html/elementindex.html
deleted file mode 100644
index fdf6d187dabed74f4ac74902930818719356cece..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/elementindex.html
+++ /dev/null
@@ -1,339 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title></title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						<a name="top"></a>
-<h2>Full index</h2>
-<h3>Package indexes</h3>
-<ul>
-	<li><a href="elementindex_Structures_Graph.html">Structures_Graph</a></li>
-</ul>
-<br />
-<div class="index-letter-menu">
-	<a class="index-letter" href="elementindex.html#a">a</a>
-	<a class="index-letter" href="elementindex.html#c">c</a>
-	<a class="index-letter" href="elementindex.html#g">g</a>
-	<a class="index-letter" href="elementindex.html#i">i</a>
-	<a class="index-letter" href="elementindex.html#m">m</a>
-	<a class="index-letter" href="elementindex.html#n">n</a>
-	<a class="index-letter" href="elementindex.html#o">o</a>
-	<a class="index-letter" href="elementindex.html#r">r</a>
-	<a class="index-letter" href="elementindex.html#s">s</a>
-	<a class="index-letter" href="elementindex.html#t">t</a>
-	<a class="index-letter" href="elementindex.html#u">u</a>
-</div>
-
-	<a name="a"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">a</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">addNode</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodaddNode">Structures_Graph::addNode()</a> in Graph.php</div>
-							<div class="index-item-description">Add a Node to the Graph</div>
-					</dd>
-			<dt class="field">
-						<span class="include-title">AcyclicTest.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html">AcyclicTest.php</a> in AcyclicTest.php</div>
-					</dd>
-		</dl>
-	<a name="c"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">c</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">connectsTo</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodconnectsTo">Structures_Graph_Node::connectsTo()</a> in Node.php</div>
-							<div class="index-item-description">Test wether this node has an arc to the target node</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">connectTo</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodconnectTo">Structures_Graph_Node::connectTo()</a> in Node.php</div>
-							<div class="index-item-description">Connect this node to another one.</div>
-					</dd>
-		</dl>
-	<a name="g"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">g</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">getData</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetData">Structures_Graph_Node::getData()</a> in Node.php</div>
-							<div class="index-item-description">Node data getter.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getGraph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetGraph">Structures_Graph_Node::getGraph()</a> in Node.php</div>
-							<div class="index-item-description">Node graph getter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetMetadata">Structures_Graph_Node::getMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Node metadata getter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getNeighbours</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetNeighbours">Structures_Graph_Node::getNeighbours()</a> in Node.php</div>
-							<div class="index-item-description">Return nodes connected to this one.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getNodes</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodgetNodes">Structures_Graph::getNodes()</a> in Graph.php</div>
-							<div class="index-item-description">Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.</div>
-					</dd>
-			<dt class="field">
-						<span class="include-title">Graph.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_php.html">Graph.php</a> in Graph.php</div>
-					</dd>
-		</dl>
-	<a name="i"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">i</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">inDegree</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodinDegree">Structures_Graph_Node::inDegree()</a> in Node.php</div>
-							<div class="index-item-description">Calculate the in degree of the node.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">isAcyclic</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html#methodisAcyclic">Structures_Graph_Manipulator_AcyclicTest::isAcyclic()</a> in AcyclicTest.php</div>
-							<div class="index-item-description">isAcyclic returns true if a graph contains no cycles, false otherwise.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">isDirected</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodisDirected">Structures_Graph::isDirected()</a> in Graph.php</div>
-							<div class="index-item-description">Return true if a graph is directed</div>
-					</dd>
-		</dl>
-	<a name="m"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">m</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">metadataKeyExists</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodmetadataKeyExists">Structures_Graph_Node::metadataKeyExists()</a> in Node.php</div>
-							<div class="index-item-description">Test for existence of metadata under a given key.</div>
-					</dd>
-		</dl>
-	<a name="n"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">n</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="include-title">Node.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Node_php.html">Node.php</a> in Node.php</div>
-					</dd>
-		</dl>
-	<a name="o"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">o</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">outDegree</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodoutDegree">Structures_Graph_Node::outDegree()</a> in Node.php</div>
-							<div class="index-item-description">Calculate the out degree of the node.</div>
-					</dd>
-		</dl>
-	<a name="r"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">r</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">removeNode</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodremoveNode">Structures_Graph::removeNode()</a> in Graph.php</div>
-							<div class="index-item-description">Remove a Node from the Graph</div>
-					</dd>
-		</dl>
-	<a name="s"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">s</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">setData</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetData">Structures_Graph_Node::setData()</a> in Node.php</div>
-							<div class="index-item-description">Node data setter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">setGraph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetGraph">Structures_Graph_Node::setGraph()</a> in Node.php</div>
-							<div class="index-item-description">Node graph setter. This method should not be called directly. Use Graph::addNode instead.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">setMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetMetadata">Structures_Graph_Node::setMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Node metadata setter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">sort</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html#methodsort">Structures_Graph_Manipulator_TopologicalSorter::sort()</a> in TopologicalSorter.php</div>
-							<div class="index-item-description">sort returns the graph's nodes, sorted by topological order.</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html">Structures_Graph</a> in Graph.php</div>
-							<div class="index-item-description">The Structures_Graph class represents a graph data structure.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">Structures_Graph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodStructures_Graph">Structures_Graph::Structures_Graph()</a> in Graph.php</div>
-							<div class="index-item-description">Constructor</div>
-					</dd>
-			<dt class="field">
-						<span class="const-title">STRUCTURES_GRAPH_ERROR_GENERIC</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_php.html#defineSTRUCTURES_GRAPH_ERROR_GENERIC">STRUCTURES_GRAPH_ERROR_GENERIC</a> in Graph.php</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Manipulator_AcyclicTest
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a> in AcyclicTest.php</div>
-							<div class="index-item-description">The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator  which tests whether a graph contains a cycle.</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Manipulator_TopologicalSorter
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a> in TopologicalSorter.php</div>
-							<div class="index-item-description">The Structures_Graph_Manipulator_TopologicalSorter is a manipulator  which is able to return the set of nodes in a graph, sorted by topological  order.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">Structures_Graph_Node</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodStructures_Graph_Node">Structures_Graph_Node::Structures_Graph_Node()</a> in Node.php</div>
-							<div class="index-item-description">Constructor</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Node
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a> in Node.php</div>
-							<div class="index-item-description">The Structures_Graph_Node class represents a Node that can be member of a  graph node set.</div>
-					</dd>
-		</dl>
-	<a name="t"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">t</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="include-title">TopologicalSorter.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html">TopologicalSorter.php</a> in TopologicalSorter.php</div>
-					</dd>
-		</dl>
-	<a name="u"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">u</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">unsetMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodunsetMetadata">Structures_Graph_Node::unsetMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Delete metadata by key</div>
-					</dd>
-		</dl>
-
-<div class="index-letter-menu">
-	<a class="index-letter" href="elementindex.html#a">a</a>
-	<a class="index-letter" href="elementindex.html#c">c</a>
-	<a class="index-letter" href="elementindex.html#g">g</a>
-	<a class="index-letter" href="elementindex.html#i">i</a>
-	<a class="index-letter" href="elementindex.html#m">m</a>
-	<a class="index-letter" href="elementindex.html#n">n</a>
-	<a class="index-letter" href="elementindex.html#o">o</a>
-	<a class="index-letter" href="elementindex.html#r">r</a>
-	<a class="index-letter" href="elementindex.html#s">s</a>
-	<a class="index-letter" href="elementindex.html#t">t</a>
-	<a class="index-letter" href="elementindex.html#u">u</a>
-</div>	</body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/elementindex_Structures_Graph.html b/lib/docs/Structures_Graph/docs/html/elementindex_Structures_Graph.html
deleted file mode 100644
index 85344acc04f15a39f5ed8fe71fc3499045449637..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/elementindex_Structures_Graph.html
+++ /dev/null
@@ -1,336 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title></title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						<a name="top"></a>
-<h2>[Structures_Graph] element index</h2>
-<a href="elementindex.html">All elements</a>
-<br />
-<div class="index-letter-menu">
-	<a class="index-letter" href="elementindex_Structures_Graph.html#a">a</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#c">c</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#g">g</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#i">i</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#m">m</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#n">n</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#o">o</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#r">r</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#s">s</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#t">t</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#u">u</a>
-</div>
-
-	<a name="a"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">a</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">addNode</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodaddNode">Structures_Graph::addNode()</a> in Graph.php</div>
-							<div class="index-item-description">Add a Node to the Graph</div>
-					</dd>
-			<dt class="field">
-						<span class="include-title">AcyclicTest.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html">AcyclicTest.php</a> in AcyclicTest.php</div>
-					</dd>
-		</dl>
-	<a name="c"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">c</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">connectsTo</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodconnectsTo">Structures_Graph_Node::connectsTo()</a> in Node.php</div>
-							<div class="index-item-description">Test wether this node has an arc to the target node</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">connectTo</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodconnectTo">Structures_Graph_Node::connectTo()</a> in Node.php</div>
-							<div class="index-item-description">Connect this node to another one.</div>
-					</dd>
-		</dl>
-	<a name="g"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">g</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">getData</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetData">Structures_Graph_Node::getData()</a> in Node.php</div>
-							<div class="index-item-description">Node data getter.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getGraph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetGraph">Structures_Graph_Node::getGraph()</a> in Node.php</div>
-							<div class="index-item-description">Node graph getter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetMetadata">Structures_Graph_Node::getMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Node metadata getter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getNeighbours</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodgetNeighbours">Structures_Graph_Node::getNeighbours()</a> in Node.php</div>
-							<div class="index-item-description">Return nodes connected to this one.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">getNodes</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodgetNodes">Structures_Graph::getNodes()</a> in Graph.php</div>
-							<div class="index-item-description">Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.</div>
-					</dd>
-			<dt class="field">
-						<span class="include-title">Graph.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_php.html">Graph.php</a> in Graph.php</div>
-					</dd>
-		</dl>
-	<a name="i"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">i</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">inDegree</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodinDegree">Structures_Graph_Node::inDegree()</a> in Node.php</div>
-							<div class="index-item-description">Calculate the in degree of the node.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">isAcyclic</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html#methodisAcyclic">Structures_Graph_Manipulator_AcyclicTest::isAcyclic()</a> in AcyclicTest.php</div>
-							<div class="index-item-description">isAcyclic returns true if a graph contains no cycles, false otherwise.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">isDirected</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodisDirected">Structures_Graph::isDirected()</a> in Graph.php</div>
-							<div class="index-item-description">Return true if a graph is directed</div>
-					</dd>
-		</dl>
-	<a name="m"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">m</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">metadataKeyExists</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodmetadataKeyExists">Structures_Graph_Node::metadataKeyExists()</a> in Node.php</div>
-							<div class="index-item-description">Test for existence of metadata under a given key.</div>
-					</dd>
-		</dl>
-	<a name="n"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">n</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="include-title">Node.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Node_php.html">Node.php</a> in Node.php</div>
-					</dd>
-		</dl>
-	<a name="o"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">o</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">outDegree</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodoutDegree">Structures_Graph_Node::outDegree()</a> in Node.php</div>
-							<div class="index-item-description">Calculate the out degree of the node.</div>
-					</dd>
-		</dl>
-	<a name="r"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">r</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">removeNode</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodremoveNode">Structures_Graph::removeNode()</a> in Graph.php</div>
-							<div class="index-item-description">Remove a Node from the Graph</div>
-					</dd>
-		</dl>
-	<a name="s"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">s</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">setData</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetData">Structures_Graph_Node::setData()</a> in Node.php</div>
-							<div class="index-item-description">Node data setter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">setGraph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetGraph">Structures_Graph_Node::setGraph()</a> in Node.php</div>
-							<div class="index-item-description">Node graph setter. This method should not be called directly. Use Graph::addNode instead.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">setMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodsetMetadata">Structures_Graph_Node::setMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Node metadata setter</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">sort</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html#methodsort">Structures_Graph_Manipulator_TopologicalSorter::sort()</a> in TopologicalSorter.php</div>
-							<div class="index-item-description">sort returns the graph's nodes, sorted by topological order.</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html">Structures_Graph</a> in Graph.php</div>
-							<div class="index-item-description">The Structures_Graph class represents a graph data structure.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">Structures_Graph</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph.html#methodStructures_Graph">Structures_Graph::Structures_Graph()</a> in Graph.php</div>
-							<div class="index-item-description">Constructor</div>
-					</dd>
-			<dt class="field">
-						<span class="const-title">STRUCTURES_GRAPH_ERROR_GENERIC</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_php.html#defineSTRUCTURES_GRAPH_ERROR_GENERIC">STRUCTURES_GRAPH_ERROR_GENERIC</a> in Graph.php</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Manipulator_AcyclicTest
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html">Structures_Graph_Manipulator_AcyclicTest</a> in AcyclicTest.php</div>
-							<div class="index-item-description">The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator  which tests whether a graph contains a cycle.</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Manipulator_TopologicalSorter
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html">Structures_Graph_Manipulator_TopologicalSorter</a> in TopologicalSorter.php</div>
-							<div class="index-item-description">The Structures_Graph_Manipulator_TopologicalSorter is a manipulator  which is able to return the set of nodes in a graph, sorted by topological  order.</div>
-					</dd>
-			<dt class="field">
-						<span class="method-title">Structures_Graph_Node</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodStructures_Graph_Node">Structures_Graph_Node::Structures_Graph_Node()</a> in Node.php</div>
-							<div class="index-item-description">Constructor</div>
-					</dd>
-			<dt class="field">
-						Structures_Graph_Node
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html">Structures_Graph_Node</a> in Node.php</div>
-							<div class="index-item-description">The Structures_Graph_Node class represents a Node that can be member of a  graph node set.</div>
-					</dd>
-		</dl>
-	<a name="t"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">t</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="include-title">TopologicalSorter.php</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html">TopologicalSorter.php</a> in TopologicalSorter.php</div>
-					</dd>
-		</dl>
-	<a name="u"></a>
-	<div class="index-letter-section">
-		<div style="float: left" class="index-letter-title">u</div>
-		<div style="float: right"><a href="#top">top</a></div>
-		<div style="clear: both"></div>
-	</div>
-	<dl>
-			<dt class="field">
-						<span class="method-title">unsetMetadata</span>
-					</dt>
-		<dd class="index-item-body">
-			<div class="index-item-details"><a href="Structures_Graph/Structures_Graph_Node.html#methodunsetMetadata">Structures_Graph_Node::unsetMetadata()</a> in Node.php</div>
-							<div class="index-item-description">Delete metadata by key</div>
-					</dd>
-		</dl>
-
-<div class="index-letter-menu">
-	<a class="index-letter" href="elementindex_Structures_Graph.html#a">a</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#c">c</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#g">g</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#i">i</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#m">m</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#n">n</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#o">o</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#r">r</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#s">s</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#t">t</a>
-	<a class="index-letter" href="elementindex_Structures_Graph.html#u">u</a>
-</div>	</body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/errors.html b/lib/docs/Structures_Graph/docs/html/errors.html
deleted file mode 100644
index cdc198ac2848a828d876d9949cef8a46127bbf77..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/errors.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>phpDocumentor Parser Errors and Warnings</title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						<a href="#Post-parsing">Post-parsing</a><br>
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/index.html b/lib/docs/Structures_Graph/docs/html/index.html
deleted file mode 100644
index d272cf6c381ade3e946b42035e8d2b36dbb197a5..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-   <html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<!-- Generated by phpDocumentor on Fri, 30 Jan 2004 16:37:28 +0000  -->
-  <title>Structures_Graph Documentation</title>
-  <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-</head>
-
-<FRAMESET rows='100,*'>
-	<FRAME src='packages.html' name='left_top' frameborder="1" bordercolor="#999999">
-	<FRAMESET cols='25%,*'>
-		<FRAME src='li_Structures_Graph.html' name='left_bottom' frameborder="1" bordercolor="#999999">
-		<FRAME src='Structures_Graph/tutorial_Structures_Graph.pkg.html' name='right' frameborder="1" bordercolor="#999999">
-	</FRAMESET>
-	<NOFRAMES>
-		<H2>Frame Alert</H2>
-		<P>This document is designed to be viewed using the frames feature.
-		If you see this message, you are using a non-frame-capable web client.</P>
-	</NOFRAMES>
-</FRAMESET>
-</HTML>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/li_Structures_Graph.html b/lib/docs/Structures_Graph/docs/html/li_Structures_Graph.html
deleted file mode 100644
index d563cde46f04c69cc5ce53c2b937ce250c5f5d90..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/li_Structures_Graph.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title></title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						<div class="package-title">Structures_Graph</div>
-<div class="package-details">
-
-	<dl class="tree">
-		
-		<dt class="folder-title">Description</dt>
-		<dd>
-			<a href='classtrees_Structures_Graph.html' target='right'>Class trees</a><br />
-			<a href='elementindex_Structures_Graph.html' target='right'>Index of elements</a><br />
-							<a href="todolist.html" target="right">Todo List</a><br />
-					</dd>
-	
-							
-							
-									<dt class="folder-title">Tutorials/Manuals</dt>
-					<dd>
-											<dl class="tree">
-						<dt class="folder-title">Package-level</dt>
-						<dd>
-													<div><a href="Structures_Graph/tutorial_Structures_Graph.pkg.html" target="right">Structures_Graph Tutorial</a></div>
-
-												</dd>
-						</dl>
-										
-										
-										</dd>
-													<dt class="folder-title">Classes</dt>
-											<dd><a href='Structures_Graph/Structures_Graph.html' target='right'>Structures_Graph</a></dd>
-											<dd><a href='Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html' target='right'>Structures_Graph_Manipulator_AcyclicTest</a></dd>
-											<dd><a href='Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html' target='right'>Structures_Graph_Manipulator_TopologicalSorter</a></dd>
-											<dd><a href='Structures_Graph/Structures_Graph_Node.html' target='right'>Structures_Graph_Node</a></dd>
-																						<dt class="folder-title">Files</dt>
-											<dd><a href='Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html' target='right'>AcyclicTest.php</a></dd>
-											<dd><a href='Structures_Graph/_Structures_Graph_php.html' target='right'>Graph.php</a></dd>
-											<dd><a href='Structures_Graph/_Structures_Graph_Node_php.html' target='right'>Node.php</a></dd>
-											<dd><a href='Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html' target='right'>TopologicalSorter.php</a></dd>
-																	
-						
-			</dl>
-</div>
-<p class="notes"><a href="http://www.phpdoc.org" target="_blank">phpDocumentor v <span class="field">1.2.3</span></a></p>
-</BODY>
-</HTML>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/media/banner.css b/lib/docs/Structures_Graph/docs/html/media/banner.css
deleted file mode 100644
index e67227b7cb3dddd7055b8330a28ac720a5af534f..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/media/banner.css
+++ /dev/null
@@ -1,32 +0,0 @@
-body 
-{ 
-	background-color: #CCCCFF; 
-	margin: 0px; 
-	padding: 0px;
-}
-
-/* Banner (top bar) classes */
-
-.banner {  }
-
-.banner-menu 
-{ 
-	clear: both;
-	padding: .5em;
-	border-top: 2px solid #6666AA;	
-}
-
-.banner-title 
-{ 
-	text-align: right; 
-	font-size: 20pt; 
-	font-weight: bold; 
-	margin: .2em;
-}
-
-.package-selector 
-{ 
-	background-color: #AAAADD; 
-	border: 1px solid black; 
-	color: yellow;
-}
diff --git a/lib/docs/Structures_Graph/docs/html/media/stylesheet.css b/lib/docs/Structures_Graph/docs/html/media/stylesheet.css
deleted file mode 100644
index 4a097a229c7f2950fd86589921aa337e02a99327..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/media/stylesheet.css
+++ /dev/null
@@ -1,134 +0,0 @@
-a { color: #336699; text-decoration: none; }
-a:hover { color: #6699CC; text-decoration: underline; }
-a:active { color: #6699CC; text-decoration: underline; }
-
-body { background : #FFFFFF; }
-body, table { font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt }
-p, li { line-height: 140% }
-a img { border: 0px; }
-dd { margin-left: 0px; padding-left: 1em; }
-
-/* Page layout/boxes */
-
-.info-box {}
-.info-box-title { margin: 1em 0em 0em 0em; padding: .25em; font-weight: normal; font-size: 14pt; border: 2px solid #999999; background-color: #CCCCFF }
-.info-box-body { border: 1px solid #999999; padding: .5em; }
-.nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; }
-
-.oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
-.evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
-
-.page-body { max-width: 800px; margin: auto; }
-.tree dl { margin: 0px }
-
-/* Index formatting classes */
-
-.index-item-body { margin-top: .5em; margin-bottom: .5em}
-.index-item-description { margin-top: .25em }
-.index-item-details { font-weight: normal; font-style: italic; font-size: 8pt }
-.index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em}
-.index-letter-title { font-size: 12pt; font-weight: bold }
-.index-letter-menu { text-align: center; margin: 1em }
-.index-letter { font-size: 12pt }
-
-/* Docbook classes */
-
-.description {}
-.short-description { font-weight: bold; color: #666666; }
-.tags {	padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; }
-.parameters {	padding-left: 0em; margin-left: 3em; font-style: italic; list-style-type: square; }
-.redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; }
-.package {  }
-.package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black }
-.package-details { font-size: 85%; }
-.sub-package { font-weight: bold; font-size: 120% }
-.tutorial { border-width: thin; border-color: #0066ff }
-.tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; }
-.nav-button-disabled { color: #999999; }
-.nav-button:active, 
-.nav-button:focus, 
-.nav-button:hover { background-color: #DDDDDD; outline: 1px solid #999999; text-decoration: none }
-.folder-title { font-style: italic }
-
-/* Generic formatting */
-
-.field { font-weight: bold; }
-.detail { font-size: 8pt; }
-.notes { font-style: italic; font-size: 8pt; }
-.separator { background-color: #999999; height: 2px; }
-.warning {  color: #FF6600; }
-.disabled { font-style: italic; color: #999999; }
-
-/* Code elements */
-
-.line-number {  }
-
-.class-table { width: 100%; }
-.class-table-header { border-bottom: 1px dotted #666666; text-align: left}
-.class-name { color: #000000; font-weight: bold; }
-
-.method-summary { padding-left: 1em; font-size: 8pt }
-.method-header { }
-.method-definition { margin-bottom: .3em }
-.method-title { font-weight: bold; }
-.method-name { font-weight: bold; }
-.method-signature { font-size: 85%; color: #666666; margin: .5em 0em }
-.method-result { font-style: italic; }
-
-.var-summary { padding-left: 1em; font-size: 8pt; }
-.var-header { }
-.var-title { margin-bottom: .3em }
-.var-type { font-style: italic; }
-.var-name { font-weight: bold; }
-.var-default {}
-.var-description { font-weight: normal; color: #000000; }
-
-.include-title {  }
-.include-type { font-style: italic; }
-.include-name { font-weight: bold; }
-
-.const-title {  }
-.const-name { font-weight: bold; }
-
-/* Syntax highlighting */
-
-.src-code {  border: 1px solid #336699; padding: 1em; background-color: #EEEEEE; }
-
-.src-comm { color: green; }
-.src-id {  }
-.src-inc { color: #0000FF; }
-.src-key { color: #0000FF; }
-.src-num { color: #CC0000; }
-.src-str { color: #66cccc; }
-.src-sym { font-weight: bold; }
-.src-var { }
-
-.src-php { font-weight: bold; }
-
-.src-doc { color: #009999 }
-.src-doc-close-template { color: #0000FF }
-.src-doc-coretag { color: #0099FF; font-weight: bold }
-.src-doc-inlinetag { color: #0099FF }
-.src-doc-internal { color: #6699cc }
-.src-doc-tag { color: #0080CC }
-.src-doc-template { color: #0000FF }
-.src-doc-type { font-style: italic }
-.src-doc-var { font-style: italic }
-
-/* tutorial */
-
-.authors {  }
-.author { font-style: italic; font-weight: bold }
-.author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal }
-.example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em }
-.listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap }
-.release-info { font-size: 85%; font-style: italic; margin: 1em 0em }
-.ref-title-box {  }
-.ref-title {  }
-.ref-purpose { font-style: italic; color: #666666 }
-.ref-synopsis {  }
-.title { font-weight: bold; margin: 1em 0em 0em 0em; padding: .25em; border: 2px solid #999999; background-color: #CCCCFF  }
-.cmd-synopsis { margin: 1em 0em }
-.cmd-title { font-weight: bold }
-.toc { margin-left: 2em; padding-left: 0em }
-
diff --git a/lib/docs/Structures_Graph/docs/html/packages.html b/lib/docs/Structures_Graph/docs/html/packages.html
deleted file mode 100644
index ebed0d3c808a0e47d4cc9a2430b0f0fcf7727d75..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/packages.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title></title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<link rel="stylesheet" href="media/banner.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-			<div class="banner">
-				<div class="banner-title">Structures_Graph</div>
-				<div class="banner-menu">
-	        <table cellpadding="0" cellspacing="0" style="width: 100%">
-	          <tr>
-              <td>
-								              </td>
-              <td style="width: 2em">&nbsp;</td>
-              <td style="text-align: right">
-								              </td>
-						</tr>
-          </table>
-				</div>
-			</div>
-		</body>
-	</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/html/todolist.html b/lib/docs/Structures_Graph/docs/html/todolist.html
deleted file mode 100644
index 597eb4f1d07e4502d0c1b8cf65ac17272b77c032..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/html/todolist.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-		<head>
-			<!-- template designed by Marco Von Ballmoos -->
-			<title>Todo List</title>
-			<link rel="stylesheet" href="media/stylesheet.css" />
-			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
-		</head>
-		<body>
-						<div align="center"><h1>Todo List</h1></div>
-<h2>Structures_Graph</h2>
-<h3><a href="Structures_Graph/Structures_Graph.html#methodremoveNode">Structures_Graph::removeNode()</a></h3>
-<ul>
-    <li>This is unimplemented</li>
-</ul>
-	<p class="notes" id="credit">
-		Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
-	</p>
-	</body>
-</html>
\ No newline at end of file
diff --git a/lib/docs/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg b/lib/docs/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg
deleted file mode 100644
index 23def4156ae68f5789871bc637aa6db231ce849d..0000000000000000000000000000000000000000
--- a/lib/docs/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg
+++ /dev/null
@@ -1,98 +0,0 @@
-<refentry id="{@id package.database.structures_graph.tutorial}">
- <refnamediv>
-  <refname><classname>Structures_Graph</classname> Tutorial</refname>
-  <refpurpose>A first tour of graph datastructure manipulation</refpurpose>
- </refnamediv>
- <refsect1 id="{@id package.database.structures_graph.tutorial.intro}">
-  <title>Introduction</title>
-  <para>
-  Structures_Graph is a package for creating and manipulating graph datastructures. A graph is a set of objects, called nodes, connected by arcs. When used as a datastructure, usually nodes contain data, and arcs represent relationships between nodes. When arcs have a direction, and can be travelled only one way, graphs are said to be directed. When arcs have no direction, and can always be travelled both ways, graphs are said to be non directed.
-  </para>
-  <para>
-  Structures_Graph provides an object oriented API to create and directly query a graph, as well as a set of Manipulator classes to extract information from the graph.
-  </para>
- </refsect1>
- <refsect1 id="{@id package.database.structures_graph.tutorial.creation}">
-  <title>Creating a Graph</title>
-  <para>
-   Creating a graph is done using the simple constructor:
-   <programlisting>
-    <![CDATA[
-require_once 'Structures/Graph.php';
-
-$directedGraph =& new Structures_Graph(true);
-$nonDirectedGraph =& new Structures_Graph(false);
-    ]]>
-   </programlisting>
-   and passing the constructor a flag telling it whether the graph should be directed. A directed graph will always be directed during its lifetime. It's a permanent characteristic.
-  </para>
-  <para>
-  To fill out the graph, we'll need to create some nodes, and then call Graph::addNode.
-   <programlisting>
-    <![CDATA[
-require_once 'Structures/Graph/Node.php';
-
-$nodeOne =& new Structures_Graph_Node();
-$nodeTwo =& new Structures_Graph_Node();
-$nodeThree =& new Structures_Graph_Node();
-
-$directedGraph->addNode(&$nodeOne);
-$directedGraph->addNode(&$nodeTwo);
-$directedGraph->addNode(&$nodeThree);
-    ]]>
-   </programlisting>
-   and then setup the arcs:
-   <programlisting>
-    <![CDATA[
-$nodeOne->connectTo($nodeTwo);
-$nodeOne->connectTo($nodeThree);
-    ]]>
-   </programlisting>
-   Note that arcs can only be created after the nodes have been inserted into the graph. 
-  </para>
- </refsect1>
- <refsect1 id="{@id package.database.structures_graph.tutorial.nodesanddata}">
-  <title>Associating Data</title>
-  <para>
-  Graphs are only useful as datastructures if they can hold data. Structure_Graph stores data in nodes. Each node contains a setter and a getter for its data.
-   <programlisting>
-    <![CDATA[
-$nodeOne->setData("Node One's Data is a String");
-$nodeTwo->setData(1976);
-$nodeThree->setData('Some other string');
-
-print("NodeTwo's Data is an integer: " . $nodeTwo->getData());
-    ]]>
-   </programlisting>
-  </para>
-  <para>
-  Structure_Graph nodes can also store metadata, alongside with the main data. Metadata differs from regular data just because it is stored under a key, making it possible to store more than one data reference per node. The metadata getter and setter need the key to perform the operation:
-   <programlisting>
-    <![CDATA[
-$nodeOne->setMetadata('example key', "Node One's Sample Metadata");
-print("Metadata stored under key 'example key' in node one: " . $nodeOne->getMetadata('example key'));
-$nodeOne->unsetMetadata('example key');
-    ]]>
-   </programlisting>
-  </para>
- </refsect1>
- <refsect1 id="{@id package.database.structures_graph.tutorial.querying}">
-  <title>Querying a Graph</title>
-  <para>
-  Structures_Graph provides for basic querying of the graph:
-   <programlisting>
-    <![CDATA[
-// Nodes are able to calculate their indegree and outdegree
-print("NodeOne's inDegree: " . $nodeOne->inDegree());
-print("NodeOne's outDegree: " . $nodeOne->outDegree());
-
-// and naturally, nodes can report on their arcs
-$arcs = $nodeOne->getNeighbours();
-for ($i=0;$i<sizeof($arcs);$i++) {
-    print("NodeOne has an arc to " . $arcs[$i]->getData());
-}
-    ]]>
-   </programlisting>
-  </para>
- </refsect1>
-</refentry>
diff --git a/lib/docs/XML_Util/XML/examples/example.php b/lib/docs/XML_Util/XML/examples/example.php
deleted file mode 100644
index 920ebd97dc80e73886201e2926ed34e0e5ca3c3b..0000000000000000000000000000000000000000
--- a/lib/docs/XML_Util/XML/examples/example.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Examples (file #1)
- *
- * several examples for the methods of XML_Util
- * 
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2003-2008 Stephan Schmidt <schst@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * The name of the author may not be used to endorse or promote products
- *      derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   XML
- * @package    XML_Util
- * @subpackage Examples
- * @author     Stephan Schmidt <schst@php.net>
- * @copyright  2003-2008 Stephan Schmidt <schst@php.net>
- * @license    http://opensource.org/licenses/bsd-license New BSD License
- * @version    CVS: $Id: example.php,v 1.17 2008/05/05 19:05:28 ashnazg Exp $
- * @link       http://pear.php.net/package/XML_Util
- */
-
-    /**
-     * set error level
-     */
-    error_reporting(E_ALL);
-
-    require_once 'XML/Util.php';
-    
-    /**
-     * replacing XML entities
-     */
-    print 'replace XML entities:<br>';
-    print XML_Util::replaceEntities('This string contains < & >.');
-    print "\n<br><br>\n";
-
-    /**
-     * reversing XML entities
-     */
-    print 'replace XML entities:<br>';
-    print XML_Util::reverseEntities('This string contains &lt; &amp; &gt;.');
-    print "\n<br><br>\n";
-
-    /**
-     * building XML declaration
-     */
-    print 'building XML declaration:<br>';
-    print htmlspecialchars(XML_Util::getXMLDeclaration());
-    print "\n<br><br>\n";
-
-    print 'building XML declaration with additional attributes:<br>';
-    print htmlspecialchars(XML_Util::getXMLDeclaration('1.0', 'UTF-8', true));
-    print "\n<br><br>\n";
-
-    /**
-     * building document type declaration
-     */
-    print 'building DocType declaration:<br>';
-    print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 
-        'http://pear.php.net/dtd/package-1.0'));
-    print "\n<br><br>\n";
-
-    print 'building DocType declaration with public ID (does not exist):<br>';
-    print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 
-        array('uri' => 'http://pear.php.net/dtd/package-1.0', 
-            'id' => '-//PHP//PEAR/DTD PACKAGE 0.1')));
-    print "\n<br><br>\n";
-
-    print 'building DocType declaration with internal DTD:<br>';
-    print '<pre>';
-    print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 
-        'http://pear.php.net/dtd/package-1.0', 
-        '<!ELEMENT additionalInfo (#PCDATA)>'));
-    print '</pre>';
-    print "\n<br><br>\n";
-
-    /**
-     * creating an attribute string
-     */
-    $att = array(
-        'foo'  => 'bar',
-        'argh' => 'tomato'
-    );
-
-    print 'converting array to string:<br>';
-    print XML_Util::attributesToString($att);
-    print "\n<br><br>\n";
-
-
-    /**
-     * creating an attribute string with linebreaks
-     */
-    $att = array(
-        'foo'  => 'bar',
-        'argh' => 'tomato'
-    );
-
-    print 'converting array to string (including line breaks):<br>';
-    print '<pre>';
-    print XML_Util::attributesToString($att, true, true);
-    print '</pre>';
-    print "\n<br><br>\n";
-
-
-    /**
-     * splitting a qualified tag name
-     */
-    print 'splitting qualified tag name:<br>';
-    print '<pre>';
-    print_r(XML_Util::splitQualifiedName('xslt:stylesheet'));
-    print '</pre>';
-    print "\n<br>\n";
-
-
-    /**
-     * splitting a qualified tag name (no namespace)
-     */
-    print 'splitting qualified tag name (no namespace):<br>';
-    print '<pre>';
-    print_r(XML_Util::splitQualifiedName('foo'));
-    print '</pre>';
-    print "\n<br>\n";
-
-    /**
-     * splitting a qualified tag name (no namespace, but default namespace specified)
-     */
-    print 'splitting qualified tag name '
-        . '(no namespace, but default namespace specified):<br>';
-    print '<pre>';
-    print_r(XML_Util::splitQualifiedName('foo', 'bar'));
-    print '</pre>';
-    print "\n<br>\n";
-
-    /**
-     * verifying XML names
-     */
-    print 'verifying \'My private tag\':<br>';
-    print '<pre>';
-    print_r(XML_Util::isValidname('My Private Tag'));
-    print '</pre>';
-    print "\n<br><br>\n";
-    
-    print 'verifying \'-MyTag\':<br>';
-    print '<pre>';
-    print_r(XML_Util::isValidname('-MyTag'));
-    print '</pre>';
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag
-     */
-    $tag = array(
-        'namespace'  => 'foo',
-        'localPart'  => 'bar',
-        'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-        'content'    => 'I\'m inside the tag'
-    );
-
-    print 'creating a tag with namespace and local part:<br>';
-    print htmlentities(XML_Util::createTagFromArray($tag));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag
-     */
-    $tag = array(
-        'qname'        => 'foo:bar',
-        'namespaceUri' => 'http://foo.com',
-        'attributes'   => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-        'content'      => 'I\'m inside the tag'
-    );
-
-    print 'creating a tag with qualified name and namespaceUri:<br>';
-    print htmlentities(XML_Util::createTagFromArray($tag));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag
-     */
-    $tag = array(
-        'qname'        => 'bar',
-        'namespaceUri' => 'http://foo.com',
-        'attributes'   => array('key' => 'value', 'argh' => 'fruit&vegetable')
-    );
-
-    print 'creating an empty tag without namespace but namespace Uri:<br>';
-    print htmlentities(XML_Util::createTagFromArray($tag));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag with more namespaces
-     */
-    $tag = array(
-        'namespace'   => 'foo',
-        'localPart'   => 'bar',
-        'attributes'  => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-        'content'     => 'I\'m inside the tag',
-        'namespaces'  => array(
-            'bar'  => 'http://bar.com',
-            'pear' => 'http://pear.php.net',
-        )
-    );
-
-    print 'creating an XML tag with more namespaces:<br />';
-    print htmlentities(XML_Util::createTagFromArray($tag));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag with a CData Section
-     */
-    $tag = array(
-        'qname'      => 'foo',
-        'attributes' => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-        'content'    => 'I\'m inside the tag'
-    );
-
-    print 'creating a tag with CData section:<br>';
-    print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_CDATA_SECTION));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag with a CData Section
-     */
-    $tag = array(
-        'qname'      => 'foo',
-        'attributes' => array('key' => 'value', 'argh' => 't�t�'),
-        'content'    => 
-            'Also XHTML-tags can be created '
-            . 'and HTML entities can be replaced � � � � <>.'
-    );
-
-    print 'creating a tag with HTML entities:<br>';
-    print htmlentities(XML_Util::createTagFromArray($tag, XML_UTIL_ENTITIES_HTML));
-    print "\n<br><br>\n";
-
-    /**
-    * creating an XML tag with createTag
-    */
-    print 'creating a tag with createTag:<br>';
-    print htmlentities(XML_Util::createTag('myNs:myTag', 
-        array('foo' => 'bar'), 
-        'This is inside the tag', 
-        'http://www.w3c.org/myNs#'));
-    print "\n<br><br>\n";
-
-    
-    /**
-     * trying to create an XML tag with an array as content
-     */
-    $tag = array(
-        'qname'   => 'bar',
-        'content' => array('foo' => 'bar')
-    );
-    print 'trying to create an XML tag with an array as content:<br>';
-    print '<pre>';
-    print_r(XML_Util::createTagFromArray($tag));
-    print '</pre>';
-    print "\n<br><br>\n";
-    
-    /**
-     * trying to create an XML tag without a name
-     */
-    $tag = array(
-        'attributes' => array('foo' => 'bar'),
-    );
-    print 'trying to create an XML tag without a name:<br>';
-    print '<pre>';
-    print_r(XML_Util::createTagFromArray($tag));
-    print '</pre>';
-    print "\n<br><br>\n";
-?>
diff --git a/lib/docs/XML_Util/XML/examples/example2.php b/lib/docs/XML_Util/XML/examples/example2.php
deleted file mode 100644
index 0bf9b743660e2e96c3445dcf3cf1bfd150f4ff06..0000000000000000000000000000000000000000
--- a/lib/docs/XML_Util/XML/examples/example2.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Examples (file #2)
- *
- * several examples for the methods of XML_Util
- * 
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2003-2008 Stephan Schmidt <schst@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * The name of the author may not be used to endorse or promote products
- *      derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   XML
- * @package    XML_Util
- * @subpackage Examples
- * @author     Stephan Schmidt <schst@php.net>
- * @copyright  2003-2008 Stephan Schmidt <schst@php.net>
- * @license    http://opensource.org/licenses/bsd-license New BSD License
- * @version    CVS: $Id: example2.php,v 1.11 2008/05/05 19:03:13 ashnazg Exp $
- * @link       http://pear.php.net/package/XML_Util
- */
-
-    /**
-     * set error level
-     */
-    error_reporting(E_ALL);
-
-    require_once 'XML/Util.php';
-
-    /**
-     * creating a start element
-     */
-    print 'creating a start element:<br>';
-    print htmlentities(XML_Util::createStartElement('myNs:myTag', 
-        array('foo' => 'bar'), 'http://www.w3c.org/myNs#'));
-    print "\n<br><br>\n";
-
-
-    /**
-     * creating a start element
-     */
-    print 'creating a start element:<br>';
-    print htmlentities(XML_Util::createStartElement('myTag', 
-        array(), 'http://www.w3c.org/myNs#'));
-    print "\n<br><br>\n";
-
-    /**
-     * creating a start element
-     */
-    print 'creating a start element:<br>';
-    print '<pre>';
-    print htmlentities(XML_Util::createStartElement('myTag', 
-        array('foo' => 'bar', 'argh' => 'tomato'), 
-        'http://www.w3c.org/myNs#', true));
-    print '</pre>';
-    print "\n<br><br>\n";
-
-
-    /**
-     * creating an end element
-     */
-    print 'creating an end element:<br>';
-    print htmlentities(XML_Util::createEndElement('myNs:myTag'));
-    print "\n<br><br>\n";
-
-    /**
-     * creating a CData section
-     */
-    print 'creating a CData section:<br>';
-    print htmlentities(XML_Util::createCDataSection('I am content.'));
-    print "\n<br><br>\n";
-
-    /**
-     * creating a comment
-     */
-    print 'creating a comment:<br>';
-    print htmlentities(XML_Util::createComment('I am a comment.'));
-    print "\n<br><br>\n";
-
-    /**
-     * creating an XML tag with multiline mode
-     */
-    $tag = array(
-        'qname'        => 'foo:bar',
-        'namespaceUri' => 'http://foo.com',
-        'attributes'   => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-        'content'      => 'I\'m inside the tag & contain dangerous chars'
-    );
-
-    print 'creating a tag with qualified name and namespaceUri:<br>';
-    print '<pre>';
-    print htmlentities(XML_Util::createTagFromArray($tag, 
-        XML_UTIL_REPLACE_ENTITIES, true));
-    print '</pre>';
-    print "\n<br><br>\n";
-
-    /**
-     * create an attribute string without replacing the entities
-     */
-    $atts = array('series' => 'Starsky &amp; Hutch', 'channel' => 'ABC');
-    print 'creating a attribute string, '
-        . 'entities in values already had been replaced:<br>';
-    print htmlentities(XML_Util::attributesToString($atts, 
-        true, false, false, false, XML_UTIL_ENTITIES_NONE));
-    print "\n<br><br>\n";
-
-    /**
-     * using the array-syntax for attributesToString()
-     */
-    $atts = array('series' => 'Starsky &amp; Hutch', 'channel' => 'ABC');
-    print 'using the array-syntax for attributesToString()<br>';
-    print htmlentities(XML_Util::attributesToString($atts, 
-        array('entities' => XML_UTIL_ENTITIES_NONE)));
-    print "\n<br><br>\n";
-
-
-?>
diff --git a/lib/downloads/Archive_Tar-1.3.3.tgz b/lib/downloads/Archive_Tar-1.3.3.tgz
deleted file mode 100644
index 2cc3c08fb6bd38e3777a9772cdc9d4d0aa06498b..0000000000000000000000000000000000000000
Binary files a/lib/downloads/Archive_Tar-1.3.3.tgz and /dev/null differ
diff --git a/lib/downloads/Console_Getopt-1.2.3.tgz b/lib/downloads/Console_Getopt-1.2.3.tgz
deleted file mode 100644
index 156a0740d6e55f7afad6501d8c927d7a86de7a9c..0000000000000000000000000000000000000000
Binary files a/lib/downloads/Console_Getopt-1.2.3.tgz and /dev/null differ
diff --git a/lib/downloads/DB-1.7.13.tgz b/lib/downloads/DB-1.7.13.tgz
deleted file mode 100644
index 3057965ef41c239aeb693d6bc854f14eb1b9ee0f..0000000000000000000000000000000000000000
Binary files a/lib/downloads/DB-1.7.13.tgz and /dev/null differ
diff --git a/lib/downloads/DB_DataObject-1.9.3.tgz b/lib/downloads/DB_DataObject-1.9.3.tgz
deleted file mode 100644
index dca5775605f31a1bb7479f4a21d760d429c3df7a..0000000000000000000000000000000000000000
Binary files a/lib/downloads/DB_DataObject-1.9.3.tgz and /dev/null differ
diff --git a/lib/downloads/Date-1.4.7.tgz b/lib/downloads/Date-1.4.7.tgz
deleted file mode 100644
index 955ed033c3e332646d6f7dbe0270a596fa252765..0000000000000000000000000000000000000000
Binary files a/lib/downloads/Date-1.4.7.tgz and /dev/null differ
diff --git a/lib/downloads/MDB2-2.4.1.tgz b/lib/downloads/MDB2-2.4.1.tgz
deleted file mode 100644
index 5a324087aa3b6a909380182c819f4cfa402a2e7d..0000000000000000000000000000000000000000
Binary files a/lib/downloads/MDB2-2.4.1.tgz and /dev/null differ
diff --git a/lib/downloads/MDB2-2.5.0b2.tgz b/lib/downloads/MDB2-2.5.0b2.tgz
deleted file mode 100644
index bc3b8b31aef2c76c32a36183d16de0f5c5140b38..0000000000000000000000000000000000000000
Binary files a/lib/downloads/MDB2-2.5.0b2.tgz and /dev/null differ
diff --git a/lib/downloads/MDB2_Driver_mysqli-1.5.0b2.tgz b/lib/downloads/MDB2_Driver_mysqli-1.5.0b2.tgz
deleted file mode 100644
index 63a801cf90b1a1374315bbfe951aa3996891ae49..0000000000000000000000000000000000000000
Binary files a/lib/downloads/MDB2_Driver_mysqli-1.5.0b2.tgz and /dev/null differ
diff --git a/lib/downloads/PEAR-1.9.0.tgz b/lib/downloads/PEAR-1.9.0.tgz
deleted file mode 100644
index 3c526dc594d6a2f3044c5fb479361b42b4394cf8..0000000000000000000000000000000000000000
Binary files a/lib/downloads/PEAR-1.9.0.tgz and /dev/null differ
diff --git a/lib/downloads/Structures_Graph-1.0.2.tgz b/lib/downloads/Structures_Graph-1.0.2.tgz
deleted file mode 100644
index f46064632a7e92cb769e69e2b8aff00d70116964..0000000000000000000000000000000000000000
Binary files a/lib/downloads/Structures_Graph-1.0.2.tgz and /dev/null differ
diff --git a/lib/downloads/XML_Util-1.2.1.tgz b/lib/downloads/XML_Util-1.2.1.tgz
deleted file mode 100644
index 6338719c663f60adb9de34ee5216ede56a19b712..0000000000000000000000000000000000000000
Binary files a/lib/downloads/XML_Util-1.2.1.tgz and /dev/null differ
diff --git a/lib/php/Archive/Tar.php b/lib/php/Archive/Tar.php
deleted file mode 100644
index c32e7627094d518de195c0dce5b47ecd50f40b87..0000000000000000000000000000000000000000
--- a/lib/php/Archive/Tar.php
+++ /dev/null
@@ -1,1848 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * File::CSV
- *
- * PHP versions 4 and 5
- *
- * Copyright (c) 1997-2008,
- * Vincent Blavet <vincent@phpconcept.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright notice,
- *       this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @category    File_Formats
- * @package     Archive_Tar
- * @author      Vincent Blavet <vincent@phpconcept.net>
- * @copyright   1997-2008 The Authors
- * @license     http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version     CVS: $Id: Tar.php,v 1.43 2008/10/30 17:58:42 dufuz Exp $
- * @link        http://pear.php.net/package/Archive_Tar
- */
-
-require_once 'PEAR.php';
-
-
-define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
-define ('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
-
-/**
-* Creates a (compressed) Tar archive
-*
-* @author   Vincent Blavet <vincent@phpconcept.net>
-* @version  $Revision: 1.43 $
-* @license  http://www.opensource.org/licenses/bsd-license.php New BSD License
-* @package  Archive_Tar
-*/
-class Archive_Tar extends PEAR
-{
-    /**
-    * @var string Name of the Tar
-    */
-    var $_tarname='';
-
-    /**
-    * @var boolean if true, the Tar file will be gzipped
-    */
-    var $_compress=false;
-
-    /**
-    * @var string Type of compression : 'none', 'gz' or 'bz2'
-    */
-    var $_compress_type='none';
-
-    /**
-    * @var string Explode separator
-    */
-    var $_separator=' ';
-
-    /**
-    * @var file descriptor
-    */
-    var $_file=0;
-
-    /**
-    * @var string Local Tar name of a remote Tar (http:// or ftp://)
-    */
-    var $_temp_tarname='';
-
-    // {{{ constructor
-    /**
-    * Archive_Tar Class constructor. This flavour of the constructor only
-    * declare a new Archive_Tar object, identifying it by the name of the
-    * tar file.
-    * If the compress argument is set the tar will be read or created as a
-    * gzip or bz2 compressed TAR file.
-    *
-    * @param    string  $p_tarname  The name of the tar archive to create
-    * @param    string  $p_compress can be null, 'gz' or 'bz2'. This
-    *                   parameter indicates if gzip or bz2 compression
-    *                   is required.  For compatibility reason the
-    *                   boolean value 'true' means 'gz'.
-    * @access public
-    */
-    function Archive_Tar($p_tarname, $p_compress = null)
-    {
-        $this->PEAR();
-        $this->_compress = false;
-        $this->_compress_type = 'none';
-        if (($p_compress === null) || ($p_compress == '')) {
-            if (@file_exists($p_tarname)) {
-                if ($fp = @fopen($p_tarname, "rb")) {
-                    // look for gzip magic cookie
-                    $data = fread($fp, 2);
-                    fclose($fp);
-                    if ($data == "\37\213") {
-                        $this->_compress = true;
-                        $this->_compress_type = 'gz';
-                    // No sure it's enought for a magic code ....
-                    } elseif ($data == "BZ") {
-                        $this->_compress = true;
-                        $this->_compress_type = 'bz2';
-                    }
-                }
-            } else {
-                // probably a remote file or some file accessible
-                // through a stream interface
-                if (substr($p_tarname, -2) == 'gz') {
-                    $this->_compress = true;
-                    $this->_compress_type = 'gz';
-                } elseif ((substr($p_tarname, -3) == 'bz2') ||
-                          (substr($p_tarname, -2) == 'bz')) {
-                    $this->_compress = true;
-                    $this->_compress_type = 'bz2';
-                }
-            }
-        } else {
-            if (($p_compress === true) || ($p_compress == 'gz')) {
-                $this->_compress = true;
-                $this->_compress_type = 'gz';
-            } else if ($p_compress == 'bz2') {
-                $this->_compress = true;
-                $this->_compress_type = 'bz2';
-            } else {
-                die("Unsupported compression type '$p_compress'\n".
-                    "Supported types are 'gz' and 'bz2'.\n");
-                return false;
-            }
-        }
-        $this->_tarname = $p_tarname;
-        if ($this->_compress) { // assert zlib or bz2 extension support
-            if ($this->_compress_type == 'gz')
-                $extname = 'zlib';
-            else if ($this->_compress_type == 'bz2')
-                $extname = 'bz2';
-
-            if (!extension_loaded($extname)) {
-                PEAR::loadExtension($extname);
-            }
-            if (!extension_loaded($extname)) {
-                die("The extension '$extname' couldn't be found.\n".
-                    "Please make sure your version of PHP was built ".
-                    "with '$extname' support.\n");
-                return false;
-            }
-        }
-    }
-    // }}}
-
-    // {{{ destructor
-    function _Archive_Tar()
-    {
-        $this->_close();
-        // ----- Look for a local copy to delete
-        if ($this->_temp_tarname != '')
-            @unlink($this->_temp_tarname);
-        $this->_PEAR();
-    }
-    // }}}
-
-    // {{{ create()
-    /**
-    * This method creates the archive file and add the files / directories
-    * that are listed in $p_filelist.
-    * If a file with the same name exist and is writable, it is replaced
-    * by the new tar.
-    * The method return false and a PEAR error text.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * For each directory added in the archive, the files and
-    * sub-directories are also added.
-    * See also createModify() method for more details.
-    *
-    * @param array  $p_filelist An array of filenames and directory names, or a
-	*                           single string with names separated by a single
-	*                           blank space.
-    * @return                   true on success, false on error.
-    * @see createModify()
-    * @access public
-    */
-    function create($p_filelist)
-    {
-        return $this->createModify($p_filelist, '', '');
-    }
-    // }}}
-
-    // {{{ add()
-    /**
-    * This method add the files / directories that are listed in $p_filelist in
-    * the archive. If the archive does not exist it is created.
-    * The method return false and a PEAR error text.
-    * The files and directories listed are only added at the end of the archive,
-    * even if a file with the same name is already archived.
-    * See also createModify() method for more details.
-    *
-    * @param array  $p_filelist An array of filenames and directory names, or a
-	*                           single string with names separated by a single
-	*                           blank space.
-    * @return                   true on success, false on error.
-    * @see createModify()
-    * @access public
-    */
-    function add($p_filelist)
-    {
-        return $this->addModify($p_filelist, '', '');
-    }
-    // }}}
-
-    // {{{ extract()
-    function extract($p_path='')
-    {
-        return $this->extractModify($p_path, '');
-    }
-    // }}}
-
-    // {{{ listContent()
-    function listContent()
-    {
-        $v_list_detail = array();
-
-        if ($this->_openRead()) {
-            if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
-                unset($v_list_detail);
-                $v_list_detail = 0;
-            }
-            $this->_close();
-        }
-
-        return $v_list_detail;
-    }
-    // }}}
-
-    // {{{ createModify()
-    /**
-    * This method creates the archive file and add the files / directories
-    * that are listed in $p_filelist.
-    * If the file already exists and is writable, it is replaced by the
-    * new tar. It is a create and not an add. If the file exists and is
-    * read-only or is a directory it is not replaced. The method return
-    * false and a PEAR error text.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * The path indicated in $p_remove_dir will be removed from the
-    * memorized path of each file / directory listed when this path
-    * exists. By default nothing is removed (empty path '')
-    * The path indicated in $p_add_dir will be added at the beginning of
-    * the memorized path of each file / directory listed. However it can
-    * be set to empty ''. The adding of a path is done after the removing
-    * of path.
-    * The path add/remove ability enables the user to prepare an archive
-    * for extraction in a different path than the origin files are.
-    * See also addModify() method for file adding properties.
-    *
-    * @param array  $p_filelist     An array of filenames and directory names,
-	*                               or a single string with names separated by
-	*                               a single blank space.
-    * @param string $p_add_dir      A string which contains a path to be added
-	*                               to the memorized path of each element in
-	*                               the list.
-    * @param string $p_remove_dir   A string which contains a path to be
-	*                               removed from the memorized path of each
-	*                               element in the list, when relevant.
-    * @return boolean               true on success, false on error.
-    * @access public
-    * @see addModify()
-    */
-    function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
-    {
-        $v_result = true;
-
-        if (!$this->_openWrite())
-            return false;
-
-        if ($p_filelist != '') {
-            if (is_array($p_filelist))
-                $v_list = $p_filelist;
-            elseif (is_string($p_filelist))
-                $v_list = explode($this->_separator, $p_filelist);
-            else {
-                $this->_cleanFile();
-                $this->_error('Invalid file list');
-                return false;
-            }
-
-            $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
-        }
-
-        if ($v_result) {
-            $this->_writeFooter();
-            $this->_close();
-        } else
-            $this->_cleanFile();
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ addModify()
-    /**
-    * This method add the files / directories listed in $p_filelist at the
-    * end of the existing archive. If the archive does not yet exists it
-    * is created.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * The path indicated in $p_remove_dir will be removed from the
-    * memorized path of each file / directory listed when this path
-    * exists. By default nothing is removed (empty path '')
-    * The path indicated in $p_add_dir will be added at the beginning of
-    * the memorized path of each file / directory listed. However it can
-    * be set to empty ''. The adding of a path is done after the removing
-    * of path.
-    * The path add/remove ability enables the user to prepare an archive
-    * for extraction in a different path than the origin files are.
-    * If a file/dir is already in the archive it will only be added at the
-    * end of the archive. There is no update of the existing archived
-    * file/dir. However while extracting the archive, the last file will
-    * replace the first one. This results in a none optimization of the
-    * archive size.
-    * If a file/dir does not exist the file/dir is ignored. However an
-    * error text is send to PEAR error.
-    * If a file/dir is not readable the file/dir is ignored. However an
-    * error text is send to PEAR error.
-    *
-    * @param array      $p_filelist     An array of filenames and directory
-	*                                   names, or a single string with names
-	*                                   separated by a single blank space.
-    * @param string     $p_add_dir      A string which contains a path to be
-	*                                   added to the memorized path of each
-	*                                   element in the list.
-    * @param string     $p_remove_dir   A string which contains a path to be
-	*                                   removed from the memorized path of
-	*                                   each element in the list, when
-    *                                   relevant.
-    * @return                           true on success, false on error.
-    * @access public
-    */
-    function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
-    {
-        $v_result = true;
-
-        if (!$this->_isArchive())
-            $v_result = $this->createModify($p_filelist, $p_add_dir,
-			                                $p_remove_dir);
-        else {
-            if (is_array($p_filelist))
-                $v_list = $p_filelist;
-            elseif (is_string($p_filelist))
-                $v_list = explode($this->_separator, $p_filelist);
-            else {
-                $this->_error('Invalid file list');
-                return false;
-            }
-
-            $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
-        }
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ addString()
-    /**
-    * This method add a single string as a file at the
-    * end of the existing archive. If the archive does not yet exists it
-    * is created.
-    *
-    * @param string     $p_filename     A string which contains the full
-	*                                   filename path that will be associated
-	*                                   with the string.
-    * @param string     $p_string       The content of the file added in
-	*                                   the archive.
-    * @return                           true on success, false on error.
-    * @access public
-    */
-    function addString($p_filename, $p_string)
-    {
-        $v_result = true;
-
-        if (!$this->_isArchive()) {
-            if (!$this->_openWrite()) {
-                return false;
-            }
-            $this->_close();
-        }
-
-        if (!$this->_openAppend())
-            return false;
-
-        // Need to check the get back to the temporary file ? ....
-        $v_result = $this->_addString($p_filename, $p_string);
-
-        $this->_writeFooter();
-
-        $this->_close();
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ extractModify()
-    /**
-    * This method extract all the content of the archive in the directory
-    * indicated by $p_path. When relevant the memorized path of the
-    * files/dir can be modified by removing the $p_remove_path path at the
-    * beginning of the file/dir path.
-    * While extracting a file, if the directory path does not exists it is
-    * created.
-    * While extracting a file, if the file already exists it is replaced
-    * without looking for last modification date.
-    * While extracting a file, if the file already exists and is write
-    * protected, the extraction is aborted.
-    * While extracting a file, if a directory with the same name already
-    * exists, the extraction is aborted.
-    * While extracting a directory, if a file with the same name already
-    * exists, the extraction is aborted.
-    * While extracting a file/directory if the destination directory exist
-    * and is write protected, or does not exist but can not be created,
-    * the extraction is aborted.
-    * If after extraction an extracted file does not show the correct
-    * stored file size, the extraction is aborted.
-    * When the extraction is aborted, a PEAR error text is set and false
-    * is returned. However the result can be a partial extraction that may
-    * need to be manually cleaned.
-    *
-    * @param string $p_path         The path of the directory where the
-	*                               files/dir need to by extracted.
-    * @param string $p_remove_path  Part of the memorized path that can be
-	*                               removed if present at the beginning of
-	*                               the file/dir path.
-    * @return boolean               true on success, false on error.
-    * @access public
-    * @see extractList()
-    */
-    function extractModify($p_path, $p_remove_path)
-    {
-        $v_result = true;
-        $v_list_detail = array();
-
-        if ($v_result = $this->_openRead()) {
-            $v_result = $this->_extractList($p_path, $v_list_detail,
-			                                "complete", 0, $p_remove_path);
-            $this->_close();
-        }
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ extractInString()
-    /**
-    * This method extract from the archive one file identified by $p_filename.
-    * The return value is a string with the file content, or NULL on error.
-    * @param string $p_filename     The path of the file to extract in a string.
-    * @return                       a string with the file content or NULL.
-    * @access public
-    */
-    function extractInString($p_filename)
-    {
-        if ($this->_openRead()) {
-            $v_result = $this->_extractInString($p_filename);
-            $this->_close();
-        } else {
-            $v_result = NULL;
-        }
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ extractList()
-    /**
-    * This method extract from the archive only the files indicated in the
-    * $p_filelist. These files are extracted in the current directory or
-    * in the directory indicated by the optional $p_path parameter.
-    * If indicated the $p_remove_path can be used in the same way as it is
-    * used in extractModify() method.
-    * @param array  $p_filelist     An array of filenames and directory names,
-	*                               or a single string with names separated
-	*                               by a single blank space.
-    * @param string $p_path         The path of the directory where the
-	*                               files/dir need to by extracted.
-    * @param string $p_remove_path  Part of the memorized path that can be
-	*                               removed if present at the beginning of
-	*                               the file/dir path.
-    * @return                       true on success, false on error.
-    * @access public
-    * @see extractModify()
-    */
-    function extractList($p_filelist, $p_path='', $p_remove_path='')
-    {
-        $v_result = true;
-        $v_list_detail = array();
-
-        if (is_array($p_filelist))
-            $v_list = $p_filelist;
-        elseif (is_string($p_filelist))
-            $v_list = explode($this->_separator, $p_filelist);
-        else {
-            $this->_error('Invalid string list');
-            return false;
-        }
-
-        if ($v_result = $this->_openRead()) {
-            $v_result = $this->_extractList($p_path, $v_list_detail, "partial",
-			                                $v_list, $p_remove_path);
-            $this->_close();
-        }
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ setAttribute()
-    /**
-    * This method set specific attributes of the archive. It uses a variable
-    * list of parameters, in the format attribute code + attribute values :
-    * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
-    * @param mixed $argv            variable list of attributes and values
-    * @return                       true on success, false on error.
-    * @access public
-    */
-    function setAttribute()
-    {
-        $v_result = true;
-
-        // ----- Get the number of variable list of arguments
-        if (($v_size = func_num_args()) == 0) {
-            return true;
-        }
-
-        // ----- Get the arguments
-        $v_att_list = &func_get_args();
-
-        // ----- Read the attributes
-        $i=0;
-        while ($i<$v_size) {
-
-            // ----- Look for next option
-            switch ($v_att_list[$i]) {
-                // ----- Look for options that request a string value
-                case ARCHIVE_TAR_ATT_SEPARATOR :
-                    // ----- Check the number of parameters
-                    if (($i+1) >= $v_size) {
-                        $this->_error('Invalid number of parameters for '
-						              .'attribute ARCHIVE_TAR_ATT_SEPARATOR');
-                        return false;
-                    }
-
-                    // ----- Get the value
-                    $this->_separator = $v_att_list[$i+1];
-                    $i++;
-                break;
-
-                default :
-                    $this->_error('Unknow attribute code '.$v_att_list[$i].'');
-                    return false;
-            }
-
-            // ----- Next attribute
-            $i++;
-        }
-
-        return $v_result;
-    }
-    // }}}
-
-    // {{{ _error()
-    function _error($p_message)
-    {
-        // ----- To be completed
-        $this->raiseError($p_message);
-    }
-    // }}}
-
-    // {{{ _warning()
-    function _warning($p_message)
-    {
-        // ----- To be completed
-        $this->raiseError($p_message);
-    }
-    // }}}
-
-    // {{{ _isArchive()
-    function _isArchive($p_filename=NULL)
-    {
-        if ($p_filename == NULL) {
-            $p_filename = $this->_tarname;
-        }
-        clearstatcache();
-        return @is_file($p_filename) && !@is_link($p_filename);
-    }
-    // }}}
-
-    // {{{ _openWrite()
-    function _openWrite()
-    {
-        if ($this->_compress_type == 'gz')
-            $this->_file = @gzopen($this->_tarname, "wb9");
-        else if ($this->_compress_type == 'bz2')
-            $this->_file = @bzopen($this->_tarname, "w");
-        else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($this->_tarname, "wb");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
-
-        if ($this->_file == 0) {
-            $this->_error('Unable to open in write mode \''
-			              .$this->_tarname.'\'');
-            return false;
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _openRead()
-    function _openRead()
-    {
-        if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
-
-          // ----- Look if a local copy need to be done
-          if ($this->_temp_tarname == '') {
-              $this->_temp_tarname = uniqid('tar').'.tmp';
-              if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
-                $this->_error('Unable to open in read mode \''
-				              .$this->_tarname.'\'');
-                $this->_temp_tarname = '';
-                return false;
-              }
-              if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
-                $this->_error('Unable to open in write mode \''
-				              .$this->_temp_tarname.'\'');
-                $this->_temp_tarname = '';
-                return false;
-              }
-              while ($v_data = @fread($v_file_from, 1024))
-                  @fwrite($v_file_to, $v_data);
-              @fclose($v_file_from);
-              @fclose($v_file_to);
-          }
-
-          // ----- File to open if the local copy
-          $v_filename = $this->_temp_tarname;
-
-        } else
-          // ----- File to open if the normal Tar file
-          $v_filename = $this->_tarname;
-
-        if ($this->_compress_type == 'gz')
-            $this->_file = @gzopen($v_filename, "rb");
-        else if ($this->_compress_type == 'bz2')
-            $this->_file = @bzopen($v_filename, "r");
-        else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($v_filename, "rb");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
-
-        if ($this->_file == 0) {
-            $this->_error('Unable to open in read mode \''.$v_filename.'\'');
-            return false;
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _openReadWrite()
-    function _openReadWrite()
-    {
-        if ($this->_compress_type == 'gz')
-            $this->_file = @gzopen($this->_tarname, "r+b");
-        else if ($this->_compress_type == 'bz2') {
-            $this->_error('Unable to open bz2 in read/write mode \''
-			              .$this->_tarname.'\' (limitation of bz2 extension)');
-            return false;
-        } else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($this->_tarname, "r+b");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
-
-        if ($this->_file == 0) {
-            $this->_error('Unable to open in read/write mode \''
-			              .$this->_tarname.'\'');
-            return false;
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _close()
-    function _close()
-    {
-        //if (isset($this->_file)) {
-        if (is_resource($this->_file)) {
-            if ($this->_compress_type == 'gz')
-                @gzclose($this->_file);
-            else if ($this->_compress_type == 'bz2')
-                @bzclose($this->_file);
-            else if ($this->_compress_type == 'none')
-                @fclose($this->_file);
-            else
-                $this->_error('Unknown or missing compression type ('
-				              .$this->_compress_type.')');
-
-            $this->_file = 0;
-        }
-
-        // ----- Look if a local copy need to be erase
-        // Note that it might be interesting to keep the url for a time : ToDo
-        if ($this->_temp_tarname != '') {
-            @unlink($this->_temp_tarname);
-            $this->_temp_tarname = '';
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _cleanFile()
-    function _cleanFile()
-    {
-        $this->_close();
-
-        // ----- Look for a local copy
-        if ($this->_temp_tarname != '') {
-            // ----- Remove the local copy but not the remote tarname
-            @unlink($this->_temp_tarname);
-            $this->_temp_tarname = '';
-        } else {
-            // ----- Remove the local tarname file
-            @unlink($this->_tarname);
-        }
-        $this->_tarname = '';
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _writeBlock()
-    function _writeBlock($p_binary_data, $p_len=null)
-    {
-      if (is_resource($this->_file)) {
-          if ($p_len === null) {
-              if ($this->_compress_type == 'gz')
-                  @gzputs($this->_file, $p_binary_data);
-              else if ($this->_compress_type == 'bz2')
-                  @bzwrite($this->_file, $p_binary_data);
-              else if ($this->_compress_type == 'none')
-                  @fputs($this->_file, $p_binary_data);
-              else
-                  $this->_error('Unknown or missing compression type ('
-				                .$this->_compress_type.')');
-          } else {
-              if ($this->_compress_type == 'gz')
-                  @gzputs($this->_file, $p_binary_data, $p_len);
-              else if ($this->_compress_type == 'bz2')
-                  @bzwrite($this->_file, $p_binary_data, $p_len);
-              else if ($this->_compress_type == 'none')
-                  @fputs($this->_file, $p_binary_data, $p_len);
-              else
-                  $this->_error('Unknown or missing compression type ('
-				                .$this->_compress_type.')');
-
-          }
-      }
-      return true;
-    }
-    // }}}
-
-    // {{{ _readBlock()
-    function _readBlock()
-    {
-      $v_block = null;
-      if (is_resource($this->_file)) {
-          if ($this->_compress_type == 'gz')
-              $v_block = @gzread($this->_file, 512);
-          else if ($this->_compress_type == 'bz2')
-              $v_block = @bzread($this->_file, 512);
-          else if ($this->_compress_type == 'none')
-              $v_block = @fread($this->_file, 512);
-          else
-              $this->_error('Unknown or missing compression type ('
-			                .$this->_compress_type.')');
-      }
-      return $v_block;
-    }
-    // }}}
-
-    // {{{ _jumpBlock()
-    function _jumpBlock($p_len=null)
-    {
-      if (is_resource($this->_file)) {
-          if ($p_len === null)
-              $p_len = 1;
-
-          if ($this->_compress_type == 'gz') {
-              @gzseek($this->_file, gztell($this->_file)+($p_len*512));
-          }
-          else if ($this->_compress_type == 'bz2') {
-              // ----- Replace missing bztell() and bzseek()
-              for ($i=0; $i<$p_len; $i++)
-                  $this->_readBlock();
-          } else if ($this->_compress_type == 'none')
-              @fseek($this->_file, ftell($this->_file)+($p_len*512));
-          else
-              $this->_error('Unknown or missing compression type ('
-			                .$this->_compress_type.')');
-
-      }
-      return true;
-    }
-    // }}}
-
-    // {{{ _writeFooter()
-    function _writeFooter()
-    {
-      if (is_resource($this->_file)) {
-          // ----- Write the last 0 filled block for end of archive
-          $v_binary_data = pack('a1024', '');
-          $this->_writeBlock($v_binary_data);
-      }
-      return true;
-    }
-    // }}}
-
-    // {{{ _addList()
-    function _addList($p_list, $p_add_dir, $p_remove_dir)
-    {
-      $v_result=true;
-      $v_header = array();
-
-      // ----- Remove potential windows directory separator
-      $p_add_dir = $this->_translateWinPath($p_add_dir);
-      $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
-
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
-
-      if (sizeof($p_list) == 0)
-          return true;
-
-      foreach ($p_list as $v_filename) {
-          if (!$v_result) {
-              break;
-          }
-
-        // ----- Skip the current tar name
-        if ($v_filename == $this->_tarname)
-            continue;
-
-        if ($v_filename == '')
-            continue;
-
-        if (!file_exists($v_filename)) {
-            $this->_warning("File '$v_filename' does not exist");
-            continue;
-        }
-
-        // ----- Add the file or directory header
-        if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
-            return false;
-
-        if (@is_dir($v_filename) && !@is_link($v_filename)) {
-            if (!($p_hdir = opendir($v_filename))) {
-                $this->_warning("Directory '$v_filename' can not be read");
-                continue;
-            }
-            while (false !== ($p_hitem = readdir($p_hdir))) {
-                if (($p_hitem != '.') && ($p_hitem != '..')) {
-                    if ($v_filename != ".")
-                        $p_temp_list[0] = $v_filename.'/'.$p_hitem;
-                    else
-                        $p_temp_list[0] = $p_hitem;
-
-                    $v_result = $this->_addList($p_temp_list,
-					                            $p_add_dir,
-												$p_remove_dir);
-                }
-            }
-
-            unset($p_temp_list);
-            unset($p_hdir);
-            unset($p_hitem);
-        }
-      }
-
-      return $v_result;
-    }
-    // }}}
-
-    // {{{ _addFile()
-    function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
-    {
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
-
-      if ($p_filename == '') {
-          $this->_error('Invalid file name');
-          return false;
-      }
-
-      // ----- Calculate the stored filename
-      $p_filename = $this->_translateWinPath($p_filename, false);;
-      $v_stored_filename = $p_filename;
-      if (strcmp($p_filename, $p_remove_dir) == 0) {
-          return true;
-      }
-      if ($p_remove_dir != '') {
-          if (substr($p_remove_dir, -1) != '/')
-              $p_remove_dir .= '/';
-
-          if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
-              $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
-      }
-      $v_stored_filename = $this->_translateWinPath($v_stored_filename);
-      if ($p_add_dir != '') {
-          if (substr($p_add_dir, -1) == '/')
-              $v_stored_filename = $p_add_dir.$v_stored_filename;
-          else
-              $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
-      }
-
-      $v_stored_filename = $this->_pathReduction($v_stored_filename);
-
-      if ($this->_isArchive($p_filename)) {
-          if (($v_file = @fopen($p_filename, "rb")) == 0) {
-              $this->_warning("Unable to open file '".$p_filename
-			                  ."' in binary read mode");
-              return true;
-          }
-
-          if (!$this->_writeHeader($p_filename, $v_stored_filename))
-              return false;
-
-          while (($v_buffer = fread($v_file, 512)) != '') {
-              $v_binary_data = pack("a512", "$v_buffer");
-              $this->_writeBlock($v_binary_data);
-          }
-
-          fclose($v_file);
-
-      } else {
-          // ----- Only header for dir
-          if (!$this->_writeHeader($p_filename, $v_stored_filename))
-              return false;
-      }
-
-      return true;
-    }
-    // }}}
-
-    // {{{ _addString()
-    function _addString($p_filename, $p_string)
-    {
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
-
-      if ($p_filename == '') {
-          $this->_error('Invalid file name');
-          return false;
-      }
-
-      // ----- Calculate the stored filename
-      $p_filename = $this->_translateWinPath($p_filename, false);;
-
-      if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
-	                                  time(), 384, "", 0, 0))
-          return false;
-
-      $i=0;
-      while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
-          $v_binary_data = pack("a512", $v_buffer);
-          $this->_writeBlock($v_binary_data);
-      }
-
-      return true;
-    }
-    // }}}
-
-    // {{{ _writeHeader()
-    function _writeHeader($p_filename, $p_stored_filename)
-    {
-        if ($p_stored_filename == '')
-            $p_stored_filename = $p_filename;
-        $v_reduce_filename = $this->_pathReduction($p_stored_filename);
-
-        if (strlen($v_reduce_filename) > 99) {
-          if (!$this->_writeLongHeader($v_reduce_filename))
-            return false;
-        }
-
-        $v_info = lstat($p_filename);
-        $v_uid = sprintf("%6s ", DecOct($v_info[4]));
-        $v_gid = sprintf("%6s ", DecOct($v_info[5]));
-        $v_perms = sprintf("%6s ", DecOct($v_info['mode']));
-
-        $v_mtime = sprintf("%11s", DecOct($v_info['mode']));
-
-        $v_linkname = '';
-
-        if (@is_link($p_filename)) {
-          $v_typeflag = '2';
-          $v_linkname = readlink($p_filename);
-          $v_size = sprintf("%11s ", DecOct(0));
-        } elseif (@is_dir($p_filename)) {
-          $v_typeflag = "5";
-          $v_size = sprintf("%11s ", DecOct(0));
-        } else {
-          $v_typeflag = '';
-          clearstatcache();
-          $v_size = sprintf("%11s ", DecOct($v_info['size']));
-        }
-
-        $v_magic = '';
-
-        $v_version = '';
-
-        $v_uname = '';
-
-        $v_gname = '';
-
-        $v_devmajor = '';
-
-        $v_devminor = '';
-
-        $v_prefix = '';
-
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            $v_reduce_filename, $v_perms, $v_uid,
-									$v_gid, $v_size, $v_mtime);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $v_typeflag, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
-
-        // ----- Calculate the checksum
-        $v_checksum = 0;
-        // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
-        // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
-            $v_checksum += ord(' ');
-        // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
-        // ----- Write the first 148 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_first, 148);
-
-        // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
-        $v_binary_data = pack("a8", $v_checksum);
-        $this->_writeBlock($v_binary_data, 8);
-
-        // ----- Write the last 356 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_last, 356);
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _writeHeaderBlock()
-    function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0,
-	                           $p_type='', $p_uid=0, $p_gid=0)
-    {
-        $p_filename = $this->_pathReduction($p_filename);
-
-        if (strlen($p_filename) > 99) {
-          if (!$this->_writeLongHeader($p_filename))
-            return false;
-        }
-
-        if ($p_type == "5") {
-          $v_size = sprintf("%11s ", DecOct(0));
-        } else {
-          $v_size = sprintf("%11s ", DecOct($p_size));
-        }
-
-        $v_uid = sprintf("%6s ", DecOct($p_uid));
-        $v_gid = sprintf("%6s ", DecOct($p_gid));
-        $v_perms = sprintf("%6s ", DecOct($p_perms));
-
-        $v_mtime = sprintf("%11s", DecOct($p_mtime));
-
-        $v_linkname = '';
-
-        $v_magic = '';
-
-        $v_version = '';
-
-        $v_uname = '';
-
-        $v_gname = '';
-
-        $v_devmajor = '';
-
-        $v_devminor = '';
-
-        $v_prefix = '';
-
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            $p_filename, $v_perms, $v_uid, $v_gid,
-									$v_size, $v_mtime);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $p_type, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
-
-        // ----- Calculate the checksum
-        $v_checksum = 0;
-        // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
-        // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
-            $v_checksum += ord(' ');
-        // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
-        // ----- Write the first 148 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_first, 148);
-
-        // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
-        $v_binary_data = pack("a8", $v_checksum);
-        $this->_writeBlock($v_binary_data, 8);
-
-        // ----- Write the last 356 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_last, 356);
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _writeLongHeader()
-    function _writeLongHeader($p_filename)
-    {
-        $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
-
-        $v_typeflag = 'L';
-
-        $v_linkname = '';
-
-        $v_magic = '';
-
-        $v_version = '';
-
-        $v_uname = '';
-
-        $v_gname = '';
-
-        $v_devmajor = '';
-
-        $v_devminor = '';
-
-        $v_prefix = '';
-
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            '././@LongLink', 0, 0, 0, $v_size, 0);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $v_typeflag, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
-
-        // ----- Calculate the checksum
-        $v_checksum = 0;
-        // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
-        // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
-            $v_checksum += ord(' ');
-        // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
-        // ----- Write the first 148 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_first, 148);
-
-        // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
-        $v_binary_data = pack("a8", $v_checksum);
-        $this->_writeBlock($v_binary_data, 8);
-
-        // ----- Write the last 356 bytes of the header in the archive
-        $this->_writeBlock($v_binary_data_last, 356);
-
-        // ----- Write the filename as content of the block
-        $i=0;
-        while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
-            $v_binary_data = pack("a512", "$v_buffer");
-            $this->_writeBlock($v_binary_data);
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _readHeader()
-    function _readHeader($v_binary_data, &$v_header)
-    {
-        if (strlen($v_binary_data)==0) {
-            $v_header['filename'] = '';
-            return true;
-        }
-
-        if (strlen($v_binary_data) != 512) {
-            $v_header['filename'] = '';
-            $this->_error('Invalid block size : '.strlen($v_binary_data));
-            return false;
-        }
-
-        if (!is_array($v_header)) {
-            $v_header = array();
-        }
-        // ----- Calculate the checksum
-        $v_checksum = 0;
-        // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum+=ord(substr($v_binary_data,$i,1));
-        // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
-            $v_checksum += ord(' ');
-        // ..... Last part of the header
-        for ($i=156; $i<512; $i++)
-           $v_checksum+=ord(substr($v_binary_data,$i,1));
-
-        $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
-		                 ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
-						 ."a32uname/a32gname/a8devmajor/a8devminor",
-						 $v_binary_data);
-
-        // ----- Extract the checksum
-        $v_header['checksum'] = OctDec(trim($v_data['checksum']));
-        if ($v_header['checksum'] != $v_checksum) {
-            $v_header['filename'] = '';
-
-            // ----- Look for last block (empty block)
-            if (($v_checksum == 256) && ($v_header['checksum'] == 0))
-                return true;
-
-            $this->_error('Invalid checksum for file "'.$v_data['filename']
-			              .'" : '.$v_checksum.' calculated, '
-						  .$v_header['checksum'].' expected');
-            return false;
-        }
-
-        // ----- Extract the properties
-        $v_header['filename'] = trim($v_data['filename']);
-        if ($this->_maliciousFilename($v_header['filename'])) {
-            $this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
-                '" will not install in desired directory tree');
-            return false;
-        }
-        $v_header['mode'] = OctDec(trim($v_data['mode']));
-        $v_header['uid'] = OctDec(trim($v_data['uid']));
-        $v_header['gid'] = OctDec(trim($v_data['gid']));
-        $v_header['size'] = OctDec(trim($v_data['size']));
-        $v_header['mtime'] = OctDec(trim($v_data['mtime']));
-        if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
-          $v_header['size'] = 0;
-        }
-        $v_header['link'] = trim($v_data['link']);
-        /* ----- All these fields are removed form the header because
-		they do not carry interesting info
-        $v_header[magic] = trim($v_data[magic]);
-        $v_header[version] = trim($v_data[version]);
-        $v_header[uname] = trim($v_data[uname]);
-        $v_header[gname] = trim($v_data[gname]);
-        $v_header[devmajor] = trim($v_data[devmajor]);
-        $v_header[devminor] = trim($v_data[devminor]);
-        */
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _maliciousFilename()
-    /**
-     * Detect and report a malicious file name
-     *
-     * @param string $file
-     * @return bool
-     * @access private
-     */
-    function _maliciousFilename($file)
-    {
-        if (strpos($file, '/../') !== false) {
-            return true;
-        }
-        if (strpos($file, '../') === 0) {
-            return true;
-        }
-        return false;
-    }
-    // }}}
-
-    // {{{ _readLongHeader()
-    function _readLongHeader(&$v_header)
-    {
-      $v_filename = '';
-      $n = floor($v_header['size']/512);
-      for ($i=0; $i<$n; $i++) {
-        $v_content = $this->_readBlock();
-        $v_filename .= $v_content;
-      }
-      if (($v_header['size'] % 512) != 0) {
-        $v_content = $this->_readBlock();
-        $v_filename .= $v_content;
-      }
-
-      // ----- Read the next header
-      $v_binary_data = $this->_readBlock();
-
-      if (!$this->_readHeader($v_binary_data, $v_header))
-        return false;
-
-      $v_filename = trim($v_filename);
-      $v_header['filename'] = $v_filename;
-        if ($this->_maliciousFilename($v_filename)) {
-            $this->_error('Malicious .tar detected, file "' . $v_filename .
-                '" will not install in desired directory tree');
-            return false;
-      }
-
-      return true;
-    }
-    // }}}
-
-    // {{{ _extractInString()
-    /**
-    * This method extract from the archive one file identified by $p_filename.
-    * The return value is a string with the file content, or NULL on error.
-    * @param string $p_filename     The path of the file to extract in a string.
-    * @return                       a string with the file content or NULL.
-    * @access private
-    */
-    function _extractInString($p_filename)
-    {
-        $v_result_str = "";
-
-        While (strlen($v_binary_data = $this->_readBlock()) != 0)
-        {
-          if (!$this->_readHeader($v_binary_data, $v_header))
-            return NULL;
-
-          if ($v_header['filename'] == '')
-            continue;
-
-          // ----- Look for long filename
-          if ($v_header['typeflag'] == 'L') {
-            if (!$this->_readLongHeader($v_header))
-              return NULL;
-          }
-
-          if ($v_header['filename'] == $p_filename) {
-              if ($v_header['typeflag'] == "5") {
-                  $this->_error('Unable to extract in string a directory '
-				                .'entry {'.$v_header['filename'].'}');
-                  return NULL;
-              } else {
-                  $n = floor($v_header['size']/512);
-                  for ($i=0; $i<$n; $i++) {
-                      $v_result_str .= $this->_readBlock();
-                  }
-                  if (($v_header['size'] % 512) != 0) {
-                      $v_content = $this->_readBlock();
-                      $v_result_str .= substr($v_content, 0,
-					                          ($v_header['size'] % 512));
-                  }
-                  return $v_result_str;
-              }
-          } else {
-              $this->_jumpBlock(ceil(($v_header['size']/512)));
-          }
-        }
-
-        return NULL;
-    }
-    // }}}
-
-    // {{{ _extractList()
-    function _extractList($p_path, &$p_list_detail, $p_mode,
-	                      $p_file_list, $p_remove_path)
-    {
-    $v_result=true;
-    $v_nb = 0;
-    $v_extract_all = true;
-    $v_listing = false;
-
-    $p_path = $this->_translateWinPath($p_path, false);
-    if ($p_path == '' || (substr($p_path, 0, 1) != '/'
-	    && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
-      $p_path = "./".$p_path;
-    }
-    $p_remove_path = $this->_translateWinPath($p_remove_path);
-
-    // ----- Look for path to remove format (should end by /)
-    if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
-      $p_remove_path .= '/';
-    $p_remove_path_size = strlen($p_remove_path);
-
-    switch ($p_mode) {
-      case "complete" :
-        $v_extract_all = TRUE;
-        $v_listing = FALSE;
-      break;
-      case "partial" :
-          $v_extract_all = FALSE;
-          $v_listing = FALSE;
-      break;
-      case "list" :
-          $v_extract_all = FALSE;
-          $v_listing = TRUE;
-      break;
-      default :
-        $this->_error('Invalid extract mode ('.$p_mode.')');
-        return false;
-    }
-
-    clearstatcache();
-
-    while (strlen($v_binary_data = $this->_readBlock()) != 0)
-    {
-      $v_extract_file = FALSE;
-      $v_extraction_stopped = 0;
-
-      if (!$this->_readHeader($v_binary_data, $v_header))
-        return false;
-
-      if ($v_header['filename'] == '') {
-        continue;
-      }
-
-      // ----- Look for long filename
-      if ($v_header['typeflag'] == 'L') {
-        if (!$this->_readLongHeader($v_header))
-          return false;
-      }
-
-      if ((!$v_extract_all) && (is_array($p_file_list))) {
-        // ----- By default no unzip if the file is not found
-        $v_extract_file = false;
-
-        for ($i=0; $i<sizeof($p_file_list); $i++) {
-          // ----- Look if it is a directory
-          if (substr($p_file_list[$i], -1) == '/') {
-            // ----- Look if the directory is in the filename path
-            if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
-			    && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
-				    == $p_file_list[$i])) {
-              $v_extract_file = TRUE;
-              break;
-            }
-          }
-
-          // ----- It is a file, so compare the file names
-          elseif ($p_file_list[$i] == $v_header['filename']) {
-            $v_extract_file = TRUE;
-            break;
-          }
-        }
-      } else {
-        $v_extract_file = TRUE;
-      }
-
-      // ----- Look if this file need to be extracted
-      if (($v_extract_file) && (!$v_listing))
-      {
-        if (($p_remove_path != '')
-            && (substr($v_header['filename'], 0, $p_remove_path_size)
-			    == $p_remove_path))
-          $v_header['filename'] = substr($v_header['filename'],
-		                                 $p_remove_path_size);
-        if (($p_path != './') && ($p_path != '/')) {
-          while (substr($p_path, -1) == '/')
-            $p_path = substr($p_path, 0, strlen($p_path)-1);
-
-          if (substr($v_header['filename'], 0, 1) == '/')
-              $v_header['filename'] = $p_path.$v_header['filename'];
-          else
-            $v_header['filename'] = $p_path.'/'.$v_header['filename'];
-        }
-        if (file_exists($v_header['filename'])) {
-          if (   (@is_dir($v_header['filename']))
-		      && ($v_header['typeflag'] == '')) {
-            $this->_error('File '.$v_header['filename']
-			              .' already exists as a directory');
-            return false;
-          }
-          if (   ($this->_isArchive($v_header['filename']))
-		      && ($v_header['typeflag'] == "5")) {
-            $this->_error('Directory '.$v_header['filename']
-			              .' already exists as a file');
-            return false;
-          }
-          if (!is_writeable($v_header['filename'])) {
-            $this->_error('File '.$v_header['filename']
-			              .' already exists and is write protected');
-            return false;
-          }
-          if (filemtime($v_header['filename']) > $v_header['mtime']) {
-            // To be completed : An error or silent no replace ?
-          }
-        }
-
-        // ----- Check the directory availability and create it if necessary
-        elseif (($v_result
-		         = $this->_dirCheck(($v_header['typeflag'] == "5"
-				                    ?$v_header['filename']
-									:dirname($v_header['filename'])))) != 1) {
-            $this->_error('Unable to create path for '.$v_header['filename']);
-            return false;
-        }
-
-        if ($v_extract_file) {
-          if ($v_header['typeflag'] == "5") {
-            if (!@file_exists($v_header['filename'])) {
-                if (!@mkdir($v_header['filename'], 0777)) {
-                    $this->_error('Unable to create directory {'
-					              .$v_header['filename'].'}');
-                    return false;
-                }
-            }
-          } elseif ($v_header['typeflag'] == "2") {
-              if (@file_exists($v_header['filename'])) {
-                  @unlink($v_header['filename']);
-              }
-              if (!@symlink($v_header['link'], $v_header['filename'])) {
-                  $this->_error('Unable to extract symbolic link {'
-                                .$v_header['filename'].'}');
-                  return false;
-              }
-          } else {
-              if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
-                  $this->_error('Error while opening {'.$v_header['filename']
-				                .'} in write binary mode');
-                  return false;
-              } else {
-                  $n = floor($v_header['size']/512);
-                  for ($i=0; $i<$n; $i++) {
-                      $v_content = $this->_readBlock();
-                      fwrite($v_dest_file, $v_content, 512);
-                  }
-            if (($v_header['size'] % 512) != 0) {
-              $v_content = $this->_readBlock();
-              fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
-            }
-
-            @fclose($v_dest_file);
-
-            // ----- Change the file mode, mtime
-            @touch($v_header['filename'], $v_header['mtime']);
-            if ($v_header['mode'] & 0111) {
-                // make file executable, obey umask
-                $mode = fileperms($v_header['filename']) | (~umask() & 0111);
-                @chmod($v_header['filename'], $mode);
-            }
-          }
-
-          // ----- Check the file size
-          clearstatcache();
-          if (filesize($v_header['filename']) != $v_header['size']) {
-              $this->_error('Extracted file '.$v_header['filename']
-			                .' does not have the correct file size \''
-							.filesize($v_header['filename'])
-							.'\' ('.$v_header['size']
-							.' expected). Archive may be corrupted.');
-              return false;
-          }
-          }
-        } else {
-          $this->_jumpBlock(ceil(($v_header['size']/512)));
-        }
-      } else {
-          $this->_jumpBlock(ceil(($v_header['size']/512)));
-      }
-
-      /* TBC : Seems to be unused ...
-      if ($this->_compress)
-        $v_end_of_file = @gzeof($this->_file);
-      else
-        $v_end_of_file = @feof($this->_file);
-        */
-
-      if ($v_listing || $v_extract_file || $v_extraction_stopped) {
-        // ----- Log extracted files
-        if (($v_file_dir = dirname($v_header['filename']))
-		    == $v_header['filename'])
-          $v_file_dir = '';
-        if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
-          $v_file_dir = '/';
-
-        $p_list_detail[$v_nb++] = $v_header;
-        if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
-            return true;
-        }
-      }
-    }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _openAppend()
-    function _openAppend()
-    {
-        if (filesize($this->_tarname) == 0)
-          return $this->_openWrite();
-
-        if ($this->_compress) {
-            $this->_close();
-
-            if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
-                $this->_error('Error while renaming \''.$this->_tarname
-				              .'\' to temporary file \''.$this->_tarname
-							  .'.tmp\'');
-                return false;
-            }
-
-            if ($this->_compress_type == 'gz')
-                $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb");
-            elseif ($this->_compress_type == 'bz2')
-                $v_temp_tar = @bzopen($this->_tarname.".tmp", "r");
-
-            if ($v_temp_tar == 0) {
-                $this->_error('Unable to open file \''.$this->_tarname
-				              .'.tmp\' in binary read mode');
-                @rename($this->_tarname.".tmp", $this->_tarname);
-                return false;
-            }
-
-            if (!$this->_openWrite()) {
-                @rename($this->_tarname.".tmp", $this->_tarname);
-                return false;
-            }
-
-            if ($this->_compress_type == 'gz') {
-                while (!@gzeof($v_temp_tar)) {
-                    $v_buffer = @gzread($v_temp_tar, 512);
-                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
-                        // do not copy end blocks, we will re-make them
-                        // after appending
-                        continue;
-                    }
-                    $v_binary_data = pack("a512", $v_buffer);
-                    $this->_writeBlock($v_binary_data);
-                }
-
-                @gzclose($v_temp_tar);
-            }
-            elseif ($this->_compress_type == 'bz2') {
-                while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
-                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
-                        continue;
-                    }
-                    $v_binary_data = pack("a512", $v_buffer);
-                    $this->_writeBlock($v_binary_data);
-                }
-
-                @bzclose($v_temp_tar);
-            }
-
-            if (!@unlink($this->_tarname.".tmp")) {
-                $this->_error('Error while deleting temporary file \''
-				              .$this->_tarname.'.tmp\'');
-            }
-
-        } else {
-            // ----- For not compressed tar, just add files before the last
-			//       one or two 512 bytes block
-            if (!$this->_openReadWrite())
-               return false;
-
-            clearstatcache();
-            $v_size = filesize($this->_tarname);
-
-            // We might have zero, one or two end blocks.
-            // The standard is two, but we should try to handle
-            // other cases.
-            fseek($this->_file, $v_size - 1024);
-            if (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
-                fseek($this->_file, $v_size - 1024);
-            }
-            elseif (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
-                fseek($this->_file, $v_size - 512);
-            }
-        }
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _append()
-    function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
-    {
-        if (!$this->_openAppend())
-            return false;
-
-        if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
-           $this->_writeFooter();
-
-        $this->_close();
-
-        return true;
-    }
-    // }}}
-
-    // {{{ _dirCheck()
-
-    /**
-     * Check if a directory exists and create it (including parent
-     * dirs) if not.
-     *
-     * @param string $p_dir directory to check
-     *
-     * @return bool TRUE if the directory exists or was created
-     */
-    function _dirCheck($p_dir)
-    {
-        clearstatcache();
-        if ((@is_dir($p_dir)) || ($p_dir == ''))
-            return true;
-
-        $p_parent_dir = dirname($p_dir);
-
-        if (($p_parent_dir != $p_dir) &&
-            ($p_parent_dir != '') &&
-            (!$this->_dirCheck($p_parent_dir)))
-             return false;
-
-        if (!@mkdir($p_dir, 0777)) {
-            $this->_error("Unable to create directory '$p_dir'");
-            return false;
-        }
-
-        return true;
-    }
-
-    // }}}
-
-    // {{{ _pathReduction()
-
-    /**
-     * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar",
-     * rand emove double slashes.
-     *
-     * @param string $p_dir path to reduce
-     *
-     * @return string reduced path
-     *
-     * @access private
-     *
-     */
-    function _pathReduction($p_dir)
-    {
-        $v_result = '';
-
-        // ----- Look for not empty path
-        if ($p_dir != '') {
-            // ----- Explode path by directory names
-            $v_list = explode('/', $p_dir);
-
-            // ----- Study directories from last to first
-            for ($i=sizeof($v_list)-1; $i>=0; $i--) {
-                // ----- Look for current path
-                if ($v_list[$i] == ".") {
-                    // ----- Ignore this directory
-                    // Should be the first $i=0, but no check is done
-                }
-                else if ($v_list[$i] == "..") {
-                    // ----- Ignore it and ignore the $i-1
-                    $i--;
-                }
-                else if (   ($v_list[$i] == '')
-				         && ($i!=(sizeof($v_list)-1))
-						 && ($i!=0)) {
-                    // ----- Ignore only the double '//' in path,
-                    // but not the first and last /
-                } else {
-                    $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'
-					            .$v_result:'');
-                }
-            }
-        }
-        $v_result = strtr($v_result, '\\', '/');
-        return $v_result;
-    }
-
-    // }}}
-
-    // {{{ _translateWinPath()
-    function _translateWinPath($p_path, $p_remove_disk_letter=true)
-    {
-      if (defined('OS_WINDOWS') && OS_WINDOWS) {
-          // ----- Look for potential disk letter
-          if (   ($p_remove_disk_letter)
-		      && (($v_position = strpos($p_path, ':')) != false)) {
-              $p_path = substr($p_path, $v_position+1);
-          }
-          // ----- Change potential windows directory separator
-          if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
-              $p_path = strtr($p_path, '\\', '/');
-          }
-      }
-      return $p_path;
-    }
-    // }}}
-
-}
-?>
diff --git a/lib/php/Console/Getopt.php b/lib/php/Console/Getopt.php
deleted file mode 100644
index bb9d69ca22404f9fefac78e96a04aec85ee80804..0000000000000000000000000000000000000000
--- a/lib/php/Console/Getopt.php
+++ /dev/null
@@ -1,290 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 5                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 of the PHP license,       |
-// | that is bundled with this package in the file LICENSE, and is        |
-// | available through the world-wide-web at the following url:           |
-// | http://www.php.net/license/3_0.txt.                                  |
-// | If you did not receive a copy of the PHP license and are unable to   |
-// | obtain it through the world-wide-web, please send a note to          |
-// | license@php.net so we can mail you a copy immediately.               |
-// +----------------------------------------------------------------------+
-// | Author: Andrei Zmievski <andrei@php.net>                             |
-// +----------------------------------------------------------------------+
-//
-// $Id: Getopt.php,v 1.4 2007/06/12 14:58:56 cellog Exp $
-
-require_once 'PEAR.php';
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski <andrei@php.net>
- *
- */
-class Console_Getopt {
-    /**
-     * Parses the command-line options.
-     *
-     * The first parameter to this function should be the list of command-line
-     * arguments without the leading reference to the running program.
-     *
-     * The second parameter is a string of allowed short options. Each of the
-     * option letters can be followed by a colon ':' to specify that the option
-     * requires an argument, or a double colon '::' to specify that the option
-     * takes an optional argument.
-     *
-     * The third argument is an optional array of allowed long options. The
-     * leading '--' should not be included in the option name. Options that
-     * require an argument should be followed by '=', and options that take an
-     * option argument should be followed by '=='.
-     *
-     * The return value is an array of two elements: the list of parsed
-     * options and the list of non-option command-line arguments. Each entry in
-     * the list of parsed options is a pair of elements - the first one
-     * specifies the option, and the second one specifies the option argument,
-     * if there was one.
-     *
-     * Long and short options can be mixed.
-     *
-     * Most of the semantics of this function are based on GNU getopt_long().
-     *
-     * @param array  $args           an array of command-line arguments
-     * @param string $short_options  specifies the list of allowed short options
-     * @param array  $long_options   specifies the list of allowed long options
-     *
-     * @return array two-element array containing the list of parsed options and
-     * the non-option arguments
-     *
-     * @access public
-     *
-     */
-    function getopt2($args, $short_options, $long_options = null)
-    {
-        return Console_Getopt::doGetopt(2, $args, $short_options, $long_options);
-    }
-
-    /**
-     * This function expects $args to start with the script name (POSIX-style).
-     * Preserved for backwards compatibility.
-     * @see getopt2()
-     */    
-    function getopt($args, $short_options, $long_options = null)
-    {
-        return Console_Getopt::doGetopt(1, $args, $short_options, $long_options);
-    }
-
-    /**
-     * The actual implementation of the argument parsing code.
-     */
-    function doGetopt($version, $args, $short_options, $long_options = null)
-    {
-        // in case you pass directly readPHPArgv() as the first arg
-        if (PEAR::isError($args)) {
-            return $args;
-        }
-        if (empty($args)) {
-            return array(array(), array());
-        }
-        $opts     = array();
-        $non_opts = array();
-
-        settype($args, 'array');
-
-        if ($long_options) {
-            sort($long_options);
-        }
-
-        /*
-         * Preserve backwards compatibility with callers that relied on
-         * erroneous POSIX fix.
-         */
-        if ($version < 2) {
-            if (isset($args[0]{0}) && $args[0]{0} != '-') {
-                array_shift($args);
-            }
-        }
-
-        reset($args);
-        while (list($i, $arg) = each($args)) {
-
-            /* The special element '--' means explicit end of
-               options. Treat the rest of the arguments as non-options
-               and end the loop. */
-            if ($arg == '--') {
-                $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
-                break;
-            }
-
-            if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
-                $non_opts = array_merge($non_opts, array_slice($args, $i));
-                break;
-            } elseif (strlen($arg) > 1 && $arg{1} == '-') {
-                $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
-                if (PEAR::isError($error))
-                    return $error;
-            } elseif ($arg == '-') {
-                // - is stdin
-                $non_opts = array_merge($non_opts, array_slice($args, $i));
-                break;
-            } else {
-                $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
-                if (PEAR::isError($error))
-                    return $error;
-            }
-        }
-
-        return array($opts, $non_opts);
-    }
-
-    /**
-     * @access private
-     *
-     */
-    function _parseShortOption($arg, $short_options, &$opts, &$args)
-    {
-        for ($i = 0; $i < strlen($arg); $i++) {
-            $opt = $arg{$i};
-            $opt_arg = null;
-
-            /* Try to find the short option in the specifier string. */
-            if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
-            {
-                return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
-            }
-
-            if (strlen($spec) > 1 && $spec{1} == ':') {
-                if (strlen($spec) > 2 && $spec{2} == ':') {
-                    if ($i + 1 < strlen($arg)) {
-                        /* Option takes an optional argument. Use the remainder of
-                           the arg string if there is anything left. */
-                        $opts[] = array($opt, substr($arg, $i + 1));
-                        break;
-                    }
-                } else {
-                    /* Option requires an argument. Use the remainder of the arg
-                       string if there is anything left. */
-                    if ($i + 1 < strlen($arg)) {
-                        $opts[] = array($opt,  substr($arg, $i + 1));
-                        break;
-                    } else if (list(, $opt_arg) = each($args)) {
-                        /* Else use the next argument. */;
-                        if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) {
-                            return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
-                        }
-                    } else {
-                        return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
-                    }
-                }
-            }
-
-            $opts[] = array($opt, $opt_arg);
-        }
-    }
-
-    /**
-     * @access private
-     *
-     */
-    function _isShortOpt($arg)
-    {
-        return strlen($arg) == 2 && $arg[0] == '-' && preg_match('/[a-zA-Z]/', $arg[1]);
-    }
-
-    /**
-     * @access private
-     *
-     */
-    function _isLongOpt($arg)
-    {
-        return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' &&
-            preg_match('/[a-zA-Z]+$/', substr($arg, 2));
-    }
-
-    /**
-     * @access private
-     *
-     */
-    function _parseLongOption($arg, $long_options, &$opts, &$args)
-    {
-        @list($opt, $opt_arg) = explode('=', $arg, 2);
-        $opt_len = strlen($opt);
-
-        for ($i = 0; $i < count($long_options); $i++) {
-            $long_opt  = $long_options[$i];
-            $opt_start = substr($long_opt, 0, $opt_len);
-            $long_opt_name = str_replace('=', '', $long_opt);
-
-            /* Option doesn't match. Go on to the next one. */
-            if ($long_opt_name != $opt) {
-                continue;
-            }
-
-            $opt_rest  = substr($long_opt, $opt_len);
-
-            /* Check that the options uniquely matches one of the allowed
-               options. */
-            if ($i + 1 < count($long_options)) {
-                $next_option_rest = substr($long_options[$i + 1], $opt_len);
-            } else {
-                $next_option_rest = '';
-            }
-            if ($opt_rest != '' && $opt{0} != '=' &&
-                $i + 1 < count($long_options) &&
-                $opt == substr($long_options[$i+1], 0, $opt_len) &&
-                $next_option_rest != '' &&
-                $next_option_rest{0} != '=') {
-                return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
-            }
-
-            if (substr($long_opt, -1) == '=') {
-                if (substr($long_opt, -2) != '==') {
-                    /* Long option requires an argument.
-                       Take the next argument if one wasn't specified. */;
-                    if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
-                        return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
-                    }
-                    if (Console_Getopt::_isShortOpt($opt_arg) || Console_Getopt::_isLongOpt($opt_arg)) {
-                        return PEAR::raiseError("Console_Getopt: option requires an argument --$opt");
-                    }
-                }
-            } else if ($opt_arg) {
-                return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument");
-            }
-
-            $opts[] = array('--' . $opt, $opt_arg);
-            return;
-        }
-
-        return PEAR::raiseError("Console_Getopt: unrecognized option --$opt");
-    }
-
-    /**
-    * Safely read the $argv PHP array across different PHP configurations.
-    * Will take care on register_globals and register_argc_argv ini directives
-    *
-    * @access public
-    * @return mixed the $argv PHP array or PEAR error if not registered
-    */
-    function readPHPArgv()
-    {
-        global $argv;
-        if (!is_array($argv)) {
-            if (!@is_array($_SERVER['argv'])) {
-                if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
-                    return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
-                }
-                return $GLOBALS['HTTP_SERVER_VARS']['argv'];
-            }
-            return $_SERVER['argv'];
-        }
-        return $argv;
-    }
-
-}
-
-?>
diff --git a/lib/php/DB.php b/lib/php/DB.php
deleted file mode 100644
index a511979e67a74816f1facdcedc7c2ec2e16dde01..0000000000000000000000000000000000000000
--- a/lib/php/DB.php
+++ /dev/null
@@ -1,1489 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Database independent query interface
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: DB.php,v 1.88 2007/08/12 05:27:25 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the PEAR class so it can be extended from
- */
-require_once 'PEAR.php';
-
-
-// {{{ constants
-// {{{ error codes
-
-/**#@+
- * One of PEAR DB's portable error codes.
- * @see DB_common::errorCode(), DB::errorMessage()
- *
- * {@internal If you add an error code here, make sure you also add a textual
- * version of it in DB::errorMessage().}}
- */
-
-/**
- * The code returned by many methods upon success
- */
-define('DB_OK', 1);
-
-/**
- * Unkown error
- */
-define('DB_ERROR', -1);
-
-/**
- * Syntax error
- */
-define('DB_ERROR_SYNTAX', -2);
-
-/**
- * Tried to insert a duplicate value into a primary or unique index
- */
-define('DB_ERROR_CONSTRAINT', -3);
-
-/**
- * An identifier in the query refers to a non-existant object
- */
-define('DB_ERROR_NOT_FOUND', -4);
-
-/**
- * Tried to create a duplicate object
- */
-define('DB_ERROR_ALREADY_EXISTS', -5);
-
-/**
- * The current driver does not support the action you attempted
- */
-define('DB_ERROR_UNSUPPORTED', -6);
-
-/**
- * The number of parameters does not match the number of placeholders
- */
-define('DB_ERROR_MISMATCH', -7);
-
-/**
- * A literal submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID', -8);
-
-/**
- * The current DBMS does not support the action you attempted
- */
-define('DB_ERROR_NOT_CAPABLE', -9);
-
-/**
- * A literal submitted was too long so the end of it was removed
- */
-define('DB_ERROR_TRUNCATED', -10);
-
-/**
- * A literal number submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID_NUMBER', -11);
-
-/**
- * A literal date submitted did not match the data type expected
- */
-define('DB_ERROR_INVALID_DATE', -12);
-
-/**
- * Attempt to divide something by zero
- */
-define('DB_ERROR_DIVZERO', -13);
-
-/**
- * A database needs to be selected
- */
-define('DB_ERROR_NODBSELECTED', -14);
-
-/**
- * Could not create the object requested
- */
-define('DB_ERROR_CANNOT_CREATE', -15);
-
-/**
- * Could not drop the database requested because it does not exist
- */
-define('DB_ERROR_CANNOT_DROP', -17);
-
-/**
- * An identifier in the query refers to a non-existant table
- */
-define('DB_ERROR_NOSUCHTABLE', -18);
-
-/**
- * An identifier in the query refers to a non-existant column
- */
-define('DB_ERROR_NOSUCHFIELD', -19);
-
-/**
- * The data submitted to the method was inappropriate
- */
-define('DB_ERROR_NEED_MORE_DATA', -20);
-
-/**
- * The attempt to lock the table failed
- */
-define('DB_ERROR_NOT_LOCKED', -21);
-
-/**
- * The number of columns doesn't match the number of values
- */
-define('DB_ERROR_VALUE_COUNT_ON_ROW', -22);
-
-/**
- * The DSN submitted has problems
- */
-define('DB_ERROR_INVALID_DSN', -23);
-
-/**
- * Could not connect to the database
- */
-define('DB_ERROR_CONNECT_FAILED', -24);
-
-/**
- * The PHP extension needed for this DBMS could not be found
- */
-define('DB_ERROR_EXTENSION_NOT_FOUND',-25);
-
-/**
- * The present user has inadequate permissions to perform the task requestd
- */
-define('DB_ERROR_ACCESS_VIOLATION', -26);
-
-/**
- * The database requested does not exist
- */
-define('DB_ERROR_NOSUCHDB', -27);
-
-/**
- * Tried to insert a null value into a column that doesn't allow nulls
- */
-define('DB_ERROR_CONSTRAINT_NOT_NULL',-29);
-/**#@-*/
-
-
-// }}}
-// {{{ prepared statement-related
-
-
-/**#@+
- * Identifiers for the placeholders used in prepared statements.
- * @see DB_common::prepare()
- */
-
-/**
- * Indicates a scalar (<kbd>?</kbd>) placeholder was used
- *
- * Quote and escape the value as necessary.
- */
-define('DB_PARAM_SCALAR', 1);
-
-/**
- * Indicates an opaque (<kbd>&</kbd>) placeholder was used
- *
- * The value presented is a file name.  Extract the contents of that file
- * and place them in this column.
- */
-define('DB_PARAM_OPAQUE', 2);
-
-/**
- * Indicates a misc (<kbd>!</kbd>) placeholder was used
- *
- * The value should not be quoted or escaped.
- */
-define('DB_PARAM_MISC',   3);
-/**#@-*/
-
-
-// }}}
-// {{{ binary data-related
-
-
-/**#@+
- * The different ways of returning binary data from queries.
- */
-
-/**
- * Sends the fetched data straight through to output
- */
-define('DB_BINMODE_PASSTHRU', 1);
-
-/**
- * Lets you return data as usual
- */
-define('DB_BINMODE_RETURN', 2);
-
-/**
- * Converts the data to hex format before returning it
- *
- * For example the string "123" would become "313233".
- */
-define('DB_BINMODE_CONVERT', 3);
-/**#@-*/
-
-
-// }}}
-// {{{ fetch modes
-
-
-/**#@+
- * Fetch Modes.
- * @see DB_common::setFetchMode()
- */
-
-/**
- * Indicates the current default fetch mode should be used
- * @see DB_common::$fetchmode
- */
-define('DB_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-define('DB_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-define('DB_FETCHMODE_ASSOC', 2);
-
-/**
- * Column data as object properties
- */
-define('DB_FETCHMODE_OBJECT', 3);
-
-/**
- * For multi-dimensional results, make the column name the first level
- * of the array and put the row number in the second level of the array
- *
- * This is flipped from the normal behavior, which puts the row numbers
- * in the first level of the array and the column names in the second level.
- */
-define('DB_FETCHMODE_FLIPPED', 4);
-/**#@-*/
-
-/**#@+
- * Old fetch modes.  Left here for compatibility.
- */
-define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
-define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
-define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
-/**#@-*/
-
-
-// }}}
-// {{{ tableInfo() && autoPrepare()-related
-
-
-/**#@+
- * The type of information to return from the tableInfo() method.
- *
- * Bitwised constants, so they can be combined using <kbd>|</kbd>
- * and removed using <kbd>^</kbd>.
- *
- * @see DB_common::tableInfo()
- *
- * {@internal Since the TABLEINFO constants are bitwised, if more of them are
- * added in the future, make sure to adjust DB_TABLEINFO_FULL accordingly.}}
- */
-define('DB_TABLEINFO_ORDER', 1);
-define('DB_TABLEINFO_ORDERTABLE', 2);
-define('DB_TABLEINFO_FULL', 3);
-/**#@-*/
-
-
-/**#@+
- * The type of query to create with the automatic query building methods.
- * @see DB_common::autoPrepare(), DB_common::autoExecute()
- */
-define('DB_AUTOQUERY_INSERT', 1);
-define('DB_AUTOQUERY_UPDATE', 2);
-/**#@-*/
-
-
-// }}}
-// {{{ portability modes
-
-
-/**#@+
- * Portability Modes.
- *
- * Bitwised constants, so they can be combined using <kbd>|</kbd>
- * and removed using <kbd>^</kbd>.
- *
- * @see DB_common::setOption()
- *
- * {@internal Since the PORTABILITY constants are bitwised, if more of them are
- * added in the future, make sure to adjust DB_PORTABILITY_ALL accordingly.}}
- */
-
-/**
- * Turn off all portability features
- */
-define('DB_PORTABILITY_NONE', 0);
-
-/**
- * Convert names of tables and fields to lower case
- * when using the get*(), fetch*() and tableInfo() methods
- */
-define('DB_PORTABILITY_LOWERCASE', 1);
-
-/**
- * Right trim the data output by get*() and fetch*()
- */
-define('DB_PORTABILITY_RTRIM', 2);
-
-/**
- * Force reporting the number of rows deleted
- */
-define('DB_PORTABILITY_DELETE_COUNT', 4);
-
-/**
- * Enable hack that makes numRows() work in Oracle
- */
-define('DB_PORTABILITY_NUMROWS', 8);
-
-/**
- * Makes certain error messages in certain drivers compatible
- * with those from other DBMS's
- *
- * + mysql, mysqli:  change unique/primary key constraints
- *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
- *
- * + odbc(access):  MS's ODBC driver reports 'no such field' as code
- *   07001, which means 'too few parameters.'  When this option is on
- *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
- */
-define('DB_PORTABILITY_ERRORS', 16);
-
-/**
- * Convert null values to empty strings in data output by
- * get*() and fetch*()
- */
-define('DB_PORTABILITY_NULL_TO_EMPTY', 32);
-
-/**
- * Turn on all portability features
- */
-define('DB_PORTABILITY_ALL', 63);
-/**#@-*/
-
-// }}}
-
-
-// }}}
-// {{{ class DB
-
-/**
- * Database independent query interface
- *
- * The main "DB" class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of DB is as follows (indentation means inheritance):
- * <pre>
- * DB           The main DB class.  This is simply a utility class
- *              with some "static" methods for creating DB objects as
- *              well as common utility functions for other DB classes.
- *
- * DB_common    The base for each DB implementation.  Provides default
- * |            implementations (in OO lingo virtual methods) for
- * |            the actual DB implementations as well as a bunch of
- * |            query utility functions.
- * |
- * +-DB_mysql   The DB implementation for MySQL.  Inherits DB_common.
- *              When calling DB::factory or DB::connect for MySQL
- *              connections, the object returned is an instance of this
- *              class.
- * </pre>
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB
-{
-    // {{{ &factory()
-
-    /**
-     * Create a new DB object for the specified database type but don't
-     * connect to the database
-     *
-     * @param string $type     the database type (eg "mysql")
-     * @param array  $options  an associative array of option names and values
-     *
-     * @return object  a new DB object.  A DB_Error object on failure.
-     *
-     * @see DB_common::setOption()
-     */
-    function &factory($type, $options = false)
-    {
-        if (!is_array($options)) {
-            $options = array('persistent' => $options);
-        }
-
-        if (isset($options['debug']) && $options['debug'] >= 2) {
-            // expose php errors with sufficient debug level
-            include_once "DB/{$type}.php";
-        } else {
-            @include_once "DB/{$type}.php";
-        }
-
-        $classname = "DB_${type}";
-
-        if (!class_exists($classname)) {
-            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
-                                    "Unable to include the DB/{$type}.php"
-                                    . " file for '$dsn'",
-                                    'DB_Error', true);
-            return $tmp;
-        }
-
-        @$obj = new $classname;
-
-        foreach ($options as $option => $value) {
-            $test = $obj->setOption($option, $value);
-            if (DB::isError($test)) {
-                return $test;
-            }
-        }
-
-        return $obj;
-    }
-
-    // }}}
-    // {{{ &connect()
-
-    /**
-     * Create a new DB object including a connection to the specified database
-     *
-     * Example 1.
-     * <code>
-     * require_once 'DB.php';
-     *
-     * $dsn = 'pgsql://user:password@host/database';
-     * $options = array(
-     *     'debug'       => 2,
-     *     'portability' => DB_PORTABILITY_ALL,
-     * );
-     *
-     * $db =& DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param mixed $dsn      the string "data source name" or array in the
-     *                         format returned by DB::parseDSN()
-     * @param array $options  an associative array of option names and values
-     *
-     * @return object  a new DB object.  A DB_Error object on failure.
-     *
-     * @uses DB_dbase::connect(), DB_fbsql::connect(), DB_ibase::connect(),
-     *       DB_ifx::connect(), DB_msql::connect(), DB_mssql::connect(),
-     *       DB_mysql::connect(), DB_mysqli::connect(), DB_oci8::connect(),
-     *       DB_odbc::connect(), DB_pgsql::connect(), DB_sqlite::connect(),
-     *       DB_sybase::connect()
-     *
-     * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
-     */
-    function &connect($dsn, $options = array())
-    {
-        $dsninfo = DB::parseDSN($dsn);
-        $type = $dsninfo['phptype'];
-
-        if (!is_array($options)) {
-            /*
-             * For backwards compatibility.  $options used to be boolean,
-             * indicating whether the connection should be persistent.
-             */
-            $options = array('persistent' => $options);
-        }
-
-        if (isset($options['debug']) && $options['debug'] >= 2) {
-            // expose php errors with sufficient debug level
-            include_once "DB/${type}.php";
-        } else {
-            @include_once "DB/${type}.php";
-        }
-
-        $classname = "DB_${type}";
-        if (!class_exists($classname)) {
-            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
-                                    "Unable to include the DB/{$type}.php"
-                                    . " file for '$dsn'",
-                                    'DB_Error', true);
-            return $tmp;
-        }
-
-        @$obj = new $classname;
-
-        foreach ($options as $option => $value) {
-            $test = $obj->setOption($option, $value);
-            if (DB::isError($test)) {
-                return $test;
-            }
-        }
-
-        $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
-        if (DB::isError($err)) {
-            if (is_array($dsn)) {
-                $err->addUserInfo(DB::getDSNString($dsn, true));
-            } else {
-                $err->addUserInfo($dsn);
-            }
-            return $err;
-        }
-
-        return $obj;
-    }
-
-    // }}}
-    // {{{ apiVersion()
-
-    /**
-     * Return the DB API version
-     *
-     * @return string  the DB API version number
-     */
-    function apiVersion()
-    {
-        return '1.7.13';
-    }
-
-    // }}}
-    // {{{ isError()
-
-    /**
-     * Determines if a variable is a DB_Error object
-     *
-     * @param mixed $value  the variable to check
-     *
-     * @return bool  whether $value is DB_Error object
-     */
-    function isError($value)
-    {
-        return is_a($value, 'DB_Error');
-    }
-
-    // }}}
-    // {{{ isConnection()
-
-    /**
-     * Determines if a value is a DB_<driver> object
-     *
-     * @param mixed $value  the value to test
-     *
-     * @return bool  whether $value is a DB_<driver> object
-     */
-    function isConnection($value)
-    {
-        return (is_object($value) &&
-                is_subclass_of($value, 'db_common') &&
-                method_exists($value, 'simpleQuery'));
-    }
-
-    // }}}
-    // {{{ isManip()
-
-    /**
-     * Tell whether a query is a data manipulation or data definition query
-     *
-     * Examples of data manipulation queries are INSERT, UPDATE and DELETE.
-     * Examples of data definition queries are CREATE, DROP, ALTER, GRANT,
-     * REVOKE.
-     *
-     * @param string $query  the query
-     *
-     * @return boolean  whether $query is a data manipulation query
-     */
-    function isManip($query)
-    {
-        $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
-                . 'CREATE|DROP|'
-                . 'LOAD DATA|SELECT .* INTO .* FROM|COPY|'
-                . 'ALTER|GRANT|REVOKE|'
-                . 'LOCK|UNLOCK';
-        if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
-            return true;
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ errorMessage()
-
-    /**
-     * Return a textual error message for a DB error code
-     *
-     * @param integer $value  the DB error code
-     *
-     * @return string  the error message or false if the error code was
-     *                  not recognized
-     */
-    function errorMessage($value)
-    {
-        static $errorMessages;
-        if (!isset($errorMessages)) {
-            $errorMessages = array(
-                DB_ERROR                    => 'unknown error',
-                DB_ERROR_ACCESS_VIOLATION   => 'insufficient permissions',
-                DB_ERROR_ALREADY_EXISTS     => 'already exists',
-                DB_ERROR_CANNOT_CREATE      => 'can not create',
-                DB_ERROR_CANNOT_DROP        => 'can not drop',
-                DB_ERROR_CONNECT_FAILED     => 'connect failed',
-                DB_ERROR_CONSTRAINT         => 'constraint violation',
-                DB_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
-                DB_ERROR_DIVZERO            => 'division by zero',
-                DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
-                DB_ERROR_INVALID            => 'invalid',
-                DB_ERROR_INVALID_DATE       => 'invalid date or time',
-                DB_ERROR_INVALID_DSN        => 'invalid DSN',
-                DB_ERROR_INVALID_NUMBER     => 'invalid number',
-                DB_ERROR_MISMATCH           => 'mismatch',
-                DB_ERROR_NEED_MORE_DATA     => 'insufficient data supplied',
-                DB_ERROR_NODBSELECTED       => 'no database selected',
-                DB_ERROR_NOSUCHDB           => 'no such database',
-                DB_ERROR_NOSUCHFIELD        => 'no such field',
-                DB_ERROR_NOSUCHTABLE        => 'no such table',
-                DB_ERROR_NOT_CAPABLE        => 'DB backend not capable',
-                DB_ERROR_NOT_FOUND          => 'not found',
-                DB_ERROR_NOT_LOCKED         => 'not locked',
-                DB_ERROR_SYNTAX             => 'syntax error',
-                DB_ERROR_UNSUPPORTED        => 'not supported',
-                DB_ERROR_TRUNCATED          => 'truncated',
-                DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
-                DB_OK                       => 'no error',
-            );
-        }
-
-        if (DB::isError($value)) {
-            $value = $value->getCode();
-        }
-
-        return isset($errorMessages[$value]) ? $errorMessages[$value]
-                     : $errorMessages[DB_ERROR];
-    }
-
-    // }}}
-    // {{{ parseDSN()
-
-    /**
-     * Parse a data source name
-     *
-     * Additional keys can be added by appending a URI query string to the
-     * end of the DSN.
-     *
-     * The format of the supplied DSN is in its fullest form:
-     * <code>
-     *  phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
-     * </code>
-     *
-     * Most variations are allowed:
-     * <code>
-     *  phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
-     *  phptype://username:password@hostspec/database_name
-     *  phptype://username:password@hostspec
-     *  phptype://username@hostspec
-     *  phptype://hostspec/database
-     *  phptype://hostspec
-     *  phptype(dbsyntax)
-     *  phptype
-     * </code>
-     *
-     * @param string $dsn Data Source Name to be parsed
-     *
-     * @return array an associative array with the following keys:
-     *  + phptype:  Database backend used in PHP (mysql, odbc etc.)
-     *  + dbsyntax: Database used with regards to SQL syntax etc.
-     *  + protocol: Communication protocol to use (tcp, unix etc.)
-     *  + hostspec: Host specification (hostname[:port])
-     *  + database: Database to use on the DBMS server
-     *  + username: User name for login
-     *  + password: Password for login
-     */
-    function parseDSN($dsn)
-    {
-        $parsed = array(
-            'phptype'  => false,
-            'dbsyntax' => false,
-            'username' => false,
-            'password' => false,
-            'protocol' => false,
-            'hostspec' => false,
-            'port'     => false,
-            'socket'   => false,
-            'database' => false,
-        );
-
-        if (is_array($dsn)) {
-            $dsn = array_merge($parsed, $dsn);
-            if (!$dsn['dbsyntax']) {
-                $dsn['dbsyntax'] = $dsn['phptype'];
-            }
-            return $dsn;
-        }
-
-        // Find phptype and dbsyntax
-        if (($pos = strpos($dsn, '://')) !== false) {
-            $str = substr($dsn, 0, $pos);
-            $dsn = substr($dsn, $pos + 3);
-        } else {
-            $str = $dsn;
-            $dsn = null;
-        }
-
-        // Get phptype and dbsyntax
-        // $str => phptype(dbsyntax)
-        if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
-            $parsed['phptype']  = $arr[1];
-            $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
-        } else {
-            $parsed['phptype']  = $str;
-            $parsed['dbsyntax'] = $str;
-        }
-
-        if (!count($dsn)) {
-            return $parsed;
-        }
-
-        // Get (if found): username and password
-        // $dsn => username:password@protocol+hostspec/database
-        if (($at = strrpos($dsn,'@')) !== false) {
-            $str = substr($dsn, 0, $at);
-            $dsn = substr($dsn, $at + 1);
-            if (($pos = strpos($str, ':')) !== false) {
-                $parsed['username'] = rawurldecode(substr($str, 0, $pos));
-                $parsed['password'] = rawurldecode(substr($str, $pos + 1));
-            } else {
-                $parsed['username'] = rawurldecode($str);
-            }
-        }
-
-        // Find protocol and hostspec
-
-        if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
-            // $dsn => proto(proto_opts)/database
-            $proto       = $match[1];
-            $proto_opts  = $match[2] ? $match[2] : false;
-            $dsn         = $match[3];
-
-        } else {
-            // $dsn => protocol+hostspec/database (old format)
-            if (strpos($dsn, '+') !== false) {
-                list($proto, $dsn) = explode('+', $dsn, 2);
-            }
-            if (strpos($dsn, '/') !== false) {
-                list($proto_opts, $dsn) = explode('/', $dsn, 2);
-            } else {
-                $proto_opts = $dsn;
-                $dsn = null;
-            }
-        }
-
-        // process the different protocol options
-        $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
-        $proto_opts = rawurldecode($proto_opts);
-        if (strpos($proto_opts, ':') !== false) {
-            list($proto_opts, $parsed['port']) = explode(':', $proto_opts);
-        }
-        if ($parsed['protocol'] == 'tcp') {
-            $parsed['hostspec'] = $proto_opts;
-        } elseif ($parsed['protocol'] == 'unix') {
-            $parsed['socket'] = $proto_opts;
-        }
-
-        // Get dabase if any
-        // $dsn => database
-        if ($dsn) {
-            if (($pos = strpos($dsn, '?')) === false) {
-                // /database
-                $parsed['database'] = rawurldecode($dsn);
-            } else {
-                // /database?param1=value1&param2=value2
-                $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
-                $dsn = substr($dsn, $pos + 1);
-                if (strpos($dsn, '&') !== false) {
-                    $opts = explode('&', $dsn);
-                } else { // database?param1=value1
-                    $opts = array($dsn);
-                }
-                foreach ($opts as $opt) {
-                    list($key, $value) = explode('=', $opt);
-                    if (!isset($parsed[$key])) {
-                        // don't allow params overwrite
-                        $parsed[$key] = rawurldecode($value);
-                    }
-                }
-            }
-        }
-
-        return $parsed;
-    }
-
-    // }}}
-    // {{{ getDSNString()
-
-    /**
-     * Returns the given DSN in a string format suitable for output.
-     *
-     * @param array|string the DSN to parse and format
-     * @param boolean true to hide the password, false to include it
-     * @return string
-     */
-    function getDSNString($dsn, $hidePassword) {
-        /* Calling parseDSN will ensure that we have all the array elements
-         * defined, and means that we deal with strings and array in the same
-         * manner. */
-        $dsnArray = DB::parseDSN($dsn);
-        
-        if ($hidePassword) {
-            $dsnArray['password'] = 'PASSWORD';
-        }
-
-        /* Protocol is special-cased, as using the default "tcp" along with an
-         * Oracle TNS connection string fails. */
-        if (is_string($dsn) && strpos($dsn, 'tcp') === false && $dsnArray['protocol'] == 'tcp') {
-            $dsnArray['protocol'] = false;
-        }
-        
-        // Now we just have to construct the actual string. This is ugly.
-        $dsnString = $dsnArray['phptype'];
-        if ($dsnArray['dbsyntax']) {
-            $dsnString .= '('.$dsnArray['dbsyntax'].')';
-        }
-        $dsnString .= '://'
-                     .$dsnArray['username']
-                     .':'
-                     .$dsnArray['password']
-                     .'@'
-                     .$dsnArray['protocol'];
-        if ($dsnArray['socket']) {
-            $dsnString .= '('.$dsnArray['socket'].')';
-        }
-        if ($dsnArray['protocol'] && $dsnArray['hostspec']) {
-            $dsnString .= '+';
-        }
-        $dsnString .= $dsnArray['hostspec'];
-        if ($dsnArray['port']) {
-            $dsnString .= ':'.$dsnArray['port'];
-        }
-        $dsnString .= '/'.$dsnArray['database'];
-        
-        /* Option handling. Unfortunately, parseDSN simply places options into
-         * the top-level array, so we'll first get rid of the fields defined by
-         * DB and see what's left. */
-        unset($dsnArray['phptype'],
-              $dsnArray['dbsyntax'],
-              $dsnArray['username'],
-              $dsnArray['password'],
-              $dsnArray['protocol'],
-              $dsnArray['socket'],
-              $dsnArray['hostspec'],
-              $dsnArray['port'],
-              $dsnArray['database']
-        );
-        if (count($dsnArray) > 0) {
-            $dsnString .= '?';
-            $i = 0;
-            foreach ($dsnArray as $key => $value) {
-                if (++$i > 1) {
-                    $dsnString .= '&';
-                }
-                $dsnString .= $key.'='.$value;
-            }
-        }
-
-        return $dsnString;
-    }
-    
-    // }}}
-}
-
-// }}}
-// {{{ class DB_Error
-
-/**
- * DB_Error implements a class for reporting portable database error
- * messages
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_Error extends PEAR_Error
-{
-    // {{{ constructor
-
-    /**
-     * DB_Error constructor
-     *
-     * @param mixed $code       DB error code, or string with error message
-     * @param int   $mode       what "error mode" to operate in
-     * @param int   $level      what error level to use for $mode &
-     *                           PEAR_ERROR_TRIGGER
-     * @param mixed $debuginfo  additional debug info, such as the last query
-     *
-     * @see PEAR_Error
-     */
-    function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
-                      $level = E_USER_NOTICE, $debuginfo = null)
-    {
-        if (is_int($code)) {
-            $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
-                              $mode, $level, $debuginfo);
-        } else {
-            $this->PEAR_Error("DB Error: $code", DB_ERROR,
-                              $mode, $level, $debuginfo);
-        }
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class DB_result
-
-/**
- * This class implements a wrapper for a DB result set
- *
- * A new instance of this class will be returned by the DB implementation
- * after processing a query that returns data.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_result
-{
-    // {{{ properties
-
-    /**
-     * Should results be freed automatically when there are no more rows?
-     * @var boolean
-     * @see DB_common::$options
-     */
-    var $autofree;
-
-    /**
-     * A reference to the DB_<driver> object
-     * @var object
-     */
-    var $dbh;
-
-    /**
-     * The current default fetch mode
-     * @var integer
-     * @see DB_common::$fetchmode
-     */
-    var $fetchmode;
-
-    /**
-     * The name of the class into which results should be fetched when
-     * DB_FETCHMODE_OBJECT is in effect
-     *
-     * @var string
-     * @see DB_common::$fetchmode_object_class
-     */
-    var $fetchmode_object_class;
-
-    /**
-     * The number of rows to fetch from a limit query
-     * @var integer
-     */
-    var $limit_count = null;
-
-    /**
-     * The row to start fetching from in limit queries
-     * @var integer
-     */
-    var $limit_from = null;
-
-    /**
-     * The execute parameters that created this result
-     * @var array
-     * @since Property available since Release 1.7.0
-     */
-    var $parameters;
-
-    /**
-     * The query string that created this result
-     *
-     * Copied here incase it changes in $dbh, which is referenced
-     *
-     * @var string
-     * @since Property available since Release 1.7.0
-     */
-    var $query;
-
-    /**
-     * The query result resource id created by PHP
-     * @var resource
-     */
-    var $result;
-
-    /**
-     * The present row being dealt with
-     * @var integer
-     */
-    var $row_counter = null;
-
-    /**
-     * The prepared statement resource id created by PHP in $dbh
-     *
-     * This resource is only available when the result set was created using
-     * a driver's native execute() method, not PEAR DB's emulated one.
-     *
-     * Copied here incase it changes in $dbh, which is referenced
-     *
-     * {@internal  Mainly here because the InterBase/Firebird API is only
-     * able to retrieve data from result sets if the statemnt handle is
-     * still in scope.}}
-     *
-     * @var resource
-     * @since Property available since Release 1.7.0
-     */
-    var $statement;
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor sets the object's properties
-     *
-     * @param object   &$dbh     the DB object reference
-     * @param resource $result   the result resource id
-     * @param array    $options  an associative array with result options
-     *
-     * @return void
-     */
-    function DB_result(&$dbh, $result, $options = array())
-    {
-        $this->autofree    = $dbh->options['autofree'];
-        $this->dbh         = &$dbh;
-        $this->fetchmode   = $dbh->fetchmode;
-        $this->fetchmode_object_class = $dbh->fetchmode_object_class;
-        $this->parameters  = $dbh->last_parameters;
-        $this->query       = $dbh->last_query;
-        $this->result      = $result;
-        $this->statement   = empty($dbh->last_stmt) ? null : $dbh->last_stmt;
-        foreach ($options as $key => $value) {
-            $this->setOption($key, $value);
-        }
-    }
-
-    /**
-     * Set options for the DB_result object
-     *
-     * @param string $key    the option to set
-     * @param mixed  $value  the value to set the option to
-     *
-     * @return void
-     */
-    function setOption($key, $value = null)
-    {
-        switch ($key) {
-            case 'limit_from':
-                $this->limit_from = $value;
-                break;
-            case 'limit_count':
-                $this->limit_count = $value;
-        }
-    }
-
-    // }}}
-    // {{{ fetchRow()
-
-    /**
-     * Fetch a row of data and return it by reference into an array
-     *
-     * The type of array returned can be controlled either by setting this
-     * method's <var>$fetchmode</var> parameter or by changing the default
-     * fetch mode setFetchMode() before calling this method.
-     *
-     * There are two options for standardizing the information returned
-     * from databases, ensuring their values are consistent when changing
-     * DBMS's.  These portability options can be turned on when creating a
-     * new DB object or by using setOption().
-     *
-     *   + <var>DB_PORTABILITY_LOWERCASE</var>
-     *     convert names of fields to lower case
-     *
-     *   + <var>DB_PORTABILITY_RTRIM</var>
-     *     right trim the data
-     *
-     * @param int $fetchmode  the constant indicating how to format the data
-     * @param int $rownum     the row number to fetch (index starts at 0)
-     *
-     * @return mixed  an array or object containing the row's data,
-     *                 NULL when the end of the result set is reached
-     *                 or a DB_Error object on failure.
-     *
-     * @see DB_common::setOption(), DB_common::setFetchMode()
-     */
-    function &fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
-    {
-        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
-            $fetchmode = $this->fetchmode;
-        }
-        if ($fetchmode === DB_FETCHMODE_OBJECT) {
-            $fetchmode = DB_FETCHMODE_ASSOC;
-            $object_class = $this->fetchmode_object_class;
-        }
-        if (is_null($rownum) && $this->limit_from !== null) {
-            if ($this->row_counter === null) {
-                $this->row_counter = $this->limit_from;
-                // Skip rows
-                if ($this->dbh->features['limit'] === false) {
-                    $i = 0;
-                    while ($i++ < $this->limit_from) {
-                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
-                    }
-                }
-            }
-            if ($this->row_counter >= ($this->limit_from + $this->limit_count))
-            {
-                if ($this->autofree) {
-                    $this->free();
-                }
-                $tmp = null;
-                return $tmp;
-            }
-            if ($this->dbh->features['limit'] === 'emulate') {
-                $rownum = $this->row_counter;
-            }
-            $this->row_counter++;
-        }
-        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
-        if ($res === DB_OK) {
-            if (isset($object_class)) {
-                // The default mode is specified in the
-                // DB_common::fetchmode_object_class property
-                if ($object_class == 'stdClass') {
-                    $arr = (object) $arr;
-                } else {
-                    $arr = new $object_class($arr);
-                }
-            }
-            return $arr;
-        }
-        if ($res == null && $this->autofree) {
-            $this->free();
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Fetch a row of data into an array which is passed by reference
-     *
-     * The type of array returned can be controlled either by setting this
-     * method's <var>$fetchmode</var> parameter or by changing the default
-     * fetch mode setFetchMode() before calling this method.
-     *
-     * There are two options for standardizing the information returned
-     * from databases, ensuring their values are consistent when changing
-     * DBMS's.  These portability options can be turned on when creating a
-     * new DB object or by using setOption().
-     *
-     *   + <var>DB_PORTABILITY_LOWERCASE</var>
-     *     convert names of fields to lower case
-     *
-     *   + <var>DB_PORTABILITY_RTRIM</var>
-     *     right trim the data
-     *
-     * @param array &$arr       the variable where the data should be placed
-     * @param int   $fetchmode  the constant indicating how to format the data
-     * @param int   $rownum     the row number to fetch (index starts at 0)
-     *
-     * @return mixed  DB_OK if a row is processed, NULL when the end of the
-     *                 result set is reached or a DB_Error object on failure
-     *
-     * @see DB_common::setOption(), DB_common::setFetchMode()
-     */
-    function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
-    {
-        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
-            $fetchmode = $this->fetchmode;
-        }
-        if ($fetchmode === DB_FETCHMODE_OBJECT) {
-            $fetchmode = DB_FETCHMODE_ASSOC;
-            $object_class = $this->fetchmode_object_class;
-        }
-        if (is_null($rownum) && $this->limit_from !== null) {
-            if ($this->row_counter === null) {
-                $this->row_counter = $this->limit_from;
-                // Skip rows
-                if ($this->dbh->features['limit'] === false) {
-                    $i = 0;
-                    while ($i++ < $this->limit_from) {
-                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
-                    }
-                }
-            }
-            if ($this->row_counter >= (
-                    $this->limit_from + $this->limit_count))
-            {
-                if ($this->autofree) {
-                    $this->free();
-                }
-                return null;
-            }
-            if ($this->dbh->features['limit'] === 'emulate') {
-                $rownum = $this->row_counter;
-            }
-
-            $this->row_counter++;
-        }
-        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
-        if ($res === DB_OK) {
-            if (isset($object_class)) {
-                // default mode specified in the
-                // DB_common::fetchmode_object_class property
-                if ($object_class == 'stdClass') {
-                    $arr = (object) $arr;
-                } else {
-                    $arr = new $object_class($arr);
-                }
-            }
-            return DB_OK;
-        }
-        if ($res == null && $this->autofree) {
-            $this->free();
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Get the the number of columns in a result set
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     */
-    function numCols()
-    {
-        return $this->dbh->numCols($this->result);
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Get the number of rows in a result set
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function numRows()
-    {
-        if ($this->dbh->features['numrows'] === 'emulate'
-            && $this->dbh->options['portability'] & DB_PORTABILITY_NUMROWS)
-        {
-            if ($this->dbh->features['prepare']) {
-                $res = $this->dbh->query($this->query, $this->parameters);
-            } else {
-                $res = $this->dbh->query($this->query);
-            }
-            if (DB::isError($res)) {
-                return $res;
-            }
-            $i = 0;
-            while ($res->fetchInto($tmp, DB_FETCHMODE_ORDERED)) {
-                $i++;
-            }
-            $count = $i;
-        } else {
-            $count = $this->dbh->numRows($this->result);
-        }
-
-        /* fbsql is checked for here because limit queries are implemented
-         * using a TOP() function, which results in fbsql_num_rows still
-         * returning the total number of rows that would have been returned,
-         * rather than the real number. As a result, we'll just do the limit
-         * calculations for fbsql in the same way as a database with emulated
-         * limits. Unfortunately, we can't just do this in DB_fbsql::numRows()
-         * because that only gets the result resource, rather than the full
-         * DB_Result object. */
-        if (($this->dbh->features['limit'] === 'emulate'
-             && $this->limit_from !== null)
-            || $this->dbh->phptype == 'fbsql') {
-            $limit_count = is_null($this->limit_count) ? $count : $this->limit_count;
-            if ($count < $this->limit_from) {
-                $count = 0;
-            } elseif ($count < ($this->limit_from + $limit_count)) {
-                $count -= $this->limit_from;
-            } else {
-                $count = $limit_count;
-            }
-        }
-
-        return $count;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Get the next result if a batch of queries was executed
-     *
-     * @return bool  true if a new result is available or false if not
-     */
-    function nextResult()
-    {
-        return $this->dbh->nextResult($this->result);
-    }
-
-    // }}}
-    // {{{ free()
-
-    /**
-     * Frees the resources allocated for this result set
-     *
-     * @return bool  true on success.  A DB_Error object on failure.
-     */
-    function free()
-    {
-        $err = $this->dbh->freeResult($this->result);
-        if (DB::isError($err)) {
-            return $err;
-        }
-        $this->result = false;
-        $this->statement = false;
-        return true;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * @see DB_common::tableInfo()
-     * @deprecated Method deprecated some time before Release 1.2
-     */
-    function tableInfo($mode = null)
-    {
-        if (is_string($mode)) {
-            return $this->dbh->raiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-        return $this->dbh->tableInfo($this, $mode);
-    }
-
-    // }}}
-    // {{{ getQuery()
-
-    /**
-     * Determine the query string that created this result
-     *
-     * @return string  the query string
-     *
-     * @since Method available since Release 1.7.0
-     */
-    function getQuery()
-    {
-        return $this->query;
-    }
-
-    // }}}
-    // {{{ getRowCounter()
-
-    /**
-     * Tells which row number is currently being processed
-     *
-     * @return integer  the current row being looked at.  Starts at 1.
-     */
-    function getRowCounter()
-    {
-        return $this->row_counter;
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class DB_row
-
-/**
- * PEAR DB Row Object
- *
- * The object contains a row of data from a result set.  Each column's data
- * is placed in a property named for the column.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- * @see        DB_common::setFetchMode()
- */
-class DB_row
-{
-    // {{{ constructor
-
-    /**
-     * The constructor places a row's data into properties of this object
-     *
-     * @param array  the array containing the row's data
-     *
-     * @return void
-     */
-    function DB_row(&$arr)
-    {
-        foreach ($arr as $key => $value) {
-            $this->$key = &$arr[$key];
-        }
-    }
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/DataObject.php b/lib/php/DB/DataObject.php
deleted file mode 100644
index cf6b9f9bd9e467ce537f98c61df3e84c51978bac..0000000000000000000000000000000000000000
--- a/lib/php/DB/DataObject.php
+++ /dev/null
@@ -1,4465 +0,0 @@
-<?php
-/**
- * Object Based Database Query Builder and data store
- *
- * For PHP versions 4,5 and 6
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB_DataObject
- * @author     Alan Knowles <alan@akbkhome.com>
- * @copyright  1997-2006 The PHP Group
- * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version    CVS: $Id: DataObject.php 293570 2010-01-15 07:10:44Z alan_k $
- * @link       http://pear.php.net/package/DB_DataObject
- */
-  
-
-/* =========================================================================== 
- *
- *    !!!!!!!!!!!!!               W A R N I N G                !!!!!!!!!!!
- *
- *  THIS MAY SEGFAULT PHP IF YOU ARE USING THE ZEND OPTIMIZER (to fix it, 
- *  just add "define('DB_DATAOBJECT_NO_OVERLOAD',true);" before you include 
- *  this file. reducing the optimization level may also solve the segfault.
- *  ===========================================================================
- */
-
-/**
- * The main "DB_DataObject" class is really a base class for your own tables classes
- *
- * // Set up the class by creating an ini file (refer to the manual for more details
- * [DB_DataObject]
- * database         = mysql:/username:password@host/database
- * schema_location = /home/myapplication/database
- * class_location  = /home/myapplication/DBTables/
- * clase_prefix    = DBTables_
- *
- *
- * //Start and initialize...................... - dont forget the &
- * $config = parse_ini_file('example.ini',true);
- * $options = &PEAR::getStaticProperty('DB_DataObject','options');
- * $options = $config['DB_DataObject'];
- *
- * // example of a class (that does not use the 'auto generated tables data')
- * class mytable extends DB_DataObject {
- *     // mandatory - set the table
- *     var $_database_dsn = "mysql://username:password@localhost/database";
- *     var $__table = "mytable";
- *     function table() {
- *         return array(
- *             'id' => 1, // integer or number
- *             'name' => 2, // string
- *        );
- *     }
- *     function keys() {
- *         return array('id');
- *     }
- * }
- *
- * // use in the application
- *
- *
- * Simple get one row
- *
- * $instance = new mytable;
- * $instance->get("id",12);
- * echo $instance->somedata;
- *
- *
- * Get multiple rows
- *
- * $instance = new mytable;
- * $instance->whereAdd("ID > 12");
- * $instance->whereAdd("ID < 14");
- * $instance->find();
- * while ($instance->fetch()) {
- *     echo $instance->somedata;
- * }
-
-
-/**
- * Needed classes
- * - we use getStaticProperty from PEAR pretty extensively (cant remove it ATM)
- */
-
-require_once 'PEAR.php';
-
-/**
- * We are duping fetchmode constants to be compatible with
- * both DB and MDB2
- */
-define('DB_DATAOBJECT_FETCHMODE_ORDERED',1); 
-define('DB_DATAOBJECT_FETCHMODE_ASSOC',2);
-
-
-
-
-
-/**
- * these are constants for the get_table array
- * user to determine what type of escaping is required around the object vars.
- */
-define('DB_DATAOBJECT_INT',  1);  // does not require ''
-define('DB_DATAOBJECT_STR',  2);  // requires ''
-
-define('DB_DATAOBJECT_DATE', 4);  // is date #TODO
-define('DB_DATAOBJECT_TIME', 8);  // is time #TODO
-define('DB_DATAOBJECT_BOOL', 16); // is boolean #TODO
-define('DB_DATAOBJECT_TXT',  32); // is long text #TODO
-define('DB_DATAOBJECT_BLOB', 64); // is blob type
-
-
-define('DB_DATAOBJECT_NOTNULL', 128);           // not null col.
-define('DB_DATAOBJECT_MYSQLTIMESTAMP'   , 256);           // mysql timestamps (ignored by update/insert)
-/*
- * Define this before you include DataObjects.php to  disable overload - if it segfaults due to Zend optimizer..
- */
-//define('DB_DATAOBJECT_NO_OVERLOAD',true)  
-
-
-/**
- * Theses are the standard error codes, most methods will fail silently - and return false
- * to access the error message either use $table->_lastError
- * or $last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
- * the code is $last_error->code, and the message is $last_error->message (a standard PEAR error)
- */
-
-define('DB_DATAOBJECT_ERROR_INVALIDARGS',   -1);  // wrong args to function
-define('DB_DATAOBJECT_ERROR_NODATA',        -2);  // no data available
-define('DB_DATAOBJECT_ERROR_INVALIDCONFIG', -3);  // something wrong with the config
-define('DB_DATAOBJECT_ERROR_NOCLASS',       -4);  // no class exists
-define('DB_DATAOBJECT_ERROR_INVALID_CALL'  ,-7);  // overlad getter/setter failure
-
-/**
- * Used in methods like delete() and count() to specify that the method should
- * build the condition only out of the whereAdd's and not the object parameters.
- */
-define('DB_DATAOBJECT_WHEREADD_ONLY', true);
-
-/**
- *
- * storage for connection and result objects,
- * it is done this way so that print_r()'ing the is smaller, and
- * it reduces the memory size of the object.
- * -- future versions may use $this->_connection = & PEAR object..
- *   although will need speed tests to see how this affects it.
- * - includes sub arrays
- *   - connections = md5 sum mapp to pear db object
- *   - results     = [id] => map to pear db object
- *   - resultseq   = sequence id for results & results field
- *   - resultfields = [id] => list of fields return from query (for use with toArray())
- *   - ini         = mapping of database to ini file results
- *   - links       = mapping of database to links file
- *   - lasterror   = pear error objects for last error event.
- *   - config      = aliased view of PEAR::getStaticPropery('DB_DataObject','options') * done for performance.
- *   - array of loaded classes by autoload method - to stop it doing file access request over and over again!
- */
-$GLOBALS['_DB_DATAOBJECT']['RESULTS']   = array();
-$GLOBALS['_DB_DATAOBJECT']['RESULTSEQ'] = 1;
-$GLOBALS['_DB_DATAOBJECT']['RESULTFIELDS'] = array();
-$GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'] = array();
-$GLOBALS['_DB_DATAOBJECT']['INI'] = array();
-$GLOBALS['_DB_DATAOBJECT']['LINKS'] = array();
-$GLOBALS['_DB_DATAOBJECT']['SEQUENCE'] = array();
-$GLOBALS['_DB_DATAOBJECT']['LASTERROR'] = null;
-$GLOBALS['_DB_DATAOBJECT']['CONFIG'] = array();
-$GLOBALS['_DB_DATAOBJECT']['CACHE'] = array();
-$GLOBALS['_DB_DATAOBJECT']['OVERLOADED'] = false;
-$GLOBALS['_DB_DATAOBJECT']['QUERYENDTIME'] = 0;
-
-
- 
-// this will be horrifically slow!!!!
-// NOTE: Overload SEGFAULTS ON PHP4 + Zend Optimizer (see define before..)
-// these two are BC/FC handlers for call in PHP4/5
-
-if ( substr(phpversion(),0,1) == 5) {
-    class DB_DataObject_Overload 
-    {
-        function __call($method,$args) 
-        {
-            $return = null;
-            $this->_call($method,$args,$return);
-            return $return;
-        }
-        function __sleep() 
-        {
-            return array_keys(get_object_vars($this)) ; 
-        }
-    }
-} else {
-    if (version_compare(phpversion(),'4.3.10','eq') && !defined('DB_DATAOBJECT_NO_OVERLOAD')) {
-        trigger_error(
-            "overload does not work with PHP4.3.10, either upgrade 
-            (snaps.php.net) or more recent version 
-            or define DB_DATAOBJECT_NO_OVERLOAD as per the manual.
-            ",E_USER_ERROR);
-    }
-
-    if (!function_exists('clone')) {
-        // emulate clone  - as per php_compact, slow but really the correct behaviour..
-        eval('function clone($t) { $r = $t; if (method_exists($r,"__clone")) { $r->__clone(); } return $r; }');
-    }
-    eval('
-        class DB_DataObject_Overload {
-            function __call($method,$args,&$return) {
-                return $this->_call($method,$args,$return); 
-            }
-        }
-    ');
-}
-
-    
-
-
- 
-
- /*
- *
- * @package  DB_DataObject
- * @author   Alan Knowles <alan@akbkhome.com>
- * @since    PHP 4.0
- */
- 
-class DB_DataObject extends DB_DataObject_Overload
-{
-   /**
-    * The Version - use this to check feature changes
-    *
-    * @access   private
-    * @var      string
-    */
-    var $_DB_DataObject_version = "1.9.3";
-
-    /**
-     * The Database table (used by table extends)
-     *
-     * @access  private
-     * @var     string
-     */
-    var $__table = '';  // database table
-
-    /**
-     * The Number of rows returned from a query
-     *
-     * @access  public
-     * @var     int
-     */
-    var $N = 0;  // Number of rows returned from a query
-
-    /* ============================================================= */
-    /*                      Major Public Methods                     */
-    /* (designed to be optionally then called with parent::method()) */
-    /* ============================================================= */
-
-
-    /**
-     * Get a result using key, value.
-     *
-     * for example
-     * $object->get("ID",1234);
-     * Returns Number of rows located (usually 1) for success,
-     * and puts all the table columns into this classes variables
-     *
-     * see the fetch example on how to extend this.
-     *
-     * if no value is entered, it is assumed that $key is a value
-     * and get will then use the first key in keys()
-     * to obtain the key.
-     *
-     * @param   string  $k column
-     * @param   string  $v value
-     * @access  public
-     * @return  int     No. of rows
-     */
-    function get($k = null, $v = null)
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        $keys = array();
-        
-        if ($v === null) {
-            $v = $k;
-            $keys = $this->keys();
-            if (!$keys) {
-                $this->raiseError("No Keys available for {$this->__table}", DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-                return false;
-            }
-            $k = $keys[0];
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("$k $v " .print_r($keys,true), "GET");
-        }
-        
-        if ($v === null) {
-            $this->raiseError("No Value specified for get", DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        $this->$k = $v;
-        return $this->find(1);
-    }
-
-    /**
-     * An autoloading, caching static get method  using key, value (based on get)
-     * (depreciated - use ::get / and your own caching method)
-     * 
-     * Usage:
-     * $object = DB_DataObject::staticGet("DbTable_mytable",12);
-     * or
-     * $object =  DB_DataObject::staticGet("DbTable_mytable","name","fred");
-     *
-     * or write it into your extended class:
-     * function &staticGet($k,$v=NULL) { return DB_DataObject::staticGet("This_Class",$k,$v);  }
-     *
-     * @param   string  $class class name
-     * @param   string  $k     column (or value if using keys)
-     * @param   string  $v     value (optional)
-     * @access  public
-     * @return  object
-     */
-    function &staticGet($class, $k, $v = null)
-    {
-        $lclass = strtolower($class);
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-
-        
-
-        $key = "$k:$v";
-        if ($v === null) {
-            $key = $k;
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            DB_DataObject::debug("$class $key","STATIC GET - TRY CACHE");
-        }
-        if (!empty($_DB_DATAOBJECT['CACHE'][$lclass][$key])) {
-            return $_DB_DATAOBJECT['CACHE'][$lclass][$key];
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            DB_DataObject::debug("$class $key","STATIC GET - NOT IN CACHE");
-        }
-
-        $obj = DB_DataObject::factory(substr($class,strlen($_DB_DATAOBJECT['CONFIG']['class_prefix'])));
-        if (PEAR::isError($obj)) {
-            DB_DataObject::raiseError("could not autoload $class", DB_DATAOBJECT_ERROR_NOCLASS);
-            $r = false;
-            return $r;
-        }
-        
-        if (!isset($_DB_DATAOBJECT['CACHE'][$lclass])) {
-            $_DB_DATAOBJECT['CACHE'][$lclass] = array();
-        }
-        if (!$obj->get($k,$v)) {
-            DB_DataObject::raiseError("No Data return from get $k $v", DB_DATAOBJECT_ERROR_NODATA);
-            
-            $r = false;
-            return $r;
-        }
-        $_DB_DATAOBJECT['CACHE'][$lclass][$key] = $obj;
-        return $_DB_DATAOBJECT['CACHE'][$lclass][$key];
-    }
-
-    /**
-     * find results, either normal or crosstable
-     *
-     * for example
-     *
-     * $object = new mytable();
-     * $object->ID = 1;
-     * $object->find();
-     *
-     *
-     * will set $object->N to number of rows, and expects next command to fetch rows
-     * will return $object->N
-     *
-     * @param   boolean $n Fetch first result
-     * @access  public
-     * @return  mixed (number of rows returned, or true if numRows fetching is not supported)
-     */
-    function find($n = false)
-    {
-        global $_DB_DATAOBJECT;
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug($n, "find",1);
-        }
-        if (!$this->__table) {
-            // xdebug can backtrace this!
-            trigger_error("NO \$__table SPECIFIED in class definition",E_USER_ERROR);
-        }
-        $this->N = 0;
-        $query_before = $this->_query;
-        $this->_build_condition($this->table()) ;
-        
-        $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-       
-        /* We are checking for method modifyLimitQuery as it is PEAR DB specific */
-        $sql = 'SELECT ' .
-            $this->_query['data_select'] . " \n" .
-            ' FROM ' . ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table) . " \n" .
-            $this->_join . " \n" .
-            $this->_query['condition'] . " \n" .
-            $this->_query['group_by']  . " \n" .
-            $this->_query['having']    . " \n" .
-            $this->_query['order_by']  . " \n";
-        
-        if ((!isset($_DB_DATAOBJECT['CONFIG']['db_driver'])) || 
-            ($_DB_DATAOBJECT['CONFIG']['db_driver'] == 'DB')) {
-            /* PEAR DB specific */
-        
-            if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this->_query['limit_count'])) {
-                $sql = $DB->modifyLimitQuery($sql,$this->_query['limit_start'], $this->_query['limit_count']);
-            }
-        } else {
-            /* theoretically MDB2! */
-            if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this->_query['limit_count'])) {
-	            $DB->setLimit($this->_query['limit_count'],$this->_query['limit_start']);
-	        }
-        }
-        
-        
-        $this->_query($sql);
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("CHECK autofetchd $n", "find", 1);
-        }
-        
-        // find(true)
-        
-        $ret = $this->N;
-        if (!$ret && !empty($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid])) {     
-            // clear up memory if nothing found!?
-            unset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid]);
-        }
-        
-        if ($n && $this->N > 0 ) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("ABOUT TO AUTOFETCH", "find", 1);
-            }
-            $fs = $this->fetch();
-            // if fetch returns false (eg. failed), then the backend doesnt support numRows (eg. ret=true)
-            // - hence find() also returns false..
-            $ret = ($ret === true) ? $fs : $ret;
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("DONE", "find", 1);
-        }
-        $this->_query = $query_before;
-        return $ret;
-    }
-
-    /**
-     * fetches next row into this objects var's
-     *
-     * returns 1 on success 0 on failure
-     *
-     *
-     *
-     * Example
-     * $object = new mytable();
-     * $object->name = "fred";
-     * $object->find();
-     * $store = array();
-     * while ($object->fetch()) {
-     *   echo $this->ID;
-     *   $store[] = $object; // builds an array of object lines.
-     * }
-     *
-     * to add features to a fetch
-     * function fetch () {
-     *    $ret = parent::fetch();
-     *    $this->date_formated = date('dmY',$this->date);
-     *    return $ret;
-     * }
-     *
-     * @access  public
-     * @return  boolean on success
-     */
-    function fetch()
-    {
-
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        if (empty($this->N)) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("No data returned from FIND (eg. N is 0)","FETCH", 3);
-            }
-            return false;
-        }
-        
-        if (empty($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid]) || 
-            !is_object($result = &$_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid])) 
-        {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug('fetched on object after fetch completed (no results found)');
-            }
-            return false;
-        }
-        
-        
-        $array = $result->fetchRow(DB_DATAOBJECT_FETCHMODE_ASSOC);
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug(serialize($array),"FETCH");
-        }
-        
-        // fetched after last row..
-        if ($array === null) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $t= explode(' ',microtime());
-            
-                $this->debug("Last Data Fetch'ed after " . 
-                        ($t[0]+$t[1]- $_DB_DATAOBJECT['QUERYENDTIME']  ) . 
-                        " seconds",
-                    "FETCH", 1);
-            }
-            // reduce the memory usage a bit... (but leave the id in, so count() works ok on it)
-            unset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid]);
-            
-            // we need to keep a copy of resultfields locally so toArray() still works
-            // however we dont want to keep it in the global cache..
-            
-            if (!empty($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid])) {
-                $this->_resultFields = $_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid];
-                unset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid]);
-            }
-            // this is probably end of data!!
-            //DB_DataObject::raiseError("fetch: no data returned", DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-        // make sure resultFields is always empty..
-        $this->_resultFields = false;
-        
-        if (!isset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid])) {
-            // note: we dont declare this to keep the print_r size down.
-            $_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid]= array_flip(array_keys($array));
-        }
-        
-        foreach($array as $k=>$v) {
-            $kk = str_replace(".", "_", $k);
-            $kk = str_replace(" ", "_", $kk);
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("$kk = ". $array[$k], "fetchrow LINE", 3);
-            }
-            $this->$kk = $array[$k];
-        }
-        
-        // set link flag
-        $this->_link_loaded=false;
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("{$this->__table} DONE", "fetchrow",2);
-        }
-        if (($this->_query !== false) &&  empty($_DB_DATAOBJECT['CONFIG']['keep_query_after_fetch'])) {
-            $this->_query = false;
-        }
-        return true;
-    }
-
-    
-     /**
-     * fetches all results as an array,
-     *
-     * return format is dependant on args.
-     * if selectAdd() has not been called on the object, then it will add the correct columns to the query.
-     * 
-     * A) Array of values (eg. a list of 'id')
-     *
-     * $x = DB_DataObject::factory('mytable');
-     * $x->whereAdd('something = 1')
-     * $ar = $x->fetchAll('id');
-     * -- returns array(1,2,3,4,5)
-     *
-     * B) Array of values (not from table)
-     *
-     * $x = DB_DataObject::factory('mytable');
-     * $x->whereAdd('something = 1');
-     * $x->selectAdd();
-     * $x->selectAdd('distinct(group_id) as group_id');
-     * $ar = $x->fetchAll('group_id');
-     * -- returns array(1,2,3,4,5)
-     *     *
-     * C) A key=>value associative array
-     *
-     * $x = DB_DataObject::factory('mytable');
-     * $x->whereAdd('something = 1')
-     * $ar = $x->fetchAll('id','name');
-     * -- returns array(1=>'fred',2=>'blogs',3=> .......
-     *
-     * D) array of objects
-     * $x = DB_DataObject::factory('mytable');
-     * $x->whereAdd('something = 1');
-     * $ar = $x->fetchAll();
-     *
-     * E) array of arrays (for example)
-     * $x = DB_DataObject::factory('mytable');
-     * $x->whereAdd('something = 1');
-     * $ar = $x->fetchAll(false,false,'toArray');
-     *
-     *
-     * @param    string|false  $k key
-     * @param    string|false  $v value
-     * @param    string|false  $method method to call on each result to get array value (eg. 'toArray')
-     * @access  public
-     * @return  array  format dependant on arguments, may be empty
-     */
-    function fetchAll($k= false, $v = false, $method = false)  
-    {
-        // should it even do this!!!?!?
-        if ($k !== false && 
-                (   // only do this is we have not been explicit..
-                    empty($this->_query['data_select']) || 
-                    ($this->_query['data_select'] == '*')
-                )
-            ) {
-            $this->selectAdd();
-            $this->selectAdd($k);
-            if ($v !== false) {
-                $this->selectAdd($v);
-            }
-        }
-        
-        $this->find();
-        $ret = array();
-        while ($this->fetch()) {
-            if ($v !== false) {
-                $ret[$this->$k] = $this->$v;
-                continue;
-            }
-            $ret[] = $k === false ? 
-                ($method == false ? clone($this)  : $this->$method())
-                : $this->$k;
-        }
-        return $ret;
-         
-    }
-    
-    
-    /**
-     * Adds a condition to the WHERE statement, defaults to AND
-     *
-     * $object->whereAdd(); //reset or cleaer ewhwer
-     * $object->whereAdd("ID > 20");
-     * $object->whereAdd("age > 20","OR");
-     *
-     * @param    string  $cond  condition
-     * @param    string  $logic optional logic "OR" (defaults to "AND")
-     * @access   public
-     * @return   string|PEAR::Error - previous condition or Error when invalid args found
-     */
-    function whereAdd($cond = false, $logic = 'AND')
-    {
-        // for PHP5.2.3 - there is a bug with setting array properties of an object.
-        $_query = $this->_query;
-         
-        if (!isset($this->_query) || ($_query === false)) {
-            return $this->raiseError(
-                "You cannot do two queries on the same object (clone it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        
-        if ($cond === false) {
-            $r = $this->_query['condition'];
-            $_query['condition'] = '';
-            $this->_query = $_query;
-            return preg_replace('/^\s+WHERE\s+/','',$r);
-        }
-        // check input...= 0 or '   ' == error!
-        if (!trim($cond)) {
-            return $this->raiseError("WhereAdd: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        $r = $_query['condition'];
-        if ($_query['condition']) {
-            $_query['condition'] .= " {$logic} ( {$cond} )";
-            $this->_query = $_query;
-            return $r;
-        }
-        $_query['condition'] = " WHERE ( {$cond} ) ";
-        $this->_query = $_query;
-        return $r;
-    }
-
-    /**
-    * Adds a 'IN' condition to the WHERE statement
-    *
-    * $object->whereAddIn('id', $array, 'int'); //minimal usage
-    * $object->whereAddIn('price', $array, 'float', 'OR');  // cast to float, and call whereAdd with 'OR'
-    * $object->whereAddIn('name', $array, 'string');  // quote strings
-    *
-    * @param    string  $key  key column to match
-    * @param    array  $list  list of values to match
-    * @param    string  $type  string|int|integer|float|bool  cast to type. 
-    * @param    string  $logic optional logic to call whereAdd with eg. "OR" (defaults to "AND")
-    * @access   public
-    * @return   string|PEAR::Error - previous condition or Error when invalid args found
-    */
-    function whereAddIn($key, $list, $type, $logic = 'AND') 
-    {
-        // fix type for short entry.
-        $type = $type == 'int' ? 'integer' : $type; 
-
-        $ar = array();
-        foreach($list as $k) {
-            settype($k, $type);
-            $ar[] = $type =='string' ? $this->escape($k) : $k;
-        }
-        if (!$ar) {
-            return;
-        }
-        return $this->whereAdd("$key IN (". implode(',', $ar). ')', $logic );
-    }
-
-    
-    
-    /**
-     * Adds a order by condition
-     *
-     * $object->orderBy(); //clears order by
-     * $object->orderBy("ID");
-     * $object->orderBy("ID,age");
-     *
-     * @param  string $order  Order
-     * @access public
-     * @return none|PEAR::Error - invalid args only
-     */
-    function orderBy($order = false)
-    {
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        if ($order === false) {
-            $this->_query['order_by'] = '';
-            return;
-        }
-        // check input...= 0 or '    ' == error!
-        if (!trim($order)) {
-            return $this->raiseError("orderBy: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        
-        if (!$this->_query['order_by']) {
-            $this->_query['order_by'] = " ORDER BY {$order} ";
-            return;
-        }
-        $this->_query['order_by'] .= " , {$order}";
-    }
-
-    /**
-     * Adds a group by condition
-     *
-     * $object->groupBy(); //reset the grouping
-     * $object->groupBy("ID DESC");
-     * $object->groupBy("ID,age");
-     *
-     * @param  string  $group  Grouping
-     * @access public
-     * @return none|PEAR::Error - invalid args only
-     */
-    function groupBy($group = false)
-    {
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        if ($group === false) {
-            $this->_query['group_by'] = '';
-            return;
-        }
-        // check input...= 0 or '    ' == error!
-        if (!trim($group)) {
-            return $this->raiseError("groupBy: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        
-        
-        if (!$this->_query['group_by']) {
-            $this->_query['group_by'] = " GROUP BY {$group} ";
-            return;
-        }
-        $this->_query['group_by'] .= " , {$group}";
-    }
-
-    /**
-     * Adds a having clause
-     *
-     * $object->having(); //reset the grouping
-     * $object->having("sum(value) > 0 ");
-     *
-     * @param  string  $having  condition
-     * @access public
-     * @return none|PEAR::Error - invalid args only
-     */
-    function having($having = false)
-    {
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        if ($having === false) {
-            $this->_query['having'] = '';
-            return;
-        }
-        // check input...= 0 or '    ' == error!
-        if (!trim($having)) {
-            return $this->raiseError("Having: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        
-        
-        if (!$this->_query['having']) {
-            $this->_query['having'] = " HAVING {$having} ";
-            return;
-        }
-        $this->_query['having'] .= " AND {$having}";
-    }
-
-    /**
-     * Sets the Limit
-     *
-     * $boject->limit(); // clear limit
-     * $object->limit(12);
-     * $object->limit(12,10);
-     *
-     * Note this will emit an error on databases other than mysql/postgress
-     * as there is no 'clean way' to implement it. - you should consider refering to
-     * your database manual to decide how you want to implement it.
-     *
-     * @param  string $a  limit start (or number), or blank to reset
-     * @param  string $b  number
-     * @access public
-     * @return none|PEAR::Error - invalid args only
-     */
-    function limit($a = null, $b = null)
-    {
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        
-        if ($a === null) {
-           $this->_query['limit_start'] = '';
-           $this->_query['limit_count'] = '';
-           return;
-        }
-        // check input...= 0 or '    ' == error!
-        if ((!is_int($a) && ((string)((int)$a) !== (string)$a)) 
-            || (($b !== null) && (!is_int($b) && ((string)((int)$b) !== (string)$b)))) {
-            return $this->raiseError("limit: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        global $_DB_DATAOBJECT;
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-        
-        $this->_query['limit_start'] = ($b == null) ? 0 : (int)$a;
-        $this->_query['limit_count'] = ($b == null) ? (int)$a : (int)$b;
-        
-    }
-
-    /**
-     * Adds a select columns
-     *
-     * $object->selectAdd(); // resets select to nothing!
-     * $object->selectAdd("*"); // default select
-     * $object->selectAdd("unixtime(DATE) as udate");
-     * $object->selectAdd("DATE");
-     *
-     * to prepend distict:
-     * $object->selectAdd('distinct ' . $object->selectAdd());
-     *
-     * @param  string  $k
-     * @access public
-     * @return mixed null or old string if you reset it.
-     */
-    function selectAdd($k = null)
-    {
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        if ($k === null) {
-            $old = $this->_query['data_select'];
-            $this->_query['data_select'] = '';
-            return $old;
-        }
-        
-        // check input...= 0 or '    ' == error!
-        if (!trim($k)) {
-            return $this->raiseError("selectAdd: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS);
-        }
-        
-        if ($this->_query['data_select']) {
-            $this->_query['data_select'] .= ', ';
-        }
-        $this->_query['data_select'] .= " $k ";
-    }
-    /**
-     * Adds multiple Columns or objects to select with formating.
-     *
-     * $object->selectAs(null); // adds "table.colnameA as colnameA,table.colnameB as colnameB,......"
-     *                      // note with null it will also clear the '*' default select
-     * $object->selectAs(array('a','b'),'%s_x'); // adds "a as a_x, b as b_x"
-     * $object->selectAs(array('a','b'),'ddd_%s','ccc'); // adds "ccc.a as ddd_a, ccc.b as ddd_b"
-     * $object->selectAdd($object,'prefix_%s'); // calls $object->get_table and adds it all as
-     *                  objectTableName.colnameA as prefix_colnameA
-     *
-     * @param  array|object|null the array or object to take column names from.
-     * @param  string           format in sprintf format (use %s for the colname)
-     * @param  string           table name eg. if you have joinAdd'd or send $from as an array.
-     * @access public
-     * @return void
-     */
-    function selectAs($from = null,$format = '%s',$tableName=false)
-    {
-        global $_DB_DATAOBJECT;
-        
-        if ($this->_query === false) {
-            $this->raiseError(
-                "You cannot do two queries on the same object (copy it before finding)", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        
-        if ($from === null) {
-            // blank the '*' 
-            $this->selectAdd();
-            $from = $this;
-        }
-        
-        
-        $table = $this->__table;
-        if (is_object($from)) {
-            $table = $from->__table;
-            $from = array_keys($from->table());
-        }
-        
-        if ($tableName !== false) {
-            $table = $tableName;
-        }
-        $s = '%s';
-        if (!empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers'])) {
-            $this->_connect();
-            $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-            $s      = $DB->quoteIdentifier($s);
-            $format = $DB->quoteIdentifier($format); 
-        }
-        foreach ($from as $k) {
-            $this->selectAdd(sprintf("{$s}.{$s} as {$format}",$table,$k,$k));
-        }
-        $this->_query['data_select'] .= "\n";
-    }
-    /**
-     * Insert the current objects variables into the database
-     *
-     * Returns the ID of the inserted element (if auto increment or sequences are used.)
-     *
-     * for example
-     *
-     * Designed to be extended
-     *
-     * $object = new mytable();
-     * $object->name = "fred";
-     * echo $object->insert();
-     *
-     * @access public
-     * @return mixed false on failure, int when auto increment or sequence used, otherwise true on success
-     */
-    function insert()
-    {
-        global $_DB_DATAOBJECT;
-        
-        // we need to write to the connection (For nextid) - so us the real
-        // one not, a copyied on (as ret-by-ref fails with overload!)
-        
-        if (!isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $this->_connect();
-        }
-        
-        $quoteIdentifiers  = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-         
-        $items =  isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table]) ?   
-            $_DB_DATAOBJECT['INI'][$this->_database][$this->__table] : $this->table();
-            
-        if (!$items) {
-            $this->raiseError("insert:No table definition for {$this->__table}",
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return false;
-        }
-        $options = &$_DB_DATAOBJECT['CONFIG'];
-
-
-        $datasaved = 1;
-        $leftq     = '';
-        $rightq    = '';
-     
-        $seqKeys   = isset($_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table]) ?
-                        $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] : 
-                        $this->sequenceKey();
-        
-        $key       = isset($seqKeys[0]) ? $seqKeys[0] : false;
-        $useNative = isset($seqKeys[1]) ? $seqKeys[1] : false;
-        $seq       = isset($seqKeys[2]) ? $seqKeys[2] : false;
-        
-        $dbtype    = $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn["phptype"];
-        
-         
-        // nativeSequences or Sequences..     
-
-        // big check for using sequences
-        
-        if (($key !== false) && !$useNative) { 
-        
-            if (!$seq) {
-                $keyvalue =  $DB->nextId($this->__table);
-            } else {
-                $f = $DB->getOption('seqname_format');
-                $DB->setOption('seqname_format','%s');
-                $keyvalue =  $DB->nextId($seq);
-                $DB->setOption('seqname_format',$f);
-            }
-            if (PEAR::isError($keyvalue)) {
-                $this->raiseError($keyvalue->toString(), DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-                return false;
-            }
-            $this->$key = $keyvalue;
-        }
-        
-        // if we haven't set disable_null_strings to "full"
-        $ignore_null = !isset($options['disable_null_strings'])
-                    || !is_string($options['disable_null_strings'])
-                    || strtolower($options['disable_null_strings']) !== 'full' ;
-                    
-             
-        foreach($items as $k => $v) {
-            
-            // if we are using autoincrement - skip the column...
-            if ($key && ($k == $key) && $useNative) {
-                continue;
-            }
-        
-            
-           
-           
-            // Ignore variables which aren't set to a value
-        	if ( !isset($this->$k) && $ignore_null) {
-                continue;
-            }
-            // dont insert data into mysql timestamps 
-            // use query() if you really want to do this!!!!
-            if ($v & DB_DATAOBJECT_MYSQLTIMESTAMP) {
-                continue;
-            }
-            
-            if ($leftq) {
-                $leftq  .= ', ';
-                $rightq .= ', ';
-            }
-            
-            $leftq .= ($quoteIdentifiers ? ($DB->quoteIdentifier($k) . ' ')  : "$k ");
-            
-            if (is_a($this->$k,'DB_DataObject_Cast')) {
-                $value = $this->$k->toString($v,$DB);
-                if (PEAR::isError($value)) {
-                    $this->raiseError($value->toString() ,DB_DATAOBJECT_ERROR_INVALIDARGS);
-                    return false;
-                }
-                $rightq .=  $value;
-                continue;
-            }
-            
-            
-            if (!($v & DB_DATAOBJECT_NOTNULL) && DB_DataObject::_is_null($this,$k)) {
-                $rightq .= " NULL ";
-                continue;
-            }
-            // DATE is empty... on a col. that can be null.. 
-            // note: this may be usefull for time as well..
-            if (!$this->$k && 
-                    (($v & DB_DATAOBJECT_DATE) || ($v & DB_DATAOBJECT_TIME)) && 
-                    !($v & DB_DATAOBJECT_NOTNULL)) {
-                    
-                $rightq .= " NULL ";
-                continue;
-            }
-              
-            
-            if ($v & DB_DATAOBJECT_STR) {
-                $rightq .= $this->_quote((string) (
-                        ($v & DB_DATAOBJECT_BOOL) ? 
-                            // this is thanks to the braindead idea of postgres to 
-                            // use t/f for boolean.
-                            (($this->$k === 'f') ? 0 : (int)(bool) $this->$k) :  
-                            $this->$k
-                    )) . " ";
-                continue;
-            }
-            if (is_numeric($this->$k)) {
-                $rightq .=" {$this->$k} ";
-                continue;
-            }
-            /* flag up string values - only at debug level... !!!??? */
-            if (is_object($this->$k) || is_array($this->$k)) {
-                $this->debug('ODD DATA: ' .$k . ' ' .  print_r($this->$k,true),'ERROR');
-            }
-            
-            // at present we only cast to integers
-            // - V2 may store additional data about float/int
-            $rightq .= ' ' . intval($this->$k) . ' ';
-
-        }
-        
-        // not sure why we let empty insert here.. - I guess to generate a blank row..
-        
-        
-        if ($leftq || $useNative) {
-            $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table)    : $this->__table);
-            
-            
-            if (($dbtype == 'pgsql') && empty($leftq)) {
-                $r = $this->_query("INSERT INTO {$table} DEFAULT VALUES");
-            } else {
-               $r = $this->_query("INSERT INTO {$table} ($leftq) VALUES ($rightq) ");
-            }
-            
- 
-            
-            
-            if (PEAR::isError($r)) {
-                $this->raiseError($r);
-                return false;
-            }
-            
-            if ($r < 1) {
-                return 0;
-            }
-            
-            
-            // now do we have an integer key!
-            
-            if ($key && $useNative) {
-                switch ($dbtype) {
-                    case 'mysql':
-                    case 'mysqli':
-                        $method = "{$dbtype}_insert_id";
-                        $this->$key = $method(
-                            $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->connection
-                        );
-                        break;
-                    
-                    case 'mssql':
-                        // note this is not really thread safe - you should wrapp it with 
-                        // transactions = eg.
-                        // $db->query('BEGIN');
-                        // $db->insert();
-                        // $db->query('COMMIT');
-                        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-                        $method = ($db_driver  == 'DB') ? 'getOne' : 'queryOne';
-                        $mssql_key = $DB->$method("SELECT @@IDENTITY");
-                        if (PEAR::isError($mssql_key)) {
-                            $this->raiseError($mssql_key);
-                            return false;
-                        }
-                        $this->$key = $mssql_key;
-                        break; 
-                        
-                    case 'pgsql':
-                        if (!$seq) {
-                            $seq = $DB->getSequenceName(strtolower($this->__table));
-                        }
-                        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-                        $method = ($db_driver  == 'DB') ? 'getOne' : 'queryOne';
-                        $pgsql_key = $DB->$method("SELECT currval('".$seq . "')"); 
-
-
-                        if (PEAR::isError($pgsql_key)) {
-                            $this->raiseError($pgsql_key);
-                            return false;
-                        }
-                        $this->$key = $pgsql_key;
-                        break;
-                    
-                    case 'ifx':
-                        $this->$key = array_shift (
-                            ifx_fetch_row (
-                                ifx_query(
-                                    "select DBINFO('sqlca.sqlerrd1') FROM systables where tabid=1",
-                                    $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->connection,
-                                    IFX_SCROLL
-                                ), 
-                                "FIRST"
-                            )
-                        ); 
-                        break;
-                    
-                }
-                        
-            }
-
-            if (isset($_DB_DATAOBJECT['CACHE'][strtolower(get_class($this))])) {
-                $this->_clear_cache();
-            }
-            if ($key) {
-                return $this->$key;
-            }
-            return true;
-        }
-        $this->raiseError("insert: No Data specifed for query", DB_DATAOBJECT_ERROR_NODATA);
-        return false;
-    }
-
-    /**
-     * Updates  current objects variables into the database
-     * uses the keys() to decide how to update
-     * Returns the  true on success
-     *
-     * for example
-     *
-     * $object = DB_DataObject::factory('mytable');
-     * $object->get("ID",234);
-     * $object->email="testing@test.com";
-     * if(!$object->update())
-     *   echo "UPDATE FAILED";
-     *
-     * to only update changed items :
-     * $dataobject->get(132);
-     * $original = $dataobject; // clone/copy it..
-     * $dataobject->setFrom($_POST);
-     * if ($dataobject->validate()) {
-     *    $dataobject->update($original);
-     * } // otherwise an error...
-     *
-     * performing global updates:
-     * $object = DB_DataObject::factory('mytable');
-     * $object->status = "dead";
-     * $object->whereAdd('age > 150');
-     * $object->update(DB_DATAOBJECT_WHEREADD_ONLY);
-     *
-     * @param object dataobject (optional) | DB_DATAOBJECT_WHEREADD_ONLY - used to only update changed items.
-     * @access public
-     * @return  int rows affected or false on failure
-     */
-    function update($dataObject = false)
-    {
-        global $_DB_DATAOBJECT;
-        // connect will load the config!
-        $this->_connect();
-        
-        
-        $original_query =  $this->_query;
-        
-        $items =  isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table]) ?   
-            $_DB_DATAOBJECT['INI'][$this->_database][$this->__table] : $this->table();
-        
-        // only apply update against sequence key if it is set?????
-        
-        $seq    = $this->sequenceKey();
-        if ($seq[0] !== false) {
-            $keys = array($seq[0]);
-            if (empty($this->{$keys[0]}) && $dataObject !== true) {
-                $this->raiseError("update: trying to perform an update without 
-                        the key set, and argument to update is not 
-                        DB_DATAOBJECT_WHEREADD_ONLY
-                    ", DB_DATAOBJECT_ERROR_INVALIDARGS);
-                return false;  
-            }
-        } else {
-            $keys = $this->keys();
-        }
-        
-         
-        if (!$items) {
-            $this->raiseError("update:No table definition for {$this->__table}", DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return false;
-        }
-        $datasaved = 1;
-        $settings  = '';
-        $this->_connect();
-        
-        $DB            = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-        $dbtype        = $DB->dsn["phptype"];
-        $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        $options = $_DB_DATAOBJECT['CONFIG'];
-        
-        
-        $ignore_null = !isset($options['disable_null_strings'])
-                    || !is_string($options['disable_null_strings'])
-                    || strtolower($options['disable_null_strings']) !== 'full' ;
-                    
-        
-        foreach($items as $k => $v) {
-            
-            if (!isset($this->$k) && $ignore_null) {
-                continue;
-            }
-            // ignore stuff thats 
-          
-            // dont write things that havent changed..
-            if (($dataObject !== false) && isset($dataObject->$k) && ($dataObject->$k === $this->$k)) {
-                continue;
-            }
-            
-            // - dont write keys to left.!!!
-            if (in_array($k,$keys)) {
-                continue;
-            }
-            
-             // dont insert data into mysql timestamps 
-            // use query() if you really want to do this!!!!
-            if ($v & DB_DATAOBJECT_MYSQLTIMESTAMP) {
-                continue;
-            }
-            
-            
-            if ($settings)  {
-                $settings .= ', ';
-            }
-            
-            $kSql = ($quoteIdentifiers ? $DB->quoteIdentifier($k) : $k);
-            
-            if (is_a($this->$k,'DB_DataObject_Cast')) {
-                $value = $this->$k->toString($v,$DB);
-                if (PEAR::isError($value)) {
-                    $this->raiseError($value->getMessage() ,DB_DATAOBJECT_ERROR_INVALIDARG);
-                    return false;
-                }
-                $settings .= "$kSql = $value ";
-                continue;
-            }
-            
-            // special values ... at least null is handled...
-            if (!($v & DB_DATAOBJECT_NOTNULL) && DB_DataObject::_is_null($this,$k)) {
-                $settings .= "$kSql = NULL ";
-                continue;
-            }
-            // DATE is empty... on a col. that can be null.. 
-            // note: this may be usefull for time as well..
-            if (!$this->$k && 
-                    (($v & DB_DATAOBJECT_DATE) || ($v & DB_DATAOBJECT_TIME)) && 
-                    !($v & DB_DATAOBJECT_NOTNULL)) {
-                    
-                $settings .= "$kSql = NULL ";
-                continue;
-            }
-            
-
-            if ($v & DB_DATAOBJECT_STR) {
-                $settings .= "$kSql = ". $this->_quote((string) (
-                        ($v & DB_DATAOBJECT_BOOL) ? 
-                            // this is thanks to the braindead idea of postgres to 
-                            // use t/f for boolean.
-                            (($this->$k === 'f') ? 0 : (int)(bool) $this->$k) :  
-                            $this->$k
-                    )) . ' ';
-                continue;
-            }
-            if (is_numeric($this->$k)) {
-                $settings .= "$kSql = {$this->$k} ";
-                continue;
-            }
-            // at present we only cast to integers
-            // - V2 may store additional data about float/int
-            $settings .= "$kSql = " . intval($this->$k) . ' ';
-        }
-
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("got keys as ".serialize($keys),3);
-        }
-        if ($dataObject !== true) {
-            $this->_build_condition($items,$keys);
-        } else {
-            // prevent wiping out of data!
-            if (empty($this->_query['condition'])) {
-                 $this->raiseError("update: global table update not available
-                        do \$do->whereAdd('1=1'); if you really want to do that.
-                    ", DB_DATAOBJECT_ERROR_INVALIDARGS);
-                return false;
-            }
-        }
-        
-        
-        
-        //  echo " $settings, $this->condition ";
-        if ($settings && isset($this->_query) && $this->_query['condition']) {
-            
-            $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table);
-        
-            $r = $this->_query("UPDATE  {$table}  SET {$settings} {$this->_query['condition']} ");
-            
-            // restore original query conditions.
-            $this->_query = $original_query;
-            
-            if (PEAR::isError($r)) {
-                $this->raiseError($r);
-                return false;
-            }
-            if ($r < 1) {
-                return 0;
-            }
-
-            $this->_clear_cache();
-            return $r;
-        }
-        // restore original query conditions.
-        $this->_query = $original_query;
-        
-        // if you manually specified a dataobject, and there where no changes - then it's ok..
-        if ($dataObject !== false) {
-            return true;
-        }
-        
-        $this->raiseError(
-            "update: No Data specifed for query $settings , {$this->_query['condition']}", 
-            DB_DATAOBJECT_ERROR_NODATA);
-        return false;
-    }
-
-    /**
-     * Deletes items from table which match current objects variables
-     *
-     * Returns the true on success
-     *
-     * for example
-     *
-     * Designed to be extended
-     *
-     * $object = new mytable();
-     * $object->ID=123;
-     * echo $object->delete(); // builds a conditon
-     *
-     * $object = new mytable();
-     * $object->whereAdd('age > 12');
-     * $object->limit(1);
-     * $object->orderBy('age DESC');
-     * $object->delete(true); // dont use object vars, use the conditions, limit and order.
-     *
-     * @param bool $useWhere (optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then
-     *             we will build the condition only using the whereAdd's.  Default is to
-     *             build the condition only using the object parameters.
-     *
-     * @access public
-     * @return mixed Int (No. of rows affected) on success, false on failure, 0 on no data affected
-     */
-    function delete($useWhere = false)
-    {
-        global $_DB_DATAOBJECT;
-        // connect will load the config!
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-        $quoteIdentifiers  = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        
-        $extra_cond = ' ' . (isset($this->_query['order_by']) ? $this->_query['order_by'] : ''); 
-        
-        if (!$useWhere) {
-
-            $keys = $this->keys();
-            $this->_query = array(); // as it's probably unset!
-            $this->_query['condition'] = ''; // default behaviour not to use where condition
-            $this->_build_condition($this->table(),$keys);
-            // if primary keys are not set then use data from rest of object.
-            if (!$this->_query['condition']) {
-                $this->_build_condition($this->table(),array(),$keys);
-            }
-            $extra_cond = '';
-        } 
-            
-
-        // don't delete without a condition
-        if (($this->_query !== false) && $this->_query['condition']) {
-        
-            $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table);
-            $sql = "DELETE ";
-            // using a joined delete. - with useWhere..
-            $sql .= (!empty($this->_join) && $useWhere) ? 
-                "{$table} FROM {$table} {$this->_join} " : 
-                "FROM {$table} ";
-                
-            $sql .= $this->_query['condition']. $extra_cond;
-            
-            // add limit..
-            
-            if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this->_query['limit_count'])) {
-                
-                if (!isset($_DB_DATAOBJECT['CONFIG']['db_driver']) ||  
-                    ($_DB_DATAOBJECT['CONFIG']['db_driver'] == 'DB')) {
-                    // pear DB 
-                    $sql = $DB->modifyLimitQuery($sql,$this->_query['limit_start'], $this->_query['limit_count']);
-                    
-                } else {
-                    // MDB2
-                    $DB->setLimit( $this->_query['limit_count'],$this->_query['limit_start']);
-                }
-                    
-            }
-            
-            
-            $r = $this->_query($sql);
-            
-            
-            if (PEAR::isError($r)) {
-                $this->raiseError($r);
-                return false;
-            }
-            if ($r < 1) {
-                return 0;
-            }
-            $this->_clear_cache();
-            return $r;
-        } else {
-            $this->raiseError("delete: No condition specifed for query", DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-    }
-
-    /**
-     * fetches a specific row into this object variables
-     *
-     * Not recommended - better to use fetch()
-     *
-     * Returens true on success
-     *
-     * @param  int   $row  row
-     * @access public
-     * @return boolean true on success
-     */
-    function fetchRow($row = null)
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            $this->_loadConfig();
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("{$this->__table} $row of {$this->N}", "fetchrow",3);
-        }
-        if (!$this->__table) {
-            $this->raiseError("fetchrow: No table", DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return false;
-        }
-        if ($row === null) {
-            $this->raiseError("fetchrow: No row specified", DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        if (!$this->N) {
-            $this->raiseError("fetchrow: No results avaiable", DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("{$this->__table} $row of {$this->N}", "fetchrow",3);
-        }
-
-
-        $result = &$_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid];
-        $array  = $result->fetchrow(DB_DATAOBJECT_FETCHMODE_ASSOC,$row);
-        if (!is_array($array)) {
-            $this->raiseError("fetchrow: No results available", DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-
-        foreach($array as $k => $v) {
-            $kk = str_replace(".", "_", $k);
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("$kk = ". $array[$k], "fetchrow LINE", 3);
-            }
-            $this->$kk = $array[$k];
-        }
-
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("{$this->__table} DONE", "fetchrow", 3);
-        }
-        return true;
-    }
-
-    /**
-     * Find the number of results from a simple query
-     *
-     * for example
-     *
-     * $object = new mytable();
-     * $object->name = "fred";
-     * echo $object->count();
-     * echo $object->count(true);  // dont use object vars.
-     * echo $object->count('distinct mycol');   count distinct mycol.
-     * echo $object->count('distinct mycol',true); // dont use object vars.
-     * echo $object->count('distinct');      // count distinct id (eg. the primary key)
-     *
-     *
-     * @param bool|string  (optional)
-     *                  (true|false => see below not on whereAddonly)
-     *                  (string)
-     *                      "DISTINCT" => does a distinct count on the tables 'key' column
-     *                      otherwise  => normally it counts primary keys - you can use 
-     *                                    this to do things like $do->count('distinct mycol');
-     *                  
-     * @param bool      $whereAddOnly (optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then
-     *                  we will build the condition only using the whereAdd's.  Default is to
-     *                  build the condition using the object parameters as well.
-     *                  
-     * @access public
-     * @return int
-     */
-    function count($countWhat = false,$whereAddOnly = false)
-    {
-        global $_DB_DATAOBJECT;
-        
-        if (is_bool($countWhat)) {
-            $whereAddOnly = $countWhat;
-        }
-        
-        $t = clone($this);
-        $items   = $t->table();
-        
-        $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        
-        
-        if (!isset($t->_query)) {
-            $this->raiseError(
-                "You cannot do run count after you have run fetch()", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS);
-            return false;
-        }
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-       
-
-        if (!$whereAddOnly && $items)  {
-            $t->_build_condition($items);
-        }
-        $keys = $this->keys();
-
-        if (empty($keys[0]) && (!is_string($countWhat) || (strtoupper($countWhat) == 'DISTINCT'))) {
-            $this->raiseError(
-                "You cannot do run count without keys - use \$do->count('id'), or use \$do->count('distinct id')';", 
-                DB_DATAOBJECT_ERROR_INVALIDARGS,PEAR_ERROR_DIE);
-            return false;
-            
-        }
-        $table   = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table);
-        $key_col = empty($keys[0]) ? '' : (($quoteIdentifiers ? $DB->quoteIdentifier($keys[0]) : $keys[0]));
-        $as      = ($quoteIdentifiers ? $DB->quoteIdentifier('DATAOBJECT_NUM') : 'DATAOBJECT_NUM');
-        
-        // support distinct on default keys.
-        $countWhat = (strtoupper($countWhat) == 'DISTINCT') ? 
-            "DISTINCT {$table}.{$key_col}" : $countWhat;
-        
-        $countWhat = is_string($countWhat) ? $countWhat : "{$table}.{$key_col}";
-        
-        $r = $t->_query(
-            "SELECT count({$countWhat}) as $as
-                FROM $table {$t->_join} {$t->_query['condition']}");
-        if (PEAR::isError($r)) {
-            return false;
-        }
-         
-        $result  = &$_DB_DATAOBJECT['RESULTS'][$t->_DB_resultid];
-        $l = $result->fetchRow(DB_DATAOBJECT_FETCHMODE_ORDERED);
-        // free the results - essential on oracle.
-        $t->free();
-        
-        return (int) $l[0];
-    }
-
-    /**
-     * sends raw query to database
-     *
-     * Since _query has to be a private 'non overwriteable method', this is a relay
-     *
-     * @param  string  $string  SQL Query
-     * @access public
-     * @return void or DB_Error
-     */
-    function query($string)
-    {
-        return $this->_query($string);
-    }
-
-
-    /**
-     * an escape wrapper around DB->escapeSimple()
-     * can be used when adding manual queries or clauses
-     * eg.
-     * $object->query("select * from xyz where abc like '". $object->escape($_GET['name']) . "'");
-     *
-     * @param  string  $string  value to be escaped 
-     * @param  bool $likeEscape  escapes % and _ as well. - so like queries can be protected.
-     * @access public
-     * @return string
-     */
-    function escape($string, $likeEscape=false)
-    {
-        global $_DB_DATAOBJECT;
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-        // mdb2 uses escape...
-        $dd = empty($_DB_DATAOBJECT['CONFIG']['db_driver']) ? 'DB' : $_DB_DATAOBJECT['CONFIG']['db_driver'];
-        $ret = ($dd == 'DB') ? $DB->escapeSimple($string) : $DB->escape($string);
-        if ($likeEscape) {
-            $ret = str_replace(array('_','%'), array('\_','\%'), $ret);
-        }
-        return $ret;
-        
-    }
-
-    /* ==================================================== */
-    /*        Major Private Vars                            */
-    /* ==================================================== */
-
-    /**
-     * The Database connection dsn (as described in the PEAR DB)
-     * only used really if you are writing a very simple application/test..
-     * try not to use this - it is better stored in configuration files..
-     *
-     * @access  private
-     * @var     string
-     */
-    var $_database_dsn = '';
-
-    /**
-     * The Database connection id (md5 sum of databasedsn)
-     *
-     * @access  private
-     * @var     string
-     */
-    var $_database_dsn_md5 = '';
-
-    /**
-     * The Database name
-     * created in __connection
-     *
-     * @access  private
-     * @var  string
-     */
-    var $_database = '';
-
-    
-    
-    /**
-     * The QUERY rules
-     * This replaces alot of the private variables 
-     * used to build a query, it is unset after find() is run.
-     * 
-     *
-     *
-     * @access  private
-     * @var     array
-     */
-    var $_query = array(
-        'condition'   => '', // the WHERE condition
-        'group_by'    => '', // the GROUP BY condition
-        'order_by'    => '', // the ORDER BY condition
-        'having'      => '', // the HAVING condition
-        'limit_start' => '', // the LIMIT condition
-        'limit_count' => '', // the LIMIT condition
-        'data_select' => '*', // the columns to be SELECTed
-    );
-        
-    
-  
-
-    /**
-     * Database result id (references global $_DB_DataObject[results]
-     *
-     * @access  private
-     * @var     integer
-     */
-    var $_DB_resultid;
-     
-     /**
-     * ResultFields - on the last call to fetch(), resultfields is sent here,
-     * so we can clean up the memory.
-     *
-     * @access  public
-     * @var     array
-     */
-    var $_resultFields = false; 
-
-
-    /* ============================================================== */
-    /*  Table definition layer (started of very private but 'came out'*/
-    /* ============================================================== */
-
-    /**
-     * Autoload or manually load the table definitions
-     *
-     *
-     * usage :
-     * DB_DataObject::databaseStructure(  'databasename',
-     *                                    parse_ini_file('mydb.ini',true), 
-     *                                    parse_ini_file('mydb.link.ini',true)); 
-     *
-     * obviously you dont have to use ini files.. (just return array similar to ini files..)
-     *  
-     * It should append to the table structure array 
-     *
-     *     
-     * @param optional string  name of database to assign / read
-     * @param optional array   structure of database, and keys
-     * @param optional array  table links
-     *
-     * @access public
-     * @return true or PEAR:error on wrong paramenters.. or false if no file exists..
-     *              or the array(tablename => array(column_name=>type)) if called with 1 argument.. (databasename)
-     */
-    function databaseStructure()
-    {
-
-        global $_DB_DATAOBJECT;
-        
-        // Assignment code 
-        
-        if ($args = func_get_args()) {
-        
-            if (count($args) == 1) {
-                
-                // this returns all the tables and their structure..
-                if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                    $this->debug("Loading Generator as databaseStructure called with args",1);
-                }
-                
-                $x = new DB_DataObject;
-                $x->_database = $args[0];
-                $this->_connect();
-                $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-       
-                $tables = $DB->getListOf('tables');
-                class_exists('DB_DataObject_Generator') ? '' : 
-                    require_once 'DB/DataObject/Generator.php';
-                    
-                foreach($tables as $table) {
-                    $y = new DB_DataObject_Generator;
-                    $y->fillTableSchema($x->_database,$table);
-                }
-                return $_DB_DATAOBJECT['INI'][$x->_database];            
-            } else {
-        
-                $_DB_DATAOBJECT['INI'][$args[0]] = isset($_DB_DATAOBJECT['INI'][$args[0]]) ?
-                    $_DB_DATAOBJECT['INI'][$args[0]] + $args[1] : $args[1];
-                
-                if (isset($args[1])) {
-                    $_DB_DATAOBJECT['LINKS'][$args[0]] = isset($_DB_DATAOBJECT['LINKS'][$args[0]]) ?
-                        $_DB_DATAOBJECT['LINKS'][$args[0]] + $args[2] : $args[2];
-                }
-                return true;
-            }
-          
-        }
-        
-        
-        
-        if (!$this->_database) {
-            $this->_connect();
-        }
-        
-        // loaded already?
-        if (!empty($_DB_DATAOBJECT['INI'][$this->_database])) {
-            
-            // database loaded - but this is table is not available..
-            if (
-                    empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table]) 
-                    && !empty($_DB_DATAOBJECT['CONFIG']['proxy'])
-                ) {
-                if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                    $this->debug("Loading Generator to fetch Schema",1);
-                }
-                class_exists('DB_DataObject_Generator') ? '' : 
-                    require_once 'DB/DataObject/Generator.php';
-                    
-                
-                $x = new DB_DataObject_Generator;
-                $x->fillTableSchema($this->_database,$this->__table);
-            }
-            return true;
-        }
-        
-        
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        
-        // if you supply this with arguments, then it will take those
-        // as the database and links array...
-         
-        $schemas = isset($_DB_DATAOBJECT['CONFIG']['schema_location']) ?
-            array("{$_DB_DATAOBJECT['CONFIG']['schema_location']}/{$this->_database}.ini") :
-            array() ;
-                 
-        if (isset($_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"])) {
-            $schemas = is_array($_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"]) ?
-                $_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"] :
-                explode(PATH_SEPARATOR,$_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"]);
-        }
-                    
-         
-        $_DB_DATAOBJECT['INI'][$this->_database] = array();
-        foreach ($schemas as $ini) {
-             if (file_exists($ini) && is_file($ini)) {
-                
-                $_DB_DATAOBJECT['INI'][$this->_database] = array_merge(
-                    $_DB_DATAOBJECT['INI'][$this->_database],
-                    parse_ini_file($ini, true)
-                );
-                    
-                if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { 
-                    if (!is_readable ($ini)) {
-                        $this->debug("ini file is not readable: $ini","databaseStructure",1);
-                    } else {
-                        $this->debug("Loaded ini file: $ini","databaseStructure",1);
-                    }
-                }
-            } else {
-                if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                    $this->debug("Missing ini file: $ini","databaseStructure",1);
-                }
-            }
-             
-        }
-        // now have we loaded the structure.. 
-        
-        if (!empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
-            return true;
-        }
-        // - if not try building it..
-        if (!empty($_DB_DATAOBJECT['CONFIG']['proxy'])) {
-            class_exists('DB_DataObject_Generator') ? '' : 
-                require_once 'DB/DataObject/Generator.php';
-                
-            $x = new DB_DataObject_Generator;
-            $x->fillTableSchema($this->_database,$this->__table);
-            // should this fail!!!???
-            return true;
-        }
-        $this->debug("Cant find database schema: {$this->_database}/{$this->__table} \n".
-                    "in links file data: " . print_r($_DB_DATAOBJECT['INI'],true),"databaseStructure",5);
-        // we have to die here!! - it causes chaos if we dont (including looping forever!)
-        $this->raiseError( "Unable to load schema for database and table (turn debugging up to 5 for full error message)", DB_DATAOBJECT_ERROR_INVALIDARGS, PEAR_ERROR_DIE);
-        return false;
-        
-         
-    }
-
-
-
-
-    /**
-     * Return or assign the name of the current table
-     *
-     *
-     * @param   string optinal table name to set
-     * @access public
-     * @return string The name of the current table
-     */
-    function tableName()
-    {
-        $args = func_get_args();
-        if (count($args)) {
-            $this->__table = $args[0];
-        }
-        return $this->__table;
-    }
-    
-    /**
-     * Return or assign the name of the current database
-     *
-     * @param   string optional database name to set
-     * @access public
-     * @return string The name of the current database
-     */
-    function database()
-    {
-        $args = func_get_args();
-        if (count($args)) {
-            $this->_database = $args[0];
-        }
-        return $this->_database;
-    }
-  
-    /**
-     * get/set an associative array of table columns
-     *
-     * @access public
-     * @param  array key=>type array
-     * @return array (associative)
-     */
-    function table()
-    {
-        
-        // for temporary storage of database fields..
-        // note this is not declared as we dont want to bloat the print_r output
-        $args = func_get_args();
-        if (count($args)) {
-            $this->_database_fields = $args[0];
-        }
-        if (isset($this->_database_fields)) {
-            return $this->_database_fields;
-        }
-        
-        
-        global $_DB_DATAOBJECT;
-        if (!isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $this->_connect();
-        }
-        
-        if (isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
-            return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table];
-        }
-        
-        $this->databaseStructure();
- 
-        
-        $ret = array();
-        if (isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
-            $ret =  $_DB_DATAOBJECT['INI'][$this->_database][$this->__table];
-        }
-        
-        return $ret;
-    }
-
-    /**
-     * get/set an  array of table primary keys
-     *
-     * set usage: $do->keys('id','code');
-     *
-     * This is defined in the table definition if it gets it wrong,
-     * or you do not want to use ini tables, you can override this.
-     * @param  string optional set the key
-     * @param  *   optional  set more keys
-     * @access private
-     * @return array
-     */
-    function keys()
-    {
-        // for temporary storage of database fields..
-        // note this is not declared as we dont want to bloat the print_r output
-        $args = func_get_args();
-        if (count($args)) {
-            $this->_database_keys = $args;
-        }
-        if (isset($this->_database_keys)) {
-            return $this->_database_keys;
-        }
-        
-        global $_DB_DATAOBJECT;
-        if (!isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $this->_connect();
-        }
-        if (isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
-            return array_keys($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"]);
-        }
-        $this->databaseStructure();
-        
-        if (isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
-            return array_keys($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"]);
-        }
-        return array();
-    }
-    /**
-     * get/set an  sequence key
-     *
-     * by default it returns the first key from keys()
-     * set usage: $do->sequenceKey('id',true);
-     *
-     * override this to return array(false,false) if table has no real sequence key.
-     *
-     * @param  string  optional the key sequence/autoinc. key
-     * @param  boolean optional use native increment. default false 
-     * @param  false|string optional native sequence name
-     * @access private
-     * @return array (column,use_native,sequence_name)
-     */
-    function sequenceKey()
-    {
-        global $_DB_DATAOBJECT;
-          
-        // call setting
-        if (!$this->_database) {
-            $this->_connect();
-        }
-        
-        if (!isset($_DB_DATAOBJECT['SEQUENCE'][$this->_database])) {
-            $_DB_DATAOBJECT['SEQUENCE'][$this->_database] = array();
-        }
-
-        
-        $args = func_get_args();
-        if (count($args)) {
-            $args[1] = isset($args[1]) ? $args[1] : false;
-            $args[2] = isset($args[2]) ? $args[2] : false;
-            $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = $args;
-        }
-        if (isset($_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table])) {
-            return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table];
-        }
-        // end call setting (eg. $do->sequenceKeys(a,b,c); )
-        
-       
-        
-        
-        $keys = $this->keys();
-        if (!$keys) {
-            return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] 
-                = array(false,false,false);
-        }
- 
-
-        $table =  isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table]) ?   
-            $_DB_DATAOBJECT['INI'][$this->_database][$this->__table] : $this->table();
-       
-        $dbtype    = $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'];
-        
-        $usekey = $keys[0];
-        
-        
-        
-        $seqname = false;
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['sequence_'.$this->__table])) {
-            $usekey = $_DB_DATAOBJECT['CONFIG']['sequence_'.$this->__table];
-            if (strpos($usekey,':') !== false) {
-                list($usekey,$seqname) = explode(':',$usekey);
-            }
-        }  
-        
-        
-        // if the key is not an integer - then it's not a sequence or native
-        if (empty($table[$usekey]) || !($table[$usekey] & DB_DATAOBJECT_INT)) {
-                return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array(false,false,false);
-        }
-        
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['ignore_sequence_keys'])) {
-            $ignore =  $_DB_DATAOBJECT['CONFIG']['ignore_sequence_keys'];
-            if (is_string($ignore) && (strtoupper($ignore) == 'ALL')) {
-                return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array(false,false,$seqname);
-            }
-            if (is_string($ignore)) {
-                $ignore = $_DB_DATAOBJECT['CONFIG']['ignore_sequence_keys'] = explode(',',$ignore);
-            }
-            if (in_array($this->__table,$ignore)) {
-                return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array(false,false,$seqname);
-            }
-        }
-        
-        
-        $realkeys = $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
-        
-        // if you are using an old ini file - go back to old behaviour...
-        if (is_numeric($realkeys[$usekey])) {
-            $realkeys[$usekey] = 'N';
-        }
-        
-        // multiple unique primary keys without a native sequence...
-        if (($realkeys[$usekey] == 'K') && (count($keys) > 1)) {
-            return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array(false,false,$seqname);
-        }
-        // use native sequence keys...
-        // technically postgres native here...
-        // we need to get the new improved tabledata sorted out first.
-        
-        if (    in_array($dbtype , array('pgsql', 'mysql', 'mysqli', 'mssql', 'ifx')) && 
-                ($table[$usekey] & DB_DATAOBJECT_INT) && 
-                isset($realkeys[$usekey]) && ($realkeys[$usekey] == 'N')
-                ) {
-            return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array($usekey,true,$seqname);
-        }
-        // if not a native autoinc, and we have not assumed all primary keys are sequence
-        if (($realkeys[$usekey] != 'N') && 
-            !empty($_DB_DATAOBJECT['CONFIG']['dont_use_pear_sequences'])) {
-            return array(false,false,false);
-        }
-        // I assume it's going to try and be a nextval DB sequence.. (not native)
-        return $_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] = array($usekey,false,$seqname);
-    }
-    
-    
-    
-    /* =========================================================== */
-    /*  Major Private Methods - the core part!              */
-    /* =========================================================== */
-
- 
-    
-    /**
-     * clear the cache values for this class  - normally done on insert/update etc.
-     *
-     * @access private
-     * @return void
-     */
-    function _clear_cache()
-    {
-        global $_DB_DATAOBJECT;
-        
-        $class = strtolower(get_class($this));
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("Clearing Cache for ".$class,1);
-        }
-        
-        if (!empty($_DB_DATAOBJECT['CACHE'][$class])) {
-            unset($_DB_DATAOBJECT['CACHE'][$class]);
-        }
-    }
-
-    
-    /**
-     * backend wrapper for quoting, as MDB2 and DB do it differently...
-     *
-     * @access private
-     * @return string quoted
-     */
-    
-    function _quote($str) 
-    {
-        global $_DB_DATAOBJECT;
-        return (empty($_DB_DATAOBJECT['CONFIG']['db_driver']) || 
-                ($_DB_DATAOBJECT['CONFIG']['db_driver'] == 'DB'))
-            ? $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->quoteSmart($str)
-            : $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->quote($str);
-    }
-    
-    
-    /**
-     * connects to the database
-     *
-     *
-     * TODO: tidy this up - This has grown to support a number of connection options like
-     *  a) dynamic changing of ini file to change which database to connect to
-     *  b) multi data via the table_{$table} = dsn ini option
-     *  c) session based storage.
-     *
-     * @access private
-     * @return true | PEAR::error
-     */
-    function _connect()
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            $this->_loadConfig();
-        }
-        // Set database driver for reference 
-        $db_driver = empty($_DB_DATAOBJECT['CONFIG']['db_driver']) ? 
-                'DB' : $_DB_DATAOBJECT['CONFIG']['db_driver'];
-        
-        // is it already connected ?    
-        if ($this->_database_dsn_md5 && !empty($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            
-            // connection is an error...
-            if (PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-                return $this->raiseError(
-                        $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->message,
-                        $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->code, PEAR_ERROR_DIE
-                );
-                 
-            }
-
-            if (empty($this->_database)) {
-                $this->_database = $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['database'];
-                $hasGetDatabase = method_exists($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5], 'getDatabase');
-                
-                $this->_database = ($db_driver != 'DB' && $hasGetDatabase)  
-                        ? $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->getDatabase() 
-                        : $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['database'];
-
-                
-                
-                if (($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'] == 'sqlite') 
-                    && is_file($this->_database))  {
-                    $this->_database = basename($this->_database);
-                }
-                if ($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'] == 'ibase')  {
-                    $this->_database = substr(basename($this->_database), 0, -4);
-                }
-                
-            }
-            // theoretically we have a md5, it's listed in connections and it's not an error.
-            // so everything is ok!
-            return true;
-            
-        }
-
-        // it's not currently connected!
-        // try and work out what to use for the dsn !
-
-        $options= &$_DB_DATAOBJECT['CONFIG'];
-        // if the databse dsn dis defined in the object..
-        $dsn = isset($this->_database_dsn) ? $this->_database_dsn : null;
-        
-        if (!$dsn) {
-            if (!$this->_database) {
-                $this->_database = isset($options["table_{$this->__table}"]) ? $options["table_{$this->__table}"] : null;
-            }
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("Checking for database specific ini ('{$this->_database}') : database_{$this->_database} in options","CONNECT");
-            }
-            
-            if ($this->_database && !empty($options["database_{$this->_database}"]))  {
-                $dsn = $options["database_{$this->_database}"];
-            } else if (!empty($options['database'])) {
-                $dsn = $options['database'];
-                  
-            }
-        }
-        
-        // if still no database...
-        if (!$dsn) {
-            return $this->raiseError(
-                "No database name / dsn found anywhere",
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG, PEAR_ERROR_DIE
-            );
-                 
-        }
-        
-        
-        if (is_string($dsn)) {
-            $this->_database_dsn_md5 = md5($dsn);
-        } else {
-            /// support array based dsn's
-            $this->_database_dsn_md5 = md5(serialize($dsn));
-        }
-
-        if (!empty($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                $this->debug("USING CACHED CONNECTION", "CONNECT",3);
-            }
-            
-            
-            
-            if (!$this->_database) {
-
-                $hasGetDatabase = method_exists($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5], 'getDatabase');
-                $this->_database = ($db_driver != 'DB' && $hasGetDatabase)  
-                        ? $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->getDatabase() 
-                        : $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['database'];
-                
-                if (($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'] == 'sqlite') 
-                    && is_file($this->_database)) 
-                {
-                    $this->_database = basename($this->_database);
-                }
-            }
-            return true;
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug("NEW CONNECTION TP DATABASE :" .$this->_database , "CONNECT",3);
-            /* actualy make a connection */
-            $this->debug(print_r($dsn,true) ." {$this->_database_dsn_md5}", "CONNECT",3);
-        }
-        
-        // Note this is verbose deliberatly! 
-        
-        if ($db_driver == 'DB') {
-            
-            /* PEAR DB connect */
-            
-            // this allows the setings of compatibility on DB 
-            $db_options = PEAR::getStaticProperty('DB','options');
-            require_once 'DB.php';
-            if ($db_options) {
-                $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &DB::connect($dsn,$db_options);
-            } else {
-                $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &DB::connect($dsn);
-            }
-            
-        } else {
-            /* assumption is MDB2 */
-            require_once 'MDB2.php';
-            // this allows the setings of compatibility on MDB2 
-            $db_options = PEAR::getStaticProperty('MDB2','options');
-            $db_options = is_array($db_options) ? $db_options : array();
-            $db_options['portability'] = isset($db_options['portability'] )
-                ? $db_options['portability']  : MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE;
-            $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &MDB2::connect($dsn,$db_options);
-            
-        }
-        
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug(serialize($_DB_DATAOBJECT['CONNECTIONS']), "CONNECT",5);
-        }
-        if (PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $this->debug($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->toString(), "CONNECT FAILED",5);
-            return $this->raiseError(
-                    "Connect failed, turn on debugging to 5 see why",
-                        $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->code, PEAR_ERROR_DIE
-            );
-
-        }
-         
-        if (empty($this->_database)) {
-            $hasGetDatabase = method_exists($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5], 'getDatabase');
-            
-            $this->_database = ($db_driver != 'DB' && $hasGetDatabase)  
-                    ? $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->getDatabase() 
-                    : $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['database'];
-
-
-            if (($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'] == 'sqlite') 
-                && is_file($this->_database)) 
-            {
-                $this->_database = basename($this->_database);
-            }
-        }
-        
-        // Oracle need to optimize for portibility - not sure exactly what this does though :)
-        $c = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-         
-        return true;
-    }
-
-    /**
-     * sends query to database - this is the private one that must work 
-     *   - internal functions use this rather than $this->query()
-     *
-     * @param  string  $string
-     * @access private
-     * @return mixed none or PEAR_Error
-     */
-    function _query($string)
-    {
-        global $_DB_DATAOBJECT;
-        $this->_connect();
-        
-
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-
-        $options = &$_DB_DATAOBJECT['CONFIG'];
-        
-        $_DB_driver = empty($_DB_DATAOBJECT['CONFIG']['db_driver']) ? 
-                    'DB':  $_DB_DATAOBJECT['CONFIG']['db_driver'];
-        
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug($string,$log="QUERY");
-            
-        }
-        
-        if (strtoupper($string) == 'BEGIN') {
-            if ($_DB_driver == 'DB') {
-                $DB->autoCommit(false);
-            } else {
-                $DB->beginTransaction();
-            }
-            // db backend adds begin anyway from now on..
-            return true;
-        }
-        if (strtoupper($string) == 'COMMIT') {
-            $res = $DB->commit();
-            if ($_DB_driver == 'DB') {
-                $DB->autoCommit(true);
-            }
-            return $res;
-        }
-        
-        if (strtoupper($string) == 'ROLLBACK') {
-            $DB->rollback();
-            if ($_DB_driver == 'DB') {
-                $DB->autoCommit(true);
-            }
-            return true;
-        }
-        
-
-        if (!empty($options['debug_ignore_updates']) &&
-            (strtolower(substr(trim($string), 0, 6)) != 'select') &&
-            (strtolower(substr(trim($string), 0, 4)) != 'show') &&
-            (strtolower(substr(trim($string), 0, 8)) != 'describe')) {
-
-            $this->debug('Disabling Update as you are in debug mode');
-            return $this->raiseError("Disabling Update as you are in debug mode", null) ;
-
-        }
-        //if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 1) {
-            // this will only work when PEAR:DB supports it.
-            //$this->debug($DB->getAll('explain ' .$string,DB_DATAOBJECT_FETCHMODE_ASSOC), $log="sql",2);
-        //}
-        
-        // some sim
-        $t= explode(' ',microtime());
-        $_DB_DATAOBJECT['QUERYENDTIME'] = $time = $t[0]+$t[1];
-         
-        
-        for ($tries = 0;$tries < 3;$tries++) {
-            
-            if ($_DB_driver == 'DB') {
-                
-                $result = $DB->query($string);
-            } else {
-                switch (strtolower(substr(trim($string),0,6))) {
-                
-                    case 'insert':
-                    case 'update':
-                    case 'delete':
-                        $result = $DB->exec($string);
-                        break;
-                        
-                    default:
-                        $result = $DB->query($string);
-                        break;
-                }
-            }
-            
-            // see if we got a failure.. - try again a few times..
-            if (!is_a($result,'PEAR_Error')) {
-                break;
-            }
-            if ($result->getCode() != -14) {  // *DB_ERROR_NODBSELECTED
-                break; // not a connection error..
-            }
-            sleep(1); // wait before retyring..
-            $DB->connect($DB->dsn);
-        }
-       
-
-        if (is_a($result,'PEAR_Error')) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { 
-                $this->debug($result->toString(), "Query Error",1 );
-            }
-            return $this->raiseError($result);
-        }
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $t= explode(' ',microtime());
-            $_DB_DATAOBJECT['QUERYENDTIME'] = $t[0]+$t[1];
-            $this->debug('QUERY DONE IN  '.($t[0]+$t[1]-$time)." seconds", 'query',1);
-        }
-        switch (strtolower(substr(trim($string),0,6))) {
-            case 'insert':
-            case 'update':
-            case 'delete':
-                if ($_DB_driver == 'DB') {
-                    // pear DB specific
-                    return $DB->affectedRows(); 
-                }
-                return $result;
-        }
-        if (is_object($result)) {
-            // lets hope that copying the result object is OK!
-            
-            $_DB_resultid  = $GLOBALS['_DB_DATAOBJECT']['RESULTSEQ']++;
-            $_DB_DATAOBJECT['RESULTS'][$_DB_resultid] = $result; 
-            $this->_DB_resultid = $_DB_resultid;
-        }
-        $this->N = 0;
-        if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-            $this->debug(serialize($result), 'RESULT',5);
-        }
-        if (method_exists($result, 'numrows')) {
-            if ($_DB_driver == 'DB') {
-                $DB->expectError(DB_ERROR_UNSUPPORTED);
-            } else {
-                $DB->expectError(MDB2_ERROR_UNSUPPORTED);
-            }
-            $this->N = $result->numrows();
-            if (is_a($this->N,'PEAR_Error')) {
-                $this->N = true;
-            }
-            $DB->popExpect();
-        }
-    }
-
-    /**
-     * Builds the WHERE based on the values of of this object
-     *
-     * @param   mixed   $keys
-     * @param   array   $filter (used by update to only uses keys in this filter list).
-     * @param   array   $negative_filter (used by delete to prevent deleting using the keys mentioned..)
-     * @access  private
-     * @return  string
-     */
-    function _build_condition($keys, $filter = array(),$negative_filter=array())
-    {
-        global $_DB_DATAOBJECT;
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-       
-        $quoteIdentifiers  = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        $options = $_DB_DATAOBJECT['CONFIG'];
-        
-        // if we dont have query vars.. - reset them.
-        if ($this->_query === false) {
-            $x = new DB_DataObject;
-            $this->_query= $x->_query;
-        }
-       
-                    
-        foreach($keys as $k => $v) {
-            // index keys is an indexed array
-            /* these filter checks are a bit suspicious..
-                - need to check that update really wants to work this way */
-
-            if ($filter) {
-                if (!in_array($k, $filter)) {
-                    continue;
-                }
-            }
-            if ($negative_filter) {
-                if (in_array($k, $negative_filter)) {
-                    continue;
-                }
-            }
-            if (!isset($this->$k)) {
-                continue;
-            }
-            
-            $kSql = $quoteIdentifiers 
-                ? ( $DB->quoteIdentifier($this->__table) . '.' . $DB->quoteIdentifier($k) )  
-                : "{$this->__table}.{$k}";
-             
-             
-            
-            if (is_a($this->$k,'DB_DataObject_Cast')) {
-                $dbtype = $DB->dsn["phptype"];
-                $value = $this->$k->toString($v,$DB);
-                if (PEAR::isError($value)) {
-                    $this->raiseError($value->getMessage() ,DB_DATAOBJECT_ERROR_INVALIDARG);
-                    return false;
-                }
-                if ((strtolower($value) === 'null') && !($v & DB_DATAOBJECT_NOTNULL)) {
-                    $this->whereAdd(" $kSql IS NULL");
-                    continue;
-                }
-                $this->whereAdd(" $kSql = $value");
-                continue;
-            }
-            
-            if (!($v & DB_DATAOBJECT_NOTNULL) && DB_DataObject::_is_null($this,$k)) {
-                $this->whereAdd(" $kSql  IS NULL");
-                continue;
-            }
-            
-
-            if ($v & DB_DATAOBJECT_STR) {
-                $this->whereAdd(" $kSql  = " . $this->_quote((string) (
-                        ($v & DB_DATAOBJECT_BOOL) ? 
-                            // this is thanks to the braindead idea of postgres to 
-                            // use t/f for boolean.
-                            (($this->$k === 'f') ? 0 : (int)(bool) $this->$k) :  
-                            $this->$k
-                    )) );
-                continue;
-            }
-            if (is_numeric($this->$k)) {
-                $this->whereAdd(" $kSql = {$this->$k}");
-                continue;
-            }
-            /* this is probably an error condition! */
-            $this->whereAdd(" $kSql = ".intval($this->$k));
-        }
-    }
-
-    /**
-     * autoload Class relating to a table
-     * (depreciated - use ::factory)
-     *
-     * @param  string  $table  table
-     * @access private
-     * @return string classname on Success
-     */
-    function staticAutoloadTable($table)
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        $p = isset($_DB_DATAOBJECT['CONFIG']['class_prefix']) ?
-            $_DB_DATAOBJECT['CONFIG']['class_prefix'] : '';
-        $class = $p . preg_replace('/[^A-Z0-9]/i','_',ucfirst($table));
-        
-        $ce = substr(phpversion(),0,1) > 4 ? class_exists($class,false) : class_exists($class);
-        $class = $ce ? $class  : DB_DataObject::_autoloadClass($class);
-        return $class;
-    }
-    
-    
-     /**
-     * classic factory method for loading a table class
-     * usage: $do = DB_DataObject::factory('person')
-     * WARNING - this may emit a include error if the file does not exist..
-     * use @ to silence it (if you are sure it is acceptable)
-     * eg. $do = @DB_DataObject::factory('person')
-     *
-     * table name can bedatabasename/table
-     * - and allow modular dataobjects to be written..
-     * (this also helps proxy creation)
-     *
-     * Experimental Support for Multi-Database factory eg. mydatabase.mytable
-     * 
-     * 
-     * @param  string  $table  tablename (use blank to create a new instance of the same class.)
-     * @access private
-     * @return DataObject|PEAR_Error 
-     */
-    
-    
-
-    function factory($table = '') {
-        global $_DB_DATAOBJECT;
-        
-        
-        // multi-database support.. - experimental.
-        $database = '';
-       
-        if (strpos( $table,'/') !== false ) {
-            list($database,$table) = explode('.',$table, 2);
-          
-        }
-         
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        // no configuration available for database
-        if (!empty($database) && empty($_DB_DATAOBJECT['CONFIG']['database_'.$database])) {
-                return DB_DataObject::raiseError(
-                    "unable to find database_{$database} in Configuration, It is required for factory with database"
-                    , 0, PEAR_ERROR_DIE );   
-       }
-        
-       
-        
-        if ($table === '') {
-            if (is_a($this,'DB_DataObject') && strlen($this->__table)) {
-                $table = $this->__table;
-            } else {
-                return DB_DataObject::raiseError(
-                    "factory did not recieve a table name",
-                    DB_DATAOBJECT_ERROR_INVALIDARGS);
-            }
-        }
-        
-        // does this need multi db support??
-        $cp = isset($_DB_DATAOBJECT['CONFIG']['class_prefix']) ?
-            explode(PATH_SEPARATOR, $_DB_DATAOBJECT['CONFIG']['class_prefix']) : '';
-        
-        // multiprefix support.
-        $tbl = preg_replace('/[^A-Z0-9]/i','_',ucfirst($table));
-        if (is_array($cp)) {
-            $class = array();
-            foreach($cp as $cpr) {
-                $ce = substr(phpversion(),0,1) > 4 ? class_exists($cpr . $tbl,false) : class_exists($cpr . $tbl);
-                if ($ce) {
-                    $class = $cpr . $tbl;
-                    break;
-                }
-                $class[] = $cpr . $tbl;
-            }
-        } else {
-            $class = $tbl;
-            $ce = substr(phpversion(),0,1) > 4 ? class_exists($class,false) : class_exists($class);
-        }
-        
-        
-        $rclass = $ce ? $class  : DB_DataObject::_autoloadClass($class, $table);
-        
-        // proxy = full|light
-        if (!$rclass && isset($_DB_DATAOBJECT['CONFIG']['proxy'])) { 
-        
-            DB_DataObject::debug("FAILED TO Autoload  $database.$table - using proxy.","FACTORY",1);
-        
-        
-            $proxyMethod = 'getProxy'.$_DB_DATAOBJECT['CONFIG']['proxy'];
-            // if you have loaded (some other way) - dont try and load it again..
-            class_exists('DB_DataObject_Generator') ? '' : 
-                    require_once 'DB/DataObject/Generator.php';
-            
-            $d = new DB_DataObject;
-           
-            $d->__table = $table;
-            if (is_a($ret = $d->_connect(), 'PEAR_Error')) {
-                return $ret;
-            }
-            
-            $x = new DB_DataObject_Generator;
-            return $x->$proxyMethod( $d->_database, $table);
-        }
-        
-        if (!$rclass) {
-            return DB_DataObject::raiseError(
-                "factory could not find class " . 
-                (is_array($class) ? implode(PATH_SEPARATOR, $class)  : $class  ). 
-                "from $table",
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-        }
-        $ret = new $rclass;
-        if (!empty($database)) {
-            DB_DataObject::debug("Setting database to $database","FACTORY",1);
-            $ret->database($database);
-        }
-        return $ret;
-    }
-    /**
-     * autoload Class
-     *
-     * @param  string|array  $class  Class
-     * @param  string  $table  Table trying to load.
-     * @access private
-     * @return string classname on Success
-     */
-    function _autoloadClass($class, $table=false)
-    {
-        global $_DB_DATAOBJECT;
-        
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        $class_prefix = empty($_DB_DATAOBJECT['CONFIG']['class_prefix']) ? 
-                '' : $_DB_DATAOBJECT['CONFIG']['class_prefix'];
-                
-        $table   = $table ? $table : substr($class,strlen($class_prefix));
-
-        // only include the file if it exists - and barf badly if it has parse errors :)
-        if (!empty($_DB_DATAOBJECT['CONFIG']['proxy']) || empty($_DB_DATAOBJECT['CONFIG']['class_location'])) {
-            return false;
-        }
-        // support for:
-        // class_location = mydir/ => maps to mydir/Tablename.php
-        // class_location = mydir/myfile_%s.php => maps to mydir/myfile_Tablename
-        // with directory sepr
-        // class_location = mydir/:mydir2/: => tries all of thes locations.
-        $cl = $_DB_DATAOBJECT['CONFIG']['class_location'];
-        
-        
-        switch (true) {
-            case (strpos($cl ,'%s') !== false):
-                $file = sprintf($cl , preg_replace('/[^A-Z0-9]/i','_',ucfirst($table)));
-                break;
-                
-            case (strpos($cl , PATH_SEPARATOR) !== false):
-                $file = array();
-                foreach(explode(PATH_SEPARATOR, $cl ) as $p) {
-                    $file[] =  $p .'/'.preg_replace('/[^A-Z0-9]/i','_',ucfirst($table)).".php";
-                }
-                break;
-            default:
-                $file = $cl .'/'.preg_replace('/[^A-Z0-9]/i','_',ucfirst($table)).".php";
-                break;
-        }
-        
-        $cls = is_array($class) ? $class : array($class);
-        
-        if (is_array($file) || !file_exists($file)) {
-            $found = false;
-            
-            $file = is_array($file) ? $file : array($file);
-            $search = implode(PATH_SEPARATOR, $file);
-            foreach($file as $f) {
-                foreach(explode(PATH_SEPARATOR, '' . PATH_SEPARATOR . ini_get('include_path')) as $p) {
-                    $ff = empty($p) ? $f : "$p/$f";
-
-                    if (file_exists($ff)) {
-                        $file = $ff;
-                        $found = true;
-                        break;
-                    }
-                }
-                if ($found) {
-                    break;
-                }
-            }
-            if (!$found) {
-                DB_DataObject::raiseError(
-                    "autoload:Could not find class " . implode(',', $cls) .
-                    " using class_location value :" . $search .
-                    " using include_path value :" . ini_get('include_path'), 
-                    DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-                return false;
-            }
-        }
-        
-        include_once $file;
-        
-       
-        $ce = false;
-        foreach($cls as $c) {
-            $ce = substr(phpversion(),0,1) > 4 ? class_exists($c,false) : class_exists($c);
-            if ($ce) {
-                $class = $c;
-                break;
-            }
-        }
-        if (!$ce) {
-            DB_DataObject::raiseError(
-                "autoload:Could not autoload " . implode(',', $cls) , 
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return false;
-        }
-        return $class;
-    }
-    
-    
-    
-    /**
-     * Have the links been loaded?
-     * if they have it contains a array of those variables.
-     *
-     * @access  private
-     * @var     boolean | array
-     */
-    var $_link_loaded = false;
-    
-    /**
-    * Get the links associate array  as defined by the links.ini file.
-    * 
-    *
-    * Experimental... - 
-    * Should look a bit like
-    *       [local_col_name] => "related_tablename:related_col_name"
-    * 
-    * 
-    * @return   array|null    
-    *           array       = if there are links defined for this table.
-    *           empty array - if there is a links.ini file, but no links on this table
-    *           null        - if no links.ini exists for this database (hence try auto_links).
-    * @access   public
-    * @see      DB_DataObject::getLinks(), DB_DataObject::getLink()
-    */
-    
-    function links()
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            $this->_loadConfig();
-        }
-        // have to connect.. -> otherwise things break later.
-        $this->_connect();
-        
-        if (isset($_DB_DATAOBJECT['LINKS'][$this->_database][$this->__table])) {
-            return $_DB_DATAOBJECT['LINKS'][$this->_database][$this->__table];
-        }
-        
-        
-        
-        
-        
-        // attempt to load links file here..
-        
-        if (!isset($_DB_DATAOBJECT['LINKS'][$this->_database])) {
-            $schemas = isset($_DB_DATAOBJECT['CONFIG']['schema_location']) ?
-                array("{$_DB_DATAOBJECT['CONFIG']['schema_location']}/{$this->_database}.ini") :
-                array() ;
-                     
-            if (isset($_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"])) {
-                $schemas = is_array($_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"]) ?
-                    $_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"] :
-                    explode(PATH_SEPARATOR,$_DB_DATAOBJECT['CONFIG']["ini_{$this->_database}"]);
-            }
-                        
-             
-            $_DB_DATAOBJECT['LINKS'][$this->_database] = array();
-            foreach ($schemas as $ini) {
-                
-                $links =
-                    isset($_DB_DATAOBJECT['CONFIG']["links_{$this->_database}"]) ?
-                        $_DB_DATAOBJECT['CONFIG']["links_{$this->_database}"] :
-                        str_replace('.ini','.links.ini',$ini);
-        
-                if (file_exists($links) && is_file($links)) {
-                    /* not sure why $links = ... here  - TODO check if that works */
-                    $_DB_DATAOBJECT['LINKS'][$this->_database] = array_merge(
-                        $_DB_DATAOBJECT['LINKS'][$this->_database],
-                        parse_ini_file($links, true)
-                    );
-                        
-                    if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                        $this->debug("Loaded links.ini file: $links","links",1);
-                    }
-                } else {
-                    if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
-                        $this->debug("Missing links.ini file: $links","links",1);
-                    }
-                }
-            }
-        }
-        
-        
-        // if there is no link data at all on the file!
-        // we return null.
-        if (!isset($_DB_DATAOBJECT['LINKS'][$this->_database])) {
-            return null;
-        }
-        
-        if (isset($_DB_DATAOBJECT['LINKS'][$this->_database][$this->__table])) {
-            return $_DB_DATAOBJECT['LINKS'][$this->_database][$this->__table];
-        }
-        
-        return array();
-    }
-    /**
-     * load related objects
-     *
-     * There are two ways to use this, one is to set up a <dbname>.links.ini file
-     * into a static property named <dbname>.links and specifies the table joins,
-     * the other highly dependent on naming columns 'correctly' :)
-     * using colname = xxxxx_yyyyyy
-     * xxxxxx = related table; (yyyyy = user defined..)
-     * looks up table xxxxx, for value id=$this->xxxxx
-     * stores it in $this->_xxxxx_yyyyy
-     * you can change what object vars the links are stored in by 
-     * changeing the format parameter
-     *
-     *
-     * @param  string format (default _%s) where %s is the table name.
-     * @author Tim White <tim@cyface.com>
-     * @access public
-     * @return boolean , true on success
-     */
-    function getLinks($format = '_%s')
-    {
-         
-        // get table will load the options.
-        if ($this->_link_loaded) {
-            return true;
-        }
-        $this->_link_loaded = false;
-        $cols  = $this->table();
-        $links = $this->links();
-         
-        $loaded = array();
-        
-        if ($links) {   
-            foreach($links as $key => $match) {
-                list($table,$link) = explode(':', $match);
-                $k = sprintf($format, str_replace('.', '_', $key));
-                // makes sure that '.' is the end of the key;
-                if ($p = strpos($key,'.')) {
-                      $key = substr($key, 0, $p);
-                }
-                
-                $this->$k = $this->getLink($key, $table, $link);
-                
-                if (is_object($this->$k)) {
-                    $loaded[] = $k; 
-                }
-            }
-            $this->_link_loaded = $loaded;
-            return true;
-        }
-        // this is the autonaming stuff..
-        // it sends the column name down to getLink and lets that sort it out..
-        // if there is a links file then it is not used!
-        // IT IS DEPRECIATED!!!! - USE 
-        if (!is_null($links)) {    
-            return false;
-        }
-        
-        
-        foreach (array_keys($cols) as $key) {
-            if (!($p = strpos($key, '_'))) {
-                continue;
-            }
-            // does the table exist.
-            $k =sprintf($format, $key);
-            $this->$k = $this->getLink($key);
-            if (is_object($this->$k)) {
-                $loaded[] = $k; 
-            }
-        }
-        $this->_link_loaded = $loaded;
-        return true;
-    }
-
-    /**
-     * return name from related object
-     *
-     * There are two ways to use this, one is to set up a <dbname>.links.ini file
-     * into a static property named <dbname>.links and specifies the table joins,
-     * the other is highly dependant on naming columns 'correctly' :)
-     *
-     * NOTE: the naming convention is depreciated!!! - use links.ini
-     *
-     * using colname = xxxxx_yyyyyy
-     * xxxxxx = related table; (yyyyy = user defined..)
-     * looks up table xxxxx, for value id=$this->xxxxx
-     * stores it in $this->_xxxxx_yyyyy
-     *
-     * you can also use $this->getLink('thisColumnName','otherTable','otherTableColumnName')
-     *
-     *
-     * @param string $row    either row or row.xxxxx
-     * @param string $table  name of table to look up value in
-     * @param string $link   name of column in other table to match
-     * @author Tim White <tim@cyface.com>
-     * @access public
-     * @return mixed object on success
-     */
-    function getLink($row, $table = null, $link = false)
-    {
-        
-        
-        // GUESS THE LINKED TABLE.. (if found - recursevly call self)
-        
-        if ($table === null) {
-            $links = $this->links();
-            
-            if (is_array($links)) {
-            
-                if ($links[$row]) {
-                    list($table,$link) = explode(':', $links[$row]);
-                    if ($p = strpos($row,".")) {
-                        $row = substr($row,0,$p);
-                    }
-                    return $this->getLink($row,$table,$link);
-                    
-                } 
-                
-                $this->raiseError(
-                    "getLink: $row is not defined as a link (normally this is ok)", 
-                    DB_DATAOBJECT_ERROR_NODATA);
-                    
-                $r = false;
-                return $r;// technically a possible error condition?
-
-            }  
-            // use the old _ method - this shouldnt happen if called via getLinks()
-            if (!($p = strpos($row, '_'))) {
-                $r = null;
-                return $r; 
-            }
-            $table = substr($row, 0, $p);
-            return $this->getLink($row, $table);
-            
-
-        }
-        
-        
-        
-        if (!isset($this->$row)) {
-            $this->raiseError("getLink: row not set $row", DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-        
-        // check to see if we know anything about this table..
-        
-        $obj = $this->factory($table);
-        
-        if (!is_a($obj,'DB_DataObject')) {
-            $this->raiseError(
-                "getLink:Could not find class for row $row, table $table", 
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return false;
-        }
-        if ($link) {
-            if ($obj->get($link, $this->$row)) {
-                return $obj;
-            } 
-            return  false;
-        }
-        
-        if ($obj->get($this->$row)) {
-            return $obj;
-        }
-        return false;
-        
-    }
-
-    /**
-     * IS THIS SUPPORTED/USED ANYMORE???? 
-     *return a list of options for a linked table
-     *
-     * This is highly dependant on naming columns 'correctly' :)
-     * using colname = xxxxx_yyyyyy
-     * xxxxxx = related table; (yyyyy = user defined..)
-     * looks up table xxxxx, for value id=$this->xxxxx
-     * stores it in $this->_xxxxx_yyyyy
-     *
-     * @access public
-     * @return array of results (empty array on failure)
-     */
-    function &getLinkArray($row, $table = null)
-    {
-        
-        $ret = array();
-        if (!$table) {
-            $links = $this->links();
-            
-            if (is_array($links)) {
-                if (!isset($links[$row])) {
-                    // failed..
-                    return $ret;
-                }
-                list($table,$link) = explode(':',$links[$row]);
-            } else {
-                if (!($p = strpos($row,'_'))) {
-                    return $ret;
-                }
-                $table = substr($row,0,$p);
-            }
-        }
-        
-        $c  = $this->factory($table);
-        
-        if (!is_a($c,'DB_DataObject')) {
-            $this->raiseError(
-                "getLinkArray:Could not find class for row $row, table $table", 
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG
-            );
-            return $ret;
-        }
-
-        // if the user defined method list exists - use it...
-        if (method_exists($c, 'listFind')) {
-            $c->listFind($this->id);
-        } else {
-            $c->find();
-        }
-        while ($c->fetch()) {
-            $ret[] = $c;
-        }
-        return $ret;
-    }
-
-    /**
-     * The JOIN condition
-     *
-     * @access  private
-     * @var     string
-     */
-    var $_join = '';
-
-    /**
-     * joinAdd - adds another dataobject to this, building a joined query.
-     *
-     * example (requires links.ini to be set up correctly)
-     * // get all the images for product 24
-     * $i = new DataObject_Image();
-     * $pi = new DataObjects_Product_image();
-     * $pi->product_id = 24; // set the product id to 24
-     * $i->joinAdd($pi); // add the product_image connectoin
-     * $i->find();
-     * while ($i->fetch()) {
-     *     // do stuff
-     * }
-     * // an example with 2 joins
-     * // get all the images linked with products or productgroups
-     * $i = new DataObject_Image();
-     * $pi = new DataObject_Product_image();
-     * $pgi = new DataObject_Productgroup_image();
-     * $i->joinAdd($pi);
-     * $i->joinAdd($pgi);
-     * $i->find();
-     * while ($i->fetch()) {
-     *     // do stuff
-     * }
-     *
-     *
-     * @param    optional $obj       object |array    the joining object (no value resets the join)
-     *                                          If you use an array here it should be in the format:
-     *                                          array('local_column','remotetable:remote_column');
-     *                                          if remotetable does not have a definition, you should
-     *                                          use @ to hide the include error message..
-     *                                      
-     *
-     * @param    optional $joinType  string | array
-     *                                          'LEFT'|'INNER'|'RIGHT'|'' Inner is default, '' indicates 
-     *                                          just select ... from a,b,c with no join and 
-     *                                          links are added as where items.
-     *                                          
-     *                                          If second Argument is array, it is assumed to be an associative
-     *                                          array with arguments matching below = eg.
-     *                                          'joinType' => 'INNER',
-     *                                          'joinAs' => '...'
-     *                                          'joinCol' => ....
-     *                                          'useWhereAsOn' => false,
-     *
-     * @param    optional $joinAs    string     if you want to select the table as anther name
-     *                                          useful when you want to select multiple columsn
-     *                                          from a secondary table.
-     
-     * @param    optional $joinCol   string     The column on This objects table to match (needed
-     *                                          if this table links to the child object in 
-     *                                          multiple places eg.
-     *                                          user->friend (is a link to another user)
-     *                                          user->mother (is a link to another user..)
-     *
-     *           optional 'useWhereAsOn' bool   default false;
-     *                                          convert the where argments from the object being added
-     *                                          into ON arguments.
-     * 
-     * 
-     * @return   none
-     * @access   public
-     * @author   Stijn de Reede      <sjr@gmx.co.uk>
-     */
-    function joinAdd($obj = false, $joinType='INNER', $joinAs=false, $joinCol=false)
-    {
-        global $_DB_DATAOBJECT;
-        if ($obj === false) {
-            $this->_join = '';
-            return;
-        }
-         
-        //echo '<PRE>'; print_r(func_get_args());
-        $useWhereAsOn = false;
-        // support for 2nd argument as an array of options
-        if (is_array($joinType)) {
-            // new options can now go in here... (dont forget to document them)
-            $useWhereAsOn = !empty($joinType['useWhereAsOn']);
-            $joinCol      = isset($joinType['joinCol'])  ? $joinType['joinCol']  : $joinCol;
-            $joinAs       = isset($joinType['joinAs'])   ? $joinType['joinAs']   : $joinAs;
-            $joinType     = isset($joinType['joinType']) ? $joinType['joinType'] : 'INNER';
-        }
-        // support for array as first argument 
-        // this assumes that you dont have a links.ini for the specified table.
-        // and it doesnt exist as am extended dataobject!! - experimental.
-        
-        $ofield = false; // object field
-        $tfield = false; // this field
-        $toTable = false;
-        if (is_array($obj)) {
-            $tfield = $obj[0];
-            list($toTable,$ofield) = explode(':',$obj[1]);
-            $obj = DB_DataObject::factory($toTable);
-            
-            if (!$obj || is_a($obj,'PEAR_Error')) {
-                $obj = new DB_DataObject;
-                $obj->__table = $toTable;
-            }
-            $obj->_connect();
-            // set the table items to nothing.. - eg. do not try and match
-            // things in the child table...???
-            $items = array();
-        }
-        
-        if (!is_object($obj) || !is_a($obj,'DB_DataObject')) {
-            return $this->raiseError("joinAdd: called without an object", DB_DATAOBJECT_ERROR_NODATA,PEAR_ERROR_DIE);
-        }
-        /*  make sure $this->_database is set.  */
-        $this->_connect();
-        $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-       
-
-        /// CHANGED 26 JUN 2009 - we prefer links from our local table over the remote one.
-        
-        /* otherwise see if there are any links from this table to the obj. */
-        //print_r($this->links());
-        if (($ofield === false) && ($links = $this->links())) {
-            foreach ($links as $k => $v) {
-                /* link contains {this column} = {linked table}:{linked column} */
-                $ar = explode(':', $v);
-                // Feature Request #4266 - Allow joins with multiple keys
-                if (strpos($k, ',') !== false) {
-                    $k = explode(',', $k);
-                }
-                if (strpos($ar[1], ',') !== false) {
-                    $ar[1] = explode(',', $ar[1]);
-                }
-
-                if ($ar[0] == $obj->__table) {
-                    if ($joinCol !== false) {
-                        if ($k == $joinCol) {
-                            $tfield = $k;
-                            $ofield = $ar[1];
-                            break;
-                        } else {
-                            continue;
-                        }
-                    } else {
-                        $tfield = $k;
-                        $ofield = $ar[1];
-                        break;
-                    }
-                }
-            }
-        }
-         /* look up the links for obj table */
-        //print_r($obj->links());
-        if (!$ofield && ($olinks = $obj->links())) {
-            
-            foreach ($olinks as $k => $v) {
-                /* link contains {this column} = {linked table}:{linked column} */
-                $ar = explode(':', $v);
-                
-                // Feature Request #4266 - Allow joins with multiple keys
-                
-                $links_key_array = strpos($k,',');
-                if ($links_key_array !== false) {
-                    $k = explode(',', $k);
-                }
-                
-                $ar_array = strpos($ar[1],',');
-                if ($ar_array !== false) {
-                    $ar[1] = explode(',', $ar[1]);
-                }
-             
-                if ($ar[0] == $this->__table) {
-                    
-                    // you have explictly specified the column
-                    // and the col is listed here..
-                    // not sure if 1:1 table could cause probs here..
-                    
-                    if ($joinCol !== false) {
-                        $this->raiseError( 
-                            "joinAdd: You cannot target a join column in the " .
-                            "'link from' table ({$obj->__table}). " . 
-                            "Either remove the fourth argument to joinAdd() ".
-                            "({$joinCol}), or alter your links.ini file.",
-                            DB_DATAOBJECT_ERROR_NODATA);
-                        return false;
-                    }
-                
-                    $ofield = $k;
-                    $tfield = $ar[1];
-                    break;
-                }
-            }
-        }
-
-        // finally if these two table have column names that match do a join by default on them
-
-        if (($ofield === false) && $joinCol) {
-            $ofield = $joinCol;
-            $tfield = $joinCol;
-
-        }
-        /* did I find a conneciton between them? */
-
-        if ($ofield === false) {
-            $this->raiseError(
-                "joinAdd: {$obj->__table} has no link with {$this->__table}",
-                DB_DATAOBJECT_ERROR_NODATA);
-            return false;
-        }
-        $joinType = strtoupper($joinType);
-        
-        // we default to joining as the same name (this is remvoed later..)
-        
-        if ($joinAs === false) {
-            $joinAs = $obj->__table;
-        }
-        
-        $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']);
-        $options = $_DB_DATAOBJECT['CONFIG'];
-        
-        // not sure  how portable adding database prefixes is..
-        $objTable = $quoteIdentifiers ? 
-                $DB->quoteIdentifier($obj->__table) : 
-                 $obj->__table ;
-                
-        $dbPrefix  = '';
-        if (strlen($obj->_database) && in_array($DB->dsn['phptype'],array('mysql','mysqli'))) {
-            $dbPrefix = ($quoteIdentifiers
-                         ? $DB->quoteIdentifier($obj->_database)
-                         : $obj->_database) . '.';    
-        }
-        
-        // if they are the same, then dont add a prefix...                
-        if ($obj->_database == $this->_database) {
-           $dbPrefix = '';
-        }
-        // as far as we know only mysql supports database prefixes..
-        // prefixing the database name is now the default behaviour,
-        // as it enables joining mutiple columns from multiple databases...
-         
-            // prefix database (quoted if neccessary..)
-        $objTable = $dbPrefix . $objTable;
-       
-        $cond = '';
-
-        // if obj only a dataobject - eg. no extended class has been defined..
-        // it obvioulsy cant work out what child elements might exist...
-        // until we get on the fly querying of tables..
-        // note: we have already checked that it is_a(db_dataobject earlier)
-        if ( strtolower(get_class($obj)) != 'db_dataobject') {
-                 
-            // now add where conditions for anything that is set in the object 
-        
-        
-        
-            $items = $obj->table();
-            // will return an array if no items..
-            
-            // only fail if we where expecting it to work (eg. not joined on a array)
-             
-            if (!$items) {
-                $this->raiseError(
-                    "joinAdd: No table definition for {$obj->__table}", 
-                    DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-                return false;
-            }
-            
-            $ignore_null = !isset($options['disable_null_strings'])
-                    || !is_string($options['disable_null_strings'])
-                    || strtolower($options['disable_null_strings']) !== 'full' ;
-            
-
-            foreach($items as $k => $v) {
-                if (!isset($obj->$k) && $ignore_null) {
-                    continue;
-                }
-                
-                $kSql = ($quoteIdentifiers ? $DB->quoteIdentifier($k) : $k);
-                
-                if (DB_DataObject::_is_null($obj,$k)) {
-                	$obj->whereAdd("{$joinAs}.{$kSql} IS NULL");
-                	continue;
-                }
-                
-                if ($v & DB_DATAOBJECT_STR) {
-                    $obj->whereAdd("{$joinAs}.{$kSql} = " . $this->_quote((string) (
-                            ($v & DB_DATAOBJECT_BOOL) ? 
-                                // this is thanks to the braindead idea of postgres to 
-                                // use t/f for boolean.
-                                (($obj->$k === 'f') ? 0 : (int)(bool) $obj->$k) :  
-                                $obj->$k
-                        )));
-                    continue;
-                }
-                if (is_numeric($obj->$k)) {
-                    $obj->whereAdd("{$joinAs}.{$kSql} = {$obj->$k}");
-                    continue;
-                }
-                            
-                if (is_a($obj->$k,'DB_DataObject_Cast')) {
-                    $value = $obj->$k->toString($v,$DB);
-                    if (PEAR::isError($value)) {
-                        $this->raiseError($value->getMessage() ,DB_DATAOBJECT_ERROR_INVALIDARG);
-                        return false;
-                    } 
-                    $obj->whereAdd("{$joinAs}.{$kSql} = $value");
-                    continue;
-                }
-                
-                
-                /* this is probably an error condition! */
-                $obj->whereAdd("{$joinAs}.{$kSql} = 0");
-            }
-            if ($this->_query === false) {
-                $this->raiseError(
-                    "joinAdd can not be run from a object that has had a query run on it,
-                    clone the object or create a new one and use setFrom()", 
-                    DB_DATAOBJECT_ERROR_INVALIDARGS);
-                return false;
-            }
-        }
-
-        // and finally merge the whereAdd from the child..
-        if ($obj->_query['condition']) {
-            $cond = preg_replace('/^\sWHERE/i','',$obj->_query['condition']);
-
-            if (!$useWhereAsOn) {
-                $this->whereAdd($cond);
-            }
-        }
-    
-        
-        
-        
-        // nested (join of joined objects..)
-        $appendJoin = '';
-        if ($obj->_join) {
-            // postgres allows nested queries, with ()'s
-            // not sure what the results are with other databases..
-            // may be unpredictable..
-            if (in_array($DB->dsn["phptype"],array('pgsql'))) {
-                $objTable = "($objTable {$obj->_join})";
-            } else {
-                $appendJoin = $obj->_join;
-            }
-        }
-        
-  
-        // fix for #2216
-        // add the joinee object's conditions to the ON clause instead of the WHERE clause
-        if ($useWhereAsOn && strlen($cond)) {
-            $appendJoin = ' AND ' . $cond . ' ' . $appendJoin;
-        }
-               
-        
-        
-        $table = $this->__table;
-        
-        if ($quoteIdentifiers) {
-            $joinAs   = $DB->quoteIdentifier($joinAs);
-            $table    = $DB->quoteIdentifier($table);     
-            $ofield   = (is_array($ofield)) ? array_map(array($DB, 'quoteIdentifier'), $ofield) : $DB->quoteIdentifier($ofield);
-            $tfield   = (is_array($tfield)) ? array_map(array($DB, 'quoteIdentifier'), $tfield) : $DB->quoteIdentifier($tfield); 
-        }
-        // add database prefix if they are different databases
-       
-        
-        $fullJoinAs = '';
-        $addJoinAs  = ($quoteIdentifiers ? $DB->quoteIdentifier($obj->__table) : $obj->__table) != $joinAs;
-        if ($addJoinAs) {
-            // join table a AS b - is only supported by a few databases and is probably not needed
-            // , however since it makes the whole Statement alot clearer we are leaving it in
-            // for those databases.
-            $fullJoinAs = in_array($DB->dsn["phptype"],array('mysql','mysqli','pgsql')) ? "AS {$joinAs}" :  $joinAs;
-        } else {
-            // if 
-            $joinAs = $dbPrefix . $joinAs;
-        }
-        
-        
-        switch ($joinType) {
-            case 'INNER':
-            case 'LEFT': 
-            case 'RIGHT': // others??? .. cross, left outer, right outer, natural..?
-                
-                // Feature Request #4266 - Allow joins with multiple keys
-                $jadd = "\n {$joinType} JOIN {$objTable} {$fullJoinAs}";
-                //$this->_join .= "\n {$joinType} JOIN {$objTable} {$fullJoinAs}";
-                if (is_array($ofield)) {
-                	$key_count = count($ofield);
-                    for($i = 0; $i < $key_count; $i++) {
-                    	if ($i == 0) {
-                    		$jadd .= " ON ({$joinAs}.{$ofield[$i]}={$table}.{$tfield[$i]}) ";
-                    	}
-                    	else {
-                    		$jadd .= " AND {$joinAs}.{$ofield[$i]}={$table}.{$tfield[$i]} ";
-                    	}
-                    }
-                    $jadd .= ' ' . $appendJoin . ' ';
-                } else {
-	                $jadd .= " ON ({$joinAs}.{$ofield}={$table}.{$tfield}) {$appendJoin} ";
-                }
-                // jadd avaliable for debugging join build.
-                //echo $jadd ."\n";
-                $this->_join .= $jadd;
-                break;
-                
-            case '': // this is just a standard multitable select..
-                $this->_join .= "\n , {$objTable} {$fullJoinAs} {$appendJoin}";
-                $this->whereAdd("{$joinAs}.{$ofield}={$table}.{$tfield}");
-        }
-         
-         
-        return true;
-
-    }
-
-    /**
-     * Copies items that are in the table definitions from an
-     * array or object into the current object
-     * will not override key values.
-     *
-     *
-     * @param    array | object  $from
-     * @param    string  $format eg. map xxxx_name to $object->name using 'xxxx_%s' (defaults to %s - eg. name -> $object->name
-     * @param    boolean  $skipEmpty (dont assign empty values if a column is empty (eg. '' / 0 etc...)
-     * @access   public
-     * @return   true on success or array of key=>setValue error message
-     */
-    function setFrom($from, $format = '%s', $skipEmpty=false)
-    {
-        global $_DB_DATAOBJECT;
-        $keys  = $this->keys();
-        $items = $this->table();
-        if (!$items) {
-            $this->raiseError(
-                "setFrom:Could not find table definition for {$this->__table}", 
-                DB_DATAOBJECT_ERROR_INVALIDCONFIG);
-            return;
-        }
-        $overload_return = array();
-        foreach (array_keys($items) as $k) {
-            if (in_array($k,$keys)) {
-                continue; // dont overwrite keys
-            }
-            if (!$k) {
-                continue; // ignore empty keys!!! what
-            }
-            if (is_object($from) && isset($from->{sprintf($format,$k)})) {
-                $kk = (strtolower($k) == 'from') ? '_from' : $k;
-                if (method_exists($this,'set'.$kk)) {
-                    $ret = $this->{'set'.$kk}($from->{sprintf($format,$k)});
-                    if (is_string($ret)) {
-                        $overload_return[$k] = $ret;
-                    }
-                    continue;
-                }
-                $this->$k = $from->{sprintf($format,$k)};
-                continue;
-            }
-            
-            if (is_object($from)) {
-                continue;
-            }
-            
-            if (empty($from[sprintf($format,$k)]) && $skipEmpty) {
-                continue;
-            }
-            
-            if (!isset($from[sprintf($format,$k)]) && !DB_DataObject::_is_null($from, sprintf($format,$k))) {
-                continue;
-            }
-           
-            $kk = (strtolower($k) == 'from') ? '_from' : $k;
-            if (method_exists($this,'set'. $kk)) {
-                $ret =  $this->{'set'.$kk}($from[sprintf($format,$k)]);
-                if (is_string($ret)) {
-                    $overload_return[$k] = $ret;
-                }
-                continue;
-            }
-            if (is_object($from[sprintf($format,$k)])) {
-                continue;
-            }
-            if (is_array($from[sprintf($format,$k)])) {
-                continue;
-            }
-            $ret = $this->fromValue($k,$from[sprintf($format,$k)]);
-            if ($ret !== true)  {
-                $overload_return[$k] = 'Not A Valid Value';
-            }
-            //$this->$k = $from[sprintf($format,$k)];
-        }
-        if ($overload_return) {
-            return $overload_return;
-        }
-        return true;
-    }
-
-    /**
-     * Returns an associative array from the current data
-     * (kind of oblivates the idea behind DataObjects, but
-     * is usefull if you use it with things like QuickForms.
-     *
-     * you can use the format to return things like user[key]
-     * by sending it $object->toArray('user[%s]')
-     *
-     * will also return links converted to arrays.
-     *
-     * @param   string  sprintf format for array
-     * @param   bool    empty only return elemnts that have a value set.
-     *
-     * @access   public
-     * @return   array of key => value for row
-     */
-
-    function toArray($format = '%s', $hideEmpty = false) 
-    {
-        global $_DB_DATAOBJECT;
-        $ret = array();
-        $rf = ($this->_resultFields !== false) ? $this->_resultFields : 
-                (isset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid]) ? $_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid] : false);
-        $ar = ($rf !== false) ?
-            array_merge($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid],$this->table()) :
-            $this->table();
-
-        foreach($ar as $k=>$v) {
-             
-            if (!isset($this->$k)) {
-                if (!$hideEmpty) {
-                    $ret[sprintf($format,$k)] = '';
-                }
-                continue;
-            }
-            // call the overloaded getXXXX() method. - except getLink and getLinks
-            if (method_exists($this,'get'.$k) && !in_array(strtolower($k),array('links','link'))) {
-                $ret[sprintf($format,$k)] = $this->{'get'.$k}();
-                continue;
-            }
-            // should this call toValue() ???
-            $ret[sprintf($format,$k)] = $this->$k;
-        }
-        if (!$this->_link_loaded) {
-            return $ret;
-        }
-        foreach($this->_link_loaded as $k) {
-            $ret[sprintf($format,$k)] = $this->$k->toArray();
-        
-        }
-        
-        return $ret;
-    }
-
-    /**
-     * validate the values of the object (usually prior to inserting/updating..)
-     *
-     * Note: This was always intended as a simple validation routine.
-     * It lacks understanding of field length, whether you are inserting or updating (and hence null key values)
-     *
-     * This should be moved to another class: DB_DataObject_Validate 
-     *      FEEL FREE TO SEND ME YOUR VERSION FOR CONSIDERATION!!!
-     *
-     * Usage:
-     * if (is_array($ret = $obj->validate())) { ... there are problems with the data ... }
-     *
-     * Logic:
-     *   - defaults to only testing strings/numbers if numbers or strings are the correct type and null values are correct
-     *   - validate Column methods : "validate{ROWNAME}()"  are called if they are defined.
-     *            These methods should return 
-     *                  true = everything ok
-     *                  false|object = something is wrong!
-     * 
-     *   - This method loads and uses the PEAR Validate Class.
-     *
-     *
-     * @access  public
-     * @return  array of validation results (where key=>value, value=false|object if it failed) or true (if they all succeeded)
-     */
-    function validate()
-    {
-        global $_DB_DATAOBJECT;
-        require_once 'Validate.php';
-        $table = $this->table();
-        $ret   = array();
-        $seq   = $this->sequenceKey();
-        $options = $_DB_DATAOBJECT['CONFIG'];
-        foreach($table as $key => $val) {
-            
-            
-            // call user defined validation always...
-            $method = "Validate" . ucfirst($key);
-            if (method_exists($this, $method)) {
-                $ret[$key] = $this->$method();
-                continue;
-            }
-            
-            // if not null - and it's not set.......
-            
-            if ($val & DB_DATAOBJECT_NOTNULL && DB_DataObject::_is_null($this, $key)) {
-                // dont check empty sequence key values..
-                if (($key == $seq[0]) && ($seq[1] == true)) {
-                    continue;
-                }
-                $ret[$key] = false;
-                continue;
-            }
-            
-            
-             if (DB_DataObject::_is_null($this, $key)) {
-                if ($val & DB_DATAOBJECT_NOTNULL) {
-                    $this->debug("'null' field used for '$key', but it is defined as NOT NULL", 'VALIDATION', 4);
-                    $ret[$key] = false;
-                    continue;
-                }
-                continue;
-            }
-
-            // ignore things that are not set. ?
-           
-            if (!isset($this->$key)) {
-                continue;
-            }
-            
-            // if the string is empty.. assume it is ok..
-            if (!is_object($this->$key) && !is_array($this->$key) && !strlen((string) $this->$key)) {
-                continue;
-            }
-            
-            // dont try and validate cast objects - assume they are problably ok..
-            if (is_object($this->$key) && is_a($this->$key,'DB_DataObject_Cast')) {
-                continue;
-            }
-            // at this point if you have set something to an object, and it's not expected
-            // the Validate will probably break!!... - rightly so! (your design is broken, 
-            // so issuing a runtime error like PEAR_Error is probably not appropriate..
-            
-            switch (true) {
-                // todo: date time.....
-                case  ($val & DB_DATAOBJECT_STR):
-                    $ret[$key] = Validate::string($this->$key, VALIDATE_PUNCTUATION . VALIDATE_NAME);
-                    continue;
-                case  ($val & DB_DATAOBJECT_INT):
-                    $ret[$key] = Validate::number($this->$key, array('decimal'=>'.'));
-                    continue;
-            }
-        }
-        // if any of the results are false or an object (eg. PEAR_Error).. then return the array..
-        foreach ($ret as $key => $val) {
-            if ($val !== true) {
-                return $ret;
-            }
-        }
-        return true; // everything is OK.
-    }
-
-    /**
-     * Gets the DB object related to an object - so you can use funky peardb stuf with it :)
-     *
-     * @access public
-     * @return object The DB connection
-     */
-    function &getDatabaseConnection()
-    {
-        global $_DB_DATAOBJECT;
-
-        if (($e = $this->_connect()) !== true) {
-            return $e;
-        }
-        if (!isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $r = false;
-            return $r;
-        }
-        return $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
-    }
- 
- 
-    /**
-     * Gets the DB result object related to the objects active query
-     *  - so you can use funky pear stuff with it - like pager for example.. :)
-     *
-     * @access public
-     * @return object The DB result object
-     */
-     
-    function &getDatabaseResult()
-    {
-        global $_DB_DATAOBJECT;
-        $this->_connect();
-        if (!isset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid])) {
-            $r = false;
-            return $r;
-        }
-        return $_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid];
-    }
-
-    /**
-     * Overload Extension support
-     *  - enables setCOLNAME/getCOLNAME
-     *  if you define a set/get method for the item it will be called.
-     * otherwise it will just return/set the value.
-     * NOTE this currently means that a few Names are NO-NO's 
-     * eg. links,link,linksarray, from, Databaseconnection,databaseresult
-     *
-     * note 
-     *  - set is automatically called by setFrom.
-     *   - get is automatically called by toArray()
-     *  
-     * setters return true on success. = strings on failure
-     * getters return the value!
-     *
-     * this fires off trigger_error - if any problems.. pear_error, 
-     * has problems with 4.3.2RC2 here
-     *
-     * @access public
-     * @return true?
-     * @see overload
-     */
-
-    
-    function _call($method,$params,&$return) {
-        
-        //$this->debug("ATTEMPTING OVERLOAD? $method");
-        // ignore constructors : - mm
-        if (strtolower($method) == strtolower(get_class($this))) {
-            return true;
-        }
-        $type = strtolower(substr($method,0,3));
-        $class = get_class($this);
-        if (($type != 'set') && ($type != 'get')) {
-            return false;
-        }
-         
-        
-        
-        // deal with naming conflick of setFrom = this is messy ATM!
-        
-        if (strtolower($method) == 'set_from') {
-            $return = $this->toValue('from',isset($params[0]) ? $params[0] : null);
-            return  true;
-        }
-        
-        $element = substr($method,3);
-        
-        // dont you just love php's case insensitivity!!!!
-        
-        $array =  array_keys(get_class_vars($class));
-        /* php5 version which segfaults on 5.0.3 */
-        if (class_exists('ReflectionClass')) {
-            $reflection = new ReflectionClass($class);
-            $array = array_keys($reflection->getdefaultProperties());
-        }
-        
-        if (!in_array($element,$array)) {
-            // munge case
-            foreach($array as $k) {
-                $case[strtolower($k)] = $k;
-            }
-            if ((substr(phpversion(),0,1) == 5) && isset($case[strtolower($element)])) {
-                trigger_error("PHP5 set/get calls should match the case of the variable",E_USER_WARNING);
-                $element = strtolower($element);
-            }
-            
-            // does it really exist?
-            if (!isset($case[$element])) {
-                return false;            
-            }
-            // use the mundged case
-            $element = $case[$element]; // real case !
-        }
-        
-        
-        if ($type == 'get') {
-            $return = $this->toValue($element,isset($params[0]) ? $params[0] : null);
-            return true;
-        }
-        
-        
-        $return = $this->fromValue($element, $params[0]);
-         
-        return true;
-            
-          
-    }
-        
-    
-    /**
-    * standard set* implementation.
-    *
-    * takes data and uses it to set dates/strings etc.
-    * normally called from __call..  
-    *
-    * Current supports
-    *   date      = using (standard time format, or unixtimestamp).... so you could create a method :
-    *               function setLastread($string) { $this->fromValue('lastread',strtotime($string)); }
-    *
-    *   time      = using strtotime 
-    *   datetime  = using  same as date - accepts iso standard or unixtimestamp.
-    *   string    = typecast only..
-    * 
-    * TODO: add formater:: eg. d/m/Y for date! ???
-    *
-    * @param   string       column of database
-    * @param   mixed        value to assign
-    *
-    * @return   true| false     (False on error)
-    * @access   public 
-    * @see      DB_DataObject::_call
-    */
-  
-    
-    function fromValue($col,$value) 
-    {
-        global $_DB_DATAOBJECT;
-        $options = $_DB_DATAOBJECT['CONFIG'];
-        $cols = $this->table();
-        // dont know anything about this col..
-        if (!isset($cols[$col])) {
-            $this->$col = $value;
-            return true;
-        }
-        //echo "FROM VALUE $col, {$cols[$col]}, $value\n";
-        switch (true) {
-            // set to null and column is can be null...
-            case ((!($cols[$col] & DB_DATAOBJECT_NOTNULL)) && DB_DataObject::_is_null($value, false)):
-            case (is_object($value) && is_a($value,'DB_DataObject_Cast')): 
-                $this->$col = $value;
-                return true;
-                
-            // fail on setting null on a not null field..
-            case (($cols[$col] & DB_DATAOBJECT_NOTNULL) && DB_DataObject::_is_null($value,false)):
-
-                return false;
-        
-            case (($cols[$col] & DB_DATAOBJECT_DATE) &&  ($cols[$col] & DB_DATAOBJECT_TIME)):
-                // empty values get set to '' (which is inserted/updated as NULl
-                if (!$value) {
-                    $this->$col = '';
-                }
-            
-                if (is_numeric($value)) {
-                    $this->$col = date('Y-m-d H:i:s', $value);
-                    return true;
-                }
-              
-                // eak... - no way to validate date time otherwise...
-                $this->$col = (string) $value;
-                return true;
-            
-            case ($cols[$col] & DB_DATAOBJECT_DATE):
-                // empty values get set to '' (which is inserted/updated as NULl
-                 
-                if (!$value) {
-                    $this->$col = '';
-                    return true; 
-                }
-            
-                if (is_numeric($value)) {
-                    $this->$col = date('Y-m-d',$value);
-                    return true;
-                }
-                 
-                // try date!!!!
-                require_once 'Date.php';
-                $x = new Date($value);
-                $this->$col = $x->format("%Y-%m-%d");
-                return true;
-            
-            case ($cols[$col] & DB_DATAOBJECT_TIME):
-                // empty values get set to '' (which is inserted/updated as NULl
-                if (!$value) {
-                    $this->$col = '';
-                }
-            
-                $guess = strtotime($value);
-                if ($guess != -1) {
-                     $this->$col = date('H:i:s', $guess);
-                    return $return = true;
-                }
-                // otherwise an error in type...
-                return false;
-            
-            case ($cols[$col] & DB_DATAOBJECT_STR):
-                
-                $this->$col = (string) $value;
-                return true;
-                
-            // todo : floats numerics and ints...
-            default:
-                $this->$col = $value;
-                return true;
-        }
-    
-    
-    
-    }
-     /**
-    * standard get* implementation.
-    *
-    *  with formaters..
-    * supported formaters:  
-    *   date/time : %d/%m/%Y (eg. php strftime) or pear::Date 
-    *   numbers   : %02d (eg. sprintf)
-    *  NOTE you will get unexpected results with times like 0000-00-00 !!!
-    *
-    *
-    * 
-    * @param   string       column of database
-    * @param   format       foramt
-    *
-    * @return   true     Description
-    * @access   public 
-    * @see      DB_DataObject::_call(),strftime(),Date::format()
-    */
-    function toValue($col,$format = null) 
-    {
-        if (is_null($format)) {
-            return $this->$col;
-        }
-        $cols = $this->table();
-        switch (true) {
-            case (($cols[$col] & DB_DATAOBJECT_DATE) &&  ($cols[$col] & DB_DATAOBJECT_TIME)):
-                if (!$this->$col) {
-                    return '';
-                }
-                $guess = strtotime($this->$col);
-                if ($guess != -1) {
-                    return strftime($format, $guess);
-                }
-                // eak... - no way to validate date time otherwise...
-                return $this->$col;
-            case ($cols[$col] & DB_DATAOBJECT_DATE):
-                if (!$this->$col) {
-                    return '';
-                } 
-                $guess = strtotime($this->$col);
-                if ($guess != -1) {
-                    return strftime($format,$guess);
-                }
-                // try date!!!!
-                require_once 'Date.php';
-                $x = new Date($this->$col);
-                return $x->format($format);
-                
-            case ($cols[$col] & DB_DATAOBJECT_TIME):
-                if (!$this->$col) {
-                    return '';
-                }
-                $guess = strtotime($this->$col);
-                if ($guess > -1) {
-                    return strftime($format, $guess);
-                }
-                // otherwise an error in type...
-                return $this->$col;
-                
-            case ($cols[$col] &  DB_DATAOBJECT_MYSQLTIMESTAMP):
-                if (!$this->$col) {
-                    return '';
-                }
-                require_once 'Date.php';
-                
-                $x = new Date($this->$col);
-                
-                return $x->format($format);
-            
-             
-            case ($cols[$col] &  DB_DATAOBJECT_BOOL):
-                
-                if ($cols[$col] &  DB_DATAOBJECT_STR) {
-                    // it's a 't'/'f' !
-                    return ($this->$col === 't');
-                }
-                return (bool) $this->$col;
-            
-               
-            default:
-                return sprintf($format,$this->col);
-        }
-            
-
-    }
-    
-    
-    /* ----------------------- Debugger ------------------ */
-
-    /**
-     * Debugger. - use this in your extended classes to output debugging information.
-     *
-     * Uses DB_DataObject::DebugLevel(x) to turn it on
-     *
-     * @param    string $message - message to output
-     * @param    string $logtype - bold at start
-     * @param    string $level   - output level
-     * @access   public
-     * @return   none
-     */
-    function debug($message, $logtype = 0, $level = 1)
-    {
-        global $_DB_DATAOBJECT;
-
-        if (empty($_DB_DATAOBJECT['CONFIG']['debug'])  || 
-            (is_numeric($_DB_DATAOBJECT['CONFIG']['debug']) &&  $_DB_DATAOBJECT['CONFIG']['debug'] < $level)) {
-            return;
-        }
-        // this is a bit flaky due to php's wonderfull class passing around crap..
-        // but it's about as good as it gets..
-        $class = (isset($this) && is_a($this,'DB_DataObject')) ? get_class($this) : 'DB_DataObject';
-        
-        if (!is_string($message)) {
-            $message = print_r($message,true);
-        }
-        if (!is_numeric( $_DB_DATAOBJECT['CONFIG']['debug']) && is_callable( $_DB_DATAOBJECT['CONFIG']['debug'])) {
-            return call_user_func($_DB_DATAOBJECT['CONFIG']['debug'], $class, $message, $logtype, $level);
-        }
-        
-        if (!ini_get('html_errors')) {
-            echo "$class   : $logtype       : $message\n";
-            flush();
-            return;
-        }
-        if (!is_string($message)) {
-            $message = print_r($message,true);
-        }
-        $colorize = ($logtype == 'ERROR') ? '<font color="red">' : '<font>';
-        echo "<code>{$colorize}<B>$class: $logtype:</B> ". nl2br(htmlspecialchars($message)) . "</font></code><BR>\n";
-    }
-
-    /**
-     * sets and returns debug level
-     * eg. DB_DataObject::debugLevel(4);
-     *
-     * @param   int     $v  level
-     * @access  public
-     * @return  none
-     */
-    function debugLevel($v = null)
-    {
-        global $_DB_DATAOBJECT;
-        if (empty($_DB_DATAOBJECT['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-        if ($v !== null) {
-            $r = isset($_DB_DATAOBJECT['CONFIG']['debug']) ? $_DB_DATAOBJECT['CONFIG']['debug'] : 0;
-            $_DB_DATAOBJECT['CONFIG']['debug']  = $v;
-            return $r;
-        }
-        return isset($_DB_DATAOBJECT['CONFIG']['debug']) ? $_DB_DATAOBJECT['CONFIG']['debug'] : 0;
-    }
-
-    /**
-     * Last Error that has occured
-     * - use $this->_lastError or
-     * $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
-     *
-     * @access  public
-     * @var     object PEAR_Error (or false)
-     */
-    var $_lastError = false;
-
-    /**
-     * Default error handling is to create a pear error, but never return it.
-     * if you need to handle errors you should look at setting the PEAR_Error callback
-     * this is due to the fact it would wreck havoc on the internal methods!
-     *
-     * @param  int $message    message
-     * @param  int $type       type
-     * @param  int $behaviour  behaviour (die or continue!);
-     * @access public
-     * @return error object
-     */
-    function raiseError($message, $type = null, $behaviour = null)
-    {
-        global $_DB_DATAOBJECT;
-        
-        if ($behaviour == PEAR_ERROR_DIE && !empty($_DB_DATAOBJECT['CONFIG']['dont_die'])) {
-            $behaviour = null;
-        }
-        $error = &PEAR::getStaticProperty('DB_DataObject','lastError');
-        
-        // this will never work totally with PHP's object model.
-        // as this is passed on static calls (like staticGet in our case)
-
-        if (isset($this) && is_object($this) && is_subclass_of($this,'db_dataobject')) {
-            $this->_lastError = $error;
-        }
-
-        $_DB_DATAOBJECT['LASTERROR'] = $error;
-
-        // no checks for production here?....... - we log  errors before we throw them.
-        DB_DataObject::debug($message,'ERROR',1);
-        
-        
-        if (PEAR::isError($message)) {
-            $error = $message;
-        } else {
-            require_once 'DB/DataObject/Error.php';
-            $error = PEAR::raiseError($message, $type, $behaviour,
-                            $opts=null, $userinfo=null, 'DB_DataObject_Error'
-                        );
-        }
-   
-        return $error;
-    }
-
-    /**
-     * Define the global $_DB_DATAOBJECT['CONFIG'] as an alias to  PEAR::getStaticProperty('DB_DataObject','options');
-     *
-     * After Profiling DB_DataObject, I discoved that the debug calls where taking
-     * considerable time (well 0.1 ms), so this should stop those calls happening. as
-     * all calls to debug are wrapped with direct variable queries rather than actually calling the funciton
-     * THIS STILL NEEDS FURTHER INVESTIGATION
-     *
-     * @access   public
-     * @return   object an error object
-     */
-    function _loadConfig()
-    {
-        global $_DB_DATAOBJECT;
-
-        $_DB_DATAOBJECT['CONFIG'] = &PEAR::getStaticProperty('DB_DataObject','options');
-
-
-    }
-     /**
-     * Free global arrays associated with this object.
-     *
-     *
-     * @access   public
-     * @return   none
-     */
-    function free() 
-    {
-        global $_DB_DATAOBJECT;
-          
-        if (isset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid])) {
-            unset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid]);
-        }
-        if (isset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid])) {     
-            unset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid]);
-        }
-        // clear the staticGet cache as well.
-        $this->_clear_cache();
-        // this is a huge bug in DB!
-        if (isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
-            $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->num_rows = array();
-        }
-
-        if (is_array($this->_link_loaded)) {
-            foreach ($this->_link_loaded as $do) {
-                $do->free();
-            }
-        }
-
-        
-    }
-    /**
-    * Evaluate whether or not a value is set to null, taking the 'disable_null_strings' option into account.
-    * If the value is a string set to "null" and the "disable_null_strings" option is not set to 
-    * true, then the value is considered to be null.
-    * If the value is actually a PHP NULL value, and "disable_null_strings" has been set to 
-    * the value "full", then it will also be considered null. - this can not differenticate between not set
-    * 
-    * 
-    * @param  object|array $obj_or_ar 
-    * @param  string|false $prop prperty
-    
-    * @access private
-    * @return bool  object
-    */
-    function _is_null($obj_or_ar , $prop) 
-    {
-    	global $_DB_DATAOBJECT;
-    	
-        
-        $isset = $prop === false ? isset($obj_or_ar) : 
-            (is_array($obj_or_ar) ? isset($obj_or_ar[$prop]) : isset($obj_or_ar->$prop));
-        
-        $value = $isset ? 
-            ($prop === false ? $obj_or_ar : 
-                (is_array($obj_or_ar) ? $obj_or_ar[$prop] : $obj_or_ar->$prop))
-            : null;
-        
-        
-        
-    	$options = $_DB_DATAOBJECT['CONFIG'];
-    	
-        $null_strings = !isset($options['disable_null_strings'])
-                    || $options['disable_null_strings'] === false;
-                    
-        $crazy_null = isset($options['disable_null_strings'])
-                && is_string($options['disable_null_strings'])
-                && strtolower($options['disable_null_strings'] === 'full');
-        
-        if ( $null_strings && $isset  && is_string($value)  && (strtolower($value) === 'null') ) {
-            return true;
-        }
-        
-        if ( $crazy_null && !$isset )  {
-        	return true;
-        }
-        
-        return false;
-        
-    	
-    }
-    
-    /* ---- LEGACY BC METHODS - NOT DOCUMENTED - See Documentation on New Methods. ---*/
-    
-    function _get_table() { return $this->table(); }
-    function _get_keys()  { return $this->keys();  }
-    
-    
-    
-    
-}
-// technially 4.3.2RC1 was broken!!
-// looks like 4.3.3 may have problems too....
-if (!defined('DB_DATAOBJECT_NO_OVERLOAD')) {
-
-    if ((phpversion() != '4.3.2-RC1') && (version_compare( phpversion(), "4.3.1") > 0)) {
-        if (version_compare( phpversion(), "5") < 0) {
-           overload('DB_DataObject');
-        } 
-        $GLOBALS['_DB_DATAOBJECT']['OVERLOADED'] = true;
-    }
-}
-
-
diff --git a/lib/php/DB/DataObject/Cast.php b/lib/php/DB/DataObject/Cast.php
deleted file mode 100644
index 2049beb581f54357a3463724e42e9ab7cfd24ccc..0000000000000000000000000000000000000000
--- a/lib/php/DB/DataObject/Cast.php
+++ /dev/null
@@ -1,549 +0,0 @@
-<?php
-/**
- * Prototype Castable Object.. for DataObject queries
- *
- * Storage for Data that may be cast into a variety of formats.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB_DataObject
- * @author     Alan Knowles <alan@akbkhome.com>
- * @copyright  1997-2008 The PHP Group
- * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version    CVS: $Id: Cast.php 287158 2009-08-12 13:58:31Z alan_k $
- * @link       http://pear.php.net/package/DB_DataObject
- */
-  
-/**
-*  
-* Common usages:
-*   // blobs
-*   $data = DB_DataObject_Cast::blob($somefile);
-*   $data = DB_DataObject_Cast::string($somefile);
-*   $dataObject->someblobfield = $data
-*
-*   // dates?
-*   $d1 = new DB_DataObject_Cast::date('12/12/2000');
-*   $d2 = new DB_DataObject_Cast::date(2000,12,30);
-*   $d3 = new DB_DataObject_Cast::date($d1->year, $d1->month+30, $d1->day+30);
-*   
-*   // time, datetime.. ?????????
-*
-*   // raw sql????
-*    $data = DB_DataObject_Cast::sql('cast("123123",datetime)');
-*    $data = DB_DataObject_Cast::sql('NULL');
-*
-*   // int's/string etc. are proably pretty pointless..!!!!
-*
-*   
-*   inside DB_DataObject, 
-*   if (is_a($v,'db_dataobject_class')) {
-*           $value .= $v->toString(DB_DATAOBJECT_INT,'mysql');
-*   }
-*
-*
-*
-*
-
-*/ 
-class DB_DataObject_Cast {
-        
-    /**
-    * Type of data Stored in the object..
-    *
-    * @var string       (date|blob|.....?)
-    * @access public        
-    */
-    var $type;
-        
-    /**
-    * Data For date representation
-    *
-    * @var int  day/month/year
-    * @access public
-    */
-    var $day;
-    var $month;
-    var $year;
-
-    
-    /**
-    * Generic Data..
-    *
-    * @var string
-    * @access public
-    */
-
-    var $value;
-
-
-
-    /**
-    * Blob consructor
-    *
-    * create a Cast object from some raw data.. (binary)
-    * 
-    * 
-    * @param   string (with binary data!)
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    */
-  
-    function blob($value) {
-        $r = new DB_DataObject_Cast;
-        $r->type = 'blob';
-        $r->value = $value;
-        return $r;
-    }
-
-
-    /**
-    * String consructor (actually use if for ints and everything else!!!
-    *
-    * create a Cast object from some string (not binary)
-    * 
-    * 
-    * @param   string (with binary data!)
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    */
-  
-    function string($value) {
-        $r = new DB_DataObject_Cast;
-        $r->type = 'string';
-        $r->value = $value;
-        return $r;
-    }
-    
-    /**
-    * SQL constructor (for raw SQL insert)
-    *
-    * create a Cast object from some sql
-    * 
-    * @param   string (with binary data!)
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    */
-  
-    function sql($value) 
-    {
-        $r = new DB_DataObject_Cast;
-        $r->type = 'sql';
-        $r->value = $value;
-        return $r;
-    }
-
-
-    /**
-    * Date Constructor
-    *
-    * create a Cast object from some string (not binary)
-    * NO VALIDATION DONE, although some crappy re-calcing done!
-    * 
-    * @param   vargs... accepts
-    *       dd/mm
-    *       dd/mm/yyyy
-    *       yyyy-mm
-    *       yyyy-mm-dd
-    *       array(yyyy,dd)
-    *       array(yyyy,dd,mm)
-    *
-    *
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    */
-  
-    function date() 
-    {  
-        $args = func_get_args();
-        switch(count($args)) {
-            case 0: // no args = today!
-               $bits =  explode('-',date('Y-m-d'));
-                break;
-            case 1: // one arg = a string 
-            
-                if (strpos($args[0],'/') !== false) {
-                    $bits = array_reverse(explode('/',$args[0]));
-                } else {
-                    $bits = explode('-',$args[0]);
-                }
-                break;
-            default: // 2 or more..
-                $bits = $args;
-        }
-        if (count($bits) == 1) { // if YYYY set day = 1st..
-            $bits[] = 1;
-        }
-        
-        if (count($bits) == 2) { // if YYYY-DD set day = 1st..
-            $bits[] = 1;
-        }
-        
-        // if year < 1970 we cant use system tools to check it...
-        // so we make a few best gueses....
-        // basically do date calculations for the year 2000!!!
-        // fix me if anyone has more time...
-        if (($bits[0] < 1975) || ($bits[0] > 2030)) {
-            $oldyear = $bits[0];
-            $bits = explode('-',date('Y-m-d',mktime(1,1,1,$bits[1],$bits[2],2000)));
-            $bits[0] = ($bits[0] - 2000) + $oldyear;
-        } else {
-            // now mktime
-            $bits = explode('-',date('Y-m-d',mktime(1,1,1,$bits[1],$bits[2],$bits[0])));
-        }
-        $r = new DB_DataObject_Cast;
-        $r->type = 'date';
-        list($r->year,$r->month,$r->day) = $bits;
-        return $r;
-    }
-    
-   
-
-    /**
-    * Data For time representation ** does not handle timezones!!
-    *
-    * @var int  hour/minute/second
-    * @access public
-    */
-    var $hour;
-    var $minute;
-    var $second;
-
-    
-    /**
-    * DateTime Constructor
-    *
-    * create a Cast object from a Date/Time
-    * Maybe should accept a Date object.!
-    * NO VALIDATION DONE, although some crappy re-calcing done!
-    * 
-    * @param   vargs... accepts
-    *              noargs (now)
-    *              yyyy-mm-dd HH:MM:SS (Iso)
-    *              array(yyyy,mm,dd,HH,MM,SS) 
-    *
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    * @author   therion 5 at hotmail
-    */
-    
-    function dateTime()
-    {
-        $args = func_get_args();
-        switch(count($args)) {
-            case 0: // no args = now!
-                $datetime = date('Y-m-d G:i:s', mktime());
-            
-            case 1:
-                // continue on from 0 args.
-                if (!isset($datetime)) {
-                    $datetime = $args[0];
-                }
-                
-                $parts =  explode(' ', $datetime);
-                $bits = explode('-', $parts[0]);
-                $bits = array_merge($bits, explode(':', $parts[1]));
-                break;
-                
-            default: // 2 or more..
-                $bits = $args;
-                
-        }
-
-        if (count($bits) != 6) {
-            // PEAR ERROR?
-            return false;
-        }
-        
-        $r = DB_DataObject_Cast::date($bits[0], $bits[1], $bits[2]);
-        if (!$r) {
-            return $r; // pass thru error (False) - doesnt happen at present!
-        }
-        // change the type!
-        $r->type = 'datetime';
-        
-        // should we mathematically sort this out.. 
-        // (or just assume that no-one's dumb enough to enter 26:90:90 as a time!
-        $r->hour = $bits[3];
-        $r->minute = $bits[4];
-        $r->second = $bits[5];
-        return $r;
-
-    }
-
-
-
-    /**
-    * time Constructor
-    *
-    * create a Cast object from a Date/Time
-    * Maybe should accept a Date object.!
-    * NO VALIDATION DONE, and no-recalcing done!
-    *
-    * @param   vargs... accepts
-    *              noargs (now)
-    *              HH:MM:SS (Iso)
-    *              array(HH,MM,SS)    
-    *
-    *
-    * @return   object DB_DataObject_Cast
-    * @access   public 
-    * @author   therion 5 at hotmail
-    */
-    function time()
-    {
-        $args = func_get_args();
-        switch (count($args)) {
-            case 0: // no args = now!
-                $time = date('G:i:s', mktime());
-                
-            case 1:
-                // continue on from 0 args.
-                if (!isset($time)) {
-                    $time = $args[0];
-                }
-                $bits =  explode(':', $time);
-                break;
-                
-            default: // 2 or more..
-                $bits = $args;
-                
-        }
-        
-        if (count($bits) != 3) {
-            return false;
-        }
-        
-        // now take data from bits into object fields
-        $r = new DB_DataObject_Cast;
-        $r->type = 'time';
-        $r->hour = $bits[0];
-        $r->minute = $bits[1];
-        $r->second = $bits[2];
-        return $r;
-
-    }
-
-  
-  
-    /**
-    * get the string to use in the SQL statement for this...
-    *
-    * 
-    * @param   int      $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    */
-  
-    function toString($to=false,$db) 
-    {
-        // if $this->type is not set, we are in serious trouble!!!!
-        // values for to:
-        $method = 'toStringFrom'.$this->type;
-        return $this->$method($to,$db);
-    }
-    
-    /**
-    * get the string to use in the SQL statement from a blob of binary data 
-    *   ** Suppots only blob->postgres::bytea
-    *
-    * @param   int      $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    */
-    function toStringFromBlob($to,$db) 
-    {
-        // first weed out invalid casts..
-        // in blobs can only be cast to blobs.!
-        
-        // perhaps we should support TEXT fields???
-        
-        if (!($to & DB_DATAOBJECT_BLOB)) {
-            return PEAR::raiseError('Invalid Cast from a DB_DataObject_Cast::blob to something other than a blob!');
-        }
-        
-        switch ($db->dsn["phptype"]) {
-            case 'pgsql':
-                return "'".pg_escape_bytea($this->value)."'::bytea";
-                
-            case 'mysql':
-                return "'".mysql_real_escape_string($this->value,$db->connection)."'";
-            
-            case 'mysqli':
-                // this is funny - the parameter order is reversed ;)
-                return "'".mysqli_real_escape_string($db->connection, $this->value)."'";
-             
-            case 'sqlite':
-                // this is funny - the parameter order is reversed ;)
-                return "'".sqlite_escape_string($this->value)."'";
-           
-                 
-            default:
-                return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:{$db->dsn['phptype']} Yet");
-        }
-    
-    }
-    
-    /**
-    * get the string to use in the SQL statement for a blob from a string!
-    *   ** Suppots only string->postgres::bytea
-    * 
-    *
-    * @param   int      $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    */
-    function toStringFromString($to,$db) 
-    {
-        // first weed out invalid casts..
-        // in blobs can only be cast to blobs.!
-        
-        // perhaps we should support TEXT fields???
-        // 
-        
-        if (!($to & DB_DATAOBJECT_BLOB)) {
-            return PEAR::raiseError('Invalid Cast from a DB_DataObject_Cast::string to something other than a blob!'.
-                ' (why not just use native features)');
-        }
-        
-        switch ($db->dsn['phptype']) {
-            case 'pgsql':
-                return "'".pg_escape_string($this->value)."'::bytea";
-            
-            case 'mysql':
-                return "'".mysql_real_escape_string($this->value,$db->connection)."'";
-            
-            
-            case 'mysqli':
-                return "'".mysqli_real_escape_string($db->connection, $this->value)."'";
-
-            
-            default:
-                return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:{$db->dsn['phptype']} Yet");
-        }
-    
-    }
-    
-    
-    /**
-    * get the string to use in the SQL statement for a date
-    *   
-    * 
-    *
-    * @param   int      $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    */
-    function toStringFromDate($to,$db) 
-    {
-        // first weed out invalid casts..
-        // in blobs can only be cast to blobs.!
-         // perhaps we should support TEXT fields???
-        // 
-        
-        if (($to !== false) && !($to & DB_DATAOBJECT_DATE)) {
-            return PEAR::raiseError('Invalid Cast from a DB_DataObject_Cast::string to something other than a date!'.
-                ' (why not just use native features)');
-        }
-        return "'{$this->year}-{$this->month}-{$this->day}'";
-    }
-    
-    /**
-    * get the string to use in the SQL statement for a datetime
-    *   
-    * 
-    *
-    * @param   int     $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    * @author   therion 5 at hotmail
-    */
-    
-    function toStringFromDateTime($to,$db) 
-    {
-        // first weed out invalid casts..
-        // in blobs can only be cast to blobs.!
-        // perhaps we should support TEXT fields???
-        if (($to !== false) && 
-            !($to & (DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME))) {
-            return PEAR::raiseError('Invalid Cast from a ' .
-                ' DB_DataObject_Cast::dateTime to something other than a datetime!' .
-                ' (try using native features)');
-        }
-        return "'{$this->year}-{$this->month}-{$this->day} {$this->hour}:{$this->minute}:{$this->second}'";
-    }
-
-    /**
-    * get the string to use in the SQL statement for a time
-    *   
-    * 
-    *
-    * @param   int     $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    * @author   therion 5 at hotmail
-    */
-
-    function toStringFromTime($to,$db) 
-    {
-        // first weed out invalid casts..
-        // in blobs can only be cast to blobs.!
-        // perhaps we should support TEXT fields???
-        if (($to !== false) && !($to & DB_DATAOBJECT_TIME)) {
-            return PEAR::raiseError('Invalid Cast from a' . 
-                ' DB_DataObject_Cast::time to something other than a time!'.
-                ' (try using native features)');
-        }
-        return "'{$this->hour}:{$this->minute}:{$this->second}'";
-    }
-  
-    /**
-    * get the string to use in the SQL statement for a raw sql statement.
-    *
-    * @param   int      $to Type (DB_DATAOBJECT_*
-    * @param   object   $db DB Connection Object
-    * 
-    *
-    * @return   string 
-    * @access   public
-    */
-    function toStringFromSql($to,$db) 
-    {
-        return $this->value; 
-    }
-    
-    
-    
-    
-}
-
diff --git a/lib/php/DB/DataObject/Error.php b/lib/php/DB/DataObject/Error.php
deleted file mode 100644
index cdb863d83c6d371300bf58b92e9eb26f6c744e8b..0000000000000000000000000000000000000000
--- a/lib/php/DB/DataObject/Error.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * DataObjects error handler, loaded on demand...
- *
- * DB_DataObject_Error is a quick wrapper around pear error, so you can distinguish the
- * error code source.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB_DataObject
- * @author     Alan Knowles <alan@akbkhome.com>
- * @copyright  1997-2006 The PHP Group
- * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version    CVS: $Id: Error.php 287158 2009-08-12 13:58:31Z alan_k $
- * @link       http://pear.php.net/package/DB_DataObject
- */
-  
- 
-class DB_DataObject_Error extends PEAR_Error
-{
-    
-    /**
-     * DB_DataObject_Error constructor.
-     *
-     * @param mixed   $code   DB error code, or string with error message.
-     * @param integer $mode   what "error mode" to operate in
-     * @param integer $level  what error level to use for $mode & PEAR_ERROR_TRIGGER
-     * @param mixed   $debuginfo  additional debug info, such as the last query
-     *
-     * @access public
-     *
-     * @see PEAR_Error
-     */
-    function DB_DataObject_Error($message = '', $code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
-              $level = E_USER_NOTICE)
-    {
-        $this->PEAR_Error('DB_DataObject Error: ' . $message, $code, $mode, $level);
-        
-    }
-    
-    
-    // todo : - support code -> message handling, and translated error messages...
-    
-    
-    
-}
diff --git a/lib/php/DB/DataObject/Generator.php b/lib/php/DB/DataObject/Generator.php
deleted file mode 100644
index 17d310f57c3e3a1983e329eb8dd3dee2937060cb..0000000000000000000000000000000000000000
--- a/lib/php/DB/DataObject/Generator.php
+++ /dev/null
@@ -1,1568 +0,0 @@
-<?php
-/**
- * Generation tools for DB_DataObject
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB_DataObject
- * @author     Alan Knowles <alan@akbkhome.com>
- * @copyright  1997-2006 The PHP Group
- * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version    CVS: $Id: Generator.php 289384 2009-10-09 00:17:26Z alan_k $
- * @link       http://pear.php.net/package/DB_DataObject
- */
- 
- /*
- * Security Notes:
- *   This class uses eval to create classes on the fly.
- *   The table name and database name are used to check the database before writing the
- *   class definitions, we now check for quotes and semi-colon's in both variables
- *   so I cant see how it would be possible to generate code even if
- *   for some crazy reason you took the classname and table name from User Input.
- *   
- *   If you consider that wrong, or can prove it.. let me know!
- */
- 
- /**
- * 
- * Config _$ptions
- * [DB_DataObject]
- * ; optional default = DB/DataObject.php
- * extends_location =
- * ; optional default = DB_DataObject
- * extends =
- * ; alter the extends field when updating a class (defaults to only replacing DB_DataObject)
- * generator_class_rewrite = ANY|specific_name   // default is DB_DataObject
- *
- */
-
-/**
- * Needed classes
- * We lazy load here, due to problems with the tests not setting up include path correctly.
- * FIXME!
- */
-class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
-//require_once('Config.php');
-
-/**
- * Generator class
- *
- * @package DB_DataObject
- */
-class DB_DataObject_Generator extends DB_DataObject
-{
-    /* =========================================================== */
-    /*  Utility functions - for building db config files           */
-    /* =========================================================== */
-
-    /**
-     * Array of table names
-     *
-     * @var array
-     * @access private
-     */
-    var $tables;
-
-    /**
-     * associative array table -> array of table row objects
-     *
-     * @var array
-     * @access private
-     */
-    var $_definitions;
-
-    /**
-     * active table being output
-     *
-     * @var string
-     * @access private
-     */
-    var $table; // active tablename
-
-
-    /**
-     * The 'starter' = call this to start the process
-     *
-     * @access  public
-     * @return  none
-     */
-    function start()
-    {
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-
-        $databases = array();
-        foreach($options as $k=>$v) {
-            if (substr($k,0,9) == 'database_') {
-                $databases[substr($k,9)] = $v;
-            }
-        }
-
-        if (isset($options['database'])) {
-            if ($db_driver == 'DB') {
-                require_once 'DB.php';
-                $dsn = DB::parseDSN($options['database']);
-            } else {
-                require_once 'MDB2.php';
-                $dsn = MDB2::parseDSN($options['database']);
-            }
-
-            if (!isset($database[$dsn['database']])) {
-                $databases[$dsn['database']] = $options['database'];
-            }
-        }
-
-        foreach($databases as $databasename => $database) {
-            if (!$database) {
-                continue;
-            }
-            $this->debug("CREATING FOR $databasename\n");
-            $class = get_class($this);
-            $t = new $class;
-            $t->_database_dsn = $database;
-
-
-            $t->_database = $databasename;
-            if ($db_driver == 'DB') {
-                require_once 'DB.php';
-                $dsn = DB::parseDSN($database);
-            } else {
-                require_once 'MDB2.php';
-                $dsn = MDB2::parseDSN($database);
-            }
-
-            if (($dsn['phptype'] == 'sqlite') && is_file($databasename)) {
-                $t->_database = basename($t->_database);
-            }
-            $t->_createTableList();
-
-            foreach(get_class_methods($class) as $method) {
-                if (substr($method,0,8 ) != 'generate') {
-                    continue;
-                }
-                $this->debug("calling $method");
-                $t->$method();
-            }
-        }
-        $this->debug("DONE\n\n");
-    }
-
-    /**
-     * Output File was config object, now just string
-     * Used to generate the Tables
-     *
-     * @var    string outputbuffer for table definitions
-     * @access private
-     */
-    var $_newConfig;
-
-    /**
-     * Build a list of tables;
-     * and store it in $this->tables and $this->_definitions[tablename];
-     *
-     * @access  private
-     * @return  none
-     */
-    function _createTableList()
-    {
-        $this->_connect();
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-
-        $__DB= &$GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'][$this->_database_dsn_md5];
-
-        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-        $is_MDB2 = ($db_driver != 'DB') ? true : false;
-
-        if (is_a($__DB , 'PEAR_Error')) {
-            return PEAR::raiseError($__DB->toString(), null, PEAR_ERROR_DIE);
-        }
-        
-        if (!$is_MDB2) {
-            // try getting a list of schema tables first. (postgres)
-            $__DB->expectError(DB_ERROR_UNSUPPORTED);
-            $this->tables = $__DB->getListOf('schema.tables');
-            $__DB->popExpect();
-        } else {
-            /**
-             * set portability and some modules to fetch the informations
-             */
-            $db_options = PEAR::getStaticProperty('MDB2','options');
-            if (empty($db_options)) {
-                $__DB->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE);
-            }
-            
-            $__DB->loadModule('Manager');
-            $__DB->loadModule('Reverse');
-        }
-
-        if ((empty($this->tables) || is_a($this->tables , 'PEAR_Error'))) {
-            //if that fails fall back to clasic tables list.
-            if (!$is_MDB2) {
-                // try getting a list of schema tables first. (postgres)
-                $__DB->expectError(DB_ERROR_UNSUPPORTED);
-                $this->tables = $__DB->getListOf('tables');
-                $__DB->popExpect();
-            } else  {
-                $this->tables = $__DB->manager->listTables();
-                $sequences = $__DB->manager->listSequences();
-                foreach ($sequences as $k => $v) {
-                    $this->tables[] = $__DB->getSequenceName($v);
-                }
-            }
-        }
-
-        if (is_a($this->tables , 'PEAR_Error')) {
-            return PEAR::raiseError($this->tables->toString(), null, PEAR_ERROR_DIE);
-        }
-
-        // build views as well if asked to.
-        if (!empty($options['build_views'])) {
-            if (!$is_MDB2) {
-                $views = $__DB->getListOf('views');
-            } else {
-                $views = $__DB->manager->listViews();
-            }
-            if (is_a($views,'PEAR_Error')) {
-                return PEAR::raiseError(
-                'Error getting Views (check the PEAR bug database for the fix to DB), ' .
-                $views->toString(),
-                null,
-                PEAR_ERROR_DIE
-                );
-            }
-            $this->tables = array_merge ($this->tables, $views);
-        }
-
-        // declare a temporary table to be filled with matching tables names
-        $tmp_table = array();
-
-
-        foreach($this->tables as $table) {
-            if (isset($options['generator_include_regex']) &&
-            !preg_match($options['generator_include_regex'],$table)) {
-                continue;
-            } else if (isset($options['generator_exclude_regex']) &&
-            preg_match($options['generator_exclude_regex'],$table)) {
-                continue;
-            }
-            // postgres strip the schema bit from the
-            if (!empty($options['generator_strip_schema'])) {
-                $bits = explode('.', $table,2);
-                $table = $bits[0];
-                if (count($bits) > 1) {
-                    $table = $bits[1];
-                }
-            }
-            $quotedTable = !empty($options['quote_identifiers_tableinfo']) ? 
-                $__DB->quoteIdentifier($table) : $table;
-                
-            if (!$is_MDB2) {
-                
-                $defs =  $__DB->tableInfo($quotedTable);
-            } else {
-                $defs =  $__DB->reverse->tableInfo($quotedTable);
-                // rename the length value, so it matches db's return.
-                
-            }
-
-            if (is_a($defs,'PEAR_Error')) {
-                // running in debug mode should pick this up as a big warning..
-                $this->raiseError('Error reading tableInfo, '. $defs->toString());
-                continue;
-            }
-            // cast all definitions to objects - as we deal with that better.
-
-
-
-            foreach($defs as $def) {
-                if (!is_array($def)) {
-                    continue;
-                }
-                // rename the length value, so it matches db's return.
-                if (isset($def['length']) && !isset($def['len'])) {
-                    $def['len'] = $def['length'];
-                }
-                $this->_definitions[$table][] = (object) $def;
-
-            }
-            // we find a matching table, just  store it into a temporary array
-            $tmp_table[] = $table;
-
-
-        }
-        // the temporary table array is now the right one (tables names matching
-        // with regex expressions have been removed)
-        $this->tables = $tmp_table;
-        //print_r($this->_definitions);
-    }
-    
-    /**
-     * Auto generation of table data.
-     *
-     * it will output to db_oo_{database} the table definitions
-     *
-     * @access  private
-     * @return  none
-     */
-    function generateDefinitions()
-    {
-        $this->debug("Generating Definitions file:        ");
-        if (!$this->tables) {
-            $this->debug("-- NO TABLES -- \n");
-            return;
-        }
-
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-
-
-        //$this->_newConfig = new Config('IniFile');
-        $this->_newConfig = '';
-        foreach($this->tables as $this->table) {
-            $this->_generateDefinitionsTable();
-        }
-        $this->_connect();
-        // dont generate a schema if location is not set
-        // it's created on the fly!
-        if (empty($options['schema_location']) && empty($options["ini_{$this->_database}"]) ) {
-            return;
-        }
-        if (!empty($options['generator_no_ini'])) { // built in ini files..
-            return;
-        }
-        $base =  @$options['schema_location'];
-        if (isset($options["ini_{$this->_database}"])) {
-            $file = $options["ini_{$this->_database}"];
-        } else {
-            $file = "{$base}/{$this->_database}.ini";
-        }
-        
-        if (!file_exists(dirname($file))) {
-            require_once 'System.php';
-            System::mkdir(array('-p','-m',0755,dirname($file)));
-        }
-        $this->debug("Writing ini as {$file}\n");
-        //touch($file);
-        $tmpname = tempnam(session_save_path(),'DataObject_');
-        //print_r($this->_newConfig);
-        $fh = fopen($tmpname,'w');
-        fwrite($fh,$this->_newConfig);
-        fclose($fh);
-        $perms = file_exists($file) ? fileperms($file) : 0755;
-        // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy..
-        
-        if (!@rename($tmpname, $file)) { 
-            unlink($file); 
-            rename($tmpname, $file);
-        }
-        chmod($file,$perms);
-        //$ret = $this->_newConfig->writeInput($file,false);
-
-        //if (PEAR::isError($ret) ) {
-        //    return PEAR::raiseError($ret->message,null,PEAR_ERROR_DIE);
-        // }
-    }
-
-    /**
-     * generate Foreign Keys (for links.ini) 
-     * Currenly only works with mysql / mysqli
-     * to use, you must set option: generate_links=true
-     * 
-     * @author Pascal Sch�ni 
-     */
-    function generateForeignKeys() 
-    {
-        $options = PEAR::getStaticProperty('DB_DataObject','options');
-        if (empty($options['generate_links'])) {
-            return false;
-        }
-        $__DB = &$GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'][$this->_database_dsn_md5];
-        if (!in_array($__DB->phptype, array('mysql','mysqli'))) {
-            echo "WARNING: cant handle non-mysql introspection for defaults.";
-            return; // cant handle non-mysql introspection for defaults.
-        }
-
-        $DB = $this->getDatabaseConnection();
-
-        $fk = array();
-
-        foreach($this->tables as $this->table) {
-            $quotedTable = !empty($options['quote_identifiers_tableinfo']) ?  $DB->quoteIdentifier($table)  : $this->table;
-            
-            $res =& $DB->query('SHOW CREATE TABLE ' . $quotedTable );
-
-            if (PEAR::isError($res)) {
-                die($res->getMessage());
-            }
-
-            $text = $res->fetchRow(DB_FETCHMODE_DEFAULT, 0);
-            $treffer = array();
-            // Extract FOREIGN KEYS
-            preg_match_all(
-                "/FOREIGN KEY \(`(\w*)`\) REFERENCES `(\w*)` \(`(\w*)`\)/i", 
-                $text[1], 
-                $treffer, 
-                PREG_SET_ORDER);
-
-            if (count($treffer) < 1) {
-                continue;
-            }
-            for ($i = 0; $i < count($treffer); $i++) {
-                $fk[$this->table][$treffer[$i][1]] = $treffer[$i][2] . ":" . $treffer[$i][3];
-            }
-            
-        }
-
-        $links_ini = "";
-
-        foreach($fk as $table => $details) {
-            $links_ini .= "[$table]\n";
-            foreach ($details as $col => $ref) {
-                $links_ini .= "$col = $ref\n";
-            }
-            $links_ini .= "\n";
-        }
-
-        // dont generate a schema if location is not set
-        // it's created on the fly!
-        $options = PEAR::getStaticProperty('DB_DataObject','options');
-
-        if (empty($options['schema_location'])) {
-            return;
-        }
-
-        
-        $file = "{$options['schema_location']}/{$this->_database}.links.ini";
-
-        if (!file_exists(dirname($file))) {
-            require_once 'System.php';
-            System::mkdir(array('-p','-m',0755,dirname($file)));
-        }
-
-        $this->debug("Writing ini as {$file}\n");
-        
-        //touch($file); // not sure why this is needed?
-        $tmpname = tempnam(session_save_path(),'DataObject_');
-       
-        $fh = fopen($tmpname,'w');
-        fwrite($fh,$links_ini);
-        fclose($fh);
-        $perms = file_exists($file) ? fileperms($file) : 0755;
-        // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy..
-        if (!@rename($tmpname, $file)) { 
-            unlink($file); 
-            rename($tmpname, $file);
-        }
-        chmod($file, $perms);
-    }
-
-      
-    /**
-     * The table geneation part
-     *
-     * @access  private
-     * @return  tabledef and keys array.
-     */
-    function _generateDefinitionsTable()
-    {
-        global $_DB_DATAOBJECT;
-        $options = PEAR::getStaticProperty('DB_DataObject','options');
-        $defs = $this->_definitions[$this->table];
-        $this->_newConfig .= "\n[{$this->table}]\n";
-        $keys_out =  "\n[{$this->table}__keys]\n";
-        $keys_out_primary = '';
-        $keys_out_secondary = '';
-        if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) {
-            echo "TABLE STRUCTURE FOR {$this->table}\n";
-            print_r($defs);
-        }
-        $DB = $this->getDatabaseConnection();
-        $dbtype = $DB->phptype;
-        
-        $ret = array(
-                'table' => array(),
-                'keys' => array(),
-            );
-            
-        $ret_keys_primary = array();
-        $ret_keys_secondary = array();
-        
-        
-        
-        foreach($defs as $t) {
-             
-            $n=0;
-            $write_ini = true;
-            
-            
-            switch (strtoupper($t->type)) {
-
-                case 'INT':
-                case 'INT2':    // postgres
-                case 'INT4':    // postgres
-                case 'INT8':    // postgres
-                case 'SERIAL4': // postgres
-                case 'SERIAL8': // postgres
-                case 'INTEGER':
-                case 'TINYINT':
-                case 'SMALLINT':
-                case 'MEDIUMINT':
-                case 'BIGINT':
-                    $type = DB_DATAOBJECT_INT;
-                    if ($t->len == 1) {
-                        $type +=  DB_DATAOBJECT_BOOL;
-                    }
-                    break;
-               
-                case 'REAL':
-                case 'DOUBLE':
-                case 'DOUBLE PRECISION': // double precision (firebird)
-                case 'FLOAT':
-                case 'FLOAT4': // real (postgres)
-                case 'FLOAT8': // double precision (postgres)
-                case 'DECIMAL':
-                case 'MONEY':  // mssql and maybe others
-                case 'NUMERIC':
-                case 'NUMBER': // oci8 
-                    $type = DB_DATAOBJECT_INT; // should really by FLOAT!!! / MONEY...
-                    break;
-                    
-                case 'YEAR':
-                    $type = DB_DATAOBJECT_INT; 
-                    break;
-                    
-                case 'BIT':
-                case 'BOOL':   
-                case 'BOOLEAN':   
-                
-                    $type = DB_DATAOBJECT_BOOL;
-                    // postgres needs to quote '0'
-                    if ($dbtype == 'pgsql') {
-                        $type +=  DB_DATAOBJECT_STR;
-                    }
-                    break;
-                    
-                case 'STRING':
-                case 'CHAR':
-                case 'VARCHAR':
-                case 'VARCHAR2':
-                case 'TINYTEXT':
-                
-                case 'ENUM':
-                case 'SET':         // not really but oh well
-                
-                case 'POINT':       // mysql geometry stuff - not really string - but will do..
-                
-                case 'TIMESTAMPTZ': // postgres
-                case 'BPCHAR':      // postgres
-                case 'INTERVAL':    // postgres (eg. '12 days')
-                
-                case 'CIDR':        // postgres IP net spec
-                case 'INET':        // postgres IP
-                case 'MACADDR':     // postgress network Mac address.
-                
-                case 'INTEGER[]':   // postgres type
-                case 'BOOLEAN[]':   // postgres type
-                
-                    $type = DB_DATAOBJECT_STR;
-                    break;
-                
-                case 'TEXT':
-                case 'MEDIUMTEXT':
-                case 'LONGTEXT':
-                    
-                    $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT;
-                    break;
-                
-                
-                case 'DATE':    
-                    $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE;
-                    break;
-                    
-                case 'TIME':    
-                    $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_TIME;
-                    break;    
-                    
-                
-                case 'DATETIME': 
-                     
-                    $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME;
-                    break;    
-                    
-                case 'TIMESTAMP': // do other databases use this???
-                    
-                    $type = ($dbtype == 'mysql') ?
-                        DB_DATAOBJECT_MYSQLTIMESTAMP : 
-                        DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME;
-                    break;    
-                    
-                
-                case 'BLOB':       /// these should really be ignored!!!???
-                case 'TINYBLOB':
-                case 'MEDIUMBLOB':
-                case 'LONGBLOB':
-                
-                case 'CLOB': // oracle character lob support
-                
-                case 'BYTEA':   // postgres blob support..
-                    $type = DB_DATAOBJECT_STR + DB_DATAOBJECT_BLOB;
-                    break;
-                    
-                default:     
-                    echo "*****************************************************************\n".
-                         "**               WARNING UNKNOWN TYPE                          **\n".
-                         "** Found column '{$t->name}', of type  '{$t->type}'            **\n".
-                         "** Please submit a bug, describe what type you expect this     **\n".
-                         "** column  to be                                               **\n".
-                         "** ---------POSSIBLE FIX / WORKAROUND -------------------------**\n".
-                         "** Try using MDB2 as the backend - eg set the config option    **\n".
-                         "** db_driver = MDB2                                            **\n".
-                         "*****************************************************************\n";
-                    $write_ini = false;
-                    break;
-            }
-            
-            if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $t->name)) {
-                echo "*****************************************************************\n".
-                     "**               WARNING COLUMN NAME UNUSABLE                  **\n".
-                     "** Found column '{$t->name}', of type  '{$t->type}'            **\n".
-                     "** Since this column name can't be converted to a php variable **\n".
-                     "** name, and the whole idea of mapping would result in a mess  **\n".
-                     "** This column has been ignored...                             **\n".
-                     "*****************************************************************\n";
-                continue;
-            }
-            
-            if (!strlen(trim($t->name))) {
-                continue; // is this a bug?
-            }
-            
-            if (preg_match('/not[ _]null/i',$t->flags)) {
-                $type += DB_DATAOBJECT_NOTNULL;
-            }
-           
-           
-            if (in_array($t->name,array('null','yes','no','true','false'))) {
-                echo "*****************************************************************\n".
-                     "**                             WARNING                         **\n".
-                     "** Found column '{$t->name}', which is invalid in an .ini file **\n".
-                     "** This line will not be writen to the file - you will have    **\n".
-                     "** define the keys()/method manually.                          **\n".
-                     "*****************************************************************\n";
-                $write_ini = false;
-            } else {
-                $this->_newConfig .= "{$t->name} = $type\n";
-            }
-            
-            $ret['table'][$t->name] = $type;
-            // i've no idea if this will work well on other databases?
-            // only use primary key or nextval(), cause the setFrom blocks you setting all key items...
-            // if no keys exist fall back to using unique
-            //echo "\n{$t->name} => {$t->flags}\n";
-            $secondary_key_match = isset($options['generator_secondary_key_match']) ? $options['generator_secondary_key_match'] : 'primary|unique';
-            
-            if (preg_match('/(auto_increment|nextval\()/i',rawurldecode($t->flags)) 
-                || (isset($t->autoincrement) && ($t->autoincrement === true))) {
-                    
-                // native sequences = 2
-                if ($write_ini) {
-                    $keys_out_primary .= "{$t->name} = N\n";
-                }
-                $ret_keys_primary[$t->name] = 'N';
-            
-            } else if ($secondary_key_match && preg_match('/('.$secondary_key_match.')/i',$t->flags)) {
-                // keys.. = 1
-                $key_type = 'K';
-                if (!preg_match("/(primary)/i",$t->flags)) {
-                    $key_type = 'U';
-                }
-                
-                if ($write_ini) {
-                    $keys_out_secondary .= "{$t->name} = {$key_type}\n";
-                }
-                $ret_keys_secondary[$t->name] = $key_type;
-            }
-            
-        
-        }
-        
-        $this->_newConfig .= $keys_out . (empty($keys_out_primary) ? $keys_out_secondary : $keys_out_primary);
-        $ret['keys'] = empty($keys_out_primary) ? $ret_keys_secondary : $ret_keys_primary;
-        
-        if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) {
-            print_r(array("dump for {$this->table}", $ret));
-        }
-        
-        return $ret;
-        
-        
-    }
-
-    /**
-    * Convert a table name into a class name -> override this if you want a different mapping
-    *
-    * @access  public
-    * @return  string class name;
-    */
-    
-    
-    function getClassNameFromTableName($table)
-    {
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $class_prefix  = empty($options['class_prefix']) ? '' : $options['class_prefix'];
-        return  $class_prefix.preg_replace('/[^A-Z0-9]/i','_',ucfirst(trim($this->table)));
-    }
-    
-    
-    /**
-    * Convert a table name into a file name -> override this if you want a different mapping
-    *
-    * @access  public
-    * @return  string file name;
-    */
-    
-    
-    function getFileNameFromTableName($table)
-    {
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $base = $options['class_location'];
-        if (strpos($base,'%s') !== false) {
-            $base = dirname($base);
-        } 
-        if (!file_exists($base)) {
-            require_once 'System.php';
-            System::mkdir(array('-p',$base));
-        }
-        if (strpos($options['class_location'],'%s') !== false) {
-            $outfilename   = sprintf($options['class_location'], 
-                    preg_replace('/[^A-Z0-9]/i','_',ucfirst($this->table)));
-        } else { 
-            $outfilename = "{$base}/".preg_replace('/[^A-Z0-9]/i','_',ucfirst($this->table)).".php";
-        }
-        return $outfilename;
-        
-    }
-    
-    
-     /**
-    * Convert a column name into a method name (usually prefixed by get/set/validateXXXXX)
-    *
-    * @access  public
-    * @return  string method name;
-    */
-    
-    
-    function getMethodNameFromColumnName($col)
-    {
-        return ucfirst($col);
-    }
-    
-    
-    
-    
-    /*
-     * building the class files
-     * for each of the tables output a file!
-     */
-    function generateClasses()
-    {
-        //echo "Generating Class files:        \n";
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-       
-	$this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
-	$this->_extendsFile = empty($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
- 
-
-        foreach($this->tables as $this->table) {
-            $this->table        = trim($this->table);
-            $this->classname    = $this->getClassNameFromTableName($this->table);
-            $i = '';
-            $outfilename        = $this->getFileNameFromTableName($this->table);
-            
-            $oldcontents = '';
-            if (file_exists($outfilename)) {
-                // file_get_contents???
-                $oldcontents = implode('',file($outfilename));
-            }
-            
-            $out = $this->_generateClassTable($oldcontents);
-            $this->debug( "writing $this->classname\n");
-            $tmpname = tempnam(session_save_path(),'DataObject_');
-       
-            $fh = fopen($tmpname, "w");
-            fputs($fh,$out);
-            fclose($fh);
-            $perms = file_exists($outfilename) ? fileperms($outfilename) : 0755;
-            
-            // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy..
-            if (!@rename($tmpname, $outfilename)) {
-                unlink($outfilename); 
-                rename($tmpname, $outfilename);
-            }
-            
-            chmod($outfilename, $perms);
-        }
-        //echo $out;
-    }
-
-    /**
-     * class being extended (can be overridden by [DB_DataObject] extends=xxxx
-     *
-     * @var    string
-     * @access private
-     */
-    var $_extends = 'DB_DataObject';
-
-    /**
-     * line to use for require('DB/DataObject.php');
-     *
-     * @var    string
-     * @access private
-     */
-    var $_extendsFile = "DB/DataObject.php";
-
-    /**
-     * class being generated
-     *
-     * @var    string
-     * @access private
-     */
-    var $_className;
-
-    /**
-     * The table class geneation part - single file.
-     *
-     * @access  private
-     * @return  none
-     */
-    function _generateClassTable($input = '')
-    {
-        // title = expand me!
-        $foot = "";
-        $head = "<?php\n/**\n * Table Definition for {$this->table}\n";
-        $head .= $this->derivedHookPageLevelDocBlock();
-        $head .= " */\n";
-        $head .= $this->derivedHookExtendsDocBlock();
-
-        
-        // requires
-        $head .= "require_once '{$this->_extendsFile}';\n\n";
-        // add dummy class header in...
-        // class 
-        $head .= $this->derivedHookClassDocBlock();
-        $head .= "class {$this->classname} extends {$this->_extends} \n{";
-
-        $body =  "\n    ###START_AUTOCODE\n";
-        $body .= "    /* the code below is auto generated do not remove the above tag */\n\n";
-        // table
-        $padding = (30 - strlen($this->table));
-        $padding  = ($padding < 2) ? 2 : $padding;
-        
-        $p =  str_repeat(' ',$padding) ;
-        
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        
-        
-        $var = (substr(phpversion(),0,1) > 4) ? 'public' : 'var';
-        $var = !empty($options['generator_var_keyword']) ? $options['generator_var_keyword'] : $var;
-        
-        
-        $body .= "    {$var} \$__table = '{$this->table}';  {$p}// table name\n";
-    
-        
-        // if we are using the option database_{databasename} = dsn
-        // then we should add var $_database = here
-        // as database names may not always match.. 
-        
-        if (empty($GLOBALS['_DB_DATAOBJECT']['CONFIG'])) {
-            DB_DataObject::_loadConfig();
-        }
-
-         // Only include the $_database property if the omit_database_var is unset or false
-        
-        if (isset($options["database_{$this->_database}"]) && empty($GLOBALS['_DB_DATAOBJECT']['CONFIG']['generator_omit_database_var'])) {
-            $body .= "    {$var} \$_database = '{$this->_database}';  {$p}// database name (used with database_{*} config)\n";
-        }
-        
-        
-        if (!empty($options['generator_novars'])) {
-            $var = '//'.$var;
-        }
-        
-        $defs = $this->_definitions[$this->table];
-
-        // show nice information!
-        $connections = array();
-        $sets = array();
-        foreach($defs as $t) {
-            if (!strlen(trim($t->name))) {
-                continue;
-            }
-            if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $t->name)) {
-                echo "*****************************************************************\n".
-                     "**               WARNING COLUMN NAME UNUSABLE                  **\n".
-                     "** Found column '{$t->name}', of type  '{$t->type}'            **\n".
-                     "** Since this column name can't be converted to a php variable **\n".
-                     "** name, and the whole idea of mapping would result in a mess  **\n".
-                     "** This column has been ignored...                             **\n".
-                     "*****************************************************************\n";
-                continue;
-            }
-            
-            
-            $padding = (30 - strlen($t->name));
-            if ($padding < 2) $padding =2;
-            $p =  str_repeat(' ',$padding) ;
-            
-            $length = empty($t->len) ? '' : '('.$t->len.')';
-            $body .="    {$var} \${$t->name};  {$p}// {$t->type}$length  {$t->flags}\n";
-            
-            // can not do set as PEAR::DB table info doesnt support it.
-            //if (substr($t->Type,0,3) == "set")
-            //    $sets[$t->Field] = "array".substr($t->Type,3);
-            $body .= $this->derivedHookVar($t,$padding);
-        }
-
-        // THIS IS TOTALLY BORKED old FC creation
-        // IT WILL BE REMOVED!!!!! in DataObjects 1.6
-        // grep -r __clone * to find all it's uses
-        // and replace them with $x = clone($y);
-        // due to the change in the PHP5 clone design.
-        
-        if ( substr(phpversion(),0,1) < 5) {
-            $body .= "\n";
-            $body .= "    /* ZE2 compatibility trick*/\n";
-            $body .= "    function __clone() { return \$this;}\n";
-        }
-
-        // simple creation tools ! (static stuff!)
-        $body .= "\n";
-        $body .= "    /* Static get */\n";
-        $body .= "    function staticGet(\$k,\$v=NULL) { return DB_DataObject::staticGet('{$this->classname}',\$k,\$v); }\n";
-        
-        // generate getter and setter methods
-        $body .= $this->_generateGetters($input);
-        $body .= $this->_generateSetters($input);
-        
-        /*
-        theoretically there is scope here to introduce 'list' methods
-        based up 'xxxx_up' column!!! for heiracitcal trees..
-        */
-
-        // set methods
-        //foreach ($sets as $k=>$v) {
-        //    $kk = strtoupper($k);
-        //    $body .="    function getSets{$k}() { return {$v}; }\n";
-        //}
-        
-        if (!empty($options['generator_no_ini'])) {
-            $def = $this->_generateDefinitionsTable();  // simplify this!?
-            $body .= $this->_generateTableFunction($def['table']);
-            $body .= $this->_generateKeysFunction($def['keys']);
-            $body .= $this->_generateSequenceKeyFunction($def);
-            $body .= $this->_generateDefaultsFunction($this->table, $def['table']);
-        }  else if (!empty($options['generator_add_defaults'])) {   
-            // I dont really like doing it this way (adding another option)
-            // but it helps on older projects.
-            $def = $this->_generateDefinitionsTable();  // simplify this!?
-            $body .= $this->_generateDefaultsFunction($this->table,$def['table']);
-             
-        }
-        $body .= $this->derivedHookFunctions($input);
-
-        $body .= "\n    /* the code above is auto generated do not remove the tag below */";
-        $body .= "\n    ###END_AUTOCODE\n";
-
-
-        // stubs..
-        
-        if (!empty($options['generator_add_validate_stubs'])) {
-            foreach($defs as $t) {
-                if (!strlen(trim($t->name))) {
-                    continue;
-                }
-                $validate_fname = 'validate' . $this->getMethodNameFromColumnName($t->name);
-                // dont re-add it..
-                if (preg_match('/\s+function\s+' . $validate_fname . '\s*\(/i', $input)) {
-                    continue;
-                }
-                $body .= "\n    function {$validate_fname}()\n    {\n        return false;\n    }\n";
-            }
-        }
-
-
-
-
-        $foot .= "}\n";
-        $full = $head . $body . $foot;
-
-        if (!$input) {
-            return $full;
-        }
-        if (!preg_match('/(\n|\r\n)\s*###START_AUTOCODE(\n|\r\n)/s',$input))  {
-            return $full;
-        }
-        if (!preg_match('/(\n|\r\n)\s*###END_AUTOCODE(\n|\r\n)/s',$input)) {
-            return $full;
-        }
-
-
-        /* this will only replace extends DB_DataObject by default,
-            unless use set generator_class_rewrite to ANY or a name*/
-
-        $class_rewrite = 'DB_DataObject';
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        if (empty($options['generator_class_rewrite']) || !($class_rewrite = $options['generator_class_rewrite'])) {
-            $class_rewrite = 'DB_DataObject';
-        }
-        if ($class_rewrite == 'ANY') {
-            $class_rewrite = '[a-z_]+';
-        }
-
-        $input = preg_replace(
-            '/(\n|\r\n)class\s*[a-z0-9_]+\s*extends\s*' .$class_rewrite . '\s*(\n|\r\n)\{(\n|\r\n)/si',
-            "\nclass {$this->classname} extends {$this->_extends} \n{\n",
-            $input);
-
-        $ret =  preg_replace(
-            '/(\n|\r\n)\s*###START_AUTOCODE(\n|\r\n).*(\n|\r\n)\s*###END_AUTOCODE(\n|\r\n)/s',
-            $body,$input);
-        
-        if (!strlen($ret)) {
-            return PEAR::raiseError(
-                "PREG_REPLACE failed to replace body, - you probably need to set these in your php.ini\n".
-                "pcre.backtrack_limit=1000000\n".
-                "pcre.recursion_limit=1000000\n"
-                ,null, PEAR_ERROR_DIE);
-       }
-        
-        return $ret;
-    }
-
-    /**
-     * hook to add extra methods to all classes
-     *
-     * called once for each class, use with $this->table and
-     * $this->_definitions[$this->table], to get data out of the current table,
-     * use it to add extra methods to the default classes.
-     *
-     * @access   public
-     * @return  string added to class eg. functions.
-     */
-    function derivedHookFunctions($input = "")
-    {
-        // This is so derived generator classes can generate functions
-        // It MUST NOT be changed here!!!
-        return "";
-    }
-
-    /**
-     * hook for var lines
-     * called each time a var line is generated, override to add extra var
-     * lines
-     *
-     * @param object t containing type,len,flags etc. from tableInfo call
-     * @param int padding number of spaces
-     * @access   public
-     * @return  string added to class eg. functions.
-     */
-    function derivedHookVar(&$t,$padding)
-    {
-        // This is so derived generator classes can generate variabels
-        // It MUST NOT be changed here!!!
-        return "";
-    }
-
-    /**
-     * hook to add extra page-level (in terms of phpDocumentor) DocBlock
-     *
-     * called once for each class, use it add extra page-level docs
-     * @access public
-     * @return string added to class eg. functions.
-     */
-    function derivedHookPageLevelDocBlock() {
-        return '';
-    }
-
-    /**
-     * hook to add extra doc block (in terms of phpDocumentor) to extend string
-     *
-     * called once for each class, use it add extra comments to extends
-     * string (require_once...)
-     * @access public
-     * @return string added to class eg. functions.
-     */
-    function derivedHookExtendsDocBlock() {
-        return '';
-    }
-
-    /**
-     * hook to add extra class level DocBlock (in terms of phpDocumentor)
-     *
-     * called once for each class, use it add extra comments to class
-     * string (require_once...)
-     * @access public
-     * @return string added to class eg. functions.
-     */
-    function derivedHookClassDocBlock() {
-        return '';
-    }
-
-    /**
-
-    /**
-    * getProxyFull - create a class definition on the fly and instantate it..
-    *
-    * similar to generated files - but also evals the class definitoin code.
-    * 
-    * 
-    * @param   string database name
-    * @param   string  table   name of table to create proxy for.
-    * 
-    *
-    * @return   object    Instance of class. or PEAR Error
-    * @access   public
-    */
-    function getProxyFull($database,$table) 
-    {
-        
-        if ($err = $this->fillTableSchema($database,$table)) {
-            return $err;
-        }
-        
-        
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $class_prefix  = empty($options['class_prefix']) ? '' : $options['class_prefix'];
-        
-        $this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
-	$this->_extendsFile = empty($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
- 
-        $classname = $this->classname = $this->getClassNameFromTableName($this->table);
-        
-        $out = $this->_generateClassTable();
-        //echo $out;
-        eval('?>'.$out);
-        return new $classname;
-        
-    }
-    
-     /**
-    * fillTableSchema - set the database schema on the fly
-    *
-    * 
-    * 
-    * @param   string database name
-    * @param   string  table   name of table to create schema info for
-    *
-    * @return   none | PEAR::error()
-    * @access   public
-    */
-    function fillTableSchema($database,$table) 
-    {
-        global $_DB_DATAOBJECT;
-         // a little bit of sanity testing.
-        if ((false !== strpos($database,"'")) || (false !== strpos($database,";"))) {   
-            return PEAR::raiseError("Error: Database name contains a quote or semi-colon", null, PEAR_ERROR_DIE);
-        }
-        
-        $this->_database  = $database; 
-        
-        $this->_connect();
-        $table = trim($table);
-        
-        // a little bit of sanity testing.
-        if ((false !== strpos($table,"'")) || (false !== strpos($table,";"))) {   
-            return PEAR::raiseError("Error: Table contains a quote or semi-colon", null, PEAR_ERROR_DIE);
-        }
-        $__DB= &$GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'][$this->_database_dsn_md5];
-        
-        
-        $options   = PEAR::getStaticProperty('DB_DataObject','options');
-        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-        $is_MDB2   = ($db_driver != 'DB') ? true : false;
-        
-        if (!$is_MDB2) {
-            // try getting a list of schema tables first. (postgres)
-            $__DB->expectError(DB_ERROR_UNSUPPORTED);
-            $this->tables = $__DB->getListOf('schema.tables');
-            $__DB->popExpect();
-        } else {
-            /**
-             * set portability and some modules to fetch the informations
-             */
-            $__DB->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE);
-            $__DB->loadModule('Manager');
-            $__DB->loadModule('Reverse');
-        }
-        $quotedTable = !empty($options['quote_identifiers_tableinfo']) ? 
-                $__DB->quoteIdentifier($table) : $table;
-          
-        if (!$is_MDB2) {
-            $defs =  $__DB->tableInfo($quotedTable);
-        } else {
-            $defs =  $__DB->reverse->tableInfo($quotedTable);
-            foreach ($defs as $k => $v) {
-                if (!isset($defs[$k]['length'])) {
-                    continue;
-                }
-                $defs[$k]['len'] = $defs[$k]['length'];
-            }
-        }
-        
-         
-        
-        
-        if (PEAR::isError($defs)) {
-            return $defs;
-        }
-        if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) {
-            $this->debug("getting def for $database/$table",'fillTable');
-            $this->debug(print_r($defs,true),'defs');
-        }
-        // cast all definitions to objects - as we deal with that better.
-        
-            
-        foreach($defs as $def) {
-            if (is_array($def)) {
-                $this->_definitions[$table][] = (object) $def;
-            }
-        }
-
-        $this->table = trim($table);
-        $ret = $this->_generateDefinitionsTable();
-        
-        $_DB_DATAOBJECT['INI'][$database][$table] = $ret['table'];
-        $_DB_DATAOBJECT['INI'][$database][$table.'__keys'] = $ret['keys'];
-        return false;
-        
-    }
-    
-    /**
-    * Generate getter methods for class definition
-    *
-    * @param    string  $input  Existing class contents
-    * @return   string
-    * @access   public
-    */
-    function _generateGetters($input) 
-    {
-
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $getters = '';
-
-        // only generate if option is set to true
-        if  (empty($options['generate_getters'])) {
-            return '';
-        }
-
-        // remove auto-generated code from input to be able to check if the method exists outside of the auto-code
-        $input = preg_replace('/(\n|\r\n)\s*###START_AUTOCODE(\n|\r\n).*(\n|\r\n)\s*###END_AUTOCODE(\n|\r\n)/s', '', $input);
-
-        $getters .= "\n\n";
-        $defs     = $this->_definitions[$this->table];
-
-        // loop through properties and create getter methods
-        foreach ($defs = $defs as $t) {
-
-            // build mehtod name
-            $methodName = 'get' . $this->getMethodNameFromColumnName($t->name);
-
-            if (!strlen(trim($t->name)) || preg_match("/function[\s]+[&]?$methodName\(/i", $input)) {
-                continue;
-            }
-
-            $getters .= "   /**\n";
-            $getters .= "    * Getter for \${$t->name}\n";
-            $getters .= "    *\n";
-            $getters .= (stristr($t->flags, 'multiple_key')) ? "    * @return   object\n"
-                                                             : "    * @return   {$t->type}\n";
-            $getters .= "    * @access   public\n";
-            $getters .= "    */\n";
-            $getters .= (substr(phpversion(),0,1) > 4) ? '    public '
-                                                       : '    ';
-            $getters .= "function $methodName() {\n";
-            $getters .= "        return \$this->{$t->name};\n";
-            $getters .= "    }\n\n";
-        }
-   
-
-        return $getters;
-    }
-
-
-   /**
-    * Generate setter methods for class definition
-    *
-    * @param    string  Existing class contents
-    * @return   string
-    * @access   public
-    */
-    function _generateSetters($input) 
-    {
-
-        $options = &PEAR::getStaticProperty('DB_DataObject','options');
-        $setters = '';
-
-        // only generate if option is set to true
-        if  (empty($options['generate_setters'])) {
-            return '';
-        }
-
-        // remove auto-generated code from input to be able to check if the method exists outside of the auto-code
-        $input = preg_replace('/(\n|\r\n)\s*###START_AUTOCODE(\n|\r\n).*(\n|\r\n)\s*###END_AUTOCODE(\n|\r\n)/s', '', $input);
-
-        $setters .= "\n";
-        $defs     = $this->_definitions[$this->table];
-
-        // loop through properties and create setter methods
-        foreach ($defs = $defs as $t) {
-
-            // build mehtod name
-            $methodName = 'set' . $this->getMethodNameFromColumnName($t->name);
-
-            if (!strlen(trim($t->name)) || preg_match("/function[\s]+[&]?$methodName\(/i", $input)) {
-                continue;
-            }
-
-            $setters .= "   /**\n";
-            $setters .= "    * Setter for \${$t->name}\n";
-            $setters .= "    *\n";
-            $setters .= "    * @param    mixed   input value\n";
-            $setters .= "    * @access   public\n";
-            $setters .= "    */\n";
-            $setters .= (substr(phpversion(),0,1) > 4) ? '    public '
-                                                       : '    ';
-            $setters .= "function $methodName(\$value) {\n";
-            $setters .= "        \$this->{$t->name} = \$value;\n";
-            $setters .= "    }\n\n";
-        }
-        
-
-        return $setters;
-    }
-    /**
-    * Generate table Function - used when generator_no_ini is set.
-    *
-    * @param    array  table array.
-    * @return   string
-    * @access   public
-    */
-    function _generateTableFunction($def) 
-    {
-        $defines = explode(',','INT,STR,DATE,TIME,BOOL,TXT,BLOB,NOTNULL,MYSQLTIMESTAMP');
-    
-        $ret = "\n" .
-               "    function table()\n" .
-               "    {\n" .
-               "         return array(\n";
-        
-        foreach($def as $k=>$v) {
-            $str = '0';
-            foreach($defines as $dn) {
-                if ($v & constant('DB_DATAOBJECT_' . $dn)) {
-                    $str .= ' + DB_DATAOBJECT_' . $dn;
-                }
-            }
-            if (strlen($str) > 1) {
-                $str = substr($str,3); // strip the 0 +
-            }
-            // hopefully addslashes is good enough here!!!
-            $ret .= '             \''.addslashes($k).'\' => ' . $str . ",\n";
-        }
-        return $ret . "         );\n" .
-                      "    }\n";
-            
-    
-    
-    }
-    /**
-    * Generate keys Function - used generator_no_ini is set.
-    *
-    * @param    array  keys array.
-    * @return   string
-    * @access   public
-    */
-    function _generateKeysFunction($def) 
-    {
-         
-        $ret = "\n" .
-               "    function keys()\n" .
-               "    {\n" .
-               "         return array(";
-            
-        foreach($def as $k=>$type) {
-            // hopefully addslashes is good enough here!!!
-            $ret .= '\''.addslashes($k).'\', ';
-        }
-        $ret = preg_replace('#, $#', '', $ret);
-        return $ret . ");\n" .
-                      "    }\n";
-            
-    
-    
-    }
-    /**
-    * Generate sequenceKey Function - used generator_no_ini is set.
-    *
-    * @param    array  table and key definition.
-    * @return   string
-    * @access   public
-    */
-    function _generateSequenceKeyFunction($def)
-    {
-    
-        //print_r($def);
-        // DB_DataObject::debugLevel(5);
-        global $_DB_DATAOBJECT;
-        // print_r($def);
-        
-        
-        $dbtype     = $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['phptype'];
-        $realkeys   = $def['keys'];
-        $keys       = array_keys($realkeys);
-        $usekey     = isset($keys[0]) ? $keys[0] : false;
-        $table      = $def['table'];
-        
-         
-        $seqname = false;
-        
-        
-        
-        
-        $ar = array(false,false,false);
-        if ($usekey !== false) {
-            if (!empty($_DB_DATAOBJECT['CONFIG']['sequence_'.$this->__table])) {
-                $usekey = $_DB_DATAOBJECT['CONFIG']['sequence_'.$this->__table];
-                if (strpos($usekey,':') !== false) {
-                    list($usekey,$seqname) = explode(':',$usekey);
-                }
-            }  
-        
-            if (in_array($dbtype , array( 'mysql', 'mysqli', 'mssql', 'ifx')) && 
-                ($table[$usekey] & DB_DATAOBJECT_INT) && 
-                isset($realkeys[$usekey]) && ($realkeys[$usekey] == 'N')
-                ) {
-                // use native sequence keys.
-                $ar =  array($usekey,true,$seqname);
-            } else {
-                // use generated sequence keys..
-                if ($table[$usekey] & DB_DATAOBJECT_INT) {
-                    $ar = array($usekey,false,$seqname);
-                }
-            }
-        }
-    
-    
-      
-     
-        $ret = "\n" .
-               "    function sequenceKey() // keyname, use native, native name\n" .
-               "    {\n" .
-               "         return array(";
-        foreach($ar as $v) {
-            switch (gettype($v)) {
-                case 'boolean':
-                    $ret .= ($v ? 'true' : 'false') . ', ';
-                    break;
-                    
-                case 'string':
-                    $ret .= "'" . $v . "', ";
-                    break;
-                    
-                default:    // eak
-                    $ret .= "null, ";
-        
-            }
-        }
-        $ret = preg_replace('#, $#', '', $ret);
-        return $ret . ");\n" .
-                      "    }\n";
-        
-    }
-    /**
-    * Generate defaults Function - used generator_add_defaults or generator_no_ini is set.
-    * Only supports mysql and mysqli ... welcome ideas for more..
-    * 
-    *
-    * @param    array  table and key definition.
-    * @return   string
-    * @access   public
-    */
-    function _generateDefaultsFunction($table,$defs)
-    {
-        $__DB= &$GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'][$this->_database_dsn_md5];
-        if (!in_array($__DB->phptype, array('mysql','mysqli'))) {
-            return; // cant handle non-mysql introspection for defaults.
-        }
-        $options = PEAR::getStaticProperty('DB_DataObject','options'); 
-        $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
-        $method = $db_driver == 'DB' ? 'getAll' : 'queryAll'; 
-        $res = $__DB->$method('DESCRIBE ' . $table,DB_FETCHMODE_ASSOC);
-        $defaults = array();
-        foreach($res as $ar) {
-            // this is initially very dumb... -> and it may mess up..
-            $type = $defs[$ar['Field']];
-            
-            switch (true) {
-                
-                case (is_null( $ar['Default'])):
-                    $defaults[$ar['Field']]  = 'null';
-                    break;
-                
-                case ($type & DB_DATAOBJECT_DATE): 
-                case ($type & DB_DATAOBJECT_TIME): 
-                case ($type & DB_DATAOBJECT_MYSQLTIMESTAMP): // not supported yet..
-                    break;
-                    
-                case ($type & DB_DATAOBJECT_BOOL): 
-                    $defaults[$ar['Field']] = (int)(boolean) $ar['Default'];
-                    break;
-                    
-                
-                case ($type & DB_DATAOBJECT_STR): 
-                    $defaults[$ar['Field']] =  "'" . addslashes($ar['Default']) . "'";
-                    break;
-                
-                 
-                default:    // hopefully eveything else...  - numbers etc.
-                    if (!strlen($ar['Default'])) {
-                        continue;
-                    }
-                    if (is_numeric($ar['Default'])) {
-                        $defaults[$ar['Field']] =   $ar['Default'];
-                    }
-                    break;
-            
-            }
-            //var_dump(array($ar['Field'], $ar['Default'], $defaults[$ar['Field']]));
-        }
-        if (empty($defaults)) {
-            return;
-        }
-        
-        $ret = "\n" .
-               "    function defaults() // column default values \n" .
-               "    {\n" .
-               "         return array(\n";
-        foreach($defaults as $k=>$v) {
-            $ret .= '             \''.addslashes($k).'\' => ' . $v . ",\n";
-        }
-        return $ret . "         );\n" .
-                      "    }\n";
-         
-     
-    
-    
-    }
-    
-    
-     
-    
-    
-}
diff --git a/lib/php/DB/DataObject/createTables.php b/lib/php/DB/DataObject/createTables.php
deleted file mode 100644
index d54d28c245176b71e90a43baf9b97120ac9c590a..0000000000000000000000000000000000000000
--- a/lib/php/DB/DataObject/createTables.php
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/php -q
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license,      |
-// | that is bundled with this package in the file LICENSE, and is        |
-// | available at through the world-wide-web at                           |
-// | http://www.php.net/license/2_02.txt.                                 |
-// | If you did not receive a copy of the PHP license and are unable to   |
-// | obtain it through the world-wide-web, please send a note to          |
-// | license@php.net so we can mail you a copy immediately.               |
-// +----------------------------------------------------------------------+
-// | Author:  Alan Knowles <alan@akbkhome.com>
-// +----------------------------------------------------------------------+
-//
-// $Id: createTables.php 277015 2009-03-12 05:51:03Z alan_k $
-//
-
-// since this version doesnt use overload, 
-// and I assume anyone using custom generators should add this..
-
-define('DB_DATAOBJECT_NO_OVERLOAD',1);
-
-//require_once 'DB/DataObject/Generator.php';
-require_once 'DB/DataObject/Generator.php';
-
-if (!ini_get('register_argc_argv')) {
-    PEAR::raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE);
-    exit;
-}
-
-if (!@$_SERVER['argv'][1]) {
-    PEAR::raiseError("\nERROR: createTable.php usage:\n\nC:\php\pear\DB\DataObjects\createTable.php example.ini\n\n", null, PEAR_ERROR_DIE);
-    exit;
-}
-
-$config = parse_ini_file($_SERVER['argv'][1], true);
-foreach($config as $class=>$values) {
-    $options = &PEAR::getStaticProperty($class,'options');
-    $options = $values;
-}
-
-
-$options = &PEAR::getStaticProperty('DB_DataObject','options');
-if (empty($options)) {
-    PEAR::raiseError("\nERROR: could not read ini file\n\n", null, PEAR_ERROR_DIE);
-    exit;
-}
-set_time_limit(0);
-
-// use debug level from file if set..
-DB_DataObject::debugLevel(isset($options['debug']) ? $options['debug'] : 1);
-
-$generator = new DB_DataObject_Generator;
-$generator->start();
- 
diff --git a/lib/php/DB/common.php b/lib/php/DB/common.php
deleted file mode 100644
index 8d403126fd6e3fcbf6a771ea46734450adceee8e..0000000000000000000000000000000000000000
--- a/lib/php/DB/common.php
+++ /dev/null
@@ -1,2257 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Contains the DB_common base class
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: common.php,v 1.143 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the PEAR class so it can be extended from
- */
-require_once 'PEAR.php';
-
-/**
- * DB_common is the base class from which each database driver class extends
- *
- * All common methods are declared here.  If a given DBMS driver contains
- * a particular method, that method will overload the one here.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_common extends PEAR
-{
-    // {{{ properties
-
-    /**
-     * The current default fetch mode
-     * @var integer
-     */
-    var $fetchmode = DB_FETCHMODE_ORDERED;
-
-    /**
-     * The name of the class into which results should be fetched when
-     * DB_FETCHMODE_OBJECT is in effect
-     *
-     * @var string
-     */
-    var $fetchmode_object_class = 'stdClass';
-
-    /**
-     * Was a connection present when the object was serialized()?
-     * @var bool
-     * @see DB_common::__sleep(), DB_common::__wake()
-     */
-    var $was_connected = null;
-
-    /**
-     * The most recently executed query
-     * @var string
-     */
-    var $last_query = '';
-
-    /**
-     * Run-time configuration options
-     *
-     * The 'optimize' option has been deprecated.  Use the 'portability'
-     * option instead.
-     *
-     * @var array
-     * @see DB_common::setOption()
-     */
-    var $options = array(
-        'result_buffering' => 500,
-        'persistent' => false,
-        'ssl' => false,
-        'debug' => 0,
-        'seqname_format' => '%s_seq',
-        'autofree' => false,
-        'portability' => DB_PORTABILITY_NONE,
-        'optimize' => 'performance',  // Deprecated.  Use 'portability'.
-    );
-
-    /**
-     * The parameters from the most recently executed query
-     * @var array
-     * @since Property available since Release 1.7.0
-     */
-    var $last_parameters = array();
-
-    /**
-     * The elements from each prepared statement
-     * @var array
-     */
-    var $prepare_tokens = array();
-
-    /**
-     * The data types of the various elements in each prepared statement
-     * @var array
-     */
-    var $prepare_types = array();
-
-    /**
-     * The prepared queries
-     * @var array
-     */
-    var $prepared_queries = array();
-
-    /**
-     * Flag indicating that the last query was a manipulation query.
-     * @access protected
-     * @var boolean
-     */
-    var $_last_query_manip = false;
-
-    /**
-     * Flag indicating that the next query <em>must</em> be a manipulation
-     * query.
-     * @access protected
-     * @var boolean
-     */
-    var $_next_query_manip = false;
-
-
-    // }}}
-    // {{{ DB_common
-
-    /**
-     * This constructor calls <kbd>$this->PEAR('DB_Error')</kbd>
-     *
-     * @return void
-     */
-    function DB_common()
-    {
-        $this->PEAR('DB_Error');
-    }
-
-    // }}}
-    // {{{ __sleep()
-
-    /**
-     * Automatically indicates which properties should be saved
-     * when PHP's serialize() function is called
-     *
-     * @return array  the array of properties names that should be saved
-     */
-    function __sleep()
-    {
-        if ($this->connection) {
-            // Don't disconnect(), people use serialize() for many reasons
-            $this->was_connected = true;
-        } else {
-            $this->was_connected = false;
-        }
-        if (isset($this->autocommit)) {
-            return array('autocommit',
-                         'dbsyntax',
-                         'dsn',
-                         'features',
-                         'fetchmode',
-                         'fetchmode_object_class',
-                         'options',
-                         'was_connected',
-                   );
-        } else {
-            return array('dbsyntax',
-                         'dsn',
-                         'features',
-                         'fetchmode',
-                         'fetchmode_object_class',
-                         'options',
-                         'was_connected',
-                   );
-        }
-    }
-
-    // }}}
-    // {{{ __wakeup()
-
-    /**
-     * Automatically reconnects to the database when PHP's unserialize()
-     * function is called
-     *
-     * The reconnection attempt is only performed if the object was connected
-     * at the time PHP's serialize() function was run.
-     *
-     * @return void
-     */
-    function __wakeup()
-    {
-        if ($this->was_connected) {
-            $this->connect($this->dsn, $this->options);
-        }
-    }
-
-    // }}}
-    // {{{ __toString()
-
-    /**
-     * Automatic string conversion for PHP 5
-     *
-     * @return string  a string describing the current PEAR DB object
-     *
-     * @since Method available since Release 1.7.0
-     */
-    function __toString()
-    {
-        $info = strtolower(get_class($this));
-        $info .=  ': (phptype=' . $this->phptype .
-                  ', dbsyntax=' . $this->dbsyntax .
-                  ')';
-        if ($this->connection) {
-            $info .= ' [connected]';
-        }
-        return $info;
-    }
-
-    // }}}
-    // {{{ toString()
-
-    /**
-     * DEPRECATED:  String conversion method
-     *
-     * @return string  a string describing the current PEAR DB object
-     *
-     * @deprecated Method deprecated in Release 1.7.0
-     */
-    function toString()
-    {
-        return $this->__toString();
-    }
-
-    // }}}
-    // {{{ quoteString()
-
-    /**
-     * DEPRECATED: Quotes a string so it can be safely used within string
-     * delimiters in a query
-     *
-     * @param string $string  the string to be quoted
-     *
-     * @return string  the quoted string
-     *
-     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
-     * @deprecated Method deprecated some time before Release 1.2
-     */
-    function quoteString($string)
-    {
-        $string = $this->quote($string);
-        if ($string{0} == "'") {
-            return substr($string, 1, -1);
-        }
-        return $string;
-    }
-
-    // }}}
-    // {{{ quote()
-
-    /**
-     * DEPRECATED: Quotes a string so it can be safely used in a query
-     *
-     * @param string $string  the string to quote
-     *
-     * @return string  the quoted string or the string <samp>NULL</samp>
-     *                  if the value submitted is <kbd>null</kbd>.
-     *
-     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
-     * @deprecated Deprecated in release 1.6.0
-     */
-    function quote($string = null)
-    {
-        return ($string === null) ? 'NULL'
-                                  : "'" . str_replace("'", "''", $string) . "'";
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * Quotes a string so it can be safely used as a table or column name
-     *
-     * Delimiting style depends on which database driver is being used.
-     *
-     * NOTE: just because you CAN use delimited identifiers doesn't mean
-     * you SHOULD use them.  In general, they end up causing way more
-     * problems than they solve.
-     *
-     * Portability is broken by using the following characters inside
-     * delimited identifiers:
-     *   + backtick (<kbd>`</kbd>) -- due to MySQL
-     *   + double quote (<kbd>"</kbd>) -- due to Oracle
-     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
-     *
-     * Delimited identifiers are known to generally work correctly under
-     * the following drivers:
-     *   + mssql
-     *   + mysql
-     *   + mysqli
-     *   + oci8
-     *   + odbc(access)
-     *   + odbc(db2)
-     *   + pgsql
-     *   + sqlite
-     *   + sybase (must execute <kbd>set quoted_identifier on</kbd> sometime
-     *     prior to use)
-     *
-     * InterBase doesn't seem to be able to use delimited identifiers
-     * via PHP 4.  They work fine under PHP 5.
-     *
-     * @param string $str  the identifier name to be quoted
-     *
-     * @return string  the quoted identifier
-     *
-     * @since Method available since Release 1.6.0
-     */
-    function quoteIdentifier($str)
-    {
-        return '"' . str_replace('"', '""', $str) . '"';
-    }
-
-    // }}}
-    // {{{ quoteSmart()
-
-    /**
-     * Formats input so it can be safely used in a query
-     *
-     * The output depends on the PHP data type of input and the database
-     * type being used.
-     *
-     * @param mixed $in  the data to be formatted
-     *
-     * @return mixed  the formatted data.  The format depends on the input's
-     *                 PHP type:
-     * <ul>
-     *  <li>
-     *    <kbd>input</kbd> -> <samp>returns</samp>
-     *  </li>
-     *  <li>
-     *    <kbd>null</kbd> -> the string <samp>NULL</samp>
-     *  </li>
-     *  <li>
-     *    <kbd>integer</kbd> or <kbd>double</kbd> -> the unquoted number
-     *  </li>
-     *  <li>
-     *    <kbd>bool</kbd> -> output depends on the driver in use
-     *    Most drivers return integers: <samp>1</samp> if
-     *    <kbd>true</kbd> or <samp>0</samp> if
-     *    <kbd>false</kbd>.
-     *    Some return strings: <samp>TRUE</samp> if
-     *    <kbd>true</kbd> or <samp>FALSE</samp> if
-     *    <kbd>false</kbd>.
-     *    Finally one returns strings: <samp>T</samp> if
-     *    <kbd>true</kbd> or <samp>F</samp> if
-     *    <kbd>false</kbd>. Here is a list of each DBMS,
-     *    the values returned and the suggested column type:
-     *    <ul>
-     *      <li>
-     *        <kbd>dbase</kbd> -> <samp>T/F</samp>
-     *        (<kbd>Logical</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>fbase</kbd> -> <samp>TRUE/FALSE</samp>
-     *        (<kbd>BOOLEAN</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>ibase</kbd> -> <samp>1/0</samp>
-     *        (<kbd>SMALLINT</kbd>) [1]
-     *      </li>
-     *      <li>
-     *        <kbd>ifx</kbd> -> <samp>1/0</samp>
-     *        (<kbd>SMALLINT</kbd>) [1]
-     *      </li>
-     *      <li>
-     *        <kbd>msql</kbd> -> <samp>1/0</samp>
-     *        (<kbd>INTEGER</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>mssql</kbd> -> <samp>1/0</samp>
-     *        (<kbd>BIT</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>mysql</kbd> -> <samp>1/0</samp>
-     *        (<kbd>TINYINT(1)</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>mysqli</kbd> -> <samp>1/0</samp>
-     *        (<kbd>TINYINT(1)</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>oci8</kbd> -> <samp>1/0</samp>
-     *        (<kbd>NUMBER(1)</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>odbc</kbd> -> <samp>1/0</samp>
-     *        (<kbd>SMALLINT</kbd>) [1]
-     *      </li>
-     *      <li>
-     *        <kbd>pgsql</kbd> -> <samp>TRUE/FALSE</samp>
-     *        (<kbd>BOOLEAN</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>sqlite</kbd> -> <samp>1/0</samp>
-     *        (<kbd>INTEGER</kbd>)
-     *      </li>
-     *      <li>
-     *        <kbd>sybase</kbd> -> <samp>1/0</samp>
-     *        (<kbd>TINYINT(1)</kbd>)
-     *      </li>
-     *    </ul>
-     *    [1] Accommodate the lowest common denominator because not all
-     *    versions of have <kbd>BOOLEAN</kbd>.
-     *  </li>
-     *  <li>
-     *    other (including strings and numeric strings) ->
-     *    the data with single quotes escaped by preceeding
-     *    single quotes, backslashes are escaped by preceeding
-     *    backslashes, then the whole string is encapsulated
-     *    between single quotes
-     *  </li>
-     * </ul>
-     *
-     * @see DB_common::escapeSimple()
-     * @since Method available since Release 1.6.0
-     */
-    function quoteSmart($in)
-    {
-        if (is_int($in)) {
-            return $in;
-        } elseif (is_float($in)) {
-            return $this->quoteFloat($in);
-        } elseif (is_bool($in)) {
-            return $this->quoteBoolean($in);
-        } elseif (is_null($in)) {
-            return 'NULL';
-        } else {
-            if ($this->dbsyntax == 'access'
-                && preg_match('/^#.+#$/', $in))
-            {
-                return $this->escapeSimple($in);
-            }
-            return "'" . $this->escapeSimple($in) . "'";
-        }
-    }
-
-    // }}}
-    // {{{ quoteBoolean()
-
-    /**
-     * Formats a boolean value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param boolean the boolean value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteBoolean($boolean) {
-        return $boolean ? '1' : '0';
-    }
-     
-    // }}}
-    // {{{ quoteFloat()
-
-    /**
-     * Formats a float value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param float the float value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteFloat($float) {
-        return "'".$this->escapeSimple(str_replace(',', '.', strval(floatval($float))))."'";
-    }
-     
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * In SQLite, this makes things safe for inserts/updates, but may
-     * cause problems when performing text comparisons against columns
-     * containing binary data. See the
-     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @see DB_common::quoteSmart()
-     * @since Method available since Release 1.6.0
-     */
-    function escapeSimple($str)
-    {
-        return str_replace("'", "''", $str);
-    }
-
-    // }}}
-    // {{{ provides()
-
-    /**
-     * Tells whether the present driver supports a given feature
-     *
-     * @param string $feature  the feature you're curious about
-     *
-     * @return bool  whether this driver supports $feature
-     */
-    function provides($feature)
-    {
-        return $this->features[$feature];
-    }
-
-    // }}}
-    // {{{ setFetchMode()
-
-    /**
-     * Sets the fetch mode that should be used by default for query results
-     *
-     * @param integer $fetchmode    DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
-     *                               or DB_FETCHMODE_OBJECT
-     * @param string $object_class  the class name of the object to be returned
-     *                               by the fetch methods when the
-     *                               DB_FETCHMODE_OBJECT mode is selected.
-     *                               If no class is specified by default a cast
-     *                               to object from the assoc array row will be
-     *                               done.  There is also the posibility to use
-     *                               and extend the 'DB_row' class.
-     *
-     * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
-     */
-    function setFetchMode($fetchmode, $object_class = 'stdClass')
-    {
-        switch ($fetchmode) {
-            case DB_FETCHMODE_OBJECT:
-                $this->fetchmode_object_class = $object_class;
-            case DB_FETCHMODE_ORDERED:
-            case DB_FETCHMODE_ASSOC:
-                $this->fetchmode = $fetchmode;
-                break;
-            default:
-                return $this->raiseError('invalid fetchmode mode');
-        }
-    }
-
-    // }}}
-    // {{{ setOption()
-
-    /**
-     * Sets run-time configuration options for PEAR DB
-     *
-     * Options, their data types, default values and description:
-     * <ul>
-     * <li>
-     * <var>autofree</var> <kbd>boolean</kbd> = <samp>false</samp>
-     *      <br />should results be freed automatically when there are no
-     *            more rows?
-     * </li><li>
-     * <var>result_buffering</var> <kbd>integer</kbd> = <samp>500</samp>
-     *      <br />how many rows of the result set should be buffered?
-     *      <br />In mysql: mysql_unbuffered_query() is used instead of
-     *            mysql_query() if this value is 0.  (Release 1.7.0)
-     *      <br />In oci8: this value is passed to ocisetprefetch().
-     *            (Release 1.7.0)
-     * </li><li>
-     * <var>debug</var> <kbd>integer</kbd> = <samp>0</samp>
-     *      <br />debug level
-     * </li><li>
-     * <var>persistent</var> <kbd>boolean</kbd> = <samp>false</samp>
-     *      <br />should the connection be persistent?
-     * </li><li>
-     * <var>portability</var> <kbd>integer</kbd> = <samp>DB_PORTABILITY_NONE</samp>
-     *      <br />portability mode constant (see below)
-     * </li><li>
-     * <var>seqname_format</var> <kbd>string</kbd> = <samp>%s_seq</samp>
-     *      <br />the sprintf() format string used on sequence names.  This
-     *            format is applied to sequence names passed to
-     *            createSequence(), nextID() and dropSequence().
-     * </li><li>
-     * <var>ssl</var> <kbd>boolean</kbd> = <samp>false</samp>
-     *      <br />use ssl to connect?
-     * </li>
-     * </ul>
-     *
-     * -----------------------------------------
-     *
-     * PORTABILITY MODES
-     *
-     * These modes are bitwised, so they can be combined using <kbd>|</kbd>
-     * and removed using <kbd>^</kbd>.  See the examples section below on how
-     * to do this.
-     *
-     * <samp>DB_PORTABILITY_NONE</samp>
-     * turn off all portability features
-     *
-     * This mode gets automatically turned on if the deprecated
-     * <var>optimize</var> option gets set to <samp>performance</samp>.
-     *
-     *
-     * <samp>DB_PORTABILITY_LOWERCASE</samp>
-     * convert names of tables and fields to lower case when using
-     * <kbd>get*()</kbd>, <kbd>fetch*()</kbd> and <kbd>tableInfo()</kbd>
-     *
-     * This mode gets automatically turned on in the following databases
-     * if the deprecated option <var>optimize</var> gets set to
-     * <samp>portability</samp>:
-     * + oci8
-     *
-     *
-     * <samp>DB_PORTABILITY_RTRIM</samp>
-     * right trim the data output by <kbd>get*()</kbd> <kbd>fetch*()</kbd>
-     *
-     *
-     * <samp>DB_PORTABILITY_DELETE_COUNT</samp>
-     * force reporting the number of rows deleted
-     *
-     * Some DBMS's don't count the number of rows deleted when performing
-     * simple <kbd>DELETE FROM tablename</kbd> queries.  This portability
-     * mode tricks such DBMS's into telling the count by adding
-     * <samp>WHERE 1=1</samp> to the end of <kbd>DELETE</kbd> queries.
-     *
-     * This mode gets automatically turned on in the following databases
-     * if the deprecated option <var>optimize</var> gets set to
-     * <samp>portability</samp>:
-     * + fbsql
-     * + mysql
-     * + mysqli
-     * + sqlite
-     *
-     *
-     * <samp>DB_PORTABILITY_NUMROWS</samp>
-     * enable hack that makes <kbd>numRows()</kbd> work in Oracle
-     *
-     * This mode gets automatically turned on in the following databases
-     * if the deprecated option <var>optimize</var> gets set to
-     * <samp>portability</samp>:
-     * + oci8
-     *
-     *
-     * <samp>DB_PORTABILITY_ERRORS</samp>
-     * makes certain error messages in certain drivers compatible
-     * with those from other DBMS's
-     *
-     * + mysql, mysqli:  change unique/primary key constraints
-     *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
-     *
-     * + odbc(access):  MS's ODBC driver reports 'no such field' as code
-     *   07001, which means 'too few parameters.'  When this option is on
-     *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
-     *   DB_ERROR_MISMATCH -> DB_ERROR_NOSUCHFIELD
-     *
-     * <samp>DB_PORTABILITY_NULL_TO_EMPTY</samp>
-     * convert null values to empty strings in data output by get*() and
-     * fetch*().  Needed because Oracle considers empty strings to be null,
-     * while most other DBMS's know the difference between empty and null.
-     *
-     *
-     * <samp>DB_PORTABILITY_ALL</samp>
-     * turn on all portability features
-     *
-     * -----------------------------------------
-     *
-     * Example 1. Simple setOption() example
-     * <code>
-     * $db->setOption('autofree', true);
-     * </code>
-     *
-     * Example 2. Portability for lowercasing and trimming
-     * <code>
-     * $db->setOption('portability',
-     *                 DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM);
-     * </code>
-     *
-     * Example 3. All portability options except trimming
-     * <code>
-     * $db->setOption('portability',
-     *                 DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
-     * </code>
-     *
-     * @param string $option option name
-     * @param mixed  $value value for the option
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::$options
-     */
-    function setOption($option, $value)
-    {
-        if (isset($this->options[$option])) {
-            $this->options[$option] = $value;
-
-            /*
-             * Backwards compatibility check for the deprecated 'optimize'
-             * option.  Done here in case settings change after connecting.
-             */
-            if ($option == 'optimize') {
-                if ($value == 'portability') {
-                    switch ($this->phptype) {
-                        case 'oci8':
-                            $this->options['portability'] =
-                                    DB_PORTABILITY_LOWERCASE |
-                                    DB_PORTABILITY_NUMROWS;
-                            break;
-                        case 'fbsql':
-                        case 'mysql':
-                        case 'mysqli':
-                        case 'sqlite':
-                            $this->options['portability'] =
-                                    DB_PORTABILITY_DELETE_COUNT;
-                            break;
-                    }
-                } else {
-                    $this->options['portability'] = DB_PORTABILITY_NONE;
-                }
-            }
-
-            return DB_OK;
-        }
-        return $this->raiseError("unknown option $option");
-    }
-
-    // }}}
-    // {{{ getOption()
-
-    /**
-     * Returns the value of an option
-     *
-     * @param string $option  the option name you're curious about
-     *
-     * @return mixed  the option's value
-     */
-    function getOption($option)
-    {
-        if (isset($this->options[$option])) {
-            return $this->options[$option];
-        }
-        return $this->raiseError("unknown option $option");
-    }
-
-    // }}}
-    // {{{ prepare()
-
-    /**
-     * Prepares a query for multiple execution with execute()
-     *
-     * Creates a query that can be run multiple times.  Each time it is run,
-     * the placeholders, if any, will be replaced by the contents of
-     * execute()'s $data argument.
-     *
-     * Three types of placeholders can be used:
-     *   + <kbd>?</kbd>  scalar value (i.e. strings, integers).  The system
-     *                   will automatically quote and escape the data.
-     *   + <kbd>!</kbd>  value is inserted 'as is'
-     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
-     *                   inserted into the query (i.e. saving binary
-     *                   data in a db)
-     *
-     * Example 1.
-     * <code>
-     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
-     * $data = array(
-     *     "John's text",
-     *     "'it''s good'",
-     *     'filename.txt'
-     * );
-     * $res = $db->execute($sth, $data);
-     * </code>
-     *
-     * Use backslashes to escape placeholder characters if you don't want
-     * them to be interpreted as placeholders:
-     * <pre>
-     *    "UPDATE foo SET col=? WHERE col='over \& under'"
-     * </pre>
-     *
-     * With some database backends, this is emulated.
-     *
-     * {@internal ibase and oci8 have their own prepare() methods.}}
-     *
-     * @param string $query  the query to be prepared
-     *
-     * @return mixed  DB statement resource on success. A DB_Error object
-     *                 on failure.
-     *
-     * @see DB_common::execute()
-     */
-    function prepare($query)
-    {
-        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
-                               PREG_SPLIT_DELIM_CAPTURE);
-        $token     = 0;
-        $types     = array();
-        $newtokens = array();
-
-        foreach ($tokens as $val) {
-            switch ($val) {
-                case '?':
-                    $types[$token++] = DB_PARAM_SCALAR;
-                    break;
-                case '&':
-                    $types[$token++] = DB_PARAM_OPAQUE;
-                    break;
-                case '!':
-                    $types[$token++] = DB_PARAM_MISC;
-                    break;
-                default:
-                    $newtokens[] = preg_replace('/\\\([&?!])/', "\\1", $val);
-            }
-        }
-
-        $this->prepare_tokens[] = &$newtokens;
-        end($this->prepare_tokens);
-
-        $k = key($this->prepare_tokens);
-        $this->prepare_types[$k] = $types;
-        $this->prepared_queries[$k] = implode(' ', $newtokens);
-
-        return $k;
-    }
-
-    // }}}
-    // {{{ autoPrepare()
-
-    /**
-     * Automaticaly generates an insert or update query and pass it to prepare()
-     *
-     * @param string $table         the table name
-     * @param array  $table_fields  the array of field names
-     * @param int    $mode          a type of query to make:
-     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
-     * @param string $where         for update queries: the WHERE clause to
-     *                               append to the SQL statement.  Don't
-     *                               include the "WHERE" keyword.
-     *
-     * @return resource  the query handle
-     *
-     * @uses DB_common::prepare(), DB_common::buildManipSQL()
-     */
-    function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT,
-                         $where = false)
-    {
-        $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
-        if (DB::isError($query)) {
-            return $query;
-        }
-        return $this->prepare($query);
-    }
-
-    // }}}
-    // {{{ autoExecute()
-
-    /**
-     * Automaticaly generates an insert or update query and call prepare()
-     * and execute() with it
-     *
-     * @param string $table         the table name
-     * @param array  $fields_values the associative array where $key is a
-     *                               field name and $value its value
-     * @param int    $mode          a type of query to make:
-     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
-     * @param string $where         for update queries: the WHERE clause to
-     *                               append to the SQL statement.  Don't
-     *                               include the "WHERE" keyword.
-     *
-     * @return mixed  a new DB_result object for successful SELECT queries
-     *                 or DB_OK for successul data manipulation queries.
-     *                 A DB_Error object on failure.
-     *
-     * @uses DB_common::autoPrepare(), DB_common::execute()
-     */
-    function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT,
-                         $where = false)
-    {
-        $sth = $this->autoPrepare($table, array_keys($fields_values), $mode,
-                                  $where);
-        if (DB::isError($sth)) {
-            return $sth;
-        }
-        $ret = $this->execute($sth, array_values($fields_values));
-        $this->freePrepared($sth);
-        return $ret;
-
-    }
-
-    // }}}
-    // {{{ buildManipSQL()
-
-    /**
-     * Produces an SQL query string for autoPrepare()
-     *
-     * Example:
-     * <pre>
-     * buildManipSQL('table_sql', array('field1', 'field2', 'field3'),
-     *               DB_AUTOQUERY_INSERT);
-     * </pre>
-     *
-     * That returns
-     * <samp>
-     * INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
-     * </samp>
-     *
-     * NOTES:
-     *   - This belongs more to a SQL Builder class, but this is a simple
-     *     facility.
-     *   - Be carefull! If you don't give a $where param with an UPDATE
-     *     query, all the records of the table will be updated!
-     *
-     * @param string $table         the table name
-     * @param array  $table_fields  the array of field names
-     * @param int    $mode          a type of query to make:
-     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
-     * @param string $where         for update queries: the WHERE clause to
-     *                               append to the SQL statement.  Don't
-     *                               include the "WHERE" keyword.
-     *
-     * @return string  the sql query for autoPrepare()
-     */
-    function buildManipSQL($table, $table_fields, $mode, $where = false)
-    {
-        if (count($table_fields) == 0) {
-            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-        $first = true;
-        switch ($mode) {
-            case DB_AUTOQUERY_INSERT:
-                $values = '';
-                $names = '';
-                foreach ($table_fields as $value) {
-                    if ($first) {
-                        $first = false;
-                    } else {
-                        $names .= ',';
-                        $values .= ',';
-                    }
-                    $names .= $value;
-                    $values .= '?';
-                }
-                return "INSERT INTO $table ($names) VALUES ($values)";
-            case DB_AUTOQUERY_UPDATE:
-                $set = '';
-                foreach ($table_fields as $value) {
-                    if ($first) {
-                        $first = false;
-                    } else {
-                        $set .= ',';
-                    }
-                    $set .= "$value = ?";
-                }
-                $sql = "UPDATE $table SET $set";
-                if ($where) {
-                    $sql .= " WHERE $where";
-                }
-                return $sql;
-            default:
-                return $this->raiseError(DB_ERROR_SYNTAX);
-        }
-    }
-
-    // }}}
-    // {{{ execute()
-
-    /**
-     * Executes a DB statement prepared with prepare()
-     *
-     * Example 1.
-     * <code>
-     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
-     * $data = array(
-     *     "John's text",
-     *     "'it''s good'",
-     *     'filename.txt'
-     * );
-     * $res = $db->execute($sth, $data);
-     * </code>
-     *
-     * @param resource $stmt  a DB statement resource returned from prepare()
-     * @param mixed    $data  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return mixed  a new DB_result object for successful SELECT queries
-     *                 or DB_OK for successul data manipulation queries.
-     *                 A DB_Error object on failure.
-     *
-     * {@internal ibase and oci8 have their own execute() methods.}}
-     *
-     * @see DB_common::prepare()
-     */
-    function &execute($stmt, $data = array())
-    {
-        $realquery = $this->executeEmulateQuery($stmt, $data);
-        if (DB::isError($realquery)) {
-            return $realquery;
-        }
-        $result = $this->simpleQuery($realquery);
-
-        if ($result === DB_OK || DB::isError($result)) {
-            return $result;
-        } else {
-            $tmp = new DB_result($this, $result);
-            return $tmp;
-        }
-    }
-
-    // }}}
-    // {{{ executeEmulateQuery()
-
-    /**
-     * Emulates executing prepared statements if the DBMS not support them
-     *
-     * @param resource $stmt  a DB statement resource returned from execute()
-     * @param mixed    $data  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return mixed  a string containing the real query run when emulating
-     *                 prepare/execute.  A DB_Error object on failure.
-     *
-     * @access protected
-     * @see DB_common::execute()
-     */
-    function executeEmulateQuery($stmt, $data = array())
-    {
-        $stmt = (int)$stmt;
-        $data = (array)$data;
-        $this->last_parameters = $data;
-
-        if (count($this->prepare_types[$stmt]) != count($data)) {
-            $this->last_query = $this->prepared_queries[$stmt];
-            return $this->raiseError(DB_ERROR_MISMATCH);
-        }
-
-        $realquery = $this->prepare_tokens[$stmt][0];
-
-        $i = 0;
-        foreach ($data as $value) {
-            if ($this->prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {
-                $realquery .= $this->quoteSmart($value);
-            } elseif ($this->prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {
-                $fp = @fopen($value, 'rb');
-                if (!$fp) {
-                    return $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
-                }
-                $realquery .= $this->quoteSmart(fread($fp, filesize($value)));
-                fclose($fp);
-            } else {
-                $realquery .= $value;
-            }
-
-            $realquery .= $this->prepare_tokens[$stmt][++$i];
-        }
-
-        return $realquery;
-    }
-
-    // }}}
-    // {{{ executeMultiple()
-
-    /**
-     * Performs several execute() calls on the same statement handle
-     *
-     * $data must be an array indexed numerically
-     * from 0, one execute call is done for every "row" in the array.
-     *
-     * If an error occurs during execute(), executeMultiple() does not
-     * execute the unfinished rows, but rather returns that error.
-     *
-     * @param resource $stmt  query handle from prepare()
-     * @param array    $data  numeric array containing the
-     *                         data to insert into the query
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::prepare(), DB_common::execute()
-     */
-    function executeMultiple($stmt, $data)
-    {
-        foreach ($data as $value) {
-            $res = $this->execute($stmt, $value);
-            if (DB::isError($res)) {
-                return $res;
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freePrepared()
-
-    /**
-     * Frees the internal resources associated with a prepared query
-     *
-     * @param resource $stmt           the prepared statement's PHP resource
-     * @param bool     $free_resource  should the PHP resource be freed too?
-     *                                  Use false if you need to get data
-     *                                  from the result set later.
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_common::prepare()
-     */
-    function freePrepared($stmt, $free_resource = true)
-    {
-        $stmt = (int)$stmt;
-        if (isset($this->prepare_tokens[$stmt])) {
-            unset($this->prepare_tokens[$stmt]);
-            unset($this->prepare_types[$stmt]);
-            unset($this->prepared_queries[$stmt]);
-            return true;
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ modifyQuery()
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * It is defined here to ensure all drivers have this method available.
-     *
-     * @param string $query  the query string to modify
-     *
-     * @return string  the modified query string
-     *
-     * @access protected
-     * @see DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),
-     *      DB_sqlite::modifyQuery()
-     */
-    function modifyQuery($query)
-    {
-        return $query;
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * It is defined here to assure that all implementations
-     * have this method defined.
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        return $query;
-    }
-
-    // }}}
-    // {{{ query()
-
-    /**
-     * Sends a query to the database server
-     *
-     * The query string can be either a normal statement to be sent directly
-     * to the server OR if <var>$params</var> are passed the query can have
-     * placeholders and it will be passed through prepare() and execute().
-     *
-     * @param string $query   the SQL query or the statement to prepare
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return mixed  a new DB_result object for successful SELECT queries
-     *                 or DB_OK for successul data manipulation queries.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_result, DB_common::prepare(), DB_common::execute()
-     */
-    function &query($query, $params = array())
-    {
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-            $ret = $this->execute($sth, $params);
-            $this->freePrepared($sth, false);
-            return $ret;
-        } else {
-            $this->last_parameters = array();
-            $result = $this->simpleQuery($query);
-            if ($result === DB_OK || DB::isError($result)) {
-                return $result;
-            } else {
-                $tmp = new DB_result($this, $result);
-                return $tmp;
-            }
-        }
-    }
-
-    // }}}
-    // {{{ limitQuery()
-
-    /**
-     * Generates and executes a LIMIT query
-     *
-     * @param string $query   the query
-     * @param intr   $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return mixed  a new DB_result object for successful SELECT queries
-     *                 or DB_OK for successul data manipulation queries.
-     *                 A DB_Error object on failure.
-     */
-    function &limitQuery($query, $from, $count, $params = array())
-    {
-        $query = $this->modifyLimitQuery($query, $from, $count, $params);
-        if (DB::isError($query)){
-            return $query;
-        }
-        $result = $this->query($query, $params);
-        if (is_a($result, 'DB_result')) {
-            $result->setOption('limit_from', $from);
-            $result->setOption('limit_count', $count);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ getOne()
-
-    /**
-     * Fetches the first column of the first row from a query result
-     *
-     * Takes care of doing the query and freeing the results when finished.
-     *
-     * @param string $query   the SQL query
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return mixed  the returned value of the query.
-     *                 A DB_Error object on failure.
-     */
-    function &getOne($query, $params = array())
-    {
-        $params = (array)$params;
-        // modifyLimitQuery() would be nice here, but it causes BC issues
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-            $res = $this->execute($sth, $params);
-            $this->freePrepared($sth);
-        } else {
-            $res = $this->query($query);
-        }
-
-        if (DB::isError($res)) {
-            return $res;
-        }
-
-        $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED);
-        $res->free();
-
-        if ($err !== DB_OK) {
-            return $err;
-        }
-
-        return $row[0];
-    }
-
-    // }}}
-    // {{{ getRow()
-
-    /**
-     * Fetches the first row of data returned from a query result
-     *
-     * Takes care of doing the query and freeing the results when finished.
-     *
-     * @param string $query   the SQL query
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     * @param int $fetchmode  the fetch mode to use
-     *
-     * @return array  the first row of results as an array.
-     *                 A DB_Error object on failure.
-     */
-    function &getRow($query, $params = array(),
-                     $fetchmode = DB_FETCHMODE_DEFAULT)
-    {
-        // compat check, the params and fetchmode parameters used to
-        // have the opposite order
-        if (!is_array($params)) {
-            if (is_array($fetchmode)) {
-                if ($params === null) {
-                    $tmp = DB_FETCHMODE_DEFAULT;
-                } else {
-                    $tmp = $params;
-                }
-                $params = $fetchmode;
-                $fetchmode = $tmp;
-            } elseif ($params !== null) {
-                $fetchmode = $params;
-                $params = array();
-            }
-        }
-        // modifyLimitQuery() would be nice here, but it causes BC issues
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-            $res = $this->execute($sth, $params);
-            $this->freePrepared($sth);
-        } else {
-            $res = $this->query($query);
-        }
-
-        if (DB::isError($res)) {
-            return $res;
-        }
-
-        $err = $res->fetchInto($row, $fetchmode);
-
-        $res->free();
-
-        if ($err !== DB_OK) {
-            return $err;
-        }
-
-        return $row;
-    }
-
-    // }}}
-    // {{{ getCol()
-
-    /**
-     * Fetches a single column from a query result and returns it as an
-     * indexed array
-     *
-     * @param string $query   the SQL query
-     * @param mixed  $col     which column to return (integer [column number,
-     *                         starting at 0] or string [column name])
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return array  the results as an array.  A DB_Error object on failure.
-     *
-     * @see DB_common::query()
-     */
-    function &getCol($query, $col = 0, $params = array())
-    {
-        $params = (array)$params;
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-
-            $res = $this->execute($sth, $params);
-            $this->freePrepared($sth);
-        } else {
-            $res = $this->query($query);
-        }
-
-        if (DB::isError($res)) {
-            return $res;
-        }
-
-        $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;
-
-        if (!is_array($row = $res->fetchRow($fetchmode))) {
-            $ret = array();
-        } else {
-            if (!array_key_exists($col, $row)) {
-                $ret = $this->raiseError(DB_ERROR_NOSUCHFIELD);
-            } else {
-                $ret = array($row[$col]);
-                while (is_array($row = $res->fetchRow($fetchmode))) {
-                    $ret[] = $row[$col];
-                }
-            }
-        }
-
-        $res->free();
-
-        if (DB::isError($row)) {
-            $ret = $row;
-        }
-
-        return $ret;
-    }
-
-    // }}}
-    // {{{ getAssoc()
-
-    /**
-     * Fetches an entire query result and returns it as an
-     * associative array using the first column as the key
-     *
-     * If the result set contains more than two columns, the value
-     * will be an array of the values from column 2-n.  If the result
-     * set contains only two columns, the returned value will be a
-     * scalar with the value of the second column (unless forced to an
-     * array with the $force_array parameter).  A DB error code is
-     * returned on errors.  If the result set contains fewer than two
-     * columns, a DB_ERROR_TRUNCATED error is returned.
-     *
-     * For example, if the table "mytable" contains:
-     *
-     * <pre>
-     *  ID      TEXT       DATE
-     * --------------------------------
-     *  1       'one'      944679408
-     *  2       'two'      944679408
-     *  3       'three'    944679408
-     * </pre>
-     *
-     * Then the call getAssoc('SELECT id,text FROM mytable') returns:
-     * <pre>
-     *   array(
-     *     '1' => 'one',
-     *     '2' => 'two',
-     *     '3' => 'three',
-     *   )
-     * </pre>
-     *
-     * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
-     * <pre>
-     *   array(
-     *     '1' => array('one', '944679408'),
-     *     '2' => array('two', '944679408'),
-     *     '3' => array('three', '944679408')
-     *   )
-     * </pre>
-     *
-     * If the more than one row occurs with the same value in the
-     * first column, the last row overwrites all previous ones by
-     * default.  Use the $group parameter if you don't want to
-     * overwrite like this.  Example:
-     *
-     * <pre>
-     * getAssoc('SELECT category,id,name FROM mytable', false, null,
-     *          DB_FETCHMODE_ASSOC, true) returns:
-     *
-     *   array(
-     *     '1' => array(array('id' => '4', 'name' => 'number four'),
-     *                  array('id' => '6', 'name' => 'number six')
-     *            ),
-     *     '9' => array(array('id' => '4', 'name' => 'number four'),
-     *                  array('id' => '6', 'name' => 'number six')
-     *            )
-     *   )
-     * </pre>
-     *
-     * Keep in mind that database functions in PHP usually return string
-     * values for results regardless of the database's internal type.
-     *
-     * @param string $query        the SQL query
-     * @param bool   $force_array  used only when the query returns
-     *                              exactly two columns.  If true, the values
-     *                              of the returned array will be one-element
-     *                              arrays instead of scalars.
-     * @param mixed  $params       array, string or numeric data to be used in
-     *                              execution of the statement.  Quantity of
-     *                              items passed must match quantity of
-     *                              placeholders in query:  meaning 1
-     *                              placeholder for non-array parameters or
-     *                              1 placeholder per array element.
-     * @param int   $fetchmode     the fetch mode to use
-     * @param bool  $group         if true, the values of the returned array
-     *                              is wrapped in another array.  If the same
-     *                              key value (in the first column) repeats
-     *                              itself, the values will be appended to
-     *                              this array instead of overwriting the
-     *                              existing values.
-     *
-     * @return array  the associative array containing the query results.
-     *                A DB_Error object on failure.
-     */
-    function &getAssoc($query, $force_array = false, $params = array(),
-                       $fetchmode = DB_FETCHMODE_DEFAULT, $group = false)
-    {
-        $params = (array)$params;
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-
-            $res = $this->execute($sth, $params);
-            $this->freePrepared($sth);
-        } else {
-            $res = $this->query($query);
-        }
-
-        if (DB::isError($res)) {
-            return $res;
-        }
-        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
-            $fetchmode = $this->fetchmode;
-        }
-        $cols = $res->numCols();
-
-        if ($cols < 2) {
-            $tmp = $this->raiseError(DB_ERROR_TRUNCATED);
-            return $tmp;
-        }
-
-        $results = array();
-
-        if ($cols > 2 || $force_array) {
-            // return array values
-            // XXX this part can be optimized
-            if ($fetchmode == DB_FETCHMODE_ASSOC) {
-                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ASSOC))) {
-                    reset($row);
-                    $key = current($row);
-                    unset($row[key($row)]);
-                    if ($group) {
-                        $results[$key][] = $row;
-                    } else {
-                        $results[$key] = $row;
-                    }
-                }
-            } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {
-                while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
-                    $arr = get_object_vars($row);
-                    $key = current($arr);
-                    if ($group) {
-                        $results[$key][] = $row;
-                    } else {
-                        $results[$key] = $row;
-                    }
-                }
-            } else {
-                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
-                    // we shift away the first element to get
-                    // indices running from 0 again
-                    $key = array_shift($row);
-                    if ($group) {
-                        $results[$key][] = $row;
-                    } else {
-                        $results[$key] = $row;
-                    }
-                }
-            }
-            if (DB::isError($row)) {
-                $results = $row;
-            }
-        } else {
-            // return scalar values
-            while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
-                if ($group) {
-                    $results[$row[0]][] = $row[1];
-                } else {
-                    $results[$row[0]] = $row[1];
-                }
-            }
-            if (DB::isError($row)) {
-                $results = $row;
-            }
-        }
-
-        $res->free();
-
-        return $results;
-    }
-
-    // }}}
-    // {{{ getAll()
-
-    /**
-     * Fetches all of the rows from a query result
-     *
-     * @param string $query      the SQL query
-     * @param mixed  $params     array, string or numeric data to be used in
-     *                            execution of the statement.  Quantity of
-     *                            items passed must match quantity of
-     *                            placeholders in query:  meaning 1
-     *                            placeholder for non-array parameters or
-     *                            1 placeholder per array element.
-     * @param int    $fetchmode  the fetch mode to use:
-     *                            + DB_FETCHMODE_ORDERED
-     *                            + DB_FETCHMODE_ASSOC
-     *                            + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
-     *                            + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
-     *
-     * @return array  the nested array.  A DB_Error object on failure.
-     */
-    function &getAll($query, $params = array(),
-                     $fetchmode = DB_FETCHMODE_DEFAULT)
-    {
-        // compat check, the params and fetchmode parameters used to
-        // have the opposite order
-        if (!is_array($params)) {
-            if (is_array($fetchmode)) {
-                if ($params === null) {
-                    $tmp = DB_FETCHMODE_DEFAULT;
-                } else {
-                    $tmp = $params;
-                }
-                $params = $fetchmode;
-                $fetchmode = $tmp;
-            } elseif ($params !== null) {
-                $fetchmode = $params;
-                $params = array();
-            }
-        }
-
-        if (sizeof($params) > 0) {
-            $sth = $this->prepare($query);
-
-            if (DB::isError($sth)) {
-                return $sth;
-            }
-
-            $res = $this->execute($sth, $params);
-            $this->freePrepared($sth);
-        } else {
-            $res = $this->query($query);
-        }
-
-        if ($res === DB_OK || DB::isError($res)) {
-            return $res;
-        }
-
-        $results = array();
-        while (DB_OK === $res->fetchInto($row, $fetchmode)) {
-            if ($fetchmode & DB_FETCHMODE_FLIPPED) {
-                foreach ($row as $key => $val) {
-                    $results[$key][] = $val;
-                }
-            } else {
-                $results[] = $row;
-            }
-        }
-
-        $res->free();
-
-        if (DB::isError($row)) {
-            $tmp = $this->raiseError($row);
-            return $tmp;
-        }
-        return $results;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Determines the number of rows in a query result
-     *
-     * @param resource $result  the query result idenifier produced by PHP
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function numRows($result)
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ getSequenceName()
-
-    /**
-     * Generates the name used inside the database for a sequence
-     *
-     * The createSequence() docblock contains notes about storing sequence
-     * names.
-     *
-     * @param string $sqn  the sequence's public name
-     *
-     * @return string  the sequence's name in the backend
-     *
-     * @access protected
-     * @see DB_common::createSequence(), DB_common::dropSequence(),
-     *      DB_common::nextID(), DB_common::setOption()
-     */
-    function getSequenceName($sqn)
-    {
-        return sprintf($this->getOption('seqname_format'),
-                       preg_replace('/[^a-z0-9_.]/i', '_', $sqn));
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::dropSequence(),
-     *      DB_common::getSequenceName()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * Creates a new sequence
-     *
-     * The name of a given sequence is determined by passing the string
-     * provided in the <var>$seq_name</var> argument through PHP's sprintf()
-     * function using the value from the <var>seqname_format</var> option as
-     * the sprintf()'s format argument.
-     *
-     * <var>seqname_format</var> is set via setOption().
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_common::nextID()
-     */
-    function createSequence($seq_name)
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_common::nextID()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ raiseError()
-
-    /**
-     * Communicates an error and invoke error callbacks, etc
-     *
-     * Basically a wrapper for PEAR::raiseError without the message string.
-     *
-     * @param mixed   integer error code, or a PEAR error object (all
-     *                 other parameters are ignored if this parameter is
-     *                 an object
-     * @param int     error mode, see PEAR_Error docs
-     * @param mixed   if error mode is PEAR_ERROR_TRIGGER, this is the
-     *                 error level (E_USER_NOTICE etc).  If error mode is
-     *                 PEAR_ERROR_CALLBACK, this is the callback function,
-     *                 either as a function name, or as an array of an
-     *                 object and method name.  For other error modes this
-     *                 parameter is ignored.
-     * @param string  extra debug information.  Defaults to the last
-     *                 query and native error code.
-     * @param mixed   native error code, integer or string depending the
-     *                 backend
-     *
-     * @return object  the PEAR_Error object
-     *
-     * @see PEAR_Error
-     */
-    function &raiseError($code = DB_ERROR, $mode = null, $options = null,
-                         $userinfo = null, $nativecode = null)
-    {
-        // The error is yet a DB error object
-        if (is_object($code)) {
-            // because we the static PEAR::raiseError, our global
-            // handler should be used if it is set
-            if ($mode === null && !empty($this->_default_error_mode)) {
-                $mode    = $this->_default_error_mode;
-                $options = $this->_default_error_options;
-            }
-            $tmp = PEAR::raiseError($code, null, $mode, $options,
-                                    null, null, true);
-            return $tmp;
-        }
-
-        if ($userinfo === null) {
-            $userinfo = $this->last_query;
-        }
-
-        if ($nativecode) {
-            $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
-        } else {
-            $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
-        }
-
-        $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,
-                                'DB_Error', true);
-        return $tmp;
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return mixed  the DBMS' error code.  A DB_Error object on failure.
-     */
-    function errorNative()
-    {
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Maps native error codes to DB's portable ones
-     *
-     * Uses the <var>$errorcode_map</var> property defined in each driver.
-     *
-     * @param string|int $nativecode  the error code returned by the DBMS
-     *
-     * @return int  the portable DB error code.  Return DB_ERROR if the
-     *               current driver doesn't have a mapping for the
-     *               $nativecode submitted.
-     */
-    function errorCode($nativecode)
-    {
-        if (isset($this->errorcode_map[$nativecode])) {
-            return $this->errorcode_map[$nativecode];
-        }
-        // Fall back to DB_ERROR if there was no mapping.
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ errorMessage()
-
-    /**
-     * Maps a DB error code to a textual message
-     *
-     * @param integer $dbcode  the DB error code
-     *
-     * @return string  the error message corresponding to the error code
-     *                  submitted.  FALSE if the error code is unknown.
-     *
-     * @see DB::errorMessage()
-     */
-    function errorMessage($dbcode)
-    {
-        return DB::errorMessage($this->errorcode_map[$dbcode]);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * The format of the resulting array depends on which <var>$mode</var>
-     * you select.  The sample output below is based on this query:
-     * <pre>
-     *    SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
-     *    FROM tblFoo
-     *    JOIN tblBar ON tblFoo.fldId = tblBar.fldId
-     * </pre>
-     *
-     * <ul>
-     * <li>
-     *
-     * <kbd>null</kbd> (default)
-     *   <pre>
-     *   [0] => Array (
-     *       [table] => tblFoo
-     *       [name] => fldId
-     *       [type] => int
-     *       [len] => 11
-     *       [flags] => primary_key not_null
-     *   )
-     *   [1] => Array (
-     *       [table] => tblFoo
-     *       [name] => fldPhone
-     *       [type] => string
-     *       [len] => 20
-     *       [flags] =>
-     *   )
-     *   [2] => Array (
-     *       [table] => tblBar
-     *       [name] => fldId
-     *       [type] => int
-     *       [len] => 11
-     *       [flags] => primary_key not_null
-     *   )
-     *   </pre>
-     *
-     * </li><li>
-     *
-     * <kbd>DB_TABLEINFO_ORDER</kbd>
-     *
-     *   <p>In addition to the information found in the default output,
-     *   a notation of the number of columns is provided by the
-     *   <samp>num_fields</samp> element while the <samp>order</samp>
-     *   element provides an array with the column names as the keys and
-     *   their location index number (corresponding to the keys in the
-     *   the default output) as the values.</p>
-     *
-     *   <p>If a result set has identical field names, the last one is
-     *   used.</p>
-     *
-     *   <pre>
-     *   [num_fields] => 3
-     *   [order] => Array (
-     *       [fldId] => 2
-     *       [fldTrans] => 1
-     *   )
-     *   </pre>
-     *
-     * </li><li>
-     *
-     * <kbd>DB_TABLEINFO_ORDERTABLE</kbd>
-     *
-     *   <p>Similar to <kbd>DB_TABLEINFO_ORDER</kbd> but adds more
-     *   dimensions to the array in which the table names are keys and
-     *   the field names are sub-keys.  This is helpful for queries that
-     *   join tables which have identical field names.</p>
-     *
-     *   <pre>
-     *   [num_fields] => 3
-     *   [ordertable] => Array (
-     *       [tblFoo] => Array (
-     *           [fldId] => 0
-     *           [fldPhone] => 1
-     *       )
-     *       [tblBar] => Array (
-     *           [fldId] => 2
-     *       )
-     *   )
-     *   </pre>
-     *
-     * </li>
-     * </ul>
-     *
-     * The <samp>flags</samp> element contains a space separated list
-     * of extra information about the field.  This data is inconsistent
-     * between DBMS's due to the way each DBMS works.
-     *   + <samp>primary_key</samp>
-     *   + <samp>unique_key</samp>
-     *   + <samp>multiple_key</samp>
-     *   + <samp>not_null</samp>
-     *
-     * Most DBMS's only provide the <samp>table</samp> and <samp>flags</samp>
-     * elements if <var>$result</var> is a table name.  The following DBMS's
-     * provide full information from queries:
-     *   + fbsql
-     *   + mysql
-     *
-     * If the 'portability' option has <samp>DB_PORTABILITY_LOWERCASE</samp>
-     * turned on, the names of tables and fields will be lowercased.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                string containing the name of a table.
-     *                                While this also accepts a query result
-     *                                resource identifier, this behavior is
-     *                                deprecated.
-     * @param int  $mode   either unused or one of the tableInfo modes:
-     *                     <kbd>DB_TABLEINFO_ORDERTABLE</kbd>,
-     *                     <kbd>DB_TABLEINFO_ORDER</kbd> or
-     *                     <kbd>DB_TABLEINFO_FULL</kbd> (which does both).
-     *                     These are bitwise, so the first two can be
-     *                     combined using <kbd>|</kbd>.
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::setOption()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        /*
-         * If the DB_<driver> class has a tableInfo() method, that one
-         * overrides this one.  But, if the driver doesn't have one,
-         * this method runs and tells users about that fact.
-         */
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ getTables()
-
-    /**
-     * Lists the tables in the current database
-     *
-     * @return array  the list of tables.  A DB_Error object on failure.
-     *
-     * @deprecated Method deprecated some time before Release 1.2
-     */
-    function getTables()
-    {
-        return $this->getListOf('tables');
-    }
-
-    // }}}
-    // {{{ getListOf()
-
-    /**
-     * Lists internal database information
-     *
-     * @param string $type  type of information being sought.
-     *                       Common items being sought are:
-     *                       tables, databases, users, views, functions
-     *                       Each DBMS's has its own capabilities.
-     *
-     * @return array  an array listing the items sought.
-     *                 A DB DB_Error object on failure.
-     */
-    function getListOf($type)
-    {
-        $sql = $this->getSpecialQuery($type);
-        if ($sql === null) {
-            $this->last_query = '';
-            return $this->raiseError(DB_ERROR_UNSUPPORTED);
-        } elseif (is_int($sql) || DB::isError($sql)) {
-            // Previous error
-            return $this->raiseError($sql);
-        } elseif (is_array($sql)) {
-            // Already the result
-            return $sql;
-        }
-        // Launch this query
-        return $this->getCol($sql);
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        return $this->raiseError(DB_ERROR_UNSUPPORTED);
-    }
-
-    // }}}
-    // {{{ nextQueryIsManip()
-
-    /**
-     * Sets (or unsets) a flag indicating that the next query will be a
-     * manipulation query, regardless of the usual DB::isManip() heuristics.
-     *
-     * @param boolean true to set the flag overriding the isManip() behaviour,
-     * false to clear it and fall back onto isManip()
-     *
-     * @return void
-     *
-     * @access public
-     */
-    function nextQueryIsManip($manip)
-    {
-        $this->_next_query_manip = $manip;
-    }
-
-    // }}}
-    // {{{ _checkManip()
-
-    /**
-     * Checks if the given query is a manipulation query. This also takes into
-     * account the _next_query_manip flag and sets the _last_query_manip flag
-     * (and resets _next_query_manip) according to the result.
-     *
-     * @param string The query to check.
-     *
-     * @return boolean true if the query is a manipulation query, false
-     * otherwise
-     *
-     * @access protected
-     */
-    function _checkManip($query)
-    {
-        if ($this->_next_query_manip || DB::isManip($query)) {
-            $this->_last_query_manip = true;
-        } else {
-            $this->_last_query_manip = false;
-        }
-        $this->_next_query_manip = false;
-        return $this->_last_query_manip;
-        $manip = $this->_next_query_manip;
-    }
-
-    // }}}
-    // {{{ _rtrimArrayValues()
-
-    /**
-     * Right-trims all strings in an array
-     *
-     * @param array $array  the array to be trimmed (passed by reference)
-     *
-     * @return void
-     *
-     * @access protected
-     */
-    function _rtrimArrayValues(&$array)
-    {
-        foreach ($array as $key => $value) {
-            if (is_string($value)) {
-                $array[$key] = rtrim($value);
-            }
-        }
-    }
-
-    // }}}
-    // {{{ _convertNullArrayValuesToEmpty()
-
-    /**
-     * Converts all null values in an array to empty strings
-     *
-     * @param array  $array  the array to be de-nullified (passed by reference)
-     *
-     * @return void
-     *
-     * @access protected
-     */
-    function _convertNullArrayValuesToEmpty(&$array)
-    {
-        foreach ($array as $key => $value) {
-            if (is_null($value)) {
-                $array[$key] = '';
-            }
-        }
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/dbase.php b/lib/php/DB/dbase.php
deleted file mode 100644
index cdd2e59ef0c3160fc20a59b6f0f01b4a2e25c4d6..0000000000000000000000000000000000000000
--- a/lib/php/DB/dbase.php
+++ /dev/null
@@ -1,510 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's dbase extension
- * for interacting with dBase databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: dbase.php,v 1.45 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's dbase extension
- * for interacting with dBase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category   Database
- * @package    DB
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_dbase extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'dbase';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'dbase';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => false,
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => false,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => false,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * A means of emulating result resources
-     * @var array
-     */
-    var $res_row = array();
-
-    /**
-     * The quantity of results so far
-     *
-     * For emulating result resources.
-     *
-     * @var integer
-     */
-    var $result = 0;
-
-    /**
-     * Maps dbase data type id's to human readable strings
-     *
-     * The human readable values are based on the output of PHP's
-     * dbase_get_header_info() function.
-     *
-     * @var array
-     * @since Property available since Release 1.7.0
-     */
-    var $types = array(
-        'C' => 'character',
-        'D' => 'date',
-        'L' => 'boolean',
-        'M' => 'memo',
-        'N' => 'number',
-    );
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_dbase()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database and create it if it doesn't exist
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's dbase driver supports the following extra DSN options:
-     *   + mode    An integer specifying the read/write mode to use
-     *              (0 = read only, 1 = write only, 2 = read/write).
-     *              Available since PEAR DB 1.7.0.
-     *   + fields  An array of arrays that PHP's dbase_create() function needs
-     *              to create a new database.  This information is used if the
-     *              dBase file specified in the "database" segment of the DSN
-     *              does not exist.  For more info, see the PHP manual's
-     *              {@link http://php.net/dbase_create dbase_create()} page.
-     *              Available since PEAR DB 1.7.0.
-     *
-     * Example of how to connect and establish a new dBase file if necessary:
-     * <code>
-     * require_once 'DB.php';
-     *
-     * $dsn = array(
-     *     'phptype'  => 'dbase',
-     *     'database' => '/path/and/name/of/dbase/file',
-     *     'mode'     => 2,
-     *     'fields'   => array(
-     *         array('a', 'N', 5, 0),
-     *         array('b', 'C', 40),
-     *         array('c', 'C', 255),
-     *         array('d', 'C', 20),
-     *     ),
-     * );
-     * $options = array(
-     *     'debug'       => 2,
-     *     'portability' => DB_PORTABILITY_ALL,
-     * );
-     *
-     * $db = DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('dbase')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        /*
-         * Turn track_errors on for entire script since $php_errormsg
-         * is the only way to find errors from the dbase extension.
-         */
-        @ini_set('track_errors', 1);
-        $php_errormsg = '';
-
-        if (!file_exists($dsn['database'])) {
-            $this->dsn['mode'] = 2;
-            if (empty($dsn['fields']) || !is_array($dsn['fields'])) {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         'the dbase file does not exist and '
-                                         . 'it could not be created because '
-                                         . 'the "fields" element of the DSN '
-                                         . 'is not properly set');
-            }
-            $this->connection = @dbase_create($dsn['database'],
-                                              $dsn['fields']);
-            if (!$this->connection) {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         'the dbase file does not exist and '
-                                         . 'the attempt to create it failed: '
-                                         . $php_errormsg);
-            }
-        } else {
-            if (!isset($this->dsn['mode'])) {
-                $this->dsn['mode'] = 0;
-            }
-            $this->connection = @dbase_open($dsn['database'],
-                                            $this->dsn['mode']);
-            if (!$this->connection) {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @dbase_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ &query()
-
-    function &query($query = null)
-    {
-        // emulate result resources
-        $this->res_row[(int)$this->result] = 0;
-        $tmp = new DB_result($this, $this->result++);
-        return $tmp;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum === null) {
-            $rownum = $this->res_row[(int)$result]++;
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @dbase_get_record_with_names($this->connection, $rownum);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @dbase_get_record($this->connection, $rownum);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set.
-     *
-     * This method is a no-op for dbase, as there aren't result resources in
-     * the same sense as most other database backends.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return true;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($foo)
-    {
-        return @dbase_numfields($this->connection);
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($foo)
-    {
-        return @dbase_numrecords($this->connection);
-    }
-
-    // }}}
-    // {{{ quoteBoolean()
-
-    /**
-     * Formats a boolean value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param boolean the boolean value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteBoolean($boolean) {
-        return $boolean ? 'T' : 'F';
-    }
-     
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about the current database
-     *
-     * @param mixed $result  THIS IS UNUSED IN DBASE.  The current database
-     *                       is examined regardless of what is provided here.
-     * @param int   $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     * @since Method available since Release 1.7.0
-     */
-    function tableInfo($result = null, $mode = null)
-    {
-        if (function_exists('dbase_get_header_info')) {
-            $id = @dbase_get_header_info($this->connection);
-            if (!$id && $php_errormsg) {
-                return $this->raiseError(DB_ERROR,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-        } else {
-            /*
-             * This segment for PHP 4 is loosely based on code by
-             * Hadi Rusiah <deegos@yahoo.com> in the comments on
-             * the dBase reference page in the PHP manual.
-             */
-            $db = @fopen($this->dsn['database'], 'r');
-            if (!$db) {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-
-            $id = array();
-            $i  = 0;
-
-            $line = fread($db, 32);
-            while (!feof($db)) {
-                $line = fread($db, 32);
-                if (substr($line, 0, 1) == chr(13)) {
-                    break;
-                } else {
-                    $pos = strpos(substr($line, 0, 10), chr(0));
-                    $pos = ($pos == 0 ? 10 : $pos);
-                    $id[$i] = array(
-                        'name'   => substr($line, 0, $pos),
-                        'type'   => $this->types[substr($line, 11, 1)],
-                        'length' => ord(substr($line, 16, 1)),
-                        'precision' => ord(substr($line, 17, 1)),
-                    );
-                }
-                $i++;
-            }
-
-            fclose($db);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $res   = array();
-        $count = count($id);
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $res[$i] = array(
-                'table' => $this->dsn['database'],
-                'name'  => $case_func($id[$i]['name']),
-                'type'  => $id[$i]['type'],
-                'len'   => $id[$i]['length'],
-                'flags' => ''
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        return $res;
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/fbsql.php b/lib/php/DB/fbsql.php
deleted file mode 100644
index 7749a98faf0bb549a4aac2efe0457d85f9ea964e..0000000000000000000000000000000000000000
--- a/lib/php/DB/fbsql.php
+++ /dev/null
@@ -1,769 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's fbsql extension
- * for interacting with FrontBase databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Frank M. Kromann <frank@frontbase.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: fbsql.php,v 1.88 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's fbsql extension
- * for interacting with FrontBase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category   Database
- * @package    DB
- * @author     Frank M. Kromann <frank@frontbase.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- * @since      Class functional since Release 1.7.0
- */
-class DB_fbsql extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'fbsql';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'fbsql';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-         22 => DB_ERROR_SYNTAX,
-         85 => DB_ERROR_ALREADY_EXISTS,
-        108 => DB_ERROR_SYNTAX,
-        116 => DB_ERROR_NOSUCHTABLE,
-        124 => DB_ERROR_VALUE_COUNT_ON_ROW,
-        215 => DB_ERROR_NOSUCHFIELD,
-        217 => DB_ERROR_INVALID_NUMBER,
-        226 => DB_ERROR_NOSUCHFIELD,
-        231 => DB_ERROR_INVALID,
-        239 => DB_ERROR_TRUNCATED,
-        251 => DB_ERROR_SYNTAX,
-        266 => DB_ERROR_NOT_FOUND,
-        357 => DB_ERROR_CONSTRAINT_NOT_NULL,
-        358 => DB_ERROR_CONSTRAINT,
-        360 => DB_ERROR_CONSTRAINT,
-        361 => DB_ERROR_CONSTRAINT,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_fbsql()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('fbsql')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $params = array(
-            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
-            $dsn['username'] ? $dsn['username'] : null,
-            $dsn['password'] ? $dsn['password'] : null,
-        );
-
-        $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
-
-        $ini = ini_get('track_errors');
-        $php_errormsg = '';
-        if ($ini) {
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-        } else {
-            @ini_set('track_errors', 1);
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-            @ini_set('track_errors', $ini);
-        }
-
-        if (!$this->connection) {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     $php_errormsg);
-        }
-
-        if ($dsn['database']) {
-            if (!@fbsql_select_db($dsn['database'], $this->connection)) {
-                return $this->fbsqlRaiseError();
-            }
-        }
-
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @fbsql_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        $result = @fbsql_query("$query;", $this->connection);
-        if (!$result) {
-            return $this->fbsqlRaiseError();
-        }
-        // Determine which queries that should return data, and which
-        // should return an error code only.
-        if ($this->_checkManip($query)) {
-            return DB_OK;
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal fbsql result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return @fbsql_next_result($result);
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@fbsql_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @fbsql_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? fbsql_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff=false)
-    {
-        if ($onoff) {
-            $this->query("SET COMMIT TRUE");
-        } else {
-            $this->query("SET COMMIT FALSE");
-        }
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        @fbsql_commit($this->connection);
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        @fbsql_rollback($this->connection);
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @fbsql_num_fields($result);
-        if (!$cols) {
-            return $this->fbsqlRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @fbsql_num_rows($result);
-        if ($rows === null) {
-            return $this->fbsqlRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            $result = @fbsql_affected_rows($this->connection);
-        } else {
-            $result = 0;
-        }
-        return $result;
-     }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_fbsql::createSequence(), DB_fbsql::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        do {
-            $repeat = 0;
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query('SELECT UNIQUE FROM ' . $seqname);
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
-                $repeat = 1;
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $result;
-                }
-            } else {
-                $repeat = 0;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->fbsqlRaiseError();
-        }
-        $result->fetchInto($tmp, DB_FETCHMODE_ORDERED);
-        return $tmp[0];
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_fbsql::nextID(), DB_fbsql::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $res = $this->query('CREATE TABLE ' . $seqname
-                            . ' (id INTEGER NOT NULL,'
-                            . ' PRIMARY KEY(id))');
-        if ($res) {
-            $res = $this->query('SET UNIQUE = 0 FOR ' . $seqname);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_fbsql::nextID(), DB_fbsql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name)
-                            . ' RESTRICT');
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        if (DB::isManip($query) || $this->_next_query_manip) {
-            return preg_replace('/^([\s(])*SELECT/i',
-                                "\\1SELECT TOP($count)", $query);
-        } else {
-            return preg_replace('/([\s(])*SELECT/i',
-                                "\\1SELECT TOP($from, $count)", $query);
-        }
-    }
-
-    // }}}
-    // {{{ quoteBoolean()
-
-    /**
-     * Formats a boolean value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param boolean the boolean value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteBoolean($boolean) {
-        return $boolean ? 'TRUE' : 'FALSE';
-    }
-     
-    // }}}
-    // {{{ quoteFloat()
-
-    /**
-     * Formats a float value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param float the float value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteFloat($float) {
-        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
-    }
-     
-    // }}}
-    // {{{ fbsqlRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_fbsql::errorNative(), DB_common::errorCode()
-     */
-    function fbsqlRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            $errno = $this->errorCode(fbsql_errno($this->connection));
-        }
-        return $this->raiseError($errno, null, null, null,
-                                 @fbsql_error($this->connection));
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code
-     */
-    function errorNative()
-    {
-        return @fbsql_errno($this->connection);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @fbsql_list_fields($this->dsn['database'],
-                                     $result, $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->fbsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @fbsql_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $res[$i] = array(
-                'table' => $case_func(@fbsql_field_table($id, $i)),
-                'name'  => $case_func(@fbsql_field_name($id, $i)),
-                'type'  => @fbsql_field_type($id, $i),
-                'len'   => @fbsql_field_len($id, $i),
-                'flags' => @fbsql_field_flags($id, $i),
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @fbsql_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SELECT "table_name" FROM information_schema.tables'
-                       . ' t0, information_schema.schemata t1'
-                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
-                       . ' "table_type" = \'BASE TABLE\''
-                       . ' AND "schema_name" = current_schema';
-            case 'views':
-                return 'SELECT "table_name" FROM information_schema.tables'
-                       . ' t0, information_schema.schemata t1'
-                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
-                       . ' "table_type" = \'VIEW\''
-                       . ' AND "schema_name" = current_schema';
-            case 'users':
-                return 'SELECT "user_name" from information_schema.users'; 
-            case 'functions':
-                return 'SELECT "routine_name" FROM'
-                       . ' information_schema.psm_routines'
-                       . ' t0, information_schema.schemata t1'
-                       . ' WHERE t0.schema_pk=t1.schema_pk'
-                       . ' AND "routine_kind"=\'FUNCTION\''
-                       . ' AND "schema_name" = current_schema';
-            case 'procedures':
-                return 'SELECT "routine_name" FROM'
-                       . ' information_schema.psm_routines'
-                       . ' t0, information_schema.schemata t1'
-                       . ' WHERE t0.schema_pk=t1.schema_pk'
-                       . ' AND "routine_kind"=\'PROCEDURE\''
-                       . ' AND "schema_name" = current_schema';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/ibase.php b/lib/php/DB/ibase.php
deleted file mode 100644
index 7836064259b6be9c775ba5485a6465bc15516251..0000000000000000000000000000000000000000
--- a/lib/php/DB/ibase.php
+++ /dev/null
@@ -1,1082 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's interbase extension
- * for interacting with Interbase and Firebird databases
- *
- * While this class works with PHP 4, PHP's InterBase extension is
- * unstable in PHP 4.  Use PHP 5.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: ibase.php,v 1.116 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's interbase extension
- * for interacting with Interbase and Firebird databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * While this class works with PHP 4, PHP's InterBase extension is
- * unstable in PHP 4.  Use PHP 5.
- *
- * NOTICE:  limitQuery() only works for Firebird.
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- * @since      Class became stable in Release 1.7.0
- */
-class DB_ibase extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'ibase';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'ibase';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * NOTE: only firebird supports limit.
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => false,
-        'new_link'      => false,
-        'numrows'       => 'emulate',
-        'pconnect'      => true,
-        'prepare'       => true,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        -104 => DB_ERROR_SYNTAX,
-        -150 => DB_ERROR_ACCESS_VIOLATION,
-        -151 => DB_ERROR_ACCESS_VIOLATION,
-        -155 => DB_ERROR_NOSUCHTABLE,
-        -157 => DB_ERROR_NOSUCHFIELD,
-        -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
-        -170 => DB_ERROR_MISMATCH,
-        -171 => DB_ERROR_MISMATCH,
-        -172 => DB_ERROR_INVALID,
-        // -204 =>  // Covers too many errors, need to use regex on msg
-        -205 => DB_ERROR_NOSUCHFIELD,
-        -206 => DB_ERROR_NOSUCHFIELD,
-        -208 => DB_ERROR_INVALID,
-        -219 => DB_ERROR_NOSUCHTABLE,
-        -297 => DB_ERROR_CONSTRAINT,
-        -303 => DB_ERROR_INVALID,
-        -413 => DB_ERROR_INVALID_NUMBER,
-        -530 => DB_ERROR_CONSTRAINT,
-        -551 => DB_ERROR_ACCESS_VIOLATION,
-        -552 => DB_ERROR_ACCESS_VIOLATION,
-        // -607 =>  // Covers too many errors, need to use regex on msg
-        -625 => DB_ERROR_CONSTRAINT_NOT_NULL,
-        -803 => DB_ERROR_CONSTRAINT,
-        -804 => DB_ERROR_VALUE_COUNT_ON_ROW,
-        // -902 =>  // Covers too many errors, need to use regex on msg
-        -904 => DB_ERROR_CONNECT_FAILED,
-        -922 => DB_ERROR_NOSUCHDB,
-        -923 => DB_ERROR_CONNECT_FAILED,
-        -924 => DB_ERROR_CONNECT_FAILED
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * The number of rows affected by a data manipulation query
-     * @var integer
-     * @access private
-     */
-    var $affected = 0;
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The prepared statement handle from the most recently executed statement
-     *
-     * {@internal  Mainly here because the InterBase/Firebird API is only
-     * able to retrieve data from result sets if the statemnt handle is
-     * still in scope.}}
-     *
-     * @var resource
-     */
-    var $last_stmt;
-
-    /**
-     * Is the given prepared statement a data manipulation query?
-     * @var array
-     * @access private
-     */
-    var $manip_query = array();
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_ibase()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's ibase driver supports the following extra DSN options:
-     *   + buffers    The number of database buffers to allocate for the
-     *                 server-side cache.
-     *   + charset    The default character set for a database.
-     *   + dialect    The default SQL dialect for any statement
-     *                 executed within a connection.  Defaults to the
-     *                 highest one supported by client libraries.
-     *                 Functional only with InterBase 6 and up.
-     *   + role       Functional only with InterBase 5 and up.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('interbase')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-        if ($this->dbsyntax == 'firebird') {
-            $this->features['limit'] = 'alter';
-        }
-
-        $params = array(
-            $dsn['hostspec']
-                    ? ($dsn['hostspec'] . ':' . $dsn['database'])
-                    : $dsn['database'],
-            $dsn['username'] ? $dsn['username'] : null,
-            $dsn['password'] ? $dsn['password'] : null,
-            isset($dsn['charset']) ? $dsn['charset'] : null,
-            isset($dsn['buffers']) ? $dsn['buffers'] : null,
-            isset($dsn['dialect']) ? $dsn['dialect'] : null,
-            isset($dsn['role'])    ? $dsn['role'] : null,
-        );
-
-        $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
-
-        $this->connection = @call_user_func_array($connect_function, $params);
-        if (!$this->connection) {
-            return $this->ibaseRaiseError(DB_ERROR_CONNECT_FAILED);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @ibase_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        $result = @ibase_query($this->connection, $query);
-
-        if (!$result) {
-            return $this->ibaseRaiseError();
-        }
-        if ($this->autocommit && $ismanip) {
-            @ibase_commit($this->connection);
-        }
-        if ($ismanip) {
-            $this->affected = $result;
-            return DB_OK;
-        } else {
-            $this->affected = 0;
-            return $result;
-        }
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * Only works with Firebird.
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        if ($this->dsn['dbsyntax'] == 'firebird') {
-            $query = preg_replace('/^([\s(])*SELECT/i',
-                                  "SELECT FIRST $count SKIP $from", $query);
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal ibase result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            if (function_exists('ibase_fetch_assoc')) {
-                $arr = @ibase_fetch_assoc($result);
-            } else {
-                $arr = get_object_vars(ibase_fetch_object($result));
-            }
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @ibase_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? ibase_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ freeQuery()
-
-    function freeQuery($query)
-    {
-        return is_resource($query) ? ibase_free_query($query) : false;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if (is_integer($this->affected)) {
-            return $this->affected;
-        }
-        return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @ibase_num_fields($result);
-        if (!$cols) {
-            return $this->ibaseRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ prepare()
-
-    /**
-     * Prepares a query for multiple execution with execute().
-     *
-     * prepare() requires a generic query as string like <code>
-     *    INSERT INTO numbers VALUES (?, ?, ?)
-     * </code>.  The <kbd>?</kbd> characters are placeholders.
-     *
-     * Three types of placeholders can be used:
-     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
-     *   + <kbd>!</kbd>  value is inserted 'as is'
-     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
-     *                     inserted into the query (i.e. saving binary
-     *                     data in a db)
-     *
-     * Use backslashes to escape placeholder characters if you don't want
-     * them to be interpreted as placeholders.  Example: <code>
-     *    "UPDATE foo SET col=? WHERE col='over \& under'"
-     * </code>
-     *
-     * @param string $query query to be prepared
-     * @return mixed DB statement resource on success. DB_Error on failure.
-     */
-    function prepare($query)
-    {
-        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
-                               PREG_SPLIT_DELIM_CAPTURE);
-        $token    = 0;
-        $types    = array();
-        $newquery = '';
-
-        foreach ($tokens as $key => $val) {
-            switch ($val) {
-                case '?':
-                    $types[$token++] = DB_PARAM_SCALAR;
-                    break;
-                case '&':
-                    $types[$token++] = DB_PARAM_OPAQUE;
-                    break;
-                case '!':
-                    $types[$token++] = DB_PARAM_MISC;
-                    break;
-                default:
-                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
-                    $newquery .= $tokens[$key] . '?';
-            }
-        }
-
-        $newquery = substr($newquery, 0, -1);
-        $this->last_query = $query;
-        $newquery = $this->modifyQuery($newquery);
-        $stmt = @ibase_prepare($this->connection, $newquery);
-
-        if ($stmt === false) {
-            $stmt = $this->ibaseRaiseError();
-        } else {
-            $this->prepare_types[(int)$stmt] = $types;
-            $this->manip_query[(int)$stmt]   = DB::isManip($query);
-        }
-
-        return $stmt;
-    }
-
-    // }}}
-    // {{{ execute()
-
-    /**
-     * Executes a DB statement prepared with prepare().
-     *
-     * @param resource  $stmt  a DB statement resource returned from prepare()
-     * @param mixed  $data  array, string or numeric data to be used in
-     *                      execution of the statement.  Quantity of items
-     *                      passed must match quantity of placeholders in
-     *                      query:  meaning 1 for non-array items or the
-     *                      quantity of elements in the array.
-     * @return object  a new DB_Result or a DB_Error when fail
-     * @see DB_ibase::prepare()
-     * @access public
-     */
-    function &execute($stmt, $data = array())
-    {
-        $data = (array)$data;
-        $this->last_parameters = $data;
-
-        $types = $this->prepare_types[(int)$stmt];
-        if (count($types) != count($data)) {
-            $tmp = $this->raiseError(DB_ERROR_MISMATCH);
-            return $tmp;
-        }
-
-        $i = 0;
-        foreach ($data as $key => $value) {
-            if ($types[$i] == DB_PARAM_MISC) {
-                /*
-                 * ibase doesn't seem to have the ability to pass a
-                 * parameter along unchanged, so strip off quotes from start
-                 * and end, plus turn two single quotes to one single quote,
-                 * in order to avoid the quotes getting escaped by
-                 * ibase and ending up in the database.
-                 */
-                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
-                $data[$key] = str_replace("''", "'", $data[$key]);
-            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
-                $fp = @fopen($data[$key], 'rb');
-                if (!$fp) {
-                    $tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
-                    return $tmp;
-                }
-                $data[$key] = fread($fp, filesize($data[$key]));
-                fclose($fp);
-            }
-            $i++;
-        }
-
-        array_unshift($data, $stmt);
-
-        $res = call_user_func_array('ibase_execute', $data);
-        if (!$res) {
-            $tmp = $this->ibaseRaiseError();
-            return $tmp;
-        }
-        /* XXX need this?
-        if ($this->autocommit && $this->manip_query[(int)$stmt]) {
-            @ibase_commit($this->connection);
-        }*/
-        $this->last_stmt = $stmt;
-        if ($this->manip_query[(int)$stmt] || $this->_next_query_manip) {
-            $this->_last_query_manip = true;
-            $this->_next_query_manip = false;
-            $tmp = DB_OK;
-        } else {
-            $this->_last_query_manip = false;
-            $tmp = new DB_result($this, $res);
-        }
-        return $tmp;
-    }
-
-    /**
-     * Frees the internal resources associated with a prepared query
-     *
-     * @param resource $stmt           the prepared statement's PHP resource
-     * @param bool     $free_resource  should the PHP resource be freed too?
-     *                                  Use false if you need to get data
-     *                                  from the result set later.
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_ibase::prepare()
-     */
-    function freePrepared($stmt, $free_resource = true)
-    {
-        if (!is_resource($stmt)) {
-            return false;
-        }
-        if ($free_resource) {
-            @ibase_free_query($stmt);
-        }
-        unset($this->prepare_tokens[(int)$stmt]);
-        unset($this->prepare_types[(int)$stmt]);
-        unset($this->manip_query[(int)$stmt]);
-        return true;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        $this->autocommit = $onoff ? 1 : 0;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        return @ibase_commit($this->connection);
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        return @ibase_rollback($this->connection);
-    }
-
-    // }}}
-    // {{{ transactionInit()
-
-    function transactionInit($trans_args = 0)
-    {
-        return $trans_args
-                ? @ibase_trans($trans_args, $this->connection)
-                : @ibase_trans();
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_ibase::createSequence(), DB_ibase::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $sqn = strtoupper($this->getSequenceName($seq_name));
-        $repeat = 0;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("SELECT GEN_ID(${sqn}, 1) "
-                                   . 'FROM RDB$GENERATORS '
-                                   . "WHERE RDB\$GENERATOR_NAME='${sqn}'");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result)) {
-                $repeat = 1;
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $result;
-                }
-            } else {
-                $repeat = 0;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        $result->free();
-        return $arr[0];
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_ibase::nextID(), DB_ibase::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $sqn = strtoupper($this->getSequenceName($seq_name));
-        $this->pushErrorHandling(PEAR_ERROR_RETURN);
-        $result = $this->query("CREATE GENERATOR ${sqn}");
-        $this->popErrorHandling();
-
-        return $result;
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_ibase::nextID(), DB_ibase::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DELETE FROM RDB$GENERATORS '
-                            . "WHERE RDB\$GENERATOR_NAME='"
-                            . strtoupper($this->getSequenceName($seq_name))
-                            . "'");
-    }
-
-    // }}}
-    // {{{ _ibaseFieldFlags()
-
-    /**
-     * Get the column's flags
-     *
-     * Supports "primary_key", "unique_key", "not_null", "default",
-     * "computed" and "blob".
-     *
-     * @param string $field_name  the name of the field
-     * @param string $table_name  the name of the table
-     *
-     * @return string  the flags
-     *
-     * @access private
-     */
-    function _ibaseFieldFlags($field_name, $table_name)
-    {
-        $sql = 'SELECT R.RDB$CONSTRAINT_TYPE CTYPE'
-               .' FROM RDB$INDEX_SEGMENTS I'
-               .'  JOIN RDB$RELATION_CONSTRAINTS R ON I.RDB$INDEX_NAME=R.RDB$INDEX_NAME'
-               .' WHERE I.RDB$FIELD_NAME=\'' . $field_name . '\''
-               .'  AND UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\'';
-
-        $result = @ibase_query($this->connection, $sql);
-        if (!$result) {
-            return $this->ibaseRaiseError();
-        }
-
-        $flags = '';
-        if ($obj = @ibase_fetch_object($result)) {
-            @ibase_free_result($result);
-            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'PRIMARY KEY') {
-                $flags .= 'primary_key ';
-            }
-            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'UNIQUE') {
-                $flags .= 'unique_key ';
-            }
-        }
-
-        $sql = 'SELECT R.RDB$NULL_FLAG AS NFLAG,'
-               .'  R.RDB$DEFAULT_SOURCE AS DSOURCE,'
-               .'  F.RDB$FIELD_TYPE AS FTYPE,'
-               .'  F.RDB$COMPUTED_SOURCE AS CSOURCE'
-               .' FROM RDB$RELATION_FIELDS R '
-               .'  JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME'
-               .' WHERE UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\''
-               .'  AND R.RDB$FIELD_NAME=\'' . $field_name . '\'';
-
-        $result = @ibase_query($this->connection, $sql);
-        if (!$result) {
-            return $this->ibaseRaiseError();
-        }
-        if ($obj = @ibase_fetch_object($result)) {
-            @ibase_free_result($result);
-            if (isset($obj->NFLAG)) {
-                $flags .= 'not_null ';
-            }
-            if (isset($obj->DSOURCE)) {
-                $flags .= 'default ';
-            }
-            if (isset($obj->CSOURCE)) {
-                $flags .= 'computed ';
-            }
-            if (isset($obj->FTYPE)  && $obj->FTYPE == 261) {
-                $flags .= 'blob ';
-            }
-        }
-
-        return trim($flags);
-    }
-
-    // }}}
-    // {{{ ibaseRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_ibase::errorNative(), DB_ibase::errorCode()
-     */
-    function &ibaseRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            $errno = $this->errorCode($this->errorNative());
-        }
-        $tmp = $this->raiseError($errno, null, null, null, @ibase_errmsg());
-        return $tmp;
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code.  NULL if there is no error code.
-     *
-     * @since Method available since Release 1.7.0
-     */
-    function errorNative()
-    {
-        if (function_exists('ibase_errcode')) {
-            return @ibase_errcode();
-        }
-        if (preg_match('/^Dynamic SQL Error SQL error code = ([0-9-]+)/i',
-                       @ibase_errmsg(), $m)) {
-            return (int)$m[1];
-        }
-        return null;
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Maps native error codes to DB's portable ones
-     *
-     * @param int $nativecode  the error code returned by the DBMS
-     *
-     * @return int  the portable DB error code.  Return DB_ERROR if the
-     *               current driver doesn't have a mapping for the
-     *               $nativecode submitted.
-     *
-     * @since Method available since Release 1.7.0
-     */
-    function errorCode($nativecode = null)
-    {
-        if (isset($this->errorcode_map[$nativecode])) {
-            return $this->errorcode_map[$nativecode];
-        }
-
-        static $error_regexps;
-        if (!isset($error_regexps)) {
-            $error_regexps = array(
-                '/generator .* is not defined/'
-                    => DB_ERROR_SYNTAX,  // for compat. w ibase_errcode()
-                '/table.*(not exist|not found|unknown)/i'
-                    => DB_ERROR_NOSUCHTABLE,
-                '/table .* already exists/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/unsuccessful metadata update .* failed attempt to store duplicate value/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/unsuccessful metadata update .* not found/i'
-                    => DB_ERROR_NOT_FOUND,
-                '/validation error for column .* value "\*\*\* null/i'
-                    => DB_ERROR_CONSTRAINT_NOT_NULL,
-                '/violation of [\w ]+ constraint/i'
-                    => DB_ERROR_CONSTRAINT,
-                '/conversion error from string/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/no permission for/i'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/arithmetic exception, numeric overflow, or string truncation/i'
-                    => DB_ERROR_INVALID,
-                '/feature is not supported/i'
-                    => DB_ERROR_NOT_CAPABLE,
-            );
-        }
-
-        $errormsg = @ibase_errmsg();
-        foreach ($error_regexps as $regexp => $code) {
-            if (preg_match($regexp, $errormsg)) {
-                return $code;
-            }
-        }
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
-     * is a table name.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @ibase_query($this->connection,
-                               "SELECT * FROM $result WHERE 1=0");
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->ibaseRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @ibase_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $info = @ibase_field_info($id, $i);
-            $res[$i] = array(
-                'table' => $got_string ? $case_func($result) : '',
-                'name'  => $case_func($info['name']),
-                'type'  => $info['type'],
-                'len'   => $info['length'],
-                'flags' => ($got_string)
-                            ? $this->_ibaseFieldFlags($info['name'], $result)
-                            : '',
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @ibase_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SELECT DISTINCT R.RDB$RELATION_NAME FROM '
-                       . 'RDB$RELATION_FIELDS R WHERE R.RDB$SYSTEM_FLAG=0';
-            case 'views':
-                return 'SELECT DISTINCT RDB$VIEW_NAME from RDB$VIEW_RELATIONS';
-            case 'users':
-                return 'SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/ifx.php b/lib/php/DB/ifx.php
deleted file mode 100644
index 98ebecb2d87df8aa7d06bb3b1cbabd572f3a958a..0000000000000000000000000000000000000000
--- a/lib/php/DB/ifx.php
+++ /dev/null
@@ -1,683 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's ifx extension
- * for interacting with Informix databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: ifx.php,v 1.75 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's ifx extension
- * for interacting with Informix databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * More info on Informix errors can be found at:
- * http://www.informix.com/answers/english/ierrors.htm
- *
- * TODO:
- *   - set needed env Informix vars on connect
- *   - implement native prepare/execute
- *
- * @category   Database
- * @package    DB
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_ifx extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'ifx';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'ifx';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'emulate',
-        'new_link'      => false,
-        'numrows'       => 'emulate',
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        '-201'    => DB_ERROR_SYNTAX,
-        '-206'    => DB_ERROR_NOSUCHTABLE,
-        '-217'    => DB_ERROR_NOSUCHFIELD,
-        '-236'    => DB_ERROR_VALUE_COUNT_ON_ROW,
-        '-239'    => DB_ERROR_CONSTRAINT,
-        '-253'    => DB_ERROR_SYNTAX,
-        '-268'    => DB_ERROR_CONSTRAINT,
-        '-292'    => DB_ERROR_CONSTRAINT_NOT_NULL,
-        '-310'    => DB_ERROR_ALREADY_EXISTS,
-        '-316'    => DB_ERROR_ALREADY_EXISTS,
-        '-319'    => DB_ERROR_NOT_FOUND,
-        '-329'    => DB_ERROR_NODBSELECTED,
-        '-346'    => DB_ERROR_CONSTRAINT,
-        '-386'    => DB_ERROR_CONSTRAINT_NOT_NULL,
-        '-391'    => DB_ERROR_CONSTRAINT_NOT_NULL,
-        '-554'    => DB_ERROR_SYNTAX,
-        '-691'    => DB_ERROR_CONSTRAINT,
-        '-692'    => DB_ERROR_CONSTRAINT,
-        '-703'    => DB_ERROR_CONSTRAINT_NOT_NULL,
-        '-1202'   => DB_ERROR_DIVZERO,
-        '-1204'   => DB_ERROR_INVALID_DATE,
-        '-1205'   => DB_ERROR_INVALID_DATE,
-        '-1206'   => DB_ERROR_INVALID_DATE,
-        '-1209'   => DB_ERROR_INVALID_DATE,
-        '-1210'   => DB_ERROR_INVALID_DATE,
-        '-1212'   => DB_ERROR_INVALID_DATE,
-        '-1213'   => DB_ERROR_INVALID_NUMBER,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The number of rows affected by a data manipulation query
-     * @var integer
-     * @access private
-     */
-    var $affected = 0;
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_ifx()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('informix') &&
-            !PEAR::loadExtension('Informix'))
-        {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $dbhost = $dsn['hostspec'] ? '@' . $dsn['hostspec'] : '';
-        $dbname = $dsn['database'] ? $dsn['database'] . $dbhost : '';
-        $user = $dsn['username'] ? $dsn['username'] : '';
-        $pw = $dsn['password'] ? $dsn['password'] : '';
-
-        $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect';
-
-        $this->connection = @$connect_function($dbname, $user, $pw);
-        if (!is_resource($this->connection)) {
-            return $this->ifxRaiseError(DB_ERROR_CONNECT_FAILED);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @ifx_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $this->affected   = null;
-        if (preg_match('/(SELECT|EXECUTE)/i', $query)) {    //TESTME: Use !DB::isManip()?
-            // the scroll is needed for fetching absolute row numbers
-            // in a select query result
-            $result = @ifx_query($query, $this->connection, IFX_SCROLL);
-        } else {
-            if (!$this->autocommit && $ismanip) {
-                if ($this->transaction_opcount == 0) {
-                    $result = @ifx_query('BEGIN WORK', $this->connection);
-                    if (!$result) {
-                        return $this->ifxRaiseError();
-                    }
-                }
-                $this->transaction_opcount++;
-            }
-            $result = @ifx_query($query, $this->connection);
-        }
-        if (!$result) {
-            return $this->ifxRaiseError();
-        }
-        $this->affected = @ifx_affected_rows($result);
-        // Determine which queries should return data, and which
-        // should return an error code only.
-        if (preg_match('/(SELECT|EXECUTE)/i', $query)) {
-            return $result;
-        }
-        // XXX Testme: free results inside a transaction
-        // may cause to stop it and commit the work?
-
-        // Result has to be freed even with a insert or update
-        @ifx_free_result($result);
-
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal ifx result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            return $this->affected;
-        } else {
-            return 0;
-        }
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if (($rownum !== null) && ($rownum < 0)) {
-            return null;
-        }
-        if ($rownum === null) {
-            /*
-             * Even though fetch_row() should return the next row  if
-             * $rownum is null, it doesn't in all cases.  Bug 598.
-             */
-            $rownum = 'NEXT';
-        } else {
-            // Index starts at row 1, unlike most DBMS's starting at 0.
-            $rownum++;
-        }
-        if (!$arr = @ifx_fetch_row($result, $rownum)) {
-            return null;
-        }
-        if ($fetchmode !== DB_FETCHMODE_ASSOC) {
-            $i=0;
-            $order = array();
-            foreach ($arr as $val) {
-                $order[$i++] = $val;
-            }
-            $arr = $order;
-        } elseif ($fetchmode == DB_FETCHMODE_ASSOC &&
-                  $this->options['portability'] & DB_PORTABILITY_LOWERCASE)
-        {
-            $arr = array_change_key_case($arr, CASE_LOWER);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        if (!$cols = @ifx_num_fields($result)) {
-            return $this->ifxRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? ifx_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = true)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            $result = @ifx_query('COMMIT WORK', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->ifxRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            $result = @ifx_query('ROLLBACK WORK', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->ifxRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ ifxRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_ifx::errorNative(), DB_ifx::errorCode()
-     */
-    function ifxRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            $errno = $this->errorCode(ifx_error());
-        }
-        return $this->raiseError($errno, null, null, null,
-                                 $this->errorNative());
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code and message produced by the last query
-     *
-     * @return string  the DBMS' error code and message
-     */
-    function errorNative()
-    {
-        return @ifx_error() . ' ' . @ifx_errormsg();
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Maps native error codes to DB's portable ones.
-     *
-     * Requires that the DB implementation's constructor fills
-     * in the <var>$errorcode_map</var> property.
-     *
-     * @param  string  $nativecode  error code returned by the database
-     * @return int a portable DB error code, or DB_ERROR if this DB
-     * implementation has no mapping for the given error code.
-     */
-    function errorCode($nativecode)
-    {
-        if (ereg('SQLCODE=(.*)]', $nativecode, $match)) {
-            $code = $match[1];
-            if (isset($this->errorcode_map[$code])) {
-                return $this->errorcode_map[$code];
-            }
-        }
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' if <var>$result</var> is a table name.
-     *
-     * If analyzing a query result and the result has duplicate field names,
-     * an error will be raised saying
-     * <samp>can't distinguish duplicate field names</samp>.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     * @since Method available since Release 1.6.0
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @ifx_query("SELECT * FROM $result WHERE 1=0",
-                             $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->ifxRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        $flds = @ifx_fieldproperties($id);
-        $count = @ifx_num_fields($id);
-
-        if (count($flds) != $count) {
-            return $this->raiseError("can't distinguish duplicate field names");
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $i   = 0;
-        $res = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        foreach ($flds as $key => $value) {
-            $props = explode(';', $value);
-            $res[$i] = array(
-                'table' => $got_string ? $case_func($result) : '',
-                'name'  => $case_func($key),
-                'type'  => $props[0],
-                'len'   => $props[1],
-                'flags' => $props[4] == 'N' ? 'not_null' : '',
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-            $i++;
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @ifx_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SELECT tabname FROM systables WHERE tabid >= 100';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/msql.php b/lib/php/DB/msql.php
deleted file mode 100644
index f9c107d34ccacd2f5ee3ed251996269c2d61b9e5..0000000000000000000000000000000000000000
--- a/lib/php/DB/msql.php
+++ /dev/null
@@ -1,831 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's msql extension
- * for interacting with Mini SQL databases
- *
- * PHP's mSQL extension did weird things with NULL values prior to PHP
- * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
- * those versions.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: msql.php,v 1.64 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's msql extension
- * for interacting with Mini SQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * PHP's mSQL extension did weird things with NULL values prior to PHP
- * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
- * those versions.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- * @since      Class not functional until Release 1.7.0
- */
-class DB_msql extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'msql';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'msql';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'emulate',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => false,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * The query result resource created by PHP
-     *
-     * Used to make affectedRows() work.  Only contains the result for
-     * data manipulation queries.  Contains false for other queries.
-     *
-     * @var resource
-     * @access private
-     */
-    var $_result;
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_msql()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * Example of how to connect:
-     * <code>
-     * require_once 'DB.php';
-     * 
-     * // $dsn = 'msql://hostname/dbname';  // use a TCP connection
-     * $dsn = 'msql:///dbname';             // use a socket
-     * $options = array(
-     *     'portability' => DB_PORTABILITY_ALL,
-     * );
-     * 
-     * $db = DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('msql')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $params = array();
-        if ($dsn['hostspec']) {
-            $params[] = $dsn['port']
-                        ? $dsn['hostspec'] . ',' . $dsn['port']
-                        : $dsn['hostspec'];
-        }
-
-        $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect';
-
-        $ini = ini_get('track_errors');
-        $php_errormsg = '';
-        if ($ini) {
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-        } else {
-            @ini_set('track_errors', 1);
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-            @ini_set('track_errors', $ini);
-        }
-
-        if (!$this->connection) {
-            if (($err = @msql_error()) != '') {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $err);
-            } else {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-        }
-
-        if (!@msql_select_db($dsn['database'], $this->connection)) {
-            return $this->msqlRaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @msql_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        $result = @msql_query($query, $this->connection);
-        if (!$result) {
-            return $this->msqlRaiseError();
-        }
-        // Determine which queries that should return data, and which
-        // should return an error code only.
-        if ($this->_checkManip($query)) {
-            $this->_result = $result;
-            return DB_OK;
-        } else {
-            $this->_result = false;
-            return $result;
-        }
-    }
-
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal msql result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * PHP's mSQL extension did weird things with NULL values prior to PHP
-     * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
-     * those versions.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@msql_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @msql_fetch_array($result, MSQL_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @msql_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? msql_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @msql_num_fields($result);
-        if (!$cols) {
-            return $this->msqlRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @msql_num_rows($result);
-        if ($rows === false) {
-            return $this->msqlRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ affected()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if (!$this->_result) {
-            return 0;
-        }
-        return msql_affected_rows($this->_result);
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_msql::createSequence(), DB_msql::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $repeat = false;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("SELECT _seq FROM ${seqname}");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
-                $repeat = true;
-                $this->pushErrorHandling(PEAR_ERROR_RETURN);
-                $result = $this->createSequence($seq_name);
-                $this->popErrorHandling();
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-            } else {
-                $repeat = false;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        $result->free();
-        return $arr[0];
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * Creates a new sequence
-     *
-     * Also creates a new table to associate the sequence with.  Uses
-     * a separate table to ensure portability with other drivers.
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_msql::nextID(), DB_msql::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $res = $this->query('CREATE TABLE ' . $seqname
-                            . ' (id INTEGER NOT NULL)');
-        if (DB::isError($res)) {
-            return $res;
-        }
-        $res = $this->query("CREATE SEQUENCE ON ${seqname}");
-        return $res;
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_msql::nextID(), DB_msql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * mSQL does not support delimited identifiers
-     *
-     * @param string $str  the identifier name to be quoted
-     *
-     * @return object  a DB_Error object
-     *
-     * @see DB_common::quoteIdentifier()
-     * @since Method available since Release 1.7.0
-     */
-    function quoteIdentifier($str)
-    {
-        return $this->raiseError(DB_ERROR_UNSUPPORTED);
-    }
-
-    // }}}
-    // {{{ quoteFloat()
-
-    /**
-     * Formats a float value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param float the float value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteFloat($float) {
-        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
-    }
-     
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @see DB_common::quoteSmart()
-     * @since Method available since Release 1.7.0
-     */
-    function escapeSimple($str)
-    {
-        return addslashes($str);
-    }
-
-    // }}}
-    // {{{ msqlRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_msql::errorNative(), DB_msql::errorCode()
-     */
-    function msqlRaiseError($errno = null)
-    {
-        $native = $this->errorNative();
-        if ($errno === null) {
-            $errno = $this->errorCode($native);
-        }
-        return $this->raiseError($errno, null, null, null, $native);
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error message produced by the last query
-     *
-     * @return string  the DBMS' error message
-     */
-    function errorNative()
-    {
-        return @msql_error();
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Determines PEAR::DB error code from the database's text error message
-     *
-     * @param string $errormsg  the error message returned from the database
-     *
-     * @return integer  the error number from a DB_ERROR* constant
-     */
-    function errorCode($errormsg)
-    {
-        static $error_regexps;
-        
-        // PHP 5.2+ prepends the function name to $php_errormsg, so we need
-        // this hack to work around it, per bug #9599.
-        $errormsg = preg_replace('/^msql[a-z_]+\(\): /', '', $errormsg);
-
-        if (!isset($error_regexps)) {
-            $error_regexps = array(
-                '/^Access to database denied/i'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/^Bad index name/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/^Bad order field/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Bad type for comparison/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Can\'t perform LIKE on/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Can\'t use TEXT fields in LIKE comparison/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Couldn\'t create temporary table/i'
-                    => DB_ERROR_CANNOT_CREATE,
-                '/^Error creating table file/i'
-                    => DB_ERROR_CANNOT_CREATE,
-                '/^Field .* cannot be null$/i'
-                    => DB_ERROR_CONSTRAINT_NOT_NULL,
-                '/^Index (field|condition) .* cannot be null$/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Invalid date format/i'
-                    => DB_ERROR_INVALID_DATE,
-                '/^Invalid time format/i'
-                    => DB_ERROR_INVALID,
-                '/^Literal value for .* is wrong type$/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/^No Database Selected/i'
-                    => DB_ERROR_NODBSELECTED,
-                '/^No value specified for field/i'
-                    => DB_ERROR_VALUE_COUNT_ON_ROW,
-                '/^Non unique value for unique index/i'
-                    => DB_ERROR_CONSTRAINT,
-                '/^Out of memory for temporary table/i'
-                    => DB_ERROR_CANNOT_CREATE,
-                '/^Permission denied/i'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/^Reference to un-selected table/i'
-                    => DB_ERROR_SYNTAX,
-                '/^syntax error/i'
-                    => DB_ERROR_SYNTAX,
-                '/^Table .* exists$/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/^Unknown database/i'
-                    => DB_ERROR_NOSUCHDB,
-                '/^Unknown field/i'
-                    => DB_ERROR_NOSUCHFIELD,
-                '/^Unknown (index|system variable)/i'
-                    => DB_ERROR_NOT_FOUND,
-                '/^Unknown table/i'
-                    => DB_ERROR_NOSUCHTABLE,
-                '/^Unqualified field/i'
-                    => DB_ERROR_SYNTAX,
-            );
-        }
-
-        foreach ($error_regexps as $regexp => $code) {
-            if (preg_match($regexp, $errormsg)) {
-                return $code;
-            }
-        }
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::setOption()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @msql_query("SELECT * FROM $result",
-                              $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @msql_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $tmp = @msql_fetch_field($id);
-
-            $flags = '';
-            if ($tmp->not_null) {
-                $flags .= 'not_null ';
-            }
-            if ($tmp->unique) {
-                $flags .= 'unique_key ';
-            }
-            $flags = trim($flags);
-
-            $res[$i] = array(
-                'table' => $case_func($tmp->table),
-                'name'  => $case_func($tmp->name),
-                'type'  => $tmp->type,
-                'len'   => msql_field_len($id, $i),
-                'flags' => $flags,
-            );
-
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @msql_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtain a list of a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return array  the array containing the list of objects requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'databases':
-                $id = @msql_list_dbs($this->connection);
-                break;
-            case 'tables':
-                $id = @msql_list_tables($this->dsn['database'],
-                                        $this->connection);
-                break;
-            default:
-                return null;
-        }
-        if (!$id) {
-            return $this->msqlRaiseError();
-        }
-        $out = array();
-        while ($row = @msql_fetch_row($id)) {
-            $out[] = $row[0];
-        }
-        return $out;
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/mssql.php b/lib/php/DB/mssql.php
deleted file mode 100644
index 57e19b0fd3d3b881511a0921cf495f67d7fa6ef4..0000000000000000000000000000000000000000
--- a/lib/php/DB/mssql.php
+++ /dev/null
@@ -1,963 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's mssql extension
- * for interacting with Microsoft SQL Server databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: mssql.php,v 1.92 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mssql extension
- * for interacting with Microsoft SQL Server databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * DB's mssql driver is only for Microsfoft SQL Server databases.
- *
- * If you're connecting to a Sybase database, you MUST specify "sybase"
- * as the "phptype" in the DSN.
- *
- * This class only works correctly if you have compiled PHP using
- * --with-mssql=[dir_to_FreeTDS].
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_mssql extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'mssql';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'mssql';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'emulate',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    // XXX Add here error codes ie: 'S100E' => DB_ERROR_SYNTAX
-    var $errorcode_map = array(
-        102   => DB_ERROR_SYNTAX,
-        110   => DB_ERROR_VALUE_COUNT_ON_ROW,
-        155   => DB_ERROR_NOSUCHFIELD,
-        156   => DB_ERROR_SYNTAX,
-        170   => DB_ERROR_SYNTAX,
-        207   => DB_ERROR_NOSUCHFIELD,
-        208   => DB_ERROR_NOSUCHTABLE,
-        245   => DB_ERROR_INVALID_NUMBER,
-        319   => DB_ERROR_SYNTAX,
-        321   => DB_ERROR_NOSUCHFIELD,
-        325   => DB_ERROR_SYNTAX,
-        336   => DB_ERROR_SYNTAX,
-        515   => DB_ERROR_CONSTRAINT_NOT_NULL,
-        547   => DB_ERROR_CONSTRAINT,
-        1018  => DB_ERROR_SYNTAX,
-        1035  => DB_ERROR_SYNTAX,
-        1913  => DB_ERROR_ALREADY_EXISTS,
-        2209  => DB_ERROR_SYNTAX,
-        2223  => DB_ERROR_SYNTAX,
-        2248  => DB_ERROR_SYNTAX,
-        2256  => DB_ERROR_SYNTAX,
-        2257  => DB_ERROR_SYNTAX,
-        2627  => DB_ERROR_CONSTRAINT,
-        2714  => DB_ERROR_ALREADY_EXISTS,
-        3607  => DB_ERROR_DIVZERO,
-        3701  => DB_ERROR_NOSUCHTABLE,
-        7630  => DB_ERROR_SYNTAX,
-        8134  => DB_ERROR_DIVZERO,
-        9303  => DB_ERROR_SYNTAX,
-        9317  => DB_ERROR_SYNTAX,
-        9318  => DB_ERROR_SYNTAX,
-        9331  => DB_ERROR_SYNTAX,
-        9332  => DB_ERROR_SYNTAX,
-        15253 => DB_ERROR_SYNTAX,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The database specified in the DSN
-     *
-     * It's a fix to allow calls to different databases in the same script.
-     *
-     * @var string
-     * @access private
-     */
-    var $_db = null;
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_mssql()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('mssql') && !PEAR::loadExtension('sybase')
-            && !PEAR::loadExtension('sybase_ct'))
-        {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $params = array(
-            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
-            $dsn['username'] ? $dsn['username'] : null,
-            $dsn['password'] ? $dsn['password'] : null,
-        );
-        if ($dsn['port']) {
-            $params[0] .= ((substr(PHP_OS, 0, 3) == 'WIN') ? ',' : ':')
-                        . $dsn['port'];
-        }
-
-        $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect';
-
-        $this->connection = @call_user_func_array($connect_function, $params);
-
-        if (!$this->connection) {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     @mssql_get_last_message());
-        }
-        if ($dsn['database']) {
-            if (!@mssql_select_db($dsn['database'], $this->connection)) {
-                return $this->raiseError(DB_ERROR_NODBSELECTED,
-                                         null, null, null,
-                                         @mssql_get_last_message());
-            }
-            $this->_db = $dsn['database'];
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @mssql_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        if (!@mssql_select_db($this->_db, $this->connection)) {
-            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
-        }
-        $query = $this->modifyQuery($query);
-        if (!$this->autocommit && $ismanip) {
-            if ($this->transaction_opcount == 0) {
-                $result = @mssql_query('BEGIN TRAN', $this->connection);
-                if (!$result) {
-                    return $this->mssqlRaiseError();
-                }
-            }
-            $this->transaction_opcount++;
-        }
-        $result = @mssql_query($query, $this->connection);
-        if (!$result) {
-            return $this->mssqlRaiseError();
-        }
-        // Determine which queries that should return data, and which
-        // should return an error code only.
-        return $ismanip ? DB_OK : $result;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal mssql result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return @mssql_next_result($result);
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@mssql_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @mssql_fetch_assoc($result);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @mssql_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? mssql_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @mssql_num_fields($result);
-        if (!$cols) {
-            return $this->mssqlRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @mssql_num_rows($result);
-        if ($rows === false) {
-            return $this->mssqlRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            if (!@mssql_select_db($this->_db, $this->connection)) {
-                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $result = @mssql_query('COMMIT TRAN', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mssqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            if (!@mssql_select_db($this->_db, $this->connection)) {
-                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $result = @mssql_query('ROLLBACK TRAN', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mssqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            $res = @mssql_query('select @@rowcount', $this->connection);
-            if (!$res) {
-                return $this->mssqlRaiseError();
-            }
-            $ar = @mssql_fetch_row($res);
-            if (!$ar) {
-                $result = 0;
-            } else {
-                @mssql_free_result($res);
-                $result = $ar[0];
-            }
-        } else {
-            $result = 0;
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_mssql::createSequence(), DB_mssql::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        if (!@mssql_select_db($this->_db, $this->connection)) {
-            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
-        }
-        $repeat = 0;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
-            {
-                $repeat = 1;
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-            } elseif (!DB::isError($result)) {
-                $result = $this->query("SELECT IDENT_CURRENT('$seqname')");
-                if (DB::isError($result)) {
-                    /* Fallback code for MS SQL Server 7.0, which doesn't have
-                     * IDENT_CURRENT. This is *not* safe for concurrent
-                     * requests, and really, if you're using it, you're in a
-                     * world of hurt. Nevertheless, it's here to ensure BC. See
-                     * bug #181 for the gory details.*/
-                    $result = $this->query("SELECT @@IDENTITY FROM $seqname");
-                }
-                $repeat = 0;
-            } else {
-                $repeat = false;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        return $result[0];
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_mssql::nextID(), DB_mssql::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        return $this->query('CREATE TABLE '
-                            . $this->getSequenceName($seq_name)
-                            . ' ([id] [int] IDENTITY (1, 1) NOT NULL,'
-                            . ' [vapor] [int] NULL)');
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_mssql::nextID(), DB_mssql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * Quotes a string so it can be safely used as a table or column name
-     *
-     * @param string $str  identifier name to be quoted
-     *
-     * @return string  quoted identifier string
-     *
-     * @see DB_common::quoteIdentifier()
-     * @since Method available since Release 1.6.0
-     */
-    function quoteIdentifier($str)
-    {
-        return '[' . str_replace(']', ']]', $str) . ']';
-    }
-
-    // }}}
-    // {{{ mssqlRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_mssql::errorNative(), DB_mssql::errorCode()
-     */
-    function mssqlRaiseError($code = null)
-    {
-        $message = @mssql_get_last_message();
-        if (!$code) {
-            $code = $this->errorNative();
-        }
-        return $this->raiseError($this->errorCode($code, $message),
-                                 null, null, null, "$code - $message");
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code
-     */
-    function errorNative()
-    {
-        $res = @mssql_query('select @@ERROR as ErrorCode', $this->connection);
-        if (!$res) {
-            return DB_ERROR;
-        }
-        $row = @mssql_fetch_row($res);
-        return $row[0];
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Determines PEAR::DB error code from mssql's native codes.
-     *
-     * If <var>$nativecode</var> isn't known yet, it will be looked up.
-     *
-     * @param  mixed  $nativecode  mssql error code, if known
-     * @return integer  an error number from a DB error constant
-     * @see errorNative()
-     */
-    function errorCode($nativecode = null, $msg = '')
-    {
-        if (!$nativecode) {
-            $nativecode = $this->errorNative();
-        }
-        if (isset($this->errorcode_map[$nativecode])) {
-            if ($nativecode == 3701
-                && preg_match('/Cannot drop the index/i', $msg))
-            {
-                return DB_ERROR_NOT_FOUND;
-            }
-            return $this->errorcode_map[$nativecode];
-        } else {
-            return DB_ERROR;
-        }
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
-     * is a table name.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            if (!@mssql_select_db($this->_db, $this->connection)) {
-                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $id = @mssql_query("SELECT * FROM $result WHERE 1=0",
-                               $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->mssqlRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @mssql_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            if ($got_string) {
-                $flags = $this->_mssql_field_flags($result,
-                        @mssql_field_name($id, $i));
-                if (DB::isError($flags)) {
-                    return $flags;
-                }
-            } else {
-                $flags = '';
-            }
-
-            $res[$i] = array(
-                'table' => $got_string ? $case_func($result) : '',
-                'name'  => $case_func(@mssql_field_name($id, $i)),
-                'type'  => @mssql_field_type($id, $i),
-                'len'   => @mssql_field_length($id, $i),
-                'flags' => $flags,
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @mssql_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ _mssql_field_flags()
-
-    /**
-     * Get a column's flags
-     *
-     * Supports "not_null", "primary_key",
-     * "auto_increment" (mssql identity), "timestamp" (mssql timestamp),
-     * "unique_key" (mssql unique index, unique check or primary_key) and
-     * "multiple_key" (multikey index)
-     *
-     * mssql timestamp is NOT similar to the mysql timestamp so this is maybe
-     * not useful at all - is the behaviour of mysql_field_flags that primary
-     * keys are alway unique? is the interpretation of multiple_key correct?
-     *
-     * @param string $table   the table name
-     * @param string $column  the field name
-     *
-     * @return string  the flags
-     *
-     * @access private
-     * @author Joern Barthel <j_barthel@web.de>
-     */
-    function _mssql_field_flags($table, $column)
-    {
-        static $tableName = null;
-        static $flags = array();
-
-        if ($table != $tableName) {
-
-            $flags = array();
-            $tableName = $table;
-
-            // get unique and primary keys
-            $res = $this->getAll("EXEC SP_HELPINDEX $table", DB_FETCHMODE_ASSOC);
-            if (DB::isError($res)) {
-                return $res;
-            }
-
-            foreach ($res as $val) {
-                $keys = explode(', ', $val['index_keys']);
-
-                if (sizeof($keys) > 1) {
-                    foreach ($keys as $key) {
-                        $this->_add_flag($flags[$key], 'multiple_key');
-                    }
-                }
-
-                if (strpos($val['index_description'], 'primary key')) {
-                    foreach ($keys as $key) {
-                        $this->_add_flag($flags[$key], 'primary_key');
-                    }
-                } elseif (strpos($val['index_description'], 'unique')) {
-                    foreach ($keys as $key) {
-                        $this->_add_flag($flags[$key], 'unique_key');
-                    }
-                }
-            }
-
-            // get auto_increment, not_null and timestamp
-            $res = $this->getAll("EXEC SP_COLUMNS $table", DB_FETCHMODE_ASSOC);
-            if (DB::isError($res)) {
-                return $res;
-            }
-
-            foreach ($res as $val) {
-                $val = array_change_key_case($val, CASE_LOWER);
-                if ($val['nullable'] == '0') {
-                    $this->_add_flag($flags[$val['column_name']], 'not_null');
-                }
-                if (strpos($val['type_name'], 'identity')) {
-                    $this->_add_flag($flags[$val['column_name']], 'auto_increment');
-                }
-                if (strpos($val['type_name'], 'timestamp')) {
-                    $this->_add_flag($flags[$val['column_name']], 'timestamp');
-                }
-            }
-        }
-
-        if (array_key_exists($column, $flags)) {
-            return(implode(' ', $flags[$column]));
-        }
-        return '';
-    }
-
-    // }}}
-    // {{{ _add_flag()
-
-    /**
-     * Adds a string to the flags array if the flag is not yet in there
-     * - if there is no flag present the array is created
-     *
-     * @param array  &$array  the reference to the flag-array
-     * @param string $value   the flag value
-     *
-     * @return void
-     *
-     * @access private
-     * @author Joern Barthel <j_barthel@web.de>
-     */
-    function _add_flag(&$array, $value)
-    {
-        if (!is_array($array)) {
-            $array = array($value);
-        } elseif (!in_array($value, $array)) {
-            array_push($array, $value);
-        }
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return "SELECT name FROM sysobjects WHERE type = 'U'"
-                       . ' ORDER BY name';
-            case 'views':
-                return "SELECT name FROM sysobjects WHERE type = 'V'";
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/mysql.php b/lib/php/DB/mysql.php
deleted file mode 100644
index e9b5e70c9d38402edc0a289bfcb0f67ffe0662f0..0000000000000000000000000000000000000000
--- a/lib/php/DB/mysql.php
+++ /dev/null
@@ -1,1045 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's mysql extension
- * for interacting with MySQL databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: mysql.php,v 1.126 2007/09/21 13:32:52 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mysql extension
- * for interacting with MySQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_mysql extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'mysql';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'mysql';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => '4.2.0',
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        1004 => DB_ERROR_CANNOT_CREATE,
-        1005 => DB_ERROR_CANNOT_CREATE,
-        1006 => DB_ERROR_CANNOT_CREATE,
-        1007 => DB_ERROR_ALREADY_EXISTS,
-        1008 => DB_ERROR_CANNOT_DROP,
-        1022 => DB_ERROR_ALREADY_EXISTS,
-        1044 => DB_ERROR_ACCESS_VIOLATION,
-        1046 => DB_ERROR_NODBSELECTED,
-        1048 => DB_ERROR_CONSTRAINT,
-        1049 => DB_ERROR_NOSUCHDB,
-        1050 => DB_ERROR_ALREADY_EXISTS,
-        1051 => DB_ERROR_NOSUCHTABLE,
-        1054 => DB_ERROR_NOSUCHFIELD,
-        1061 => DB_ERROR_ALREADY_EXISTS,
-        1062 => DB_ERROR_ALREADY_EXISTS,
-        1064 => DB_ERROR_SYNTAX,
-        1091 => DB_ERROR_NOT_FOUND,
-        1100 => DB_ERROR_NOT_LOCKED,
-        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
-        1142 => DB_ERROR_ACCESS_VIOLATION,
-        1146 => DB_ERROR_NOSUCHTABLE,
-        1216 => DB_ERROR_CONSTRAINT,
-        1217 => DB_ERROR_CONSTRAINT,
-        1356 => DB_ERROR_DIVZERO,
-        1451 => DB_ERROR_CONSTRAINT,
-        1452 => DB_ERROR_CONSTRAINT,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The database specified in the DSN
-     *
-     * It's a fix to allow calls to different databases in the same script.
-     *
-     * @var string
-     * @access private
-     */
-    var $_db = '';
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_mysql()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's mysql driver supports the following extra DSN options:
-     *   + new_link      If set to true, causes subsequent calls to connect()
-     *                    to return a new connection link instead of the
-     *                    existing one.  WARNING: this is not portable to
-     *                    other DBMS's. Available since PEAR DB 1.7.0.
-     *   + client_flags  Any combination of MYSQL_CLIENT_* constants.
-     *                    Only used if PHP is at version 4.3.0 or greater.
-     *                    Available since PEAR DB 1.7.0.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('mysql')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $params = array();
-        if ($dsn['protocol'] && $dsn['protocol'] == 'unix') {
-            $params[0] = ':' . $dsn['socket'];
-        } else {
-            $params[0] = $dsn['hostspec'] ? $dsn['hostspec']
-                         : 'localhost';
-            if ($dsn['port']) {
-                $params[0] .= ':' . $dsn['port'];
-            }
-        }
-        $params[] = $dsn['username'] ? $dsn['username'] : null;
-        $params[] = $dsn['password'] ? $dsn['password'] : null;
-
-        if (!$persistent) {
-            if (isset($dsn['new_link'])
-                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
-            {
-                $params[] = true;
-            } else {
-                $params[] = false;
-            }
-        }
-        if (version_compare(phpversion(), '4.3.0', '>=')) {
-            $params[] = isset($dsn['client_flags'])
-                        ? $dsn['client_flags'] : null;
-        }
-
-        $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';
-
-        $ini = ini_get('track_errors');
-        $php_errormsg = '';
-        if ($ini) {
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-        } else {
-            @ini_set('track_errors', 1);
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-            @ini_set('track_errors', $ini);
-        }
-
-        if (!$this->connection) {
-            if (($err = @mysql_error()) != '') {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null, 
-                                         $err);
-            } else {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-        }
-
-        if ($dsn['database']) {
-            if (!@mysql_select_db($dsn['database'], $this->connection)) {
-                return $this->mysqlRaiseError();
-            }
-            $this->_db = $dsn['database'];
-        }
-
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @mysql_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * Generally uses mysql_query().  If you want to use
-     * mysql_unbuffered_query() set the "result_buffering" option to 0 using
-     * setOptions().  This option was added in Release 1.7.0.
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        if ($this->_db) {
-            if (!@mysql_select_db($this->_db, $this->connection)) {
-                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
-            }
-        }
-        if (!$this->autocommit && $ismanip) {
-            if ($this->transaction_opcount == 0) {
-                $result = @mysql_query('SET AUTOCOMMIT=0', $this->connection);
-                $result = @mysql_query('BEGIN', $this->connection);
-                if (!$result) {
-                    return $this->mysqlRaiseError();
-                }
-            }
-            $this->transaction_opcount++;
-        }
-        if (!$this->options['result_buffering']) {
-            $result = @mysql_unbuffered_query($query, $this->connection);
-        } else {
-            $result = @mysql_query($query, $this->connection);
-        }
-        if (!$result) {
-            return $this->mysqlRaiseError();
-        }
-        if (is_resource($result)) {
-            return $result;
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal mysql result pointer to the next available result
-     *
-     * This method has not been implemented yet.
-     *
-     * @param a valid sql result resource
-     *
-     * @return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@mysql_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @mysql_fetch_array($result, MYSQL_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @mysql_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            /*
-             * Even though this DBMS already trims output, we do this because
-             * a field might have intentional whitespace at the end that
-             * gets removed by DB_PORTABILITY_RTRIM under another driver.
-             */
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? mysql_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @mysql_num_fields($result);
-        if (!$cols) {
-            return $this->mysqlRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @mysql_num_rows($result);
-        if ($rows === null) {
-            return $this->mysqlRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db) {
-                if (!@mysql_select_db($this->_db, $this->connection)) {
-                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-            $result = @mysql_query('COMMIT', $this->connection);
-            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mysqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db) {
-                if (!@mysql_select_db($this->_db, $this->connection)) {
-                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-            $result = @mysql_query('ROLLBACK', $this->connection);
-            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mysqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            return @mysql_affected_rows($this->connection);
-        } else {
-            return 0;
-        }
-     }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_mysql::createSequence(), DB_mysql::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        do {
-            $repeat = 0;
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("UPDATE ${seqname} ".
-                                   'SET id=LAST_INSERT_ID(id+1)');
-            $this->popErrorHandling();
-            if ($result === DB_OK) {
-                // COMMON CASE
-                $id = @mysql_insert_id($this->connection);
-                if ($id != 0) {
-                    return $id;
-                }
-                // EMPTY SEQ TABLE
-                // Sequence table must be empty for some reason, so fill
-                // it and return 1 and obtain a user-level lock
-                $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                if ($result == 0) {
-                    // Failed to get the lock
-                    return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
-                }
-
-                // add the default value
-                $result = $this->query("REPLACE INTO ${seqname} (id) VALUES (0)");
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-
-                // Release the lock
-                $result = $this->getOne('SELECT RELEASE_LOCK('
-                                        . "'${seqname}_lock')");
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                // We know what the result will be, so no need to try again
-                return 1;
-
-            } elseif ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE)
-            {
-                // ONDEMAND TABLE CREATION
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                } else {
-                    $repeat = 1;
-                }
-
-            } elseif (DB::isError($result) &&
-                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
-            {
-                // BACKWARDS COMPAT
-                // see _BCsequence() comment
-                $result = $this->_BCsequence($seqname);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                $repeat = 1;
-            }
-        } while ($repeat);
-
-        return $this->raiseError($result);
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_mysql::nextID(), DB_mysql::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $res = $this->query('CREATE TABLE ' . $seqname
-                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
-                            . ' PRIMARY KEY(id))');
-        if (DB::isError($res)) {
-            return $res;
-        }
-        // insert yields value 1, nextId call will generate ID 2
-        $res = $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
-        if (DB::isError($res)) {
-            return $res;
-        }
-        // so reset to zero
-        return $this->query("UPDATE ${seqname} SET id = 0");
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_mysql::nextID(), DB_mysql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ _BCsequence()
-
-    /**
-     * Backwards compatibility with old sequence emulation implementation
-     * (clean up the dupes)
-     *
-     * @param string $seqname  the sequence name to clean up
-     *
-     * @return bool  true on success.  A DB_Error object on failure.
-     *
-     * @access private
-     */
-    function _BCsequence($seqname)
-    {
-        // Obtain a user-level lock... this will release any previous
-        // application locks, but unlike LOCK TABLES, it does not abort
-        // the current transaction and is much less frequently used.
-        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
-        if (DB::isError($result)) {
-            return $result;
-        }
-        if ($result == 0) {
-            // Failed to get the lock, can't do the conversion, bail
-            // with a DB_ERROR_NOT_LOCKED error
-            return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
-        }
-
-        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
-        if (DB::isError($highest_id)) {
-            return $highest_id;
-        }
-        // This should kill all rows except the highest
-        // We should probably do something if $highest_id isn't
-        // numeric, but I'm at a loss as how to handle that...
-        $result = $this->query('DELETE FROM ' . $seqname
-                               . " WHERE id <> $highest_id");
-        if (DB::isError($result)) {
-            return $result;
-        }
-
-        // If another thread has been waiting for this lock,
-        // it will go thru the above procedure, but will have no
-        // real effect
-        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
-        if (DB::isError($result)) {
-            return $result;
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * Quotes a string so it can be safely used as a table or column name
-     * (WARNING: using names that require this is a REALLY BAD IDEA)
-     *
-     * WARNING:  Older versions of MySQL can't handle the backtick
-     * character (<kbd>`</kbd>) in table or column names.
-     *
-     * @param string $str  identifier name to be quoted
-     *
-     * @return string  quoted identifier string
-     *
-     * @see DB_common::quoteIdentifier()
-     * @since Method available since Release 1.6.0
-     */
-    function quoteIdentifier($str)
-    {
-        return '`' . str_replace('`', '``', $str) . '`';
-    }
-
-    // }}}
-    // {{{ quote()
-
-    /**
-     * @deprecated  Deprecated in release 1.6.0
-     */
-    function quote($str)
-    {
-        return $this->quoteSmart($str);
-    }
-
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @see DB_common::quoteSmart()
-     * @since Method available since Release 1.6.0
-     */
-    function escapeSimple($str)
-    {
-        if (function_exists('mysql_real_escape_string')) {
-            return @mysql_real_escape_string($str, $this->connection);
-        } else {
-            return @mysql_escape_string($str);
-        }
-    }
-
-    // }}}
-    // {{{ modifyQuery()
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * This little hack lets you know how many rows were deleted
-     * when running a "DELETE FROM table" query.  Only implemented
-     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
-     *
-     * @param string $query  the query string to modify
-     *
-     * @return string  the modified query string
-     *
-     * @access protected
-     * @see DB_common::setOption()
-     */
-    function modifyQuery($query)
-    {
-        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
-            // "DELETE FROM table" gives 0 affected rows in MySQL.
-            // This little hack lets you know how many rows were deleted.
-            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
-                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
-                                      'DELETE FROM \1 WHERE 1=1', $query);
-            }
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        if (DB::isManip($query) || $this->_next_query_manip) {
-            return $query . " LIMIT $count";
-        } else {
-            return $query . " LIMIT $from, $count";
-        }
-    }
-
-    // }}}
-    // {{{ mysqlRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_mysql::errorNative(), DB_common::errorCode()
-     */
-    function mysqlRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
-                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
-                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
-                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
-            } else {
-                // Doing this in case mode changes during runtime.
-                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
-                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
-                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
-            }
-            $errno = $this->errorCode(mysql_errno($this->connection));
-        }
-        return $this->raiseError($errno, null, null, null,
-                                 @mysql_errno($this->connection) . ' ** ' .
-                                 @mysql_error($this->connection));
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code
-     */
-    function errorNative()
-    {
-        return @mysql_errno($this->connection);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            // Fix for bug #11580.
-            if ($this->_db) {
-                if (!@mysql_select_db($this->_db, $this->connection)) {
-                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-            
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @mysql_query("SELECT * FROM $result LIMIT 0",
-                               $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->mysqlRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @mysql_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $res[$i] = array(
-                'table' => $case_func(@mysql_field_table($id, $i)),
-                'name'  => $case_func(@mysql_field_name($id, $i)),
-                'type'  => @mysql_field_type($id, $i),
-                'len'   => @mysql_field_len($id, $i),
-                'flags' => @mysql_field_flags($id, $i),
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @mysql_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SHOW TABLES';
-            case 'users':
-                return 'SELECT DISTINCT User FROM mysql.user';
-            case 'databases':
-                return 'SHOW DATABASES';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/mysqli.php b/lib/php/DB/mysqli.php
deleted file mode 100644
index 4449484d719b9bd73aa37835ff04d773eb99a97b..0000000000000000000000000000000000000000
--- a/lib/php/DB/mysqli.php
+++ /dev/null
@@ -1,1092 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's mysqli extension
- * for interacting with MySQL databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: mysqli.php,v 1.82 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's mysqli extension
- * for interacting with MySQL databases
- *
- * This is for MySQL versions 4.1 and above.  Requires PHP 5.
- *
- * Note that persistent connections no longer exist.
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- * @since      Class functional since Release 1.6.3
- */
-class DB_mysqli extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'mysqli';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'mysqli';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => false,
-        'prepare'       => false,
-        'ssl'           => true,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        1004 => DB_ERROR_CANNOT_CREATE,
-        1005 => DB_ERROR_CANNOT_CREATE,
-        1006 => DB_ERROR_CANNOT_CREATE,
-        1007 => DB_ERROR_ALREADY_EXISTS,
-        1008 => DB_ERROR_CANNOT_DROP,
-        1022 => DB_ERROR_ALREADY_EXISTS,
-        1044 => DB_ERROR_ACCESS_VIOLATION,
-        1046 => DB_ERROR_NODBSELECTED,
-        1048 => DB_ERROR_CONSTRAINT,
-        1049 => DB_ERROR_NOSUCHDB,
-        1050 => DB_ERROR_ALREADY_EXISTS,
-        1051 => DB_ERROR_NOSUCHTABLE,
-        1054 => DB_ERROR_NOSUCHFIELD,
-        1061 => DB_ERROR_ALREADY_EXISTS,
-        1062 => DB_ERROR_ALREADY_EXISTS,
-        1064 => DB_ERROR_SYNTAX,
-        1091 => DB_ERROR_NOT_FOUND,
-        1100 => DB_ERROR_NOT_LOCKED,
-        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
-        1142 => DB_ERROR_ACCESS_VIOLATION,
-        1146 => DB_ERROR_NOSUCHTABLE,
-        1216 => DB_ERROR_CONSTRAINT,
-        1217 => DB_ERROR_CONSTRAINT,
-        1356 => DB_ERROR_DIVZERO,
-        1451 => DB_ERROR_CONSTRAINT,
-        1452 => DB_ERROR_CONSTRAINT,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The database specified in the DSN
-     *
-     * It's a fix to allow calls to different databases in the same script.
-     *
-     * @var string
-     * @access private
-     */
-    var $_db = '';
-
-    /**
-     * Array for converting MYSQLI_*_FLAG constants to text values
-     * @var    array
-     * @access public
-     * @since  Property available since Release 1.6.5
-     */
-    var $mysqli_flags = array(
-        MYSQLI_NOT_NULL_FLAG        => 'not_null',
-        MYSQLI_PRI_KEY_FLAG         => 'primary_key',
-        MYSQLI_UNIQUE_KEY_FLAG      => 'unique_key',
-        MYSQLI_MULTIPLE_KEY_FLAG    => 'multiple_key',
-        MYSQLI_BLOB_FLAG            => 'blob',
-        MYSQLI_UNSIGNED_FLAG        => 'unsigned',
-        MYSQLI_ZEROFILL_FLAG        => 'zerofill',
-        MYSQLI_AUTO_INCREMENT_FLAG  => 'auto_increment',
-        MYSQLI_TIMESTAMP_FLAG       => 'timestamp',
-        MYSQLI_SET_FLAG             => 'set',
-        // MYSQLI_NUM_FLAG             => 'numeric',  // unnecessary
-        // MYSQLI_PART_KEY_FLAG        => 'multiple_key',  // duplicatvie
-        MYSQLI_GROUP_FLAG           => 'group_by'
-    );
-
-    /**
-     * Array for converting MYSQLI_TYPE_* constants to text values
-     * @var    array
-     * @access public
-     * @since  Property available since Release 1.6.5
-     */
-    var $mysqli_types = array(
-        MYSQLI_TYPE_DECIMAL     => 'decimal',
-        MYSQLI_TYPE_TINY        => 'tinyint',
-        MYSQLI_TYPE_SHORT       => 'int',
-        MYSQLI_TYPE_LONG        => 'int',
-        MYSQLI_TYPE_FLOAT       => 'float',
-        MYSQLI_TYPE_DOUBLE      => 'double',
-        // MYSQLI_TYPE_NULL        => 'DEFAULT NULL',  // let flags handle it
-        MYSQLI_TYPE_TIMESTAMP   => 'timestamp',
-        MYSQLI_TYPE_LONGLONG    => 'bigint',
-        MYSQLI_TYPE_INT24       => 'mediumint',
-        MYSQLI_TYPE_DATE        => 'date',
-        MYSQLI_TYPE_TIME        => 'time',
-        MYSQLI_TYPE_DATETIME    => 'datetime',
-        MYSQLI_TYPE_YEAR        => 'year',
-        MYSQLI_TYPE_NEWDATE     => 'date',
-        MYSQLI_TYPE_ENUM        => 'enum',
-        MYSQLI_TYPE_SET         => 'set',
-        MYSQLI_TYPE_TINY_BLOB   => 'tinyblob',
-        MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
-        MYSQLI_TYPE_LONG_BLOB   => 'longblob',
-        MYSQLI_TYPE_BLOB        => 'blob',
-        MYSQLI_TYPE_VAR_STRING  => 'varchar',
-        MYSQLI_TYPE_STRING      => 'char',
-        MYSQLI_TYPE_GEOMETRY    => 'geometry',
-        /* These constants are conditionally compiled in ext/mysqli, so we'll
-         * define them by number rather than constant. */
-        16                      => 'bit',
-        246                     => 'decimal',
-    );
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_mysqli()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's mysqli driver supports the following extra DSN options:
-     *   + When the 'ssl' $option passed to DB::connect() is true:
-     *     + key      The path to the key file.
-     *     + cert     The path to the certificate file.
-     *     + ca       The path to the certificate authority file.
-     *     + capath   The path to a directory that contains trusted SSL
-     *                 CA certificates in pem format.
-     *     + cipher   The list of allowable ciphers for SSL encryption.
-     *
-     * Example of how to connect using SSL:
-     * <code>
-     * require_once 'DB.php';
-     * 
-     * $dsn = array(
-     *     'phptype'  => 'mysqli',
-     *     'username' => 'someuser',
-     *     'password' => 'apasswd',
-     *     'hostspec' => 'localhost',
-     *     'database' => 'thedb',
-     *     'key'      => 'client-key.pem',
-     *     'cert'     => 'client-cert.pem',
-     *     'ca'       => 'cacert.pem',
-     *     'capath'   => '/path/to/ca/dir',
-     *     'cipher'   => 'AES',
-     * );
-     * 
-     * $options = array(
-     *     'ssl' => true,
-     * );
-     * 
-     * $db = DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('mysqli')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $ini = ini_get('track_errors');
-        @ini_set('track_errors', 1);
-        $php_errormsg = '';
-
-        if (((int) $this->getOption('ssl')) === 1) {
-            $init = mysqli_init();
-            mysqli_ssl_set(
-                $init,
-                empty($dsn['key'])    ? null : $dsn['key'],
-                empty($dsn['cert'])   ? null : $dsn['cert'],
-                empty($dsn['ca'])     ? null : $dsn['ca'],
-                empty($dsn['capath']) ? null : $dsn['capath'],
-                empty($dsn['cipher']) ? null : $dsn['cipher']
-            );
-            if ($this->connection = @mysqli_real_connect(
-                    $init,
-                    $dsn['hostspec'],
-                    $dsn['username'],
-                    $dsn['password'],
-                    $dsn['database'],
-                    $dsn['port'],
-                    $dsn['socket']))
-            {
-                $this->connection = $init;
-            }
-        } else {
-            $this->connection = @mysqli_connect(
-                $dsn['hostspec'],
-                $dsn['username'],
-                $dsn['password'],
-                $dsn['database'],
-                $dsn['port'],
-                $dsn['socket']
-            );
-        }
-
-        @ini_set('track_errors', $ini);
-
-        if (!$this->connection) {
-            if (($err = @mysqli_connect_error()) != '') {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $err);
-            } else {
-                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                         null, null, null,
-                                         $php_errormsg);
-            }
-        }
-
-        if ($dsn['database']) {
-            $this->_db = $dsn['database'];
-        }
-
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @mysqli_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        if ($this->_db) {
-            if (!@mysqli_select_db($this->connection, $this->_db)) {
-                return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
-            }
-        }
-        if (!$this->autocommit && $ismanip) {
-            if ($this->transaction_opcount == 0) {
-                $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=0');
-                $result = @mysqli_query($this->connection, 'BEGIN');
-                if (!$result) {
-                    return $this->mysqliRaiseError();
-                }
-            }
-            $this->transaction_opcount++;
-        }
-        $result = @mysqli_query($this->connection, $query);
-        if (!$result) {
-            return $this->mysqliRaiseError();
-        }
-        if (is_object($result)) {
-            return $result;
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal mysql result pointer to the next available result.
-     *
-     * This method has not been implemented yet.
-     *
-     * @param resource $result a valid sql result resource
-     * @return false
-     * @access public
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@mysqli_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @mysqli_fetch_array($result, MYSQLI_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @mysqli_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            /*
-             * Even though this DBMS already trims output, we do this because
-             * a field might have intentional whitespace at the end that
-             * gets removed by DB_PORTABILITY_RTRIM under another driver.
-             */
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? mysqli_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @mysqli_num_fields($result);
-        if (!$cols) {
-            return $this->mysqliRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @mysqli_num_rows($result);
-        if ($rows === null) {
-            return $this->mysqliRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db) {
-                if (!@mysqli_select_db($this->connection, $this->_db)) {
-                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-            $result = @mysqli_query($this->connection, 'COMMIT');
-            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mysqliRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db) {
-                if (!@mysqli_select_db($this->connection, $this->_db)) {
-                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-            $result = @mysqli_query($this->connection, 'ROLLBACK');
-            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->mysqliRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            return @mysqli_affected_rows($this->connection);
-        } else {
-            return 0;
-        }
-     }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_mysqli::createSequence(), DB_mysqli::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        do {
-            $repeat = 0;
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query('UPDATE ' . $seqname
-                                   . ' SET id = LAST_INSERT_ID(id + 1)');
-            $this->popErrorHandling();
-            if ($result === DB_OK) {
-                // COMMON CASE
-                $id = @mysqli_insert_id($this->connection);
-                if ($id != 0) {
-                    return $id;
-                }
-
-                // EMPTY SEQ TABLE
-                // Sequence table must be empty for some reason,
-                // so fill it and return 1
-                // Obtain a user-level lock
-                $result = $this->getOne('SELECT GET_LOCK('
-                                        . "'${seqname}_lock', 10)");
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                if ($result == 0) {
-                    return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
-                }
-
-                // add the default value
-                $result = $this->query('REPLACE INTO ' . $seqname
-                                       . ' (id) VALUES (0)');
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-
-                // Release the lock
-                $result = $this->getOne('SELECT RELEASE_LOCK('
-                                        . "'${seqname}_lock')");
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                // We know what the result will be, so no need to try again
-                return 1;
-
-            } elseif ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE)
-            {
-                // ONDEMAND TABLE CREATION
-                $result = $this->createSequence($seq_name);
-
-                // Since createSequence initializes the ID to be 1,
-                // we do not need to retrieve the ID again (or we will get 2)
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                } else {
-                    // First ID of a newly created sequence is 1
-                    return 1;
-                }
-
-            } elseif (DB::isError($result) &&
-                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
-            {
-                // BACKWARDS COMPAT
-                // see _BCsequence() comment
-                $result = $this->_BCsequence($seqname);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                $repeat = 1;
-            }
-        } while ($repeat);
-
-        return $this->raiseError($result);
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_mysqli::nextID(), DB_mysqli::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $res = $this->query('CREATE TABLE ' . $seqname
-                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
-                            . ' PRIMARY KEY(id))');
-        if (DB::isError($res)) {
-            return $res;
-        }
-        // insert yields value 1, nextId call will generate ID 2
-        return $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_mysql::nextID(), DB_mysql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ _BCsequence()
-
-    /**
-     * Backwards compatibility with old sequence emulation implementation
-     * (clean up the dupes)
-     *
-     * @param string $seqname  the sequence name to clean up
-     *
-     * @return bool  true on success.  A DB_Error object on failure.
-     *
-     * @access private
-     */
-    function _BCsequence($seqname)
-    {
-        // Obtain a user-level lock... this will release any previous
-        // application locks, but unlike LOCK TABLES, it does not abort
-        // the current transaction and is much less frequently used.
-        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
-        if (DB::isError($result)) {
-            return $result;
-        }
-        if ($result == 0) {
-            // Failed to get the lock, can't do the conversion, bail
-            // with a DB_ERROR_NOT_LOCKED error
-            return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
-        }
-
-        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
-        if (DB::isError($highest_id)) {
-            return $highest_id;
-        }
-
-        // This should kill all rows except the highest
-        // We should probably do something if $highest_id isn't
-        // numeric, but I'm at a loss as how to handle that...
-        $result = $this->query('DELETE FROM ' . $seqname
-                               . " WHERE id <> $highest_id");
-        if (DB::isError($result)) {
-            return $result;
-        }
-
-        // If another thread has been waiting for this lock,
-        // it will go thru the above procedure, but will have no
-        // real effect
-        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
-        if (DB::isError($result)) {
-            return $result;
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * Quotes a string so it can be safely used as a table or column name
-     * (WARNING: using names that require this is a REALLY BAD IDEA)
-     *
-     * WARNING:  Older versions of MySQL can't handle the backtick
-     * character (<kbd>`</kbd>) in table or column names.
-     *
-     * @param string $str  identifier name to be quoted
-     *
-     * @return string  quoted identifier string
-     *
-     * @see DB_common::quoteIdentifier()
-     * @since Method available since Release 1.6.0
-     */
-    function quoteIdentifier($str)
-    {
-        return '`' . str_replace('`', '``', $str) . '`';
-    }
-
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @see DB_common::quoteSmart()
-     * @since Method available since Release 1.6.0
-     */
-    function escapeSimple($str)
-    {
-        return @mysqli_real_escape_string($this->connection, $str);
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        if (DB::isManip($query) || $this->_next_query_manip) {
-            return $query . " LIMIT $count";
-        } else {
-            return $query . " LIMIT $from, $count";
-        }
-    }
-
-    // }}}
-    // {{{ mysqliRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_mysqli::errorNative(), DB_common::errorCode()
-     */
-    function mysqliRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
-                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
-                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
-                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
-            } else {
-                // Doing this in case mode changes during runtime.
-                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
-                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
-                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
-            }
-            $errno = $this->errorCode(mysqli_errno($this->connection));
-        }
-        return $this->raiseError($errno, null, null, null,
-                                 @mysqli_errno($this->connection) . ' ** ' .
-                                 @mysqli_error($this->connection));
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code
-     */
-    function errorNative()
-    {
-        return @mysqli_errno($this->connection);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::setOption()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            // Fix for bug #11580.
-            if ($this->_db) {
-                if (!@mysqli_select_db($this->connection, $this->_db)) {
-                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
-                }
-            }
-
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @mysqli_query($this->connection,
-                                "SELECT * FROM $result LIMIT 0");
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_a($id, 'mysqli_result')) {
-            return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @mysqli_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $tmp = @mysqli_fetch_field($id);
-
-            $flags = '';
-            foreach ($this->mysqli_flags as $const => $means) {
-                if ($tmp->flags & $const) {
-                    $flags .= $means . ' ';
-                }
-            }
-            if ($tmp->def) {
-                $flags .= 'default_' . rawurlencode($tmp->def);
-            }
-            $flags = trim($flags);
-
-            $res[$i] = array(
-                'table' => $case_func($tmp->table),
-                'name'  => $case_func($tmp->name),
-                'type'  => isset($this->mysqli_types[$tmp->type])
-                                    ? $this->mysqli_types[$tmp->type]
-                                    : 'unknown',
-                // http://bugs.php.net/?id=36579
-                'len'   => $tmp->length,
-                'flags' => $flags,
-            );
-
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @mysqli_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SHOW TABLES';
-            case 'users':
-                return 'SELECT DISTINCT User FROM mysql.user';
-            case 'databases':
-                return 'SHOW DATABASES';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/oci8.php b/lib/php/DB/oci8.php
deleted file mode 100644
index 3dfee116e37471ba27a191958ab0bc62e3c3e7ab..0000000000000000000000000000000000000000
--- a/lib/php/DB/oci8.php
+++ /dev/null
@@ -1,1156 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's oci8 extension
- * for interacting with Oracle databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     James L. Pine <jlp@valinux.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: oci8.php,v 1.115 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's oci8 extension
- * for interacting with Oracle databases
- *
- * Definitely works with versions 8 and 9 of Oracle.
- *
- * These methods overload the ones declared in DB_common.
- *
- * Be aware...  OCIError() only appears to return anything when given a
- * statement, so functions return the generic DB_ERROR instead of more
- * useful errors that have to do with feedback from the database.
- *
- * @category   Database
- * @package    DB
- * @author     James L. Pine <jlp@valinux.com>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_oci8 extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'oci8';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'oci8';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => '5.0.0',
-        'numrows'       => 'subquery',
-        'pconnect'      => true,
-        'prepare'       => true,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        1     => DB_ERROR_CONSTRAINT,
-        900   => DB_ERROR_SYNTAX,
-        904   => DB_ERROR_NOSUCHFIELD,
-        913   => DB_ERROR_VALUE_COUNT_ON_ROW,
-        921   => DB_ERROR_SYNTAX,
-        923   => DB_ERROR_SYNTAX,
-        942   => DB_ERROR_NOSUCHTABLE,
-        955   => DB_ERROR_ALREADY_EXISTS,
-        1400  => DB_ERROR_CONSTRAINT_NOT_NULL,
-        1401  => DB_ERROR_INVALID,
-        1407  => DB_ERROR_CONSTRAINT_NOT_NULL,
-        1418  => DB_ERROR_NOT_FOUND,
-        1476  => DB_ERROR_DIVZERO,
-        1722  => DB_ERROR_INVALID_NUMBER,
-        2289  => DB_ERROR_NOSUCHTABLE,
-        2291  => DB_ERROR_CONSTRAINT,
-        2292  => DB_ERROR_CONSTRAINT,
-        2449  => DB_ERROR_CONSTRAINT,
-        12899 => DB_ERROR_INVALID,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * Stores the $data passed to execute() in the oci8 driver
-     *
-     * Gets reset to array() when simpleQuery() is run.
-     *
-     * Needed in case user wants to call numRows() after prepare/execute
-     * was used.
-     *
-     * @var array
-     * @access private
-     */
-    var $_data = array();
-
-    /**
-     * The result or statement handle from the most recently executed query
-     * @var resource
-     */
-    var $last_stmt;
-
-    /**
-     * Is the given prepared statement a data manipulation query?
-     * @var array
-     * @access private
-     */
-    var $manip_query = array();
-
-    /**
-     * Store of prepared SQL queries.
-     * @var array
-     * @access private
-     */
-    var $_prepared_queries = array();
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_oci8()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * If PHP is at version 5.0.0 or greater:
-     *   + Generally, oci_connect() or oci_pconnect() are used.
-     *   + But if the new_link DSN option is set to true, oci_new_connect()
-     *     is used.
-     *
-     * When using PHP version 4.x, OCILogon() or OCIPLogon() are used.
-     *
-     * PEAR DB's oci8 driver supports the following extra DSN options:
-     *   + charset       The character set to be used on the connection.
-     *                    Only used if PHP is at version 5.0.0 or greater
-     *                    and the Oracle server is at 9.2 or greater.
-     *                    Available since PEAR DB 1.7.0.
-     *   + new_link      If set to true, causes subsequent calls to
-     *                    connect() to return a new connection link
-     *                    instead of the existing one.  WARNING: this is
-     *                    not portable to other DBMS's.
-     *                    Available since PEAR DB 1.7.0.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('oci8')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        // Backwards compatibility with DB < 1.7.0
-        if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
-            $db = $dsn['hostspec'];
-        } else {
-            $db = $dsn['database'];
-        }
-
-        if (function_exists('oci_connect')) {
-            if (isset($dsn['new_link'])
-                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
-            {
-                $connect_function = 'oci_new_connect';
-            } else {
-                $connect_function = $persistent ? 'oci_pconnect'
-                                    : 'oci_connect';
-            }
-            if (isset($this->dsn['port']) && $this->dsn['port']) {
-                $db = '//'.$db.':'.$this->dsn['port'];
-            }
-
-            $char = empty($dsn['charset']) ? null : $dsn['charset'];
-            $this->connection = @$connect_function($dsn['username'],
-                                                   $dsn['password'],
-                                                   $db,
-                                                   $char);
-            $error = OCIError();
-            if (!empty($error) && $error['code'] == 12541) {
-                // Couldn't find TNS listener.  Try direct connection.
-                $this->connection = @$connect_function($dsn['username'],
-                                                       $dsn['password'],
-                                                       null,
-                                                       $char);
-            }
-        } else {
-            $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
-            if ($db) {
-                $this->connection = @$connect_function($dsn['username'],
-                                                       $dsn['password'],
-                                                       $db);
-            } elseif ($dsn['username'] || $dsn['password']) {
-                $this->connection = @$connect_function($dsn['username'],
-                                                       $dsn['password']);
-            }
-        }
-
-        if (!$this->connection) {
-            $error = OCIError();
-            $error = (is_array($error)) ? $error['message'] : null;
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     $error);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        if (function_exists('oci_close')) {
-            $ret = @oci_close($this->connection);
-        } else {
-            $ret = @OCILogOff($this->connection);
-        }
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * To determine how many rows of a result set get buffered using
-     * ocisetprefetch(), see the "result_buffering" option in setOptions().
-     * This option was added in Release 1.7.0.
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $this->_data = array();
-        $this->last_parameters = array();
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        $result = @OCIParse($this->connection, $query);
-        if (!$result) {
-            return $this->oci8RaiseError();
-        }
-        if ($this->autocommit) {
-            $success = @OCIExecute($result,OCI_COMMIT_ON_SUCCESS);
-        } else {
-            $success = @OCIExecute($result,OCI_DEFAULT);
-        }
-        if (!$success) {
-            return $this->oci8RaiseError($result);
-        }
-        $this->last_stmt = $result;
-        if ($this->_checkManip($query)) {
-            return DB_OK;
-        } else {
-            @ocisetprefetch($result, $this->options['result_buffering']);
-            return $result;
-        }
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal oracle result pointer to the next available result
-     *
-     * @param a valid oci8 result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE &&
-                $moredata)
-            {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $moredata = OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
-        }
-        if (!$moredata) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? OCIFreeStatement($result) : false;
-    }
-
-    /**
-     * Frees the internal resources associated with a prepared query
-     *
-     * @param resource $stmt           the prepared statement's resource
-     * @param bool     $free_resource  should the PHP resource be freed too?
-     *                                  Use false if you need to get data
-     *                                  from the result set later.
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_oci8::prepare()
-     */
-    function freePrepared($stmt, $free_resource = true)
-    {
-        if (!is_resource($stmt)) {
-            return false;
-        }
-        if ($free_resource) {
-            @ocifreestatement($stmt);
-        }
-        if (isset($this->prepare_types[(int)$stmt])) {
-            unset($this->prepare_types[(int)$stmt]);
-            unset($this->manip_query[(int)$stmt]);
-        } else {
-            return false;
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * Only works if the DB_PORTABILITY_NUMROWS portability option
-     * is turned on.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows(), DB_common::setOption()
-     */
-    function numRows($result)
-    {
-        // emulate numRows for Oracle.  yuck.
-        if ($this->options['portability'] & DB_PORTABILITY_NUMROWS &&
-            $result === $this->last_stmt)
-        {
-            $countquery = 'SELECT COUNT(*) FROM ('.$this->last_query.')';
-            $save_query = $this->last_query;
-            $save_stmt = $this->last_stmt;
-
-            $count = $this->query($countquery);
-
-            // Restore the last query and statement.
-            $this->last_query = $save_query;
-            $this->last_stmt = $save_stmt;
-            
-            if (DB::isError($count) ||
-                DB::isError($row = $count->fetchRow(DB_FETCHMODE_ORDERED)))
-            {
-                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-            }
-
-            return $row[0];
-        }
-        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @OCINumCols($result);
-        if (!$cols) {
-            return $this->oci8RaiseError($result);
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ prepare()
-
-    /**
-     * Prepares a query for multiple execution with execute().
-     *
-     * With oci8, this is emulated.
-     *
-     * prepare() requires a generic query as string like <code>
-     *    INSERT INTO numbers VALUES (?, ?, ?)
-     * </code>.  The <kbd>?</kbd> characters are placeholders.
-     *
-     * Three types of placeholders can be used:
-     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
-     *   + <kbd>!</kbd>  value is inserted 'as is'
-     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
-     *                     inserted into the query (i.e. saving binary
-     *                     data in a db)
-     *
-     * Use backslashes to escape placeholder characters if you don't want
-     * them to be interpreted as placeholders.  Example: <code>
-     *    "UPDATE foo SET col=? WHERE col='over \& under'"
-     * </code>
-     *
-     * @param string $query  the query to be prepared
-     *
-     * @return mixed  DB statement resource on success. DB_Error on failure.
-     *
-     * @see DB_oci8::execute()
-     */
-    function prepare($query)
-    {
-        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
-                               PREG_SPLIT_DELIM_CAPTURE);
-        $binds    = count($tokens) - 1;
-        $token    = 0;
-        $types    = array();
-        $newquery = '';
-
-        foreach ($tokens as $key => $val) {
-            switch ($val) {
-                case '?':
-                    $types[$token++] = DB_PARAM_SCALAR;
-                    unset($tokens[$key]);
-                    break;
-                case '&':
-                    $types[$token++] = DB_PARAM_OPAQUE;
-                    unset($tokens[$key]);
-                    break;
-                case '!':
-                    $types[$token++] = DB_PARAM_MISC;
-                    unset($tokens[$key]);
-                    break;
-                default:
-                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
-                    if ($key != $binds) {
-                        $newquery .= $tokens[$key] . ':bind' . $token;
-                    } else {
-                        $newquery .= $tokens[$key];
-                    }
-            }
-        }
-
-        $this->last_query = $query;
-        $newquery = $this->modifyQuery($newquery);
-        if (!$stmt = @OCIParse($this->connection, $newquery)) {
-            return $this->oci8RaiseError();
-        }
-        $this->prepare_types[(int)$stmt] = $types;
-        $this->manip_query[(int)$stmt] = DB::isManip($query);
-        $this->_prepared_queries[(int)$stmt] = $newquery;
-        return $stmt;
-    }
-
-    // }}}
-    // {{{ execute()
-
-    /**
-     * Executes a DB statement prepared with prepare().
-     *
-     * To determine how many rows of a result set get buffered using
-     * ocisetprefetch(), see the "result_buffering" option in setOptions().
-     * This option was added in Release 1.7.0.
-     *
-     * @param resource  $stmt  a DB statement resource returned from prepare()
-     * @param mixed  $data  array, string or numeric data to be used in
-     *                      execution of the statement.  Quantity of items
-     *                      passed must match quantity of placeholders in
-     *                      query:  meaning 1 for non-array items or the
-     *                      quantity of elements in the array.
-     *
-     * @return mixed  returns an oic8 result resource for successful SELECT
-     *                queries, DB_OK for other successful queries.
-     *                A DB error object is returned on failure.
-     *
-     * @see DB_oci8::prepare()
-     */
-    function &execute($stmt, $data = array())
-    {
-        $data = (array)$data;
-        $this->last_parameters = $data;
-        $this->last_query = $this->_prepared_queries[(int)$stmt];
-        $this->_data = $data;
-
-        $types = $this->prepare_types[(int)$stmt];
-        if (count($types) != count($data)) {
-            $tmp = $this->raiseError(DB_ERROR_MISMATCH);
-            return $tmp;
-        }
-
-        $i = 0;
-        foreach ($data as $key => $value) {
-            if ($types[$i] == DB_PARAM_MISC) {
-                /*
-                 * Oracle doesn't seem to have the ability to pass a
-                 * parameter along unchanged, so strip off quotes from start
-                 * and end, plus turn two single quotes to one single quote,
-                 * in order to avoid the quotes getting escaped by
-                 * Oracle and ending up in the database.
-                 */
-                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
-                $data[$key] = str_replace("''", "'", $data[$key]);
-            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
-                $fp = @fopen($data[$key], 'rb');
-                if (!$fp) {
-                    $tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
-                    return $tmp;
-                }
-                $data[$key] = fread($fp, filesize($data[$key]));
-                fclose($fp);
-            } elseif ($types[$i] == DB_PARAM_SCALAR) {
-                // Floats have to be converted to a locale-neutral
-                // representation.
-                if (is_float($data[$key])) {
-                    $data[$key] = $this->quoteFloat($data[$key]);
-                }
-            }
-            if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) {
-                $tmp = $this->oci8RaiseError($stmt);
-                return $tmp;
-            }
-            $this->last_query = str_replace(':bind'.$i, $this->quoteSmart($data[$key]), $this->last_query);
-            $i++;
-        }
-        if ($this->autocommit) {
-            $success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS);
-        } else {
-            $success = @OCIExecute($stmt, OCI_DEFAULT);
-        }
-        if (!$success) {
-            $tmp = $this->oci8RaiseError($stmt);
-            return $tmp;
-        }
-        $this->last_stmt = $stmt;
-        if ($this->manip_query[(int)$stmt] || $this->_next_query_manip) {
-            $this->_last_query_manip = true;
-            $this->_next_query_manip = false;
-            $tmp = DB_OK;
-        } else {
-            $this->_last_query_manip = false;
-            @ocisetprefetch($stmt, $this->options['result_buffering']);
-            $tmp = new DB_result($this, $stmt);
-        }
-        return $tmp;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        $this->autocommit = (bool)$onoff;;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        $result = @OCICommit($this->connection);
-        if (!$result) {
-            return $this->oci8RaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        $result = @OCIRollback($this->connection);
-        if (!$result) {
-            return $this->oci8RaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->last_stmt === false) {
-            return $this->oci8RaiseError();
-        }
-        $result = @OCIRowCount($this->last_stmt);
-        if ($result === false) {
-            return $this->oci8RaiseError($this->last_stmt);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ modifyQuery()
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * "SELECT 2+2" must be "SELECT 2+2 FROM dual" in Oracle.
-     *
-     * @param string $query  the query string to modify
-     *
-     * @return string  the modified query string
-     *
-     * @access protected
-     */
-    function modifyQuery($query)
-    {
-        if (preg_match('/^\s*SELECT/i', $query) &&
-            !preg_match('/\sFROM\s/i', $query)) {
-            $query .= ' FROM dual';
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        // Let Oracle return the name of the columns instead of
-        // coding a "home" SQL parser
-
-        if (count($params)) {
-            $result = $this->prepare("SELECT * FROM ($query) "
-                                     . 'WHERE NULL = NULL');
-            $tmp = $this->execute($result, $params);
-        } else {
-            $q_fields = "SELECT * FROM ($query) WHERE NULL = NULL";
-
-            if (!$result = @OCIParse($this->connection, $q_fields)) {
-                $this->last_query = $q_fields;
-                return $this->oci8RaiseError();
-            }
-            if (!@OCIExecute($result, OCI_DEFAULT)) {
-                $this->last_query = $q_fields;
-                return $this->oci8RaiseError($result);
-            }
-        }
-
-        $ncols = OCINumCols($result);
-        $cols  = array();
-        for ( $i = 1; $i <= $ncols; $i++ ) {
-            $cols[] = '"' . OCIColumnName($result, $i) . '"';
-        }
-        $fields = implode(', ', $cols);
-        // XXX Test that (tip by John Lim)
-        //if (preg_match('/^\s*SELECT\s+/is', $query, $match)) {
-        //    // Introduce the FIRST_ROWS Oracle query optimizer
-        //    $query = substr($query, strlen($match[0]), strlen($query));
-        //    $query = "SELECT /* +FIRST_ROWS */ " . $query;
-        //}
-
-        // Construct the query
-        // more at: http://marc.theaimsgroup.com/?l=php-db&m=99831958101212&w=2
-        // Perhaps this could be optimized with the use of Unions
-        $query = "SELECT $fields FROM".
-                 "  (SELECT rownum as linenum, $fields FROM".
-                 "      ($query)".
-                 '  WHERE rownum <= '. ($from + $count) .
-                 ') WHERE linenum >= ' . ++$from;
-        return $query;
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_oci8::createSequence(), DB_oci8::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $repeat = 0;
-        do {
-            $this->expectError(DB_ERROR_NOSUCHTABLE);
-            $result = $this->query("SELECT ${seqname}.nextval FROM dual");
-            $this->popExpect();
-            if ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
-                $repeat = 1;
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-            } else {
-                $repeat = 0;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        return $arr[0];
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_oci8::nextID(), DB_oci8::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        return $this->query('CREATE SEQUENCE '
-                            . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_oci8::nextID(), DB_oci8::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP SEQUENCE '
-                            . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ oci8RaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_oci8::errorNative(), DB_oci8::errorCode()
-     */
-    function oci8RaiseError($errno = null)
-    {
-        if ($errno === null) {
-            $error = @OCIError($this->connection);
-            return $this->raiseError($this->errorCode($error['code']),
-                                     null, null, null, $error['message']);
-        } elseif (is_resource($errno)) {
-            $error = @OCIError($errno);
-            return $this->raiseError($this->errorCode($error['code']),
-                                     null, null, null, $error['message']);
-        }
-        return $this->raiseError($this->errorCode($errno));
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code produced by the last query
-     *
-     * @return int  the DBMS' error code.  FALSE if the code could not be
-     *               determined
-     */
-    function errorNative()
-    {
-        if (is_resource($this->last_stmt)) {
-            $error = @OCIError($this->last_stmt);
-        } else {
-            $error = @OCIError($this->connection);
-        }
-        if (is_array($error)) {
-            return $error['code'];
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
-     * is a table name.
-     *
-     * NOTE: flags won't contain index information.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $res = array();
-
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $result = strtoupper($result);
-            $q_fields = 'SELECT column_name, data_type, data_length, '
-                        . 'nullable '
-                        . 'FROM user_tab_columns '
-                        . "WHERE table_name='$result' ORDER BY column_id";
-
-            $this->last_query = $q_fields;
-
-            if (!$stmt = @OCIParse($this->connection, $q_fields)) {
-                return $this->oci8RaiseError(DB_ERROR_NEED_MORE_DATA);
-            }
-            if (!@OCIExecute($stmt, OCI_DEFAULT)) {
-                return $this->oci8RaiseError($stmt);
-            }
-            
-            $i = 0;
-            while (@OCIFetch($stmt)) {
-                $res[$i] = array(
-                    'table' => $case_func($result),
-                    'name'  => $case_func(@OCIResult($stmt, 1)),
-                    'type'  => @OCIResult($stmt, 2),
-                    'len'   => @OCIResult($stmt, 3),
-                    'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '',
-                );
-                if ($mode & DB_TABLEINFO_ORDER) {
-                    $res['order'][$res[$i]['name']] = $i;
-                }
-                if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                    $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-                }
-                $i++;
-            }
-
-            if ($mode) {
-                $res['num_fields'] = $i;
-            }
-            @OCIFreeStatement($stmt);
-
-        } else {
-            if (isset($result->result)) {
-                /*
-                 * Probably received a result object.
-                 * Extract the result resource identifier.
-                 */
-                $result = $result->result;
-            }
-
-            $res = array();
-
-            if ($result === $this->last_stmt) {
-                $count = @OCINumCols($result);
-                if ($mode) {
-                    $res['num_fields'] = $count;
-                }
-                for ($i = 0; $i < $count; $i++) {
-                    $res[$i] = array(
-                        'table' => '',
-                        'name'  => $case_func(@OCIColumnName($result, $i+1)),
-                        'type'  => @OCIColumnType($result, $i+1),
-                        'len'   => @OCIColumnSize($result, $i+1),
-                        'flags' => '',
-                    );
-                    if ($mode & DB_TABLEINFO_ORDER) {
-                        $res['order'][$res[$i]['name']] = $i;
-                    }
-                    if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                        $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-                    }
-                }
-            } else {
-                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
-            }
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SELECT table_name FROM user_tables';
-            case 'synonyms':
-                return 'SELECT synonym_name FROM user_synonyms';
-            case 'views':
-                return 'SELECT view_name FROM user_views';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-    // {{{ quoteFloat()
-
-    /**
-     * Formats a float value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param float the float value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteFloat($float) {
-        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
-    }
-     
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/odbc.php b/lib/php/DB/odbc.php
deleted file mode 100644
index fecc548d8e9b58abbe7320da4db74b5fef35d477..0000000000000000000000000000000000000000
--- a/lib/php/DB/odbc.php
+++ /dev/null
@@ -1,883 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's odbc extension
- * for interacting with databases via ODBC connections
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: odbc.php,v 1.81 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's odbc extension
- * for interacting with databases via ODBC connections
- *
- * These methods overload the ones declared in DB_common.
- *
- * More info on ODBC errors could be found here:
- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_err_odbc_5stz.asp
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_odbc extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'odbc';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'sql92';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * NOTE: The feature set of the following drivers are different than
-     * the default:
-     *   + solid: 'transactions' = true
-     *   + navision: 'limit' = false
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'emulate',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => false,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-        '01004' => DB_ERROR_TRUNCATED,
-        '07001' => DB_ERROR_MISMATCH,
-        '21S01' => DB_ERROR_VALUE_COUNT_ON_ROW,
-        '21S02' => DB_ERROR_MISMATCH,
-        '22001' => DB_ERROR_INVALID,
-        '22003' => DB_ERROR_INVALID_NUMBER,
-        '22005' => DB_ERROR_INVALID_NUMBER,
-        '22008' => DB_ERROR_INVALID_DATE,
-        '22012' => DB_ERROR_DIVZERO,
-        '23000' => DB_ERROR_CONSTRAINT,
-        '23502' => DB_ERROR_CONSTRAINT_NOT_NULL,
-        '23503' => DB_ERROR_CONSTRAINT,
-        '23504' => DB_ERROR_CONSTRAINT,
-        '23505' => DB_ERROR_CONSTRAINT,
-        '24000' => DB_ERROR_INVALID,
-        '34000' => DB_ERROR_INVALID,
-        '37000' => DB_ERROR_SYNTAX,
-        '42000' => DB_ERROR_SYNTAX,
-        '42601' => DB_ERROR_SYNTAX,
-        'IM001' => DB_ERROR_UNSUPPORTED,
-        'S0000' => DB_ERROR_NOSUCHTABLE,
-        'S0001' => DB_ERROR_ALREADY_EXISTS,
-        'S0002' => DB_ERROR_NOSUCHTABLE,
-        'S0011' => DB_ERROR_ALREADY_EXISTS,
-        'S0012' => DB_ERROR_NOT_FOUND,
-        'S0021' => DB_ERROR_ALREADY_EXISTS,
-        'S0022' => DB_ERROR_NOSUCHFIELD,
-        'S1009' => DB_ERROR_INVALID,
-        'S1090' => DB_ERROR_INVALID,
-        'S1C00' => DB_ERROR_NOT_CAPABLE,
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * The number of rows affected by a data manipulation query
-     * @var integer
-     * @access private
-     */
-    var $affected = 0;
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_odbc()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's odbc driver supports the following extra DSN options:
-     *   + cursor  The type of cursor to be used for this connection.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('odbc')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-        switch ($this->dbsyntax) {
-            case 'access':
-            case 'db2':
-            case 'solid':
-                $this->features['transactions'] = true;
-                break;
-            case 'navision':
-                $this->features['limit'] = false;
-        }
-
-        /*
-         * This is hear for backwards compatibility. Should have been using
-         * 'database' all along, but prior to 1.6.0RC3 'hostspec' was used.
-         */
-        if ($dsn['database']) {
-            $odbcdsn = $dsn['database'];
-        } elseif ($dsn['hostspec']) {
-            $odbcdsn = $dsn['hostspec'];
-        } else {
-            $odbcdsn = 'localhost';
-        }
-
-        $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect';
-
-        if (empty($dsn['cursor'])) {
-            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
-                                                   $dsn['password']);
-        } else {
-            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
-                                                   $dsn['password'],
-                                                   $dsn['cursor']);
-        }
-
-        if (!is_resource($this->connection)) {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     $this->errorNative());
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $err = @odbc_close($this->connection);
-        $this->connection = null;
-        return $err;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        $result = @odbc_exec($this->connection, $query);
-        if (!$result) {
-            return $this->odbcRaiseError(); // XXX ERRORMSG
-        }
-        // Determine which queries that should return data, and which
-        // should return an error code only.
-        if ($this->_checkManip($query)) {
-            $this->affected = $result; // For affectedRows()
-            return DB_OK;
-        }
-        $this->affected = 0;
-        return $result;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal odbc result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return @odbc_next_result($result);
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        $arr = array();
-        if ($rownum !== null) {
-            $rownum++; // ODBC first row is 1
-            if (version_compare(phpversion(), '4.2.0', 'ge')) {
-                $cols = @odbc_fetch_into($result, $arr, $rownum);
-            } else {
-                $cols = @odbc_fetch_into($result, $rownum, $arr);
-            }
-        } else {
-            $cols = @odbc_fetch_into($result, $arr);
-        }
-        if (!$cols) {
-            return null;
-        }
-        if ($fetchmode !== DB_FETCHMODE_ORDERED) {
-            for ($i = 0; $i < count($arr); $i++) {
-                $colName = @odbc_field_name($result, $i+1);
-                $a[$colName] = $arr[$i];
-            }
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-                $a = array_change_key_case($a, CASE_LOWER);
-            }
-            $arr = $a;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? odbc_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @odbc_num_fields($result);
-        if (!$cols) {
-            return $this->odbcRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if (empty($this->affected)) {  // In case of SELECT stms
-            return 0;
-        }
-        $nrows = @odbc_num_rows($this->affected);
-        if ($nrows == -1) {
-            return $this->odbcRaiseError();
-        }
-        return $nrows;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * Not all ODBC drivers support this functionality.  If they don't
-     * a DB_Error object for DB_ERROR_UNSUPPORTED is returned.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $nrows = @odbc_num_rows($result);
-        if ($nrows == -1) {
-            return $this->odbcRaiseError(DB_ERROR_UNSUPPORTED);
-        }
-        if ($nrows === false) {
-            return $this->odbcRaiseError();
-        }
-        return $nrows;
-    }
-
-    // }}}
-    // {{{ quoteIdentifier()
-
-    /**
-     * Quotes a string so it can be safely used as a table or column name
-     *
-     * Use 'mssql' as the dbsyntax in the DB DSN only if you've unchecked
-     * "Use ANSI quoted identifiers" when setting up the ODBC data source.
-     *
-     * @param string $str  identifier name to be quoted
-     *
-     * @return string  quoted identifier string
-     *
-     * @see DB_common::quoteIdentifier()
-     * @since Method available since Release 1.6.0
-     */
-    function quoteIdentifier($str)
-    {
-        switch ($this->dsn['dbsyntax']) {
-            case 'access':
-                return '[' . $str . ']';
-            case 'mssql':
-            case 'sybase':
-                return '[' . str_replace(']', ']]', $str) . ']';
-            case 'mysql':
-            case 'mysqli':
-                return '`' . $str . '`';
-            default:
-                return '"' . str_replace('"', '""', $str) . '"';
-        }
-    }
-
-    // }}}
-    // {{{ quote()
-
-    /**
-     * @deprecated  Deprecated in release 1.6.0
-     * @internal
-     */
-    function quote($str)
-    {
-        return $this->quoteSmart($str);
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_odbc::createSequence(), DB_odbc::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $repeat = 0;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("update ${seqname} set id = id + 1");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
-                $repeat = 1;
-                $this->pushErrorHandling(PEAR_ERROR_RETURN);
-                $result = $this->createSequence($seq_name);
-                $this->popErrorHandling();
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-                $result = $this->query("insert into ${seqname} (id) values(0)");
-            } else {
-                $repeat = 0;
-            }
-        } while ($repeat);
-
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-
-        $result = $this->query("select id from ${seqname}");
-        if (DB::isError($result)) {
-            return $result;
-        }
-
-        $row = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        if (DB::isError($row || !$row)) {
-            return $row;
-        }
-
-        return $row[0];
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_odbc::nextID(), DB_odbc::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        return $this->query('CREATE TABLE '
-                            . $this->getSequenceName($seq_name)
-                            . ' (id integer NOT NULL,'
-                            . ' PRIMARY KEY(id))');
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_odbc::nextID(), DB_odbc::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        if (!@odbc_autocommit($this->connection, $onoff)) {
-            return $this->odbcRaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if (!@odbc_commit($this->connection)) {
-            return $this->odbcRaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if (!@odbc_rollback($this->connection)) {
-            return $this->odbcRaiseError();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ odbcRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_odbc::errorNative(), DB_common::errorCode()
-     */
-    function odbcRaiseError($errno = null)
-    {
-        if ($errno === null) {
-            switch ($this->dbsyntax) {
-                case 'access':
-                    if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
-                        $this->errorcode_map['07001'] = DB_ERROR_NOSUCHFIELD;
-                    } else {
-                        // Doing this in case mode changes during runtime.
-                        $this->errorcode_map['07001'] = DB_ERROR_MISMATCH;
-                    }
-
-                    $native_code = odbc_error($this->connection);
-
-                    // S1000 is for "General Error."  Let's be more specific.
-                    if ($native_code == 'S1000') {
-                        $errormsg = odbc_errormsg($this->connection);
-                        static $error_regexps;
-                        if (!isset($error_regexps)) {
-                            $error_regexps = array(
-                                '/includes related records.$/i'  => DB_ERROR_CONSTRAINT,
-                                '/cannot contain a Null value/i' => DB_ERROR_CONSTRAINT_NOT_NULL,
-                            );
-                        }
-                        foreach ($error_regexps as $regexp => $code) {
-                            if (preg_match($regexp, $errormsg)) {
-                                return $this->raiseError($code,
-                                        null, null, null,
-                                        $native_code . ' ' . $errormsg);
-                            }
-                        }
-                        $errno = DB_ERROR;
-                    } else {
-                        $errno = $this->errorCode($native_code);
-                    }
-                    break;
-                default:
-                    $errno = $this->errorCode(odbc_error($this->connection));
-            }
-        }
-        return $this->raiseError($errno, null, null, null,
-                                 $this->errorNative());
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error code and message produced by the last query
-     *
-     * @return string  the DBMS' error code and message
-     */
-    function errorNative()
-    {
-        if (!is_resource($this->connection)) {
-            return @odbc_error() . ' ' . @odbc_errormsg();
-        }
-        return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     * @since Method available since Release 1.7.0
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @odbc_exec($this->connection, "SELECT * FROM $result");
-            if (!$id) {
-                return $this->odbcRaiseError();
-            }
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @odbc_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $col = $i + 1;
-            $res[$i] = array(
-                'table' => $got_string ? $case_func($result) : '',
-                'name'  => $case_func(@odbc_field_name($id, $col)),
-                'type'  => @odbc_field_type($id, $col),
-                'len'   => @odbc_field_len($id, $col),
-                'flags' => '',
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @odbc_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * Thanks to symbol1@gmail.com and Philippe.Jausions@11abacus.com.
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the list of objects requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     * @since Method available since Release 1.7.0
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'databases':
-                if (!function_exists('odbc_data_source')) {
-                    return null;
-                }
-                $res = @odbc_data_source($this->connection, SQL_FETCH_FIRST);
-                if (is_array($res)) {
-                    $out = array($res['server']);
-                    while($res = @odbc_data_source($this->connection,
-                                                   SQL_FETCH_NEXT))
-                    {
-                        $out[] = $res['server'];
-                    }
-                    return $out;
-                } else {
-                    return $this->odbcRaiseError();
-                }
-                break;
-            case 'tables':
-            case 'schema.tables':
-                $keep = 'TABLE';
-                break;
-            case 'views':
-                $keep = 'VIEW';
-                break;
-            default:
-                return null;
-        }
-
-        /*
-         * Removing non-conforming items in the while loop rather than
-         * in the odbc_tables() call because some backends choke on this:
-         *     odbc_tables($this->connection, '', '', '', 'TABLE')
-         */
-        $res  = @odbc_tables($this->connection);
-        if (!$res) {
-            return $this->odbcRaiseError();
-        }
-        $out = array();
-        while ($row = odbc_fetch_array($res)) {
-            if ($row['TABLE_TYPE'] != $keep) {
-                continue;
-            }
-            if ($type == 'schema.tables') {
-                $out[] = $row['TABLE_SCHEM'] . '.' . $row['TABLE_NAME'];
-            } else {
-                $out[] = $row['TABLE_NAME'];
-            }
-        }
-        return $out;
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/pgsql.php b/lib/php/DB/pgsql.php
deleted file mode 100644
index 039888faf0c45b35b18f1fa74a52fde3cb212013..0000000000000000000000000000000000000000
--- a/lib/php/DB/pgsql.php
+++ /dev/null
@@ -1,1116 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's pgsql extension
- * for interacting with PostgreSQL databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Rui Hirokawa <hirokawa@php.net>
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: pgsql.php,v 1.138 2007/09/21 13:40:41 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's pgsql extension
- * for interacting with PostgreSQL databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * @category   Database
- * @package    DB
- * @author     Rui Hirokawa <hirokawa@php.net>
- * @author     Stig Bakken <ssb@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_pgsql extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'pgsql';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'pgsql';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => '4.3.0',
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => true,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The number of rows affected by a data manipulation query
-     * @var integer
-     */
-    var $affected = 0;
-
-    /**
-     * The current row being looked at in fetchInto()
-     * @var array
-     * @access private
-     */
-    var $row = array();
-
-    /**
-     * The number of rows in a given result set
-     * @var array
-     * @access private
-     */
-    var $_num_rows = array();
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_pgsql()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's pgsql driver supports the following extra DSN options:
-     *   + connect_timeout  How many seconds to wait for a connection to
-     *                       be established.  Available since PEAR DB 1.7.0.
-     *   + new_link         If set to true, causes subsequent calls to
-     *                       connect() to return a new connection link
-     *                       instead of the existing one.  WARNING: this is
-     *                       not portable to other DBMS's.  Available only
-     *                       if PHP is >= 4.3.0 and PEAR DB is >= 1.7.0.
-     *   + options          Command line options to be sent to the server.
-     *                       Available since PEAR DB 1.6.4.
-     *   + service          Specifies a service name in pg_service.conf that
-     *                       holds additional connection parameters.
-     *                       Available since PEAR DB 1.7.0.
-     *   + sslmode          How should SSL be used when connecting?  Values:
-     *                       disable, allow, prefer or require.
-     *                       Available since PEAR DB 1.7.0.
-     *   + tty              This was used to specify where to send server
-     *                       debug output.  Available since PEAR DB 1.6.4.
-     *
-     * Example of connecting to a new link via a socket:
-     * <code>
-     * require_once 'DB.php';
-     * 
-     * $dsn = 'pgsql://user:pass@unix(/tmp)/dbname?new_link=true';
-     * $options = array(
-     *     'portability' => DB_PORTABILITY_ALL,
-     * );
-     * 
-     * $db = DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     *
-     * @link http://www.postgresql.org/docs/current/static/libpq.html#LIBPQ-CONNECT
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('pgsql')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $protocol = $dsn['protocol'] ? $dsn['protocol'] : 'tcp';
-
-        $params = array('');
-        if ($protocol == 'tcp') {
-            if ($dsn['hostspec']) {
-                $params[0] .= 'host=' . $dsn['hostspec'];
-            }
-            if ($dsn['port']) {
-                $params[0] .= ' port=' . $dsn['port'];
-            }
-        } elseif ($protocol == 'unix') {
-            // Allow for pg socket in non-standard locations.
-            if ($dsn['socket']) {
-                $params[0] .= 'host=' . $dsn['socket'];
-            }
-            if ($dsn['port']) {
-                $params[0] .= ' port=' . $dsn['port'];
-            }
-        }
-        if ($dsn['database']) {
-            $params[0] .= ' dbname=\'' . addslashes($dsn['database']) . '\'';
-        }
-        if ($dsn['username']) {
-            $params[0] .= ' user=\'' . addslashes($dsn['username']) . '\'';
-        }
-        if ($dsn['password']) {
-            $params[0] .= ' password=\'' . addslashes($dsn['password']) . '\'';
-        }
-        if (!empty($dsn['options'])) {
-            $params[0] .= ' options=' . $dsn['options'];
-        }
-        if (!empty($dsn['tty'])) {
-            $params[0] .= ' tty=' . $dsn['tty'];
-        }
-        if (!empty($dsn['connect_timeout'])) {
-            $params[0] .= ' connect_timeout=' . $dsn['connect_timeout'];
-        }
-        if (!empty($dsn['sslmode'])) {
-            $params[0] .= ' sslmode=' . $dsn['sslmode'];
-        }
-        if (!empty($dsn['service'])) {
-            $params[0] .= ' service=' . $dsn['service'];
-        }
-
-        if (isset($dsn['new_link'])
-            && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
-        {
-            if (version_compare(phpversion(), '4.3.0', '>=')) {
-                $params[] = PGSQL_CONNECT_FORCE_NEW;
-            }
-        }
-
-        $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
-
-        $ini = ini_get('track_errors');
-        $php_errormsg = '';
-        if ($ini) {
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-        } else {
-            @ini_set('track_errors', 1);
-            $this->connection = @call_user_func_array($connect_function,
-                                                      $params);
-            @ini_set('track_errors', $ini);
-        }
-
-        if (!$this->connection) {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     $php_errormsg);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @pg_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-        if (!$this->autocommit && $ismanip) {
-            if ($this->transaction_opcount == 0) {
-                $result = @pg_exec($this->connection, 'begin;');
-                if (!$result) {
-                    return $this->pgsqlRaiseError();
-                }
-            }
-            $this->transaction_opcount++;
-        }
-        $result = @pg_exec($this->connection, $query);
-        if (!$result) {
-            return $this->pgsqlRaiseError();
-        }
-
-        /*
-         * Determine whether queries produce affected rows, result or nothing.
-         *
-         * This logic was introduced in version 1.1 of the file by ssb,
-         * though the regex has been modified slightly since then.
-         *
-         * PostgreSQL commands:
-         * ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
-         * CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
-         * GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
-         * REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
-         * UNLISTEN, UPDATE, VACUUM
-         */
-        if ($ismanip) {
-            $this->affected = @pg_affected_rows($result);
-            return DB_OK;
-        } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|FETCH|SHOW)\s/si',
-                             $query))
-        {
-            $this->row[(int)$result] = 0; // reset the row counter.
-            $numrows = $this->numRows($result);
-            if (is_object($numrows)) {
-                return $numrows;
-            }
-            $this->_num_rows[(int)$result] = $numrows;
-            $this->affected = 0;
-            return $result;
-        } else {
-            $this->affected = 0;
-            return DB_OK;
-        }
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal pgsql result pointer to the next available result
-     *
-     * @param a valid fbsql result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        $result_int = (int)$result;
-        $rownum = ($rownum !== null) ? $rownum : $this->row[$result_int];
-        if ($rownum >= $this->_num_rows[$result_int]) {
-            return null;
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @pg_fetch_row($result, $rownum);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        $this->row[$result_int] = ++$rownum;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        if (is_resource($result)) {
-            unset($this->row[(int)$result]);
-            unset($this->_num_rows[(int)$result]);
-            $this->affected = 0;
-            return @pg_freeresult($result);
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ quote()
-
-    /**
-     * @deprecated  Deprecated in release 1.6.0
-     * @internal
-     */
-    function quote($str)
-    {
-        return $this->quoteSmart($str);
-    }
-
-    // }}}
-    // {{{ quoteBoolean()
-
-    /**
-     * Formats a boolean value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param boolean the boolean value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteBoolean($boolean) {
-        return $boolean ? 'TRUE' : 'FALSE';
-    }
-     
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * {@internal PostgreSQL treats a backslash as an escape character,
-     * so they are escaped as well.
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @see DB_common::quoteSmart()
-     * @since Method available since Release 1.6.0
-     */
-    function escapeSimple($str)
-    {
-        if (function_exists('pg_escape_string')) {
-            /* This fixes an undocumented BC break in PHP 5.2.0 which changed
-             * the prototype of pg_escape_string. I'm not thrilled about having
-             * to sniff the PHP version, quite frankly, but it's the only way
-             * to deal with the problem. Revision 1.331.2.13.2.10 on
-             * php-src/ext/pgsql/pgsql.c (PHP_5_2 branch) is to blame, for the
-             * record. */
-            if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
-                return pg_escape_string($this->connection, $str);
-            } else {
-                return pg_escape_string($str);
-            }
-        } else {
-            return str_replace("'", "''", str_replace('\\', '\\\\', $str));
-        }
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @pg_numfields($result);
-        if (!$cols) {
-            return $this->pgsqlRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @pg_numrows($result);
-        if ($rows === null) {
-            return $this->pgsqlRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            // (disabled) hack to shut up error messages from libpq.a
-            //@fclose(@fopen("php://stderr", "w"));
-            $result = @pg_exec($this->connection, 'end;');
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->pgsqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            $result = @pg_exec($this->connection, 'abort;');
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->pgsqlRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        return $this->affected;
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_pgsql::createSequence(), DB_pgsql::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $repeat = false;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("SELECT NEXTVAL('${seqname}')");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
-                $repeat = true;
-                $this->pushErrorHandling(PEAR_ERROR_RETURN);
-                $result = $this->createSequence($seq_name);
-                $this->popErrorHandling();
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-            } else {
-                $repeat = false;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        $result->free();
-        return $arr[0];
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_pgsql::nextID(), DB_pgsql::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $result = $this->query("CREATE SEQUENCE ${seqname}");
-        return $result;
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_pgsql::nextID(), DB_pgsql::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP SEQUENCE '
-                            . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        return "$query LIMIT $count OFFSET $from";
-    }
-
-    // }}}
-    // {{{ pgsqlRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_pgsql::errorNative(), DB_pgsql::errorCode()
-     */
-    function pgsqlRaiseError($errno = null)
-    {
-        $native = $this->errorNative();
-        if (!$native) {
-            $native = 'Database connection has been lost.';
-            $errno = DB_ERROR_CONNECT_FAILED;
-        }
-        if ($errno === null) {
-            $errno = $this->errorCode($native);
-        }
-        return $this->raiseError($errno, null, null, null, $native);
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error message produced by the last query
-     *
-     * {@internal Error messages are used instead of error codes 
-     * in order to support older versions of PostgreSQL.}}
-     *
-     * @return string  the DBMS' error message
-     */
-    function errorNative()
-    {
-        return @pg_errormessage($this->connection);
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Determines PEAR::DB error code from the database's text error message.
-     *
-     * @param  string  $errormsg  error message returned from the database
-     * @return integer  an error number from a DB error constant
-     */
-    function errorCode($errormsg)
-    {
-        static $error_regexps;
-        if (!isset($error_regexps)) {
-            $error_regexps = array(
-                '/column .* (of relation .*)?does not exist/i'
-                    => DB_ERROR_NOSUCHFIELD,
-                '/(relation|sequence|table).*does not exist|class .* not found/i'
-                    => DB_ERROR_NOSUCHTABLE,
-                '/index .* does not exist/'
-                    => DB_ERROR_NOT_FOUND,
-                '/relation .* already exists/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/(divide|division) by zero$/i'
-                    => DB_ERROR_DIVZERO,
-                '/pg_atoi: error in .*: can\'t parse /i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/invalid input syntax for( type)? (integer|numeric)/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/value .* is out of range for type \w*int/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/integer out of range/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/value too long for type character/i'
-                    => DB_ERROR_INVALID,
-                '/attribute .* not found|relation .* does not have attribute/i'
-                    => DB_ERROR_NOSUCHFIELD,
-                '/column .* specified in USING clause does not exist in (left|right) table/i'
-                    => DB_ERROR_NOSUCHFIELD,
-                '/parser: parse error at or near/i'
-                    => DB_ERROR_SYNTAX,
-                '/syntax error at/'
-                    => DB_ERROR_SYNTAX,
-                '/column reference .* is ambiguous/i'
-                    => DB_ERROR_SYNTAX,
-                '/permission denied/'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/violates not-null constraint/'
-                    => DB_ERROR_CONSTRAINT_NOT_NULL,
-                '/violates [\w ]+ constraint/'
-                    => DB_ERROR_CONSTRAINT,
-                '/referential integrity violation/'
-                    => DB_ERROR_CONSTRAINT,
-                '/more expressions than target columns/i'
-                    => DB_ERROR_VALUE_COUNT_ON_ROW,
-            );
-        }
-        foreach ($error_regexps as $regexp => $code) {
-            if (preg_match($regexp, $errormsg)) {
-                return $code;
-            }
-        }
-        // Fall back to DB_ERROR if there was no mapping.
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
-     * is a table name.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @pg_numfields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $res[$i] = array(
-                'table' => $got_string ? $case_func($result) : '',
-                'name'  => $case_func(@pg_fieldname($id, $i)),
-                'type'  => @pg_fieldtype($id, $i),
-                'len'   => @pg_fieldsize($id, $i),
-                'flags' => $got_string
-                           ? $this->_pgFieldFlags($id, $i, $result)
-                           : '',
-            );
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @pg_freeresult($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ _pgFieldFlags()
-
-    /**
-     * Get a column's flags
-     *
-     * Supports "not_null", "default_value", "primary_key", "unique_key"
-     * and "multiple_key".  The default value is passed through
-     * rawurlencode() in case there are spaces in it.
-     *
-     * @param int $resource   the PostgreSQL result identifier
-     * @param int $num_field  the field number
-     *
-     * @return string  the flags
-     *
-     * @access private
-     */
-    function _pgFieldFlags($resource, $num_field, $table_name)
-    {
-        $field_name = @pg_fieldname($resource, $num_field);
-
-        // Check if there's a schema in $table_name and update things
-        // accordingly.
-        $from = 'pg_attribute f, pg_class tab, pg_type typ';
-        if (strpos($table_name, '.') !== false) {
-            $from .= ', pg_namespace nsp';
-            list($schema, $table) = explode('.', $table_name);
-            $tableWhere = "tab.relname = '$table' AND tab.relnamespace = nsp.oid AND nsp.nspname = '$schema'";
-        } else {
-            $tableWhere = "tab.relname = '$table_name'";
-        }
-
-        $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
-                                FROM $from
-                                WHERE tab.relname = typ.typname
-                                AND typ.typrelid = f.attrelid
-                                AND f.attname = '$field_name'
-                                AND $tableWhere");
-        if (@pg_numrows($result) > 0) {
-            $row = @pg_fetch_row($result, 0);
-            $flags  = ($row[0] == 't') ? 'not_null ' : '';
-
-            if ($row[1] == 't') {
-                $result = @pg_exec($this->connection, "SELECT a.adsrc
-                                    FROM $from, pg_attrdef a
-                                    WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
-                                    AND f.attrelid = a.adrelid AND f.attname = '$field_name'
-                                    AND $tableWhere AND f.attnum = a.adnum");
-                $row = @pg_fetch_row($result, 0);
-                $num = preg_replace("/'(.*)'::\w+/", "\\1", $row[0]);
-                $flags .= 'default_' . rawurlencode($num) . ' ';
-            }
-        } else {
-            $flags = '';
-        }
-        $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
-                                FROM $from, pg_index i
-                                WHERE tab.relname = typ.typname
-                                AND typ.typrelid = f.attrelid
-                                AND f.attrelid = i.indrelid
-                                AND f.attname = '$field_name'
-                                AND $tableWhere");
-        $count = @pg_numrows($result);
-
-        for ($i = 0; $i < $count ; $i++) {
-            $row = @pg_fetch_row($result, $i);
-            $keys = explode(' ', $row[2]);
-
-            if (in_array($num_field + 1, $keys)) {
-                $flags .= ($row[0] == 't' && $row[1] == 'f') ? 'unique_key ' : '';
-                $flags .= ($row[1] == 't') ? 'primary_key ' : '';
-                if (count($keys) > 1)
-                    $flags .= 'multiple_key ';
-            }
-        }
-
-        return trim($flags);
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return 'SELECT c.relname AS "Name"'
-                        . ' FROM pg_class c, pg_user u'
-                        . ' WHERE c.relowner = u.usesysid'
-                        . " AND c.relkind = 'r'"
-                        . ' AND NOT EXISTS'
-                        . ' (SELECT 1 FROM pg_views'
-                        . '  WHERE viewname = c.relname)'
-                        . " AND c.relname !~ '^(pg_|sql_)'"
-                        . ' UNION'
-                        . ' SELECT c.relname AS "Name"'
-                        . ' FROM pg_class c'
-                        . " WHERE c.relkind = 'r'"
-                        . ' AND NOT EXISTS'
-                        . ' (SELECT 1 FROM pg_views'
-                        . '  WHERE viewname = c.relname)'
-                        . ' AND NOT EXISTS'
-                        . ' (SELECT 1 FROM pg_user'
-                        . '  WHERE usesysid = c.relowner)'
-                        . " AND c.relname !~ '^pg_'";
-            case 'schema.tables':
-                return "SELECT schemaname || '.' || tablename"
-                        . ' AS "Name"'
-                        . ' FROM pg_catalog.pg_tables'
-                        . ' WHERE schemaname NOT IN'
-                        . " ('pg_catalog', 'information_schema', 'pg_toast')";
-            case 'schema.views':
-                return "SELECT schemaname || '.' || viewname from pg_views WHERE schemaname"
-                        . " NOT IN ('information_schema', 'pg_catalog')";
-            case 'views':
-                // Table cols: viewname | viewowner | definition
-                return 'SELECT viewname from pg_views WHERE schemaname'
-                        . " NOT IN ('information_schema', 'pg_catalog')";
-            case 'users':
-                // cols: usename |usesysid|usecreatedb|usetrace|usesuper|usecatupd|passwd  |valuntil
-                return 'SELECT usename FROM pg_user';
-            case 'databases':
-                return 'SELECT datname FROM pg_database';
-            case 'functions':
-            case 'procedures':
-                return 'SELECT proname FROM pg_proc WHERE proowner <> 1';
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/sqlite.php b/lib/php/DB/sqlite.php
deleted file mode 100644
index bf2acec5a8bf801896b6dd7e4957a1619c415812..0000000000000000000000000000000000000000
--- a/lib/php/DB/sqlite.php
+++ /dev/null
@@ -1,959 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's sqlite extension
- * for interacting with SQLite databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Urs Gehrig <urs@circle.ch>
- * @author     Mika Tuupola <tuupola@appelsiini.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
- * @version    CVS: $Id: sqlite.php,v 1.117 2007/09/21 14:23:28 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's sqlite extension
- * for interacting with SQLite databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * NOTICE:  This driver needs PHP's track_errors ini setting to be on.
- * It is automatically turned on when connecting to the database.
- * Make sure your scripts don't turn it off.
- *
- * @category   Database
- * @package    DB
- * @author     Urs Gehrig <urs@circle.ch>
- * @author     Mika Tuupola <tuupola@appelsiini.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_sqlite extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'sqlite';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'sqlite';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'alter',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => false,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     *
-     * {@internal  Error codes according to sqlite_exec.  See the online
-     * manual at http://sqlite.org/c_interface.html for info.
-     * This error handling based on sqlite_exec is not yet implemented.}}
-     *
-     * @var array
-     */
-    var $errorcode_map = array(
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * SQLite data types
-     *
-     * @link http://www.sqlite.org/datatypes.html
-     *
-     * @var array
-     */
-    var $keywords = array (
-        'BLOB'      => '',
-        'BOOLEAN'   => '',
-        'CHARACTER' => '',
-        'CLOB'      => '',
-        'FLOAT'     => '',
-        'INTEGER'   => '',
-        'KEY'       => '',
-        'NATIONAL'  => '',
-        'NUMERIC'   => '',
-        'NVARCHAR'  => '',
-        'PRIMARY'   => '',
-        'TEXT'      => '',
-        'TIMESTAMP' => '',
-        'UNIQUE'    => '',
-        'VARCHAR'   => '',
-        'VARYING'   => '',
-    );
-
-    /**
-     * The most recent error message from $php_errormsg
-     * @var string
-     * @access private
-     */
-    var $_lasterror = '';
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_sqlite()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's sqlite driver supports the following extra DSN options:
-     *   + mode  The permissions for the database file, in four digit
-     *            chmod octal format (eg "0600").
-     *
-     * Example of connecting to a database in read-only mode:
-     * <code>
-     * require_once 'DB.php';
-     * 
-     * $dsn = 'sqlite:///path/and/name/of/db/file?mode=0400';
-     * $options = array(
-     *     'portability' => DB_PORTABILITY_ALL,
-     * );
-     * 
-     * $db = DB::connect($dsn, $options);
-     * if (PEAR::isError($db)) {
-     *     die($db->getMessage());
-     * }
-     * </code>
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('sqlite')) {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        if (!$dsn['database']) {
-            return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
-        }
-
-        if ($dsn['database'] !== ':memory:') {
-            if (!file_exists($dsn['database'])) {
-                if (!touch($dsn['database'])) {
-                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
-                }
-                if (!isset($dsn['mode']) ||
-                    !is_numeric($dsn['mode']))
-                {
-                    $mode = 0644;
-                } else {
-                    $mode = octdec($dsn['mode']);
-                }
-                if (!chmod($dsn['database'], $mode)) {
-                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
-                }
-                if (!file_exists($dsn['database'])) {
-                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
-                }
-            }
-            if (!is_file($dsn['database'])) {
-                return $this->sqliteRaiseError(DB_ERROR_INVALID);
-            }
-            if (!is_readable($dsn['database'])) {
-                return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
-            }
-        }
-
-        $connect_function = $persistent ? 'sqlite_popen' : 'sqlite_open';
-
-        // track_errors must remain on for simpleQuery()
-        @ini_set('track_errors', 1);
-        $php_errormsg = '';
-
-        if (!$this->connection = @$connect_function($dsn['database'])) {
-            return $this->raiseError(DB_ERROR_NODBSELECTED,
-                                     null, null, null,
-                                     $php_errormsg);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @sqlite_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * NOTICE:  This method needs PHP's track_errors ini setting to be on.
-     * It is automatically turned on when connecting to the database.
-     * Make sure your scripts don't turn it off.
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        $query = $this->modifyQuery($query);
-
-        $php_errormsg = '';
-
-        $result = @sqlite_query($query, $this->connection);
-        $this->_lasterror = $php_errormsg ? $php_errormsg : '';
-
-        $this->result = $result;
-        if (!$this->result) {
-            return $this->sqliteRaiseError(null);
-        }
-
-        // sqlite_query() seems to allways return a resource
-        // so cant use that. Using $ismanip instead
-        if (!$ismanip) {
-            $numRows = $this->numRows($result);
-            if (is_object($numRows)) {
-                // we've got PEAR_Error
-                return $numRows;
-            }
-            return $result;
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal sqlite result pointer to the next available result
-     *
-     * @param resource $result  the valid sqlite result resource
-     *
-     * @return bool  true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@sqlite_seek($this->result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            $arr = @sqlite_fetch_array($result, SQLITE_ASSOC);
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-
-            /* Remove extraneous " characters from the fields in the result.
-             * Fixes bug #11716. */
-            if (is_array($arr) && count($arr) > 0) {
-                $strippedArr = array();
-                foreach ($arr as $field => $value) {
-                    $strippedArr[trim($field, '"')] = $value;
-                }
-                $arr = $strippedArr;
-            }
-        } else {
-            $arr = @sqlite_fetch_array($result, SQLITE_NUM);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            /*
-             * Even though this DBMS already trims output, we do this because
-             * a field might have intentional whitespace at the end that
-             * gets removed by DB_PORTABILITY_RTRIM under another driver.
-             */
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult(&$result)
-    {
-        // XXX No native free?
-        if (!is_resource($result)) {
-            return false;
-        }
-        $result = null;
-        return true;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @sqlite_num_fields($result);
-        if (!$cols) {
-            return $this->sqliteRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @sqlite_num_rows($result);
-        if ($rows === null) {
-            return $this->sqliteRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ affected()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        return @sqlite_changes($this->connection);
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_sqlite::nextID(), DB_sqlite::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_sqlite::nextID(), DB_sqlite::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        $query   = 'CREATE TABLE ' . $seqname .
-                   ' (id INTEGER UNSIGNED PRIMARY KEY) ';
-        $result  = $this->query($query);
-        if (DB::isError($result)) {
-            return($result);
-        }
-        $query   = "CREATE TRIGGER ${seqname}_cleanup AFTER INSERT ON $seqname
-                    BEGIN
-                        DELETE FROM $seqname WHERE id<LAST_INSERT_ROWID();
-                    END ";
-        $result  = $this->query($query);
-        if (DB::isError($result)) {
-            return($result);
-        }
-    }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_sqlite::createSequence(), DB_sqlite::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-
-        do {
-            $repeat = 0;
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("INSERT INTO $seqname (id) VALUES (NULL)");
-            $this->popErrorHandling();
-            if ($result === DB_OK) {
-                $id = @sqlite_last_insert_rowid($this->connection);
-                if ($id != 0) {
-                    return $id;
-                }
-            } elseif ($ondemand && DB::isError($result) &&
-                      $result->getCode() == DB_ERROR_NOSUCHTABLE)
-            {
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                } else {
-                    $repeat = 1;
-                }
-            }
-        } while ($repeat);
-
-        return $this->raiseError($result);
-    }
-
-    // }}}
-    // {{{ getDbFileStats()
-
-    /**
-     * Get the file stats for the current database
-     *
-     * Possible arguments are dev, ino, mode, nlink, uid, gid, rdev, size,
-     * atime, mtime, ctime, blksize, blocks or a numeric key between
-     * 0 and 12.
-     *
-     * @param string $arg  the array key for stats()
-     *
-     * @return mixed  an array on an unspecified key, integer on a passed
-     *                arg and false at a stats error
-     */
-    function getDbFileStats($arg = '')
-    {
-        $stats = stat($this->dsn['database']);
-        if ($stats == false) {
-            return false;
-        }
-        if (is_array($stats)) {
-            if (is_numeric($arg)) {
-                if (((int)$arg <= 12) & ((int)$arg >= 0)) {
-                    return false;
-                }
-                return $stats[$arg ];
-            }
-            if (array_key_exists(trim($arg), $stats)) {
-                return $stats[$arg ];
-            }
-        }
-        return $stats;
-    }
-
-    // }}}
-    // {{{ escapeSimple()
-
-    /**
-     * Escapes a string according to the current DBMS's standards
-     *
-     * In SQLite, this makes things safe for inserts/updates, but may
-     * cause problems when performing text comparisons against columns
-     * containing binary data. See the
-     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
-     *
-     * @param string $str  the string to be escaped
-     *
-     * @return string  the escaped string
-     *
-     * @since Method available since Release 1.6.1
-     * @see DB_common::escapeSimple()
-     */
-    function escapeSimple($str)
-    {
-        return @sqlite_escape_string($str);
-    }
-
-    // }}}
-    // {{{ modifyLimitQuery()
-
-    /**
-     * Adds LIMIT clauses to a query string according to current DBMS standards
-     *
-     * @param string $query   the query to modify
-     * @param int    $from    the row to start to fetching (0 = the first row)
-     * @param int    $count   the numbers of rows to fetch
-     * @param mixed  $params  array, string or numeric data to be used in
-     *                         execution of the statement.  Quantity of items
-     *                         passed must match quantity of placeholders in
-     *                         query:  meaning 1 placeholder for non-array
-     *                         parameters or 1 placeholder per array element.
-     *
-     * @return string  the query string with LIMIT clauses added
-     *
-     * @access protected
-     */
-    function modifyLimitQuery($query, $from, $count, $params = array())
-    {
-        return "$query LIMIT $count OFFSET $from";
-    }
-
-    // }}}
-    // {{{ modifyQuery()
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * This little hack lets you know how many rows were deleted
-     * when running a "DELETE FROM table" query.  Only implemented
-     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
-     *
-     * @param string $query  the query string to modify
-     *
-     * @return string  the modified query string
-     *
-     * @access protected
-     * @see DB_common::setOption()
-     */
-    function modifyQuery($query)
-    {
-        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
-            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
-                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
-                                      'DELETE FROM \1 WHERE 1=1', $query);
-            }
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ sqliteRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_sqlite::errorNative(), DB_sqlite::errorCode()
-     */
-    function sqliteRaiseError($errno = null)
-    {
-        $native = $this->errorNative();
-        if ($errno === null) {
-            $errno = $this->errorCode($native);
-        }
-
-        $errorcode = @sqlite_last_error($this->connection);
-        $userinfo = "$errorcode ** $this->last_query";
-
-        return $this->raiseError($errno, null, null, $userinfo, $native);
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error message produced by the last query
-     *
-     * {@internal This is used to retrieve more meaningfull error messages
-     * because sqlite_last_error() does not provide adequate info.}}
-     *
-     * @return string  the DBMS' error message
-     */
-    function errorNative()
-    {
-        return $this->_lasterror;
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Determines PEAR::DB error code from the database's text error message
-     *
-     * @param string $errormsg  the error message returned from the database
-     *
-     * @return integer  the DB error number
-     */
-    function errorCode($errormsg)
-    {
-        static $error_regexps;
-        
-        // PHP 5.2+ prepends the function name to $php_errormsg, so we need
-        // this hack to work around it, per bug #9599.
-        $errormsg = preg_replace('/^sqlite[a-z_]+\(\): /', '', $errormsg);
-        
-        if (!isset($error_regexps)) {
-            $error_regexps = array(
-                '/^no such table:/' => DB_ERROR_NOSUCHTABLE,
-                '/^no such index:/' => DB_ERROR_NOT_FOUND,
-                '/^(table|index) .* already exists$/' => DB_ERROR_ALREADY_EXISTS,
-                '/PRIMARY KEY must be unique/i' => DB_ERROR_CONSTRAINT,
-                '/is not unique/' => DB_ERROR_CONSTRAINT,
-                '/columns .* are not unique/i' => DB_ERROR_CONSTRAINT,
-                '/uniqueness constraint failed/' => DB_ERROR_CONSTRAINT,
-                '/may not be NULL/' => DB_ERROR_CONSTRAINT_NOT_NULL,
-                '/^no such column:/' => DB_ERROR_NOSUCHFIELD,
-                '/column not present in both tables/i' => DB_ERROR_NOSUCHFIELD,
-                '/^near ".*": syntax error$/' => DB_ERROR_SYNTAX,
-                '/[0-9]+ values for [0-9]+ columns/i' => DB_ERROR_VALUE_COUNT_ON_ROW,
-            );
-        }
-        foreach ($error_regexps as $regexp => $code) {
-            if (preg_match($regexp, $errormsg)) {
-                return $code;
-            }
-        }
-        // Fall back to DB_ERROR if there was no mapping.
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table
-     *
-     * @param string         $result  a string containing the name of a table
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     * @since Method available since Release 1.7.0
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            $id = @sqlite_array_query($this->connection,
-                                      "PRAGMA table_info('$result');",
-                                      SQLITE_ASSOC);
-            $got_string = true;
-        } else {
-            $this->last_query = '';
-            return $this->raiseError(DB_ERROR_NOT_CAPABLE, null, null, null,
-                                     'This DBMS can not obtain tableInfo' .
-                                     ' from result sets');
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = count($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            if (strpos($id[$i]['type'], '(') !== false) {
-                $bits = explode('(', $id[$i]['type']);
-                $type = $bits[0];
-                $len  = rtrim($bits[1],')');
-            } else {
-                $type = $id[$i]['type'];
-                $len  = 0;
-            }
-
-            $flags = '';
-            if ($id[$i]['pk']) {
-                $flags .= 'primary_key ';
-            }
-            if ($id[$i]['notnull']) {
-                $flags .= 'not_null ';
-            }
-            if ($id[$i]['dflt_value'] !== null) {
-                $flags .= 'default_' . rawurlencode($id[$i]['dflt_value']);
-            }
-            $flags = trim($flags);
-
-            $res[$i] = array(
-                'table' => $case_func($result),
-                'name'  => $case_func($id[$i]['name']),
-                'type'  => $type,
-                'len'   => $len,
-                'flags' => $flags,
-            );
-
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        return $res;
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     * @param array  $args  SQLITE DRIVER ONLY: a private array of arguments
-     *                       used by the getSpecialQuery().  Do not use
-     *                       this directly.
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type, $args = array())
-    {
-        if (!is_array($args)) {
-            return $this->raiseError('no key specified', null, null, null,
-                                     'Argument has to be an array.');
-        }
-
-        switch ($type) {
-            case 'master':
-                return 'SELECT * FROM sqlite_master;';
-            case 'tables':
-                return "SELECT name FROM sqlite_master WHERE type='table' "
-                       . 'UNION ALL SELECT name FROM sqlite_temp_master '
-                       . "WHERE type='table' ORDER BY name;";
-            case 'schema':
-                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
-                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
-                       . "WHERE type!='meta' "
-                       . 'ORDER BY tbl_name, type DESC, name;';
-            case 'schemax':
-            case 'schema_x':
-                /*
-                 * Use like:
-                 * $res = $db->query($db->getSpecialQuery('schema_x',
-                 *                   array('table' => 'table3')));
-                 */
-                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
-                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
-                       . "WHERE tbl_name LIKE '{$args['table']}' "
-                       . "AND type!='meta' "
-                       . 'ORDER BY type DESC, name;';
-            case 'alter':
-                /*
-                 * SQLite does not support ALTER TABLE; this is a helper query
-                 * to handle this. 'table' represents the table name, 'rows'
-                 * the news rows to create, 'save' the row(s) to keep _with_
-                 * the data.
-                 *
-                 * Use like:
-                 * $args = array(
-                 *     'table' => $table,
-                 *     'rows'  => "id INTEGER PRIMARY KEY, firstname TEXT, surname TEXT, datetime TEXT",
-                 *     'save'  => "NULL, titel, content, datetime"
-                 * );
-                 * $res = $db->query( $db->getSpecialQuery('alter', $args));
-                 */
-                $rows = strtr($args['rows'], $this->keywords);
-
-                $q = array(
-                    'BEGIN TRANSACTION',
-                    "CREATE TEMPORARY TABLE {$args['table']}_backup ({$args['rows']})",
-                    "INSERT INTO {$args['table']}_backup SELECT {$args['save']} FROM {$args['table']}",
-                    "DROP TABLE {$args['table']}",
-                    "CREATE TABLE {$args['table']} ({$args['rows']})",
-                    "INSERT INTO {$args['table']} SELECT {$rows} FROM {$args['table']}_backup",
-                    "DROP TABLE {$args['table']}_backup",
-                    'COMMIT',
-                );
-
-                /*
-                 * This is a dirty hack, since the above query will not get
-                 * executed with a single query call so here the query method
-                 * will be called directly and return a select instead.
-                 */
-                foreach ($q as $query) {
-                    $this->query($query);
-                }
-                return "SELECT * FROM {$args['table']};";
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/storage.php b/lib/php/DB/storage.php
deleted file mode 100644
index 30762e87e44640749481fe06dddb75940f2fb464..0000000000000000000000000000000000000000
--- a/lib/php/DB/storage.php
+++ /dev/null
@@ -1,506 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Provides an object interface to a table row
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <stig@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: storage.php,v 1.24 2007/08/12 05:27:25 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB class so it can be extended from
- */
-require_once 'DB.php';
-
-/**
- * Provides an object interface to a table row
- *
- * It lets you add, delete and change rows using objects rather than SQL
- * statements.
- *
- * @category   Database
- * @package    DB
- * @author     Stig Bakken <stig@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_storage extends PEAR
-{
-    // {{{ properties
-
-    /** the name of the table (or view, if the backend database supports
-        updates in views) we hold data from */
-    var $_table = null;
-
-    /** which column(s) in the table contains primary keys, can be a
-        string for single-column primary keys, or an array of strings
-        for multiple-column primary keys */
-    var $_keycolumn = null;
-
-    /** DB connection handle used for all transactions */
-    var $_dbh = null;
-
-    /** an assoc with the names of database fields stored as properties
-        in this object */
-    var $_properties = array();
-
-    /** an assoc with the names of the properties in this object that
-        have been changed since they were fetched from the database */
-    var $_changes = array();
-
-    /** flag that decides if data in this object can be changed.
-        objects that don't have their table's key column in their
-        property lists will be flagged as read-only. */
-    var $_readonly = false;
-
-    /** function or method that implements a validator for fields that
-        are set, this validator function returns true if the field is
-        valid, false if not */
-    var $_validator = null;
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * Constructor
-     *
-     * @param $table string the name of the database table
-     *
-     * @param $keycolumn mixed string with name of key column, or array of
-     * strings if the table has a primary key of more than one column
-     *
-     * @param $dbh object database connection object
-     *
-     * @param $validator mixed function or method used to validate
-     * each new value, called with three parameters: the name of the
-     * field/column that is changing, a reference to the new value and
-     * a reference to this object
-     *
-     */
-    function DB_storage($table, $keycolumn, &$dbh, $validator = null)
-    {
-        $this->PEAR('DB_Error');
-        $this->_table = $table;
-        $this->_keycolumn = $keycolumn;
-        $this->_dbh = $dbh;
-        $this->_readonly = false;
-        $this->_validator = $validator;
-    }
-
-    // }}}
-    // {{{ _makeWhere()
-
-    /**
-     * Utility method to build a "WHERE" clause to locate ourselves in
-     * the table.
-     *
-     * XXX future improvement: use rowids?
-     *
-     * @access private
-     */
-    function _makeWhere($keyval = null)
-    {
-        if (is_array($this->_keycolumn)) {
-            if ($keyval === null) {
-                for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
-                    $keyval[] = $this->{$this->_keycolumn[$i]};
-                }
-            }
-            $whereclause = '';
-            for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
-                if ($i > 0) {
-                    $whereclause .= ' AND ';
-                }
-                $whereclause .= $this->_keycolumn[$i];
-                if (is_null($keyval[$i])) {
-                    // there's not much point in having a NULL key,
-                    // but we support it anyway
-                    $whereclause .= ' IS NULL';
-                } else {
-                    $whereclause .= ' = ' . $this->_dbh->quote($keyval[$i]);
-                }
-            }
-        } else {
-            if ($keyval === null) {
-                $keyval = @$this->{$this->_keycolumn};
-            }
-            $whereclause = $this->_keycolumn;
-            if (is_null($keyval)) {
-                // there's not much point in having a NULL key,
-                // but we support it anyway
-                $whereclause .= ' IS NULL';
-            } else {
-                $whereclause .= ' = ' . $this->_dbh->quote($keyval);
-            }
-        }
-        return $whereclause;
-    }
-
-    // }}}
-    // {{{ setup()
-
-    /**
-     * Method used to initialize a DB_storage object from the
-     * configured table.
-     *
-     * @param $keyval mixed the key[s] of the row to fetch (string or array)
-     *
-     * @return int DB_OK on success, a DB error if not
-     */
-    function setup($keyval)
-    {
-        $whereclause = $this->_makeWhere($keyval);
-        $query = 'SELECT * FROM ' . $this->_table . ' WHERE ' . $whereclause;
-        $sth = $this->_dbh->query($query);
-        if (DB::isError($sth)) {
-            return $sth;
-        }
-        $row = $sth->fetchRow(DB_FETCHMODE_ASSOC);
-        if (DB::isError($row)) {
-            return $row;
-        }
-        if (!$row) {
-            return $this->raiseError(null, DB_ERROR_NOT_FOUND, null, null,
-                                     $query, null, true);
-        }
-        foreach ($row as $key => $value) {
-            $this->_properties[$key] = true;
-            $this->$key = $value;
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ insert()
-
-    /**
-     * Create a new (empty) row in the configured table for this
-     * object.
-     */
-    function insert($newpk)
-    {
-        if (is_array($this->_keycolumn)) {
-            $primarykey = $this->_keycolumn;
-        } else {
-            $primarykey = array($this->_keycolumn);
-        }
-        settype($newpk, "array");
-        for ($i = 0; $i < sizeof($primarykey); $i++) {
-            $pkvals[] = $this->_dbh->quote($newpk[$i]);
-        }
-
-        $sth = $this->_dbh->query("INSERT INTO $this->_table (" .
-                                  implode(",", $primarykey) . ") VALUES(" .
-                                  implode(",", $pkvals) . ")");
-        if (DB::isError($sth)) {
-            return $sth;
-        }
-        if (sizeof($newpk) == 1) {
-            $newpk = $newpk[0];
-        }
-        $this->setup($newpk);
-    }
-
-    // }}}
-    // {{{ toString()
-
-    /**
-     * Output a simple description of this DB_storage object.
-     * @return string object description
-     */
-    function toString()
-    {
-        $info = strtolower(get_class($this));
-        $info .= " (table=";
-        $info .= $this->_table;
-        $info .= ", keycolumn=";
-        if (is_array($this->_keycolumn)) {
-            $info .= "(" . implode(",", $this->_keycolumn) . ")";
-        } else {
-            $info .= $this->_keycolumn;
-        }
-        $info .= ", dbh=";
-        if (is_object($this->_dbh)) {
-            $info .= $this->_dbh->toString();
-        } else {
-            $info .= "null";
-        }
-        $info .= ")";
-        if (sizeof($this->_properties)) {
-            $info .= " [loaded, key=";
-            $keyname = $this->_keycolumn;
-            if (is_array($keyname)) {
-                $info .= "(";
-                for ($i = 0; $i < sizeof($keyname); $i++) {
-                    if ($i > 0) {
-                        $info .= ",";
-                    }
-                    $info .= $this->$keyname[$i];
-                }
-                $info .= ")";
-            } else {
-                $info .= $this->$keyname;
-            }
-            $info .= "]";
-        }
-        if (sizeof($this->_changes)) {
-            $info .= " [modified]";
-        }
-        return $info;
-    }
-
-    // }}}
-    // {{{ dump()
-
-    /**
-     * Dump the contents of this object to "standard output".
-     */
-    function dump()
-    {
-        foreach ($this->_properties as $prop => $foo) {
-            print "$prop = ";
-            print htmlentities($this->$prop);
-            print "<br />\n";
-        }
-    }
-
-    // }}}
-    // {{{ &create()
-
-    /**
-     * Static method used to create new DB storage objects.
-     * @param $data assoc. array where the keys are the names
-     *              of properties/columns
-     * @return object a new instance of DB_storage or a subclass of it
-     */
-    function &create($table, &$data)
-    {
-        $classname = strtolower(get_class($this));
-        $obj = new $classname($table);
-        foreach ($data as $name => $value) {
-            $obj->_properties[$name] = true;
-            $obj->$name = &$value;
-        }
-        return $obj;
-    }
-
-    // }}}
-    // {{{ loadFromQuery()
-
-    /**
-     * Loads data into this object from the given query.  If this
-     * object already contains table data, changes will be saved and
-     * the object re-initialized first.
-     *
-     * @param $query SQL query
-     *
-     * @param $params parameter list in case you want to use
-     * prepare/execute mode
-     *
-     * @return int DB_OK on success, DB_WARNING_READ_ONLY if the
-     * returned object is read-only (because the object's specified
-     * key column was not found among the columns returned by $query),
-     * or another DB error code in case of errors.
-     */
-// XXX commented out for now
-/*
-    function loadFromQuery($query, $params = null)
-    {
-        if (sizeof($this->_properties)) {
-            if (sizeof($this->_changes)) {
-                $this->store();
-                $this->_changes = array();
-            }
-            $this->_properties = array();
-        }
-        $rowdata = $this->_dbh->getRow($query, DB_FETCHMODE_ASSOC, $params);
-        if (DB::isError($rowdata)) {
-            return $rowdata;
-        }
-        reset($rowdata);
-        $found_keycolumn = false;
-        while (list($key, $value) = each($rowdata)) {
-            if ($key == $this->_keycolumn) {
-                $found_keycolumn = true;
-            }
-            $this->_properties[$key] = true;
-            $this->$key = &$value;
-            unset($value); // have to unset, or all properties will
-                           // refer to the same value
-        }
-        if (!$found_keycolumn) {
-            $this->_readonly = true;
-            return DB_WARNING_READ_ONLY;
-        }
-        return DB_OK;
-    }
- */
-
-    // }}}
-    // {{{ set()
-
-    /**
-     * Modify an attriute value.
-     */
-    function set($property, $newvalue)
-    {
-        // only change if $property is known and object is not
-        // read-only
-        if ($this->_readonly) {
-            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
-                                     null, null, null, true);
-        }
-        if (@isset($this->_properties[$property])) {
-            if (empty($this->_validator)) {
-                $valid = true;
-            } else {
-                $valid = @call_user_func($this->_validator,
-                                         $this->_table,
-                                         $property,
-                                         $newvalue,
-                                         $this->$property,
-                                         $this);
-            }
-            if ($valid) {
-                $this->$property = $newvalue;
-                if (empty($this->_changes[$property])) {
-                    $this->_changes[$property] = 0;
-                } else {
-                    $this->_changes[$property]++;
-                }
-            } else {
-                return $this->raiseError(null, DB_ERROR_INVALID, null,
-                                         null, "invalid field: $property",
-                                         null, true);
-            }
-            return true;
-        }
-        return $this->raiseError(null, DB_ERROR_NOSUCHFIELD, null,
-                                 null, "unknown field: $property",
-                                 null, true);
-    }
-
-    // }}}
-    // {{{ &get()
-
-    /**
-     * Fetch an attribute value.
-     *
-     * @param string attribute name
-     *
-     * @return attribute contents, or null if the attribute name is
-     * unknown
-     */
-    function &get($property)
-    {
-        // only return if $property is known
-        if (isset($this->_properties[$property])) {
-            return $this->$property;
-        }
-        $tmp = null;
-        return $tmp;
-    }
-
-    // }}}
-    // {{{ _DB_storage()
-
-    /**
-     * Destructor, calls DB_storage::store() if there are changes
-     * that are to be kept.
-     */
-    function _DB_storage()
-    {
-        if (sizeof($this->_changes)) {
-            $this->store();
-        }
-        $this->_properties = array();
-        $this->_changes = array();
-        $this->_table = null;
-    }
-
-    // }}}
-    // {{{ store()
-
-    /**
-     * Stores changes to this object in the database.
-     *
-     * @return DB_OK or a DB error
-     */
-    function store()
-    {
-        $params = array();
-        $vars = array();
-        foreach ($this->_changes as $name => $foo) {
-            $params[] = &$this->$name;
-            $vars[] = $name . ' = ?';
-        }
-        if ($vars) {
-            $query = 'UPDATE ' . $this->_table . ' SET ' .
-                implode(', ', $vars) . ' WHERE ' .
-                $this->_makeWhere();
-            $stmt = $this->_dbh->prepare($query);
-            $res = $this->_dbh->execute($stmt, $params);
-            if (DB::isError($res)) {
-                return $res;
-            }
-            $this->_changes = array();
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ remove()
-
-    /**
-     * Remove the row represented by this object from the database.
-     *
-     * @return mixed DB_OK or a DB error
-     */
-    function remove()
-    {
-        if ($this->_readonly) {
-            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
-                                     null, null, null, true);
-        }
-        $query = 'DELETE FROM ' . $this->_table .' WHERE '.
-            $this->_makeWhere();
-        $res = $this->_dbh->query($query);
-        if (DB::isError($res)) {
-            return $res;
-        }
-        foreach ($this->_properties as $prop => $foo) {
-            unset($this->$prop);
-        }
-        $this->_properties = array();
-        $this->_changes = array();
-        return DB_OK;
-    }
-
-    // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/DB/sybase.php b/lib/php/DB/sybase.php
deleted file mode 100644
index bb79c78c2aa6fe174906947407dbf0c0c2521786..0000000000000000000000000000000000000000
--- a/lib/php/DB/sybase.php
+++ /dev/null
@@ -1,942 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * The PEAR DB driver for PHP's sybase extension
- * for interacting with Sybase databases
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Ant�nio Carlos Ven�ncio J�nior <floripa@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: sybase.php,v 1.87 2007/09/21 13:40:42 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB_common class so it can be extended from
- */
-require_once 'DB/common.php';
-
-/**
- * The methods PEAR DB uses to interact with PHP's sybase extension
- * for interacting with Sybase databases
- *
- * These methods overload the ones declared in DB_common.
- *
- * WARNING:  This driver may fail with multiple connections under the
- * same user/pass/host and different databases.
- *
- * @category   Database
- * @package    DB
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Ant�nio Carlos Ven�ncio J�nior <floripa@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 1.7.13
- * @link       http://pear.php.net/package/DB
- */
-class DB_sybase extends DB_common
-{
-    // {{{ properties
-
-    /**
-     * The DB driver type (mysql, oci8, odbc, etc.)
-     * @var string
-     */
-    var $phptype = 'sybase';
-
-    /**
-     * The database syntax variant to be used (db2, access, etc.), if any
-     * @var string
-     */
-    var $dbsyntax = 'sybase';
-
-    /**
-     * The capabilities of this DB implementation
-     *
-     * The 'new_link' element contains the PHP version that first provided
-     * new_link support for this DBMS.  Contains false if it's unsupported.
-     *
-     * Meaning of the 'limit' element:
-     *   + 'emulate' = emulate with fetch row by number
-     *   + 'alter'   = alter the query
-     *   + false     = skip rows
-     *
-     * @var array
-     */
-    var $features = array(
-        'limit'         => 'emulate',
-        'new_link'      => false,
-        'numrows'       => true,
-        'pconnect'      => true,
-        'prepare'       => false,
-        'ssl'           => false,
-        'transactions'  => true,
-    );
-
-    /**
-     * A mapping of native error codes to DB error codes
-     * @var array
-     */
-    var $errorcode_map = array(
-    );
-
-    /**
-     * The raw database connection created by PHP
-     * @var resource
-     */
-    var $connection;
-
-    /**
-     * The DSN information for connecting to a database
-     * @var array
-     */
-    var $dsn = array();
-
-
-    /**
-     * Should data manipulation queries be committed automatically?
-     * @var bool
-     * @access private
-     */
-    var $autocommit = true;
-
-    /**
-     * The quantity of transactions begun
-     *
-     * {@internal  While this is private, it can't actually be designated
-     * private in PHP 5 because it is directly accessed in the test suite.}}
-     *
-     * @var integer
-     * @access private
-     */
-    var $transaction_opcount = 0;
-
-    /**
-     * The database specified in the DSN
-     *
-     * It's a fix to allow calls to different databases in the same script.
-     *
-     * @var string
-     * @access private
-     */
-    var $_db = '';
-
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * This constructor calls <kbd>$this->DB_common()</kbd>
-     *
-     * @return void
-     */
-    function DB_sybase()
-    {
-        $this->DB_common();
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database server, log in and open the database
-     *
-     * Don't call this method directly.  Use DB::connect() instead.
-     *
-     * PEAR DB's sybase driver supports the following extra DSN options:
-     *   + appname       The application name to use on this connection.
-     *                   Available since PEAR DB 1.7.0.
-     *   + charset       The character set to use on this connection.
-     *                   Available since PEAR DB 1.7.0.
-     *
-     * @param array $dsn         the data source name
-     * @param bool  $persistent  should the connection be persistent?
-     *
-     * @return int  DB_OK on success. A DB_Error object on failure.
-     */
-    function connect($dsn, $persistent = false)
-    {
-        if (!PEAR::loadExtension('sybase') &&
-            !PEAR::loadExtension('sybase_ct'))
-        {
-            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
-        }
-
-        $this->dsn = $dsn;
-        if ($dsn['dbsyntax']) {
-            $this->dbsyntax = $dsn['dbsyntax'];
-        }
-
-        $dsn['hostspec'] = $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost';
-        $dsn['password'] = !empty($dsn['password']) ? $dsn['password'] : false;
-        $dsn['charset'] = isset($dsn['charset']) ? $dsn['charset'] : false;
-        $dsn['appname'] = isset($dsn['appname']) ? $dsn['appname'] : false;
-
-        $connect_function = $persistent ? 'sybase_pconnect' : 'sybase_connect';
-
-        if ($dsn['username']) {
-            $this->connection = @$connect_function($dsn['hostspec'],
-                                                   $dsn['username'],
-                                                   $dsn['password'],
-                                                   $dsn['charset'],
-                                                   $dsn['appname']);
-        } else {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     'The DSN did not contain a username.');
-        }
-
-        if (!$this->connection) {
-            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
-                                     null, null, null,
-                                     @sybase_get_last_message());
-        }
-
-        if ($dsn['database']) {
-            if (!@sybase_select_db($dsn['database'], $this->connection)) {
-                return $this->raiseError(DB_ERROR_NODBSELECTED,
-                                         null, null, null,
-                                         @sybase_get_last_message());
-            }
-            $this->_db = $dsn['database'];
-        }
-
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Disconnects from the database server
-     *
-     * @return bool  TRUE on success, FALSE on failure
-     */
-    function disconnect()
-    {
-        $ret = @sybase_close($this->connection);
-        $this->connection = null;
-        return $ret;
-    }
-
-    // }}}
-    // {{{ simpleQuery()
-
-    /**
-     * Sends a query to the database server
-     *
-     * @param string  the SQL query string
-     *
-     * @return mixed  + a PHP result resrouce for successful SELECT queries
-     *                + the DB_OK constant for other successful queries
-     *                + a DB_Error object on failure
-     */
-    function simpleQuery($query)
-    {
-        $ismanip = $this->_checkManip($query);
-        $this->last_query = $query;
-        if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
-            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
-        }
-        $query = $this->modifyQuery($query);
-        if (!$this->autocommit && $ismanip) {
-            if ($this->transaction_opcount == 0) {
-                $result = @sybase_query('BEGIN TRANSACTION', $this->connection);
-                if (!$result) {
-                    return $this->sybaseRaiseError();
-                }
-            }
-            $this->transaction_opcount++;
-        }
-        $result = @sybase_query($query, $this->connection);
-        if (!$result) {
-            return $this->sybaseRaiseError();
-        }
-        if (is_resource($result)) {
-            return $result;
-        }
-        // Determine which queries that should return data, and which
-        // should return an error code only.
-        return $ismanip ? DB_OK : $result;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal sybase result pointer to the next available result
-     *
-     * @param a valid sybase result resource
-     *
-     * @access public
-     *
-     * @return true if a result is available otherwise return false
-     */
-    function nextResult($result)
-    {
-        return false;
-    }
-
-    // }}}
-    // {{{ fetchInto()
-
-    /**
-     * Places a row from the result set into the given array
-     *
-     * Formating of the array and the data therein are configurable.
-     * See DB_result::fetchInto() for more information.
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::fetchInto() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result    the query result resource
-     * @param array    $arr       the referenced array to put the data in
-     * @param int      $fetchmode how the resulting array should be indexed
-     * @param int      $rownum    the row number to fetch (0 = first row)
-     *
-     * @return mixed  DB_OK on success, NULL when the end of a result set is
-     *                 reached or on failure
-     *
-     * @see DB_result::fetchInto()
-     */
-    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
-    {
-        if ($rownum !== null) {
-            if (!@sybase_data_seek($result, $rownum)) {
-                return null;
-            }
-        }
-        if ($fetchmode & DB_FETCHMODE_ASSOC) {
-            if (function_exists('sybase_fetch_assoc')) {
-                $arr = @sybase_fetch_assoc($result);
-            } else {
-                if ($arr = @sybase_fetch_array($result)) {
-                    foreach ($arr as $key => $value) {
-                        if (is_int($key)) {
-                            unset($arr[$key]);
-                        }
-                    }
-                }
-            }
-            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
-                $arr = array_change_key_case($arr, CASE_LOWER);
-            }
-        } else {
-            $arr = @sybase_fetch_row($result);
-        }
-        if (!$arr) {
-            return null;
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
-            $this->_rtrimArrayValues($arr);
-        }
-        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
-            $this->_convertNullArrayValuesToEmpty($arr);
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ freeResult()
-
-    /**
-     * Deletes the result set and frees the memory occupied by the result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::free() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return bool  TRUE on success, FALSE if $result is invalid
-     *
-     * @see DB_result::free()
-     */
-    function freeResult($result)
-    {
-        return is_resource($result) ? sybase_free_result($result) : false;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Gets the number of columns in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numCols() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of columns.  A DB_Error object on failure.
-     *
-     * @see DB_result::numCols()
-     */
-    function numCols($result)
-    {
-        $cols = @sybase_num_fields($result);
-        if (!$cols) {
-            return $this->sybaseRaiseError();
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Gets the number of rows in a result set
-     *
-     * This method is not meant to be called directly.  Use
-     * DB_result::numRows() instead.  It can't be declared "protected"
-     * because DB_result is a separate object.
-     *
-     * @param resource $result  PHP's query result resource
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     *
-     * @see DB_result::numRows()
-     */
-    function numRows($result)
-    {
-        $rows = @sybase_num_rows($result);
-        if ($rows === false) {
-            return $this->sybaseRaiseError();
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ affectedRows()
-
-    /**
-     * Determines the number of rows affected by a data maniuplation query
-     *
-     * 0 is returned for queries that don't manipulate data.
-     *
-     * @return int  the number of rows.  A DB_Error object on failure.
-     */
-    function affectedRows()
-    {
-        if ($this->_last_query_manip) {
-            $result = @sybase_affected_rows($this->connection);
-        } else {
-            $result = 0;
-        }
-        return $result;
-     }
-
-    // }}}
-    // {{{ nextId()
-
-    /**
-     * Returns the next free id in a sequence
-     *
-     * @param string  $seq_name  name of the sequence
-     * @param boolean $ondemand  when true, the seqence is automatically
-     *                            created if it does not exist
-     *
-     * @return int  the next id number in the sequence.
-     *               A DB_Error object on failure.
-     *
-     * @see DB_common::nextID(), DB_common::getSequenceName(),
-     *      DB_sybase::createSequence(), DB_sybase::dropSequence()
-     */
-    function nextId($seq_name, $ondemand = true)
-    {
-        $seqname = $this->getSequenceName($seq_name);
-        if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
-            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
-        }
-        $repeat = 0;
-        do {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
-            $this->popErrorHandling();
-            if ($ondemand && DB::isError($result) &&
-                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
-            {
-                $repeat = 1;
-                $result = $this->createSequence($seq_name);
-                if (DB::isError($result)) {
-                    return $this->raiseError($result);
-                }
-            } elseif (!DB::isError($result)) {
-                $result = $this->query("SELECT @@IDENTITY FROM $seqname");
-                $repeat = 0;
-            } else {
-                $repeat = false;
-            }
-        } while ($repeat);
-        if (DB::isError($result)) {
-            return $this->raiseError($result);
-        }
-        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
-        return $result[0];
-    }
-
-    /**
-     * Creates a new sequence
-     *
-     * @param string $seq_name  name of the new sequence
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::createSequence(), DB_common::getSequenceName(),
-     *      DB_sybase::nextID(), DB_sybase::dropSequence()
-     */
-    function createSequence($seq_name)
-    {
-        return $this->query('CREATE TABLE '
-                            . $this->getSequenceName($seq_name)
-                            . ' (id numeric(10, 0) IDENTITY NOT NULL,'
-                            . ' vapor int NULL)');
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * Deletes a sequence
-     *
-     * @param string $seq_name  name of the sequence to be deleted
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     *
-     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
-     *      DB_sybase::nextID(), DB_sybase::createSequence()
-     */
-    function dropSequence($seq_name)
-    {
-        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
-    }
-
-    // }}}
-    // {{{ quoteFloat()
-
-    /**
-     * Formats a float value for use within a query in a locale-independent
-     * manner.
-     *
-     * @param float the float value to be quoted.
-     * @return string the quoted string.
-     * @see DB_common::quoteSmart()
-     * @since Method available since release 1.7.8.
-     */
-    function quoteFloat($float) {
-        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float))));
-    }
-     
-    // }}}
-    // {{{ autoCommit()
-
-    /**
-     * Enables or disables automatic commits
-     *
-     * @param bool $onoff  true turns it on, false turns it off
-     *
-     * @return int  DB_OK on success.  A DB_Error object if the driver
-     *               doesn't support auto-committing transactions.
-     */
-    function autoCommit($onoff = false)
-    {
-        // XXX if $this->transaction_opcount > 0, we should probably
-        // issue a warning here.
-        $this->autocommit = $onoff ? true : false;
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commits the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function commit()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
-                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $result = @sybase_query('COMMIT', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->sybaseRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Reverts the current transaction
-     *
-     * @return int  DB_OK on success.  A DB_Error object on failure.
-     */
-    function rollback()
-    {
-        if ($this->transaction_opcount > 0) {
-            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
-                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $result = @sybase_query('ROLLBACK', $this->connection);
-            $this->transaction_opcount = 0;
-            if (!$result) {
-                return $this->sybaseRaiseError();
-            }
-        }
-        return DB_OK;
-    }
-
-    // }}}
-    // {{{ sybaseRaiseError()
-
-    /**
-     * Produces a DB_Error object regarding the current problem
-     *
-     * @param int $errno  if the error is being manually raised pass a
-     *                     DB_ERROR* constant here.  If this isn't passed
-     *                     the error information gathered from the DBMS.
-     *
-     * @return object  the DB_Error object
-     *
-     * @see DB_common::raiseError(),
-     *      DB_sybase::errorNative(), DB_sybase::errorCode()
-     */
-    function sybaseRaiseError($errno = null)
-    {
-        $native = $this->errorNative();
-        if ($errno === null) {
-            $errno = $this->errorCode($native);
-        }
-        return $this->raiseError($errno, null, null, null, $native);
-    }
-
-    // }}}
-    // {{{ errorNative()
-
-    /**
-     * Gets the DBMS' native error message produced by the last query
-     *
-     * @return string  the DBMS' error message
-     */
-    function errorNative()
-    {
-        return @sybase_get_last_message();
-    }
-
-    // }}}
-    // {{{ errorCode()
-
-    /**
-     * Determines PEAR::DB error code from the database's text error message.
-     *
-     * @param  string  $errormsg  error message returned from the database
-     * @return integer  an error number from a DB error constant
-     */
-    function errorCode($errormsg)
-    {
-        static $error_regexps;
-        
-        // PHP 5.2+ prepends the function name to $php_errormsg, so we need
-        // this hack to work around it, per bug #9599.
-        $errormsg = preg_replace('/^sybase[a-z_]+\(\): /', '', $errormsg);
-        
-        if (!isset($error_regexps)) {
-            $error_regexps = array(
-                '/Incorrect syntax near/'
-                    => DB_ERROR_SYNTAX,
-                '/^Unclosed quote before the character string [\"\'].*[\"\']\./'
-                    => DB_ERROR_SYNTAX,
-                '/Implicit conversion (from datatype|of NUMERIC value)/i'
-                    => DB_ERROR_INVALID_NUMBER,
-                '/Cannot drop the table [\"\'].+[\"\'], because it doesn\'t exist in the system catalogs\./'
-                    => DB_ERROR_NOSUCHTABLE,
-                '/Only the owner of object [\"\'].+[\"\'] or a user with System Administrator \(SA\) role can run this command\./'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/^.+ permission denied on object .+, database .+, owner .+/'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/^.* permission denied, database .+, owner .+/'
-                    => DB_ERROR_ACCESS_VIOLATION,
-                '/[^.*] not found\./'
-                    => DB_ERROR_NOSUCHTABLE,
-                '/There is already an object named/'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/Invalid column name/'
-                    => DB_ERROR_NOSUCHFIELD,
-                '/does not allow null values/'
-                    => DB_ERROR_CONSTRAINT_NOT_NULL,
-                '/Command has been aborted/'
-                    => DB_ERROR_CONSTRAINT,
-                '/^Cannot drop the index .* because it doesn\'t exist/i'
-                    => DB_ERROR_NOT_FOUND,
-                '/^There is already an index/i'
-                    => DB_ERROR_ALREADY_EXISTS,
-                '/^There are fewer columns in the INSERT statement than values specified/i'
-                    => DB_ERROR_VALUE_COUNT_ON_ROW,
-                '/Divide by zero/i'
-                    => DB_ERROR_DIVZERO,
-            );
-        }
-
-        foreach ($error_regexps as $regexp => $code) {
-            if (preg_match($regexp, $errormsg)) {
-                return $code;
-            }
-        }
-        return DB_ERROR;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
-     * is a table name.
-     *
-     * @param object|string  $result  DB_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A DB_Error object on failure.
-     *
-     * @see DB_common::tableInfo()
-     * @since Method available since Release 1.6.0
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-            /*
-             * Probably received a table name.
-             * Create a result resource identifier.
-             */
-            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
-                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
-            }
-            $id = @sybase_query("SELECT * FROM $result WHERE 1=0",
-                                $this->connection);
-            $got_string = true;
-        } elseif (isset($result->result)) {
-            /*
-             * Probably received a result object.
-             * Extract the result resource identifier.
-             */
-            $id = $result->result;
-            $got_string = false;
-        } else {
-            /*
-             * Probably received a result resource identifier.
-             * Copy it.
-             * Deprecated.  Here for compatibility only.
-             */
-            $id = $result;
-            $got_string = false;
-        }
-
-        if (!is_resource($id)) {
-            return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
-        }
-
-        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
-            $case_func = 'strtolower';
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @sybase_num_fields($id);
-        $res   = array();
-
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        for ($i = 0; $i < $count; $i++) {
-            $f = @sybase_fetch_field($id, $i);
-            // column_source is often blank
-            $res[$i] = array(
-                'table' => $got_string
-                           ? $case_func($result)
-                           : $case_func($f->column_source),
-                'name'  => $case_func($f->name),
-                'type'  => $f->type,
-                'len'   => $f->max_length,
-                'flags' => '',
-            );
-            if ($res[$i]['table']) {
-                $res[$i]['flags'] = $this->_sybase_field_flags(
-                        $res[$i]['table'], $res[$i]['name']);
-            }
-            if ($mode & DB_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & DB_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        // free the result only if we were called on a table
-        if ($got_string) {
-            @sybase_free_result($id);
-        }
-        return $res;
-    }
-
-    // }}}
-    // {{{ _sybase_field_flags()
-
-    /**
-     * Get the flags for a field
-     *
-     * Currently supports:
-     *  + <samp>unique_key</samp>    (unique index, unique check or primary_key)
-     *  + <samp>multiple_key</samp>  (multi-key index)
-     *
-     * @param string  $table   the table name
-     * @param string  $column  the field name
-     *
-     * @return string  space delimited string of flags.  Empty string if none.
-     *
-     * @access private
-     */
-    function _sybase_field_flags($table, $column)
-    {
-        static $tableName = null;
-        static $flags = array();
-
-        if ($table != $tableName) {
-            $flags = array();
-            $tableName = $table;
-
-            /* We're running sp_helpindex directly because it doesn't exist in
-             * older versions of ASE -- unfortunately, we can't just use
-             * DB::isError() because the user may be using callback error
-             * handling. */
-            $res = @sybase_query("sp_helpindex $table", $this->connection);
-
-            if ($res === false || $res === true) {
-                // Fake a valid response for BC reasons.
-                return '';
-            }
-
-            while (($val = sybase_fetch_assoc($res)) !== false) {
-                if (!isset($val['index_keys'])) {
-                    /* No useful information returned. Break and be done with
-                     * it, which preserves the pre-1.7.9 behaviour. */
-                    break;
-                }
-
-                $keys = explode(', ', trim($val['index_keys']));
-
-                if (sizeof($keys) > 1) {
-                    foreach ($keys as $key) {
-                        $this->_add_flag($flags[$key], 'multiple_key');
-                    }
-                }
-
-                if (strpos($val['index_description'], 'unique')) {
-                    foreach ($keys as $key) {
-                        $this->_add_flag($flags[$key], 'unique_key');
-                    }
-                }
-            }
-
-            sybase_free_result($res);
-
-        }
-
-        if (array_key_exists($column, $flags)) {
-            return(implode(' ', $flags[$column]));
-        }
-
-        return '';
-    }
-
-    // }}}
-    // {{{ _add_flag()
-
-    /**
-     * Adds a string to the flags array if the flag is not yet in there
-     * - if there is no flag present the array is created
-     *
-     * @param array  $array  reference of flags array to add a value to
-     * @param mixed  $value  value to add to the flag array
-     *
-     * @return void
-     *
-     * @access private
-     */
-    function _add_flag(&$array, $value)
-    {
-        if (!is_array($array)) {
-            $array = array($value);
-        } elseif (!in_array($value, $array)) {
-            array_push($array, $value);
-        }
-    }
-
-    // }}}
-    // {{{ getSpecialQuery()
-
-    /**
-     * Obtains the query string needed for listing a given type of objects
-     *
-     * @param string $type  the kind of objects you want to retrieve
-     *
-     * @return string  the SQL query string or null if the driver doesn't
-     *                  support the object type requested
-     *
-     * @access protected
-     * @see DB_common::getListOf()
-     */
-    function getSpecialQuery($type)
-    {
-        switch ($type) {
-            case 'tables':
-                return "SELECT name FROM sysobjects WHERE type = 'U'"
-                       . ' ORDER BY name';
-            case 'views':
-                return "SELECT name FROM sysobjects WHERE type = 'V'";
-            default:
-                return null;
-        }
-    }
-
-    // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/php/Date.php b/lib/php/Date.php
deleted file mode 100644
index 99e42c28de4a671353ccb562f0cbb5c82ff2e74c..0000000000000000000000000000000000000000
--- a/lib/php/Date.php
+++ /dev/null
@@ -1,1465 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
-// {{{ Header
-
-/**
- * Generic date handling class for PEAR
- *
- * Generic date handling class for PEAR.  Attempts to be time zone aware
- * through the Date::TimeZone class.  Supports several operations from
- * Date::Calc on Date objects.
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 1997-2006 Baba Buehler, Pierre-Alain Joye
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted under the terms of the BSD License.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Baba Buehler <baba@babaz.com>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @author     Firman Wandayandi <firman@php.net>
- * @copyright  1997-2006 Baba Buehler, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    CVS: $Id: Date.php,v 1.41 2006/11/22 00:28:03 firman Exp $
- * @link       http://pear.php.net/package/Date
- */
-
-// }}}
-
-// {{{ Includes
-
-/**
- * Load Date_TimeZone.
- */
-require_once 'Date/TimeZone.php';
-
-/**
- * Load Date_Calc.
- */
-require_once 'Date/Calc.php';
-
-/**
- * Load Date_Span.
- */
-require_once 'Date/Span.php';
-
-// }}}
-// {{{ Constants
-
-// {{{ Output formats Pass this to getDate().
-
-/**
- * "YYYY-MM-DD HH:MM:SS"
- */
-define('DATE_FORMAT_ISO', 1);
-
-/**
- * "YYYYMMSSTHHMMSS(Z|(+/-)HHMM)?"
- */
-define('DATE_FORMAT_ISO_BASIC', 2);
-
-/**
- * "YYYY-MM-SSTHH:MM:SS(Z|(+/-)HH:MM)?"
- */
-define('DATE_FORMAT_ISO_EXTENDED', 3);
-
-/**
- * "YYYY-MM-SSTHH:MM:SS(.S*)?(Z|(+/-)HH:MM)?"
- */
-define('DATE_FORMAT_ISO_EXTENDED_MICROTIME', 6);
-
-/**
- * "YYYYMMDDHHMMSS"
- */
-define('DATE_FORMAT_TIMESTAMP', 4);
-
-/**
- * long int, seconds since the unix epoch
- */
-define('DATE_FORMAT_UNIXTIME', 5);
-
-// }}}
-
-// }}}
-// {{{ Class: Date
-
-/**
- * Generic date handling class for PEAR
- *
- * Generic date handling class for PEAR.  Attempts to be time zone aware
- * through the Date::TimeZone class.  Supports several operations from
- * Date::Calc on Date objects.
- *
- * @author     Baba Buehler <baba@babaz.com>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @author     Firman Wandayandi <firman@php.net>
- * @copyright  1997-2006 Baba Buehler, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    Release: 1.4.7
- * @link       http://pear.php.net/package/Date
- */
-class Date
-{
-    // {{{ Properties
-
-    /**
-     * the year
-     * @var int
-     */
-    var $year;
-
-    /**
-     * the month
-     * @var int
-     */
-    var $month;
-
-    /**
-     * the day
-     * @var int
-     */
-    var $day;
-
-    /**
-     * the hour
-     * @var int
-     */
-    var $hour;
-
-    /**
-     * the minute
-     * @var int
-     */
-    var $minute;
-
-    /**
-     * the second
-     * @var int
-     */
-    var $second;
-
-    /**
-     * the parts of a second
-     * @var float
-     */
-    var $partsecond;
-
-    /**
-     * timezone for this date
-     * @var object Date_TimeZone
-     */
-    var $tz;
-
-    /**
-     * define the default weekday abbreviation length
-     * used by ::format()
-     * @var int
-     */
-    var $getWeekdayAbbrnameLength = 3;
-
-    // }}}
-    // {{{ Constructor
-
-    /**
-     * Constructor
-     *
-     * Creates a new Date Object initialized to the current date/time in the
-     * system-default timezone by default.  A date optionally
-     * passed in may be in the ISO 8601, TIMESTAMP or UNIXTIME format,
-     * or another Date object.  If no date is passed, the current date/time
-     * is used.
-     *
-     * @access public
-     * @see setDate()
-     * @param mixed $date optional - date/time to initialize
-     * @return object Date the new Date object
-     */
-    function Date($date = null)
-    {
-        $this->tz = Date_TimeZone::getDefault();
-        if (is_null($date)) {
-            $this->setDate(date("Y-m-d H:i:s"));
-        } elseif (is_a($date, 'Date')) {
-            $this->copy($date);
-        } else {
-            $this->setDate($date);
-        }
-    }
-
-    // }}}
-    // {{{ setDate()
-
-    /**
-     * Set the fields of a Date object based on the input date and format
-     *
-     * Set the fields of a Date object based on the input date and format,
-     * which is specified by the DATE_FORMAT_* constants.
-     *
-     * @access public
-     * @param string $date input date
-     * @param int $format Optional format constant (DATE_FORMAT_*) of the input date.
-     *                    This parameter isn't really needed anymore, but you could
-     *                    use it to force DATE_FORMAT_UNIXTIME.
-     */
-    function setDate($date, $format = DATE_FORMAT_ISO)
-    {
-        if (
-            preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?$/i', $date, $regs)
-            && $format != DATE_FORMAT_UNIXTIME) {
-            // DATE_FORMAT_ISO, ISO_BASIC, ISO_EXTENDED, and TIMESTAMP
-            // These formats are extremely close to each other.  This regex
-            // is very loose and accepts almost any butchered format you could
-            // throw at it.  e.g. 2003-10-07 19:45:15 and 2003-10071945:15
-            // are the same thing in the eyes of this regex, even though the
-            // latter is not a valid ISO 8601 date.
-            $this->year       = $regs[1];
-            $this->month      = $regs[2];
-            $this->day        = $regs[3];
-            $this->hour       = isset($regs[5])?$regs[5]:0;
-            $this->minute     = isset($regs[6])?$regs[6]:0;
-            $this->second     = isset($regs[7])?$regs[7]:0;
-            $this->partsecond = isset($regs[8])?(float)$regs[8]:(float)0;
-
-            // if an offset is defined, convert time to UTC
-            // Date currently can't set a timezone only by offset,
-            // so it has to store it as UTC
-            if (isset($regs[9])) {
-                $this->toUTCbyOffset($regs[9]);
-            }
-        } elseif (is_numeric($date)) {
-            // UNIXTIME
-            $this->setDate(date("Y-m-d H:i:s", $date));
-        } else {
-            // unknown format
-            $this->year       = 0;
-            $this->month      = 1;
-            $this->day        = 1;
-            $this->hour       = 0;
-            $this->minute     = 0;
-            $this->second     = 0;
-            $this->partsecond = (float)0;
-        }
-    }
-
-    // }}}
-    // {{{ getDate()
-
-    /**
-     * Get a string (or other) representation of this date
-     *
-     * Get a string (or other) representation of this date in the
-     * format specified by the DATE_FORMAT_* constants.
-     *
-     * @access public
-     * @param int $format format constant (DATE_FORMAT_*) of the output date
-     * @return string the date in the requested format
-     */
-    function getDate($format = DATE_FORMAT_ISO)
-    {
-        switch ($format) {
-        case DATE_FORMAT_ISO:
-            return $this->format("%Y-%m-%d %T");
-            break;
-        case DATE_FORMAT_ISO_BASIC:
-            $format = "%Y%m%dT%H%M%S";
-            if ($this->tz->getID() == 'UTC') {
-                $format .= "Z";
-            }
-            return $this->format($format);
-            break;
-        case DATE_FORMAT_ISO_EXTENDED:
-            $format = "%Y-%m-%dT%H:%M:%S";
-            if ($this->tz->getID() == 'UTC') {
-                $format .= "Z";
-            }
-            return $this->format($format);
-            break;
-        case DATE_FORMAT_ISO_EXTENDED_MICROTIME:
-            $format = "%Y-%m-%dT%H:%M:%s";
-            if ($this->tz->getID() == 'UTC') {
-                $format .= "Z";
-            }
-            return $this->format($format);
-            break;
-        case DATE_FORMAT_TIMESTAMP:
-            return $this->format("%Y%m%d%H%M%S");
-            break;
-        case DATE_FORMAT_UNIXTIME:
-            return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
-            break;
-        }
-    }
-
-    // }}}
-    // {{{ copy()
-
-    /**
-     * Copy values from another Date object
-     *
-     * Makes this Date a copy of another Date object.
-     *
-     * @access public
-     * @param object Date $date Date to copy from
-     */
-    function copy($date)
-    {
-        $this->year = $date->year;
-        $this->month = $date->month;
-        $this->day = $date->day;
-        $this->hour = $date->hour;
-        $this->minute = $date->minute;
-        $this->second = $date->second;
-        $this->tz = $date->tz;
-    }
-
-    // }}}
-    // {{{ format()
-
-    /**
-     *  Date pretty printing, similar to strftime()
-     *
-     *  Formats the date in the given format, much like
-     *  strftime().  Most strftime() options are supported.<br><br>
-     *
-     *  formatting options:<br><br>
-     *
-     *  <code>%a  </code>  abbreviated weekday name (Sun, Mon, Tue) <br>
-     *  <code>%A  </code>  full weekday name (Sunday, Monday, Tuesday) <br>
-     *  <code>%b  </code>  abbreviated month name (Jan, Feb, Mar) <br>
-     *  <code>%B  </code>  full month name (January, February, March) <br>
-     *  <code>%C  </code>  century number (the year divided by 100 and truncated to an integer, range 00 to 99) <br>
-     *  <code>%d  </code>  day of month (range 00 to 31) <br>
-     *  <code>%D  </code>  same as "%m/%d/%y" <br>
-     *  <code>%e  </code>  day of month, single digit (range 0 to 31) <br>
-     *  <code>%E  </code>  number of days since unspecified epoch (integer, Date_Calc::dateToDays()) <br>
-     *  <code>%H  </code>  hour as decimal number (00 to 23) <br>
-     *  <code>%I  </code>  hour as decimal number on 12-hour clock (01 to 12) <br>
-     *  <code>%j  </code>  day of year (range 001 to 366) <br>
-     *  <code>%m  </code>  month as decimal number (range 01 to 12) <br>
-     *  <code>%M  </code>  minute as a decimal number (00 to 59) <br>
-     *  <code>%n  </code>  newline character (\n) <br>
-     *  <code>%O  </code>  dst-corrected timezone offset expressed as "+/-HH:MM" <br>
-     *  <code>%o  </code>  raw timezone offset expressed as "+/-HH:MM" <br>
-     *  <code>%p  </code>  either 'am' or 'pm' depending on the time <br>
-     *  <code>%P  </code>  either 'AM' or 'PM' depending on the time <br>
-     *  <code>%r  </code>  time in am/pm notation, same as "%I:%M:%S %p" <br>
-     *  <code>%R  </code>  time in 24-hour notation, same as "%H:%M" <br>
-     *  <code>%s  </code>  seconds including the decimal representation smaller than one second <br>
-     *  <code>%S  </code>  seconds as a decimal number (00 to 59) <br>
-     *  <code>%t  </code>  tab character (\t) <br>
-     *  <code>%T  </code>  current time, same as "%H:%M:%S" <br>
-     *  <code>%w  </code>  weekday as decimal (0 = Sunday) <br>
-     *  <code>%U  </code>  week number of current year, first sunday as first week <br>
-     *  <code>%y  </code>  year as decimal (range 00 to 99) <br>
-     *  <code>%Y  </code>  year as decimal including century (range 0000 to 9999) <br>
-     *  <code>%%  </code>  literal '%' <br>
-     * <br>
-     *
-     * @access public
-     * @param string format the format string for returned date/time
-     * @return string date/time in given format
-     */
-    function format($format)
-    {
-        $output = "";
-
-        for($strpos = 0; $strpos < strlen($format); $strpos++) {
-            $char = substr($format,$strpos,1);
-            if ($char == "%") {
-                $nextchar = substr($format,$strpos + 1,1);
-                switch ($nextchar) {
-                case "a":
-                    $output .= Date_Calc::getWeekdayAbbrname($this->day,$this->month,$this->year, $this->getWeekdayAbbrnameLength);
-                    break;
-                case "A":
-                    $output .= Date_Calc::getWeekdayFullname($this->day,$this->month,$this->year);
-                    break;
-                case "b":
-                    $output .= Date_Calc::getMonthAbbrname($this->month);
-                    break;
-                case "B":
-                    $output .= Date_Calc::getMonthFullname($this->month);
-                    break;
-                case "C":
-                    $output .= sprintf("%02d",intval($this->year/100));
-                    break;
-                case "d":
-                    $output .= sprintf("%02d",$this->day);
-                    break;
-                case "D":
-                    $output .= sprintf("%02d/%02d/%02d",$this->month,$this->day,$this->year);
-                    break;
-                case "e":
-                    $output .= $this->day * 1; // get rid of leading zero
-                    break;
-                case "E":
-                    $output .= Date_Calc::dateToDays($this->day,$this->month,$this->year);
-                    break;
-                case "H":
-                    $output .= sprintf("%02d", $this->hour);
-                    break;
-                case 'h':
-                    $output .= sprintf("%d", $this->hour);
-                    break;
-                case "I":
-                    $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour;
-                    $output .= sprintf("%02d", $hour==0 ? 12 : $hour);
-                    break;
-                case "i":
-                    $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour;
-                    $output .= sprintf("%d", $hour==0 ? 12 : $hour);
-                    break;
-                case "j":
-                    $output .= Date_Calc::julianDate($this->day,$this->month,$this->year);
-                    break;
-                case "m":
-                    $output .= sprintf("%02d",$this->month);
-                    break;
-                case "M":
-                    $output .= sprintf("%02d",$this->minute);
-                    break;
-                case "n":
-                    $output .= "\n";
-                    break;
-                case "O":
-                    $offms = $this->tz->getOffset($this);
-                    $direction = $offms >= 0 ? "+" : "-";
-                    $offmins = abs($offms) / 1000 / 60;
-                    $hours = $offmins / 60;
-                    $minutes = $offmins % 60;
-                    $output .= sprintf("%s%02d:%02d", $direction, $hours, $minutes);
-                    break;
-                case "o":
-                    $offms = $this->tz->getRawOffset($this);
-                    $direction = $offms >= 0 ? "+" : "-";
-                    $offmins = abs($offms) / 1000 / 60;
-                    $hours = $offmins / 60;
-                    $minutes = $offmins % 60;
-                    $output .= sprintf("%s%02d:%02d", $direction, $hours, $minutes);
-                    break;
-                case "p":
-                    $output .= $this->hour >= 12 ? "pm" : "am";
-                    break;
-                case "P":
-                    $output .= $this->hour >= 12 ? "PM" : "AM";
-                    break;
-                case "r":
-                    $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour;
-                    $output .= sprintf("%02d:%02d:%02d %s", $hour==0 ?  12 : $hour, $this->minute, $this->second, $this->hour >= 12 ? "PM" : "AM");
-                    break;
-                case "R":
-                    $output .= sprintf("%02d:%02d", $this->hour, $this->minute);
-                    break;
-                case "s":
-                    $output .= str_replace(',', '.', sprintf("%09f", (float)((float)$this->second + $this->partsecond)));
-                    break;
-                case "S":
-                    $output .= sprintf("%02d", $this->second);
-                    break;
-                case "t":
-                    $output .= "\t";
-                    break;
-                case "T":
-                    $output .= sprintf("%02d:%02d:%02d", $this->hour, $this->minute, $this->second);
-                    break;
-                case "w":
-                    $output .= Date_Calc::dayOfWeek($this->day,$this->month,$this->year);
-                    break;
-                case "U":
-                    $output .= Date_Calc::weekOfYear($this->day,$this->month,$this->year);
-                    break;
-                case "y":
-                    $output .= substr($this->year,2,2);
-                    break;
-                case "Y":
-                    $output .= $this->year;
-                    break;
-                case "Z":
-                    $output .= $this->tz->inDaylightTime($this) ? $this->tz->getDSTShortName() : $this->tz->getShortName();
-                    break;
-                case "%":
-                    $output .= "%";
-                    break;
-                default:
-                    $output .= $char.$nextchar;
-                }
-                $strpos++;
-            } else {
-                $output .= $char;
-            }
-        }
-        return $output;
-
-    }
-
-    // }}}
-    // {{{ getTime()
-
-    /**
-     * Get this date/time in Unix time() format
-     *
-     * Get a representation of this date in Unix time() format.  This may only be
-     * valid for dates from 1970 to ~2038.
-     *
-     * @access public
-     * @return int number of seconds since the unix epoch
-     */
-    function getTime()
-    {
-        return $this->getDate(DATE_FORMAT_UNIXTIME);
-    }
-
-    // }}}
-    // {{{ setTZ()
-
-    /**
-     * Sets the time zone of this Date
-     *
-     * Sets the time zone of this date with the given
-     * Date_TimeZone object.  Does not alter the date/time,
-     * only assigns a new time zone.  For conversion, use
-     * convertTZ().
-     *
-     * @access public
-     * @param object Date_TimeZone $tz the Date_TimeZone object to use, if called
-     * with a paramater that is not a Date_TimeZone object, will fall through to
-     * setTZbyID().
-     */
-    function setTZ($tz)
-    {
-        if(is_a($tz, 'Date_Timezone')) {
-            $this->tz = $tz;
-        } else {
-            $this->setTZbyID($tz);
-        }
-    }
-
-    // }}}
-    // {{{ setTZbyID()
-
-    /**
-     * Sets the time zone of this date with the given time zone id
-     *
-     * Sets the time zone of this date with the given
-     * time zone id, or to the system default if the
-     * given id is invalid. Does not alter the date/time,
-     * only assigns a new time zone.  For conversion, use
-     * convertTZ().
-     *
-     * @access public
-     * @param string id a time zone id
-     */
-    function setTZbyID($id)
-    {
-        if (Date_TimeZone::isValidID($id)) {
-            $this->tz = new Date_TimeZone($id);
-        } else {
-            $this->tz = Date_TimeZone::getDefault();
-        }
-    }
-
-    // }}}
-    // {{{ inDaylightTime()
-
-    /**
-     * Tests if this date/time is in DST
-     *
-     * Returns true if daylight savings time is in effect for
-     * this date in this date's time zone.  See Date_TimeZone::inDaylightTime()
-     * for compatability information.
-     *
-     * @access public
-     * @return boolean true if DST is in effect for this date
-     */
-    function inDaylightTime()
-    {
-        return $this->tz->inDaylightTime($this);
-    }
-
-    // }}}
-    // {{{ toUTC()
-
-    /**
-     * Converts this date to UTC and sets this date's timezone to UTC
-     *
-     * Converts this date to UTC and sets this date's timezone to UTC
-     *
-     * @access public
-     */
-    function toUTC()
-    {
-        if ($this->tz->getOffset($this) > 0) {
-            $this->subtractSeconds(intval($this->tz->getOffset($this) / 1000));
-        } else {
-            $this->addSeconds(intval(abs($this->tz->getOffset($this)) / 1000));
-        }
-        $this->tz = new Date_TimeZone('UTC');
-    }
-
-    // }}}
-    // {{{ convertTZ()
-
-    /**
-     * Converts this date to a new time zone
-     *
-     * Converts this date to a new time zone.
-     * WARNING: This may not work correctly if your system does not allow
-     * putenv() or if localtime() does not work in your environment.  See
-     * Date::TimeZone::inDaylightTime() for more information.
-     *
-     * @access public
-     * @param object Date_TimeZone $tz the Date::TimeZone object for the conversion time zone
-     */
-    function convertTZ($tz)
-    {
-        // convert to UTC
-        if ($this->tz->getOffset($this) > 0) {
-            $this->subtractSeconds(intval(abs($this->tz->getOffset($this)) / 1000));
-        } else {
-            $this->addSeconds(intval(abs($this->tz->getOffset($this)) / 1000));
-        }
-        // convert UTC to new timezone
-        if ($tz->getOffset($this) > 0) {
-            $this->addSeconds(intval(abs($tz->getOffset($this)) / 1000));
-        } else {
-            $this->subtractSeconds(intval(abs($tz->getOffset($this)) / 1000));
-        }
-        $this->tz = $tz;
-    }
-
-    // }}}
-    // {{{ convertTZbyID()
-
-    /**
-     * Converts this date to a new time zone, given a valid time zone ID
-     *
-     * Converts this date to a new time zone, given a valid time zone ID
-     * WARNING: This may not work correctly if your system does not allow
-     * putenv() or if localtime() does not work in your environment.  See
-     * Date::TimeZone::inDaylightTime() for more information.
-     *
-     * @access public
-     * @param string id a time zone id
-     */
-    function convertTZbyID($id)
-    {
-       if (Date_TimeZone::isValidID($id)) {
-          $tz = new Date_TimeZone($id);
-       } else {
-          $tz = Date_TimeZone::getDefault();
-       }
-       $this->convertTZ($tz);
-    }
-
-    // }}}
-    // {{{ toUTCbyOffset()
-
-    function toUTCbyOffset($offset)
-    {
-        if ($offset == "Z" || $offset == "+00:00" || $offset == "+0000") {
-            $this->toUTC();
-            return true;
-        }
-
-        if (preg_match('/([\+\-])(\d{2}):?(\d{2})/', $offset, $regs)) {
-            // convert offset to seconds
-            $hours  = (int) isset($regs[2])?$regs[2]:0;
-            $mins   = (int) isset($regs[3])?$regs[3]:0;
-            $offset = ($hours * 3600) + ($mins * 60);
-
-            if (isset($regs[1]) && $regs[1] == "-") {
-                $offset *= -1;
-            }
-
-            if ($offset > 0) {
-                $this->subtractSeconds(intval($offset));
-            } else {
-                $this->addSeconds(intval(abs($offset)));
-            }
-
-            $this->tz = new Date_TimeZone('UTC');
-            return true;
-        }
-
-        return false;
-    }
-
-    // }}}
-    // {{{ addSeconds()
-
-    /**
-     * Adds a given number of seconds to the date
-     *
-     * Adds a given number of seconds to the date
-     *
-     * @access public
-     * @param int $sec the number of seconds to add
-     */
-    function addSeconds($sec)
-    {
-        settype($sec, 'int');
-
-        // Negative value given.
-        if ($sec < 0) {
-            $this->subtractSeconds(abs($sec));
-            return;
-        }
-
-        $this->addSpan(new Date_Span($sec));
-    }
-
-    // }}}
-    // {{{ addSpan()
-
-    /**
-     * Adds a time span to the date
-     *
-     * Adds a time span to the date
-     *
-     * @access public
-     * @param object Date_Span $span the time span to add
-     */
-    function addSpan($span)
-    {
-        if (!is_a($span, 'Date_Span')) {
-            return;
-        }
-
-        $this->second += $span->second;
-        if ($this->second >= 60) {
-            $this->minute++;
-            $this->second -= 60;
-        }
-
-        $this->minute += $span->minute;
-        if ($this->minute >= 60) {
-            $this->hour++;
-            if ($this->hour >= 24) {
-                list($this->year, $this->month, $this->day) =
-                    sscanf(Date_Calc::nextDay($this->day, $this->month, $this->year), "%04s%02s%02s");
-                $this->hour -= 24;
-            }
-            $this->minute -= 60;
-        }
-
-        $this->hour += $span->hour;
-        if ($this->hour >= 24) {
-            list($this->year, $this->month, $this->day) =
-                sscanf(Date_Calc::nextDay($this->day, $this->month, $this->year), "%04s%02s%02s");
-            $this->hour -= 24;
-        }
-
-        $d = Date_Calc::dateToDays($this->day, $this->month, $this->year);
-        $d += $span->day;
-
-        list($this->year, $this->month, $this->day) =
-            sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
-        $this->year  = intval($this->year);
-        $this->month = intval($this->month);
-        $this->day   = intval($this->day);
-    }
-
-    // }}}
-    // {{{ subtractSeconds()
-
-    /**
-     * Subtracts a given number of seconds from the date
-     *
-     * Subtracts a given number of seconds from the date
-     *
-     * @access public
-     * @param int $sec the number of seconds to subtract
-     */
-    function subtractSeconds($sec)
-    {
-        settype($sec, 'int');
-
-        // Negative value given.
-        if ($sec < 0) {
-            $this->addSeconds(abs($sec));
-            return;
-        }
-
-        $this->subtractSpan(new Date_Span($sec));
-    }
-
-    // }}}
-    // {{{ subtractSpan()
-
-    /**
-     * Subtracts a time span to the date
-     *
-     * Subtracts a time span to the date
-     *
-     * @access public
-     * @param object Date_Span $span the time span to subtract
-     */
-    function subtractSpan($span)
-    {
-        if (!is_a($span, 'Date_Span')) {
-            return;
-        }
-        if ($span->isEmpty()) {
-            return;
-        }
-
-        $this->second -= $span->second;
-        if ($this->second < 0) {
-            $this->minute--;
-            $this->second += 60;
-        }
-
-        $this->minute -= $span->minute;
-        if ($this->minute < 0) {
-            $this->hour--;
-            if ($this->hour < 0) {
-                list($this->year, $this->month, $this->day) =
-                    sscanf(Date_Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s");
-                $this->hour += 24;
-            }
-            $this->minute += 60;
-        }
-
-        $this->hour -= $span->hour;
-        if ($this->hour < 0) {
-            list($this->year, $this->month, $this->day) =
-                sscanf(Date_Calc::prevDay($this->day, $this->month, $this->year), "%04s%02s%02s");
-            $this->hour += 24;
-        }
-
-        $d = Date_Calc::dateToDays($this->day, $this->month, $this->year);
-        $d -= $span->day;
-
-        list($this->year, $this->month, $this->day) =
-            sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
-        $this->year  = intval($this->year);
-        $this->month = intval($this->month);
-        $this->day   = intval($this->day);
-    }
-
-    // }}}
-    // {{{ compare()
-
-    /**
-     * Compares two dates
-     *
-     * Compares two dates.  Suitable for use
-     * in sorting functions.
-     *
-     * @access public
-     * @param object Date $d1 the first date
-     * @param object Date $d2 the second date
-     * @return int 0 if the dates are equal, -1 if d1 is before d2, 1 if d1 is after d2
-     */
-    function compare($d1, $d2)
-    {
-        $d1->convertTZ(new Date_TimeZone('UTC'));
-        $d2->convertTZ(new Date_TimeZone('UTC'));
-        $days1 = Date_Calc::dateToDays($d1->day, $d1->month, $d1->year);
-        $days2 = Date_Calc::dateToDays($d2->day, $d2->month, $d2->year);
-        if ($days1 < $days2) return -1;
-        if ($days1 > $days2) return 1;
-        if ($d1->hour < $d2->hour) return -1;
-        if ($d1->hour > $d2->hour) return 1;
-        if ($d1->minute < $d2->minute) return -1;
-        if ($d1->minute > $d2->minute) return 1;
-        if ($d1->second < $d2->second) return -1;
-        if ($d1->second > $d2->second) return 1;
-        return 0;
-    }
-
-    // }}}
-    // {{{ before()
-
-    /**
-     * Test if this date/time is before a certain date/time
-     *
-     * Test if this date/time is before a certain date/time
-     *
-     * @access public
-     * @param object Date $when the date to test against
-     * @return boolean true if this date is before $when
-     */
-    function before($when)
-    {
-        if (Date::compare($this,$when) == -1) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ after()
-
-    /**
-     * Test if this date/time is after a certian date/time
-     *
-     * Test if this date/time is after a certian date/time
-     *
-     * @access public
-     * @param object Date $when the date to test against
-     * @return boolean true if this date is after $when
-     */
-    function after($when)
-    {
-        if (Date::compare($this,$when) == 1) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ equals()
-
-    /**
-     * Test if this date/time is exactly equal to a certian date/time
-     *
-     * Test if this date/time is exactly equal to a certian date/time
-     *
-     * @access public
-     * @param object Date $when the date to test against
-     * @return boolean true if this date is exactly equal to $when
-     */
-    function equals($when)
-    {
-        if (Date::compare($this,$when) == 0) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ isFuture()
-
-    /**
-     * Determine if this date is in the future
-     *
-     * Determine if this date is in the future
-     *
-     * @access public
-     * @return boolean true if this date is in the future
-     */
-    function isFuture()
-    {
-        $now = new Date();
-        if ($this->after($now)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ isPast()
-
-    /**
-     * Determine if this date is in the past
-     *
-     * Determine if this date is in the past
-     *
-     * @access public
-     * @return boolean true if this date is in the past
-     */
-    function isPast()
-    {
-        $now = new Date();
-        if ($this->before($now)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ isLeapYear()
-
-    /**
-     * Determine if the year in this date is a leap year
-     *
-     * Determine if the year in this date is a leap year
-     *
-     * @access public
-     * @return boolean true if this year is a leap year
-     */
-    function isLeapYear()
-    {
-        return Date_Calc::isLeapYear($this->year);
-    }
-
-    // }}}
-    // {{{ getJulianDate()
-
-    /**
-     * Get the Julian date for this date
-     *
-     * Get the Julian date for this date
-     *
-     * @access public
-     * @return int the Julian date
-     */
-    function getJulianDate()
-    {
-        return Date_Calc::julianDate($this->day, $this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getDayOfWeek()
-
-    /**
-     * Gets the day of the week for this date
-     *
-     * Gets the day of the week for this date (0=Sunday)
-     *
-     * @access public
-     * @return int the day of the week (0=Sunday)
-     */
-    function getDayOfWeek()
-    {
-        return Date_Calc::dayOfWeek($this->day, $this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getWeekOfYear()
-
-    /**
-     * Gets the week of the year for this date
-     *
-     * Gets the week of the year for this date
-     *
-     * @access public
-     * @return int the week of the year
-     */
-    function getWeekOfYear()
-    {
-        return Date_Calc::weekOfYear($this->day, $this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getQuarterOfYear()
-
-    /**
-     * Gets the quarter of the year for this date
-     *
-     * Gets the quarter of the year for this date
-     *
-     * @access public
-     * @return int the quarter of the year (1-4)
-     */
-    function getQuarterOfYear()
-    {
-        return Date_Calc::quarterOfYear($this->day, $this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getDaysInMonth()
-
-    /**
-     * Gets number of days in the month for this date
-     *
-     * Gets number of days in the month for this date
-     *
-     * @access public
-     * @return int number of days in this month
-     */
-    function getDaysInMonth()
-    {
-        return Date_Calc::daysInMonth($this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getWeeksInMonth()
-
-    /**
-     * Gets the number of weeks in the month for this date
-     *
-     * Gets the number of weeks in the month for this date
-     *
-     * @access public
-     * @return int number of weeks in this month
-     */
-    function getWeeksInMonth()
-    {
-        return Date_Calc::weeksInMonth($this->month, $this->year);
-    }
-
-    // }}}
-    // {{{ getDayName()
-
-    /**
-     * Gets the full name or abbriviated name of this weekday
-     *
-     * Gets the full name or abbriviated name of this weekday
-     *
-     * @access public
-     * @param boolean $abbr abbrivate the name
-     * @return string name of this day
-     */
-    function getDayName($abbr = false, $length = 3)
-    {
-        if ($abbr) {
-            return Date_Calc::getWeekdayAbbrname($this->day, $this->month, $this->year, $length);
-        } else {
-            return Date_Calc::getWeekdayFullname($this->day, $this->month, $this->year);
-        }
-    }
-
-    // }}}
-    // {{{ getMonthName()
-
-    /**
-     * Gets the full name or abbriviated name of this month
-     *
-     * Gets the full name or abbriviated name of this month
-     *
-     * @access public
-     * @param boolean $abbr abbrivate the name
-     * @return string name of this month
-     */
-    function getMonthName($abbr = false)
-    {
-        if ($abbr) {
-            return Date_Calc::getMonthAbbrname($this->month);
-        } else {
-            return Date_Calc::getMonthFullname($this->month);
-        }
-    }
-
-    // }}}
-    // {{{ getNextDay()
-
-    /**
-     * Get a Date object for the day after this one
-     *
-     * Get a Date object for the day after this one.
-     * The time of the returned Date object is the same as this time.
-     *
-     * @access public
-     * @return object Date Date representing the next day
-     */
-    function getNextDay()
-    {
-        $day = Date_Calc::nextDay($this->day, $this->month, $this->year, "%Y-%m-%d");
-        $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second);
-        $newDate = new Date();
-        $newDate->setDate($date);
-        return $newDate;
-    }
-
-    // }}}
-    // {{{ getPrevDay()
-
-    /**
-     * Get a Date object for the day before this one
-     *
-     * Get a Date object for the day before this one.
-     * The time of the returned Date object is the same as this time.
-     *
-     * @access public
-     * @return object Date Date representing the previous day
-     */
-    function getPrevDay()
-    {
-        $day = Date_Calc::prevDay($this->day, $this->month, $this->year, "%Y-%m-%d");
-        $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second);
-        $newDate = new Date();
-        $newDate->setDate($date);
-        return $newDate;
-    }
-
-    // }}}
-    // {{{ getNextWeekday()
-
-    /**
-     * Get a Date object for the weekday after this one
-     *
-     * Get a Date object for the weekday after this one.
-     * The time of the returned Date object is the same as this time.
-     *
-     * @access public
-     * @return object Date Date representing the next weekday
-     */
-    function getNextWeekday()
-    {
-        $day = Date_Calc::nextWeekday($this->day, $this->month, $this->year, "%Y-%m-%d");
-        $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second);
-        $newDate = new Date();
-        $newDate->setDate($date);
-        return $newDate;
-    }
-
-    // }}}
-    // {{{ getPrevWeekday()
-
-    /**
-     * Get a Date object for the weekday before this one
-     *
-     * Get a Date object for the weekday before this one.
-     * The time of the returned Date object is the same as this time.
-     *
-     * @access public
-     * @return object Date Date representing the previous weekday
-     */
-    function getPrevWeekday()
-    {
-        $day = Date_Calc::prevWeekday($this->day, $this->month, $this->year, "%Y-%m-%d");
-        $date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second);
-        $newDate = new Date();
-        $newDate->setDate($date);
-        return $newDate;
-    }
-
-    // }}}
-    // {{{ getYear()
-
-    /**
-     * Returns the year field of the date object
-     *
-     * Returns the year field of the date object
-     *
-     * @access public
-     * @return int the year
-     */
-    function getYear()
-    {
-        return (int)$this->year;
-    }
-
-    // }}}
-    // {{{ getMonth()
-
-    /**
-     * Returns the month field of the date object
-     *
-     * Returns the month field of the date object
-     *
-     * @access public
-     * @return int the month
-     */
-    function getMonth()
-    {
-        return (int)$this->month;
-    }
-
-    // }}}
-    // {{{ getDay()
-
-    /**
-     * Returns the day field of the date object
-     *
-     * Returns the day field of the date object
-     *
-     * @access public
-     * @return int the day
-     */
-    function getDay()
-    {
-        return (int)$this->day;
-    }
-
-    // }}}
-    // {{{ getHour()
-
-    /**
-     * Returns the hour field of the date object
-     *
-     * Returns the hour field of the date object
-     *
-     * @access public
-     * @return int the hour
-     */
-    function getHour()
-    {
-        return $this->hour;
-    }
-
-    // }}}
-    // {{{ getMinute()
-
-    /**
-     * Returns the minute field of the date object
-     *
-     * Returns the minute field of the date object
-     *
-     * @access public
-     * @return int the minute
-     */
-    function getMinute()
-    {
-        return $this->minute;
-    }
-
-    // }}}
-    // {{{ getSecond()
-
-    /**
-     * Returns the second field of the date object
-     *
-     * Returns the second field of the date object
-     *
-     * @access public
-     * @return int the second
-     */
-    function getSecond()
-    {
-         return $this->second;
-    }
-
-    // }}}
-    // {{{ setYear()
-
-    /**
-     * Set the year field of the date object
-     *
-     * Set the year field of the date object, invalid years (not 0-9999) are set to 0.
-     *
-     * @access public
-     * @param int $y the year
-     */
-    function setYear($y)
-    {
-        if ($y < 0 || $y > 9999) {
-            $this->year = 0;
-        } else {
-            $this->year = $y;
-        }
-    }
-
-    // }}}
-    // {{{ setMonth()
-
-    /**
-     * Set the month field of the date object
-     *
-     * Set the month field of the date object, invalid months (not 1-12) are set to 1.
-     *
-     * @access public
-     * @param int $m the month
-     */
-    function setMonth($m)
-    {
-        if ($m < 1 || $m > 12) {
-            $this->month = 1;
-        } else {
-            $this->month = $m;
-        }
-    }
-
-    // }}}
-    // {{{ setDay()
-
-    /**
-     * Set the day field of the date object
-     *
-     * Set the day field of the date object, invalid days (not 1-31) are set to 1.
-     *
-     * @access public
-     * @param int $d the day
-     */
-    function setDay($d)
-    {
-        if ($d > 31 || $d < 1) {
-            $this->day = 1;
-        } else {
-            $this->day = $d;
-        }
-    }
-
-    // }}}
-    // {{{ setHour()
-
-    /**
-     * Set the hour field of the date object
-     *
-     * Set the hour field of the date object in 24-hour format.
-     * Invalid hours (not 0-23) are set to 0.
-     *
-     * @access public
-     * @param int $h the hour
-     */
-    function setHour($h)
-    {
-        if ($h > 23 || $h < 0) {
-            $this->hour = 0;
-        } else {
-            $this->hour = $h;
-        }
-    }
-
-    // }}}
-    // {{{ setMinute()
-
-    /**
-     * Set the minute field of the date object
-     *
-     * Set the minute field of the date object, invalid minutes (not 0-59) are set to 0.
-     *
-     * @access public
-     * @param int $m the minute
-     */
-    function setMinute($m)
-    {
-        if ($m > 59 || $m < 0) {
-            $this->minute = 0;
-        } else {
-            $this->minute = $m;
-        }
-    }
-
-    // }}}
-    // {{{ setSecond()
-
-    /**
-     * Set the second field of the date object
-     *
-     * Set the second field of the date object, invalid seconds (not 0-59) are set to 0.
-     *
-     * @access public
-     * @param int $s the second
-     */
-    function setSecond($s) {
-        if ($s > 59 || $s < 0) {
-            $this->second = 0;
-        } else {
-            $this->second = $s;
-        }
-    }
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/php/Date/Calc.php b/lib/php/Date/Calc.php
deleted file mode 100644
index 43a261d8f1c1fa8b3058dccd43ee8ebdfb2e398c..0000000000000000000000000000000000000000
--- a/lib/php/Date/Calc.php
+++ /dev/null
@@ -1,2117 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
-// {{{ Header
-
-/**
- * Calculates, manipulates and retrieves dates
- *
- * It does not rely on 32-bit system time stamps, so it works dates
- * before 1970 and after 2038.
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 1999-2006 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted under the terms of the BSD License.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Monte Ohrt <monte@ispi.net>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1999-2006 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    CVS: $Id: Calc.php,v 1.35 2006/11/21 23:01:13 firman Exp $
- * @link       http://pear.php.net/package/Date
- * @since      File available since Release 1.2
- */
-
-// }}}
-
-if (!defined('DATE_CALC_BEGIN_WEEKDAY')) {
-    /**
-     * Defines what day starts the week
-     *
-     * Monday (1) is the international standard.
-     * Redefine this to 0 if you want weeks to begin on Sunday.
-     */
-    define('DATE_CALC_BEGIN_WEEKDAY', 1);
-}
-
-if (!defined('DATE_CALC_FORMAT')) {
-    /**
-     * The default value for each method's $format parameter
-     *
-     * The default is '%Y%m%d'.  To override this default, define
-     * this constant before including Calc.php.
-     *
-     * @since Constant available since Release 1.4.4
-     */
-    define('DATE_CALC_FORMAT', '%Y%m%d');
-}
-
-// {{{ Class: Date_Calc
-
-/**
- * Calculates, manipulates and retrieves dates
- *
- * It does not rely on 32-bit system time stamps, so it works dates
- * before 1970 and after 2038.
- *
- * @author     Monte Ohrt <monte@ispi.net>
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1999-2006 Monte Ohrt, Pierre-Alain Joye, Daniel Convissor
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    Release: 1.4.7
- * @link       http://pear.php.net/package/Date
- * @since      Class available since Release 1.2
- */
-class Date_Calc
-{
-    // {{{ dateFormat()
-
-    /**
-     * Formats the date in the given format, much like strfmt()
-     *
-     * This function is used to alleviate the problem with 32-bit numbers for
-     * dates pre 1970 or post 2038, as strfmt() has on most systems.
-     * Most of the formatting options are compatible.
-     *
-     * Formatting options:
-     * <pre>
-     * %a   abbreviated weekday name (Sun, Mon, Tue)
-     * %A   full weekday name (Sunday, Monday, Tuesday)
-     * %b   abbreviated month name (Jan, Feb, Mar)
-     * %B   full month name (January, February, March)
-     * %d   day of month (range 00 to 31)
-     * %e   day of month, single digit (range 0 to 31)
-     * %E   number of days since unspecified epoch (integer)
-     *        (%E is useful for passing a date in a URL as
-     *        an integer value. Then simply use
-     *        daysToDate() to convert back to a date.)
-     * %j   day of year (range 001 to 366)
-     * %m   month as decimal number (range 1 to 12)
-     * %n   newline character (\n)
-     * %t   tab character (\t)
-     * %w   weekday as decimal (0 = Sunday)
-     * %U   week number of current year, first sunday as first week
-     * %y   year as decimal (range 00 to 99)
-     * %Y   year as decimal including century (range 0000 to 9999)
-     * %%   literal '%'
-     * </pre>
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     * @param string $format  the format string
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function dateFormat($day, $month, $year, $format)
-    {
-        if (!Date_Calc::isValidDate($day, $month, $year)) {
-            $year  = Date_Calc::dateNow('%Y');
-            $month = Date_Calc::dateNow('%m');
-            $day   = Date_Calc::dateNow('%d');
-        }
-
-        $output = '';
-
-        for ($strpos = 0; $strpos < strlen($format); $strpos++) {
-            $char = substr($format, $strpos, 1);
-            if ($char == '%') {
-                $nextchar = substr($format, $strpos + 1, 1);
-                switch($nextchar) {
-                    case 'a':
-                        $output .= Date_Calc::getWeekdayAbbrname($day, $month, $year);
-                        break;
-                    case 'A':
-                        $output .= Date_Calc::getWeekdayFullname($day, $month, $year);
-                        break;
-                    case 'b':
-                        $output .= Date_Calc::getMonthAbbrname($month);
-                        break;
-                    case 'B':
-                        $output .= Date_Calc::getMonthFullname($month);
-                        break;
-                    case 'd':
-                        $output .= sprintf('%02d', $day);
-                        break;
-                    case 'e':
-                        $output .= $day;
-                        break;
-                    case 'E':
-                        $output .= Date_Calc::dateToDays($day, $month, $year);
-                        break;
-                    case 'j':
-                        $output .= Date_Calc::julianDate($day, $month, $year);
-                        break;
-                    case 'm':
-                        $output .= sprintf('%02d', $month);
-                        break;
-                    case 'n':
-                        $output .= "\n";
-                        break;
-                    case 't':
-                        $output .= "\t";
-                        break;
-                    case 'w':
-                        $output .= Date_Calc::dayOfWeek($day, $month, $year);
-                        break;
-                    case 'U':
-                        $output .= Date_Calc::weekOfYear($day, $month, $year);
-                        break;
-                    case 'y':
-                        $output .= substr($year, 2, 2);
-                        break;
-                    case 'Y':
-                        $output .= $year;
-                        break;
-                    case '%':
-                        $output .= '%';
-                        break;
-                    default:
-                        $output .= $char.$nextchar;
-                }
-                $strpos++;
-            } else {
-                $output .= $char;
-            }
-        }
-        return $output;
-    }
-
-    // }}}
-    // {{{ defaultCentury()
-
-    /**
-     * Turns a two digit year into a four digit year
-     *
-     * From '51 to '99 is in the 1900's, otherwise it's in the 2000's.
-     *
-     * @param int    $year    the 2 digit year
-     *
-     * @return string  the 4 digit year
-     *
-     * @access public
-     * @static
-     */
-    function defaultCentury($year)
-    {
-        if (strlen($year) == 1) {
-            $year = '0' . $year;
-        }
-        if ($year > 50) {
-            return '19' . $year;
-        } else {
-            return '20' . $year;
-        }
-    }
-
-    // }}}
-    // {{{ dateToDays()
-
-    /**
-     * Converts a date to number of days since a distant unspecified epoch
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return integer  the number of days since the Date_Calc epoch
-     *
-     * @access public
-     * @static
-     */
-    function dateToDays($day, $month, $year)
-    {
-        $century = (int)substr($year, 0, 2);
-        $year = (int)substr($year, 2, 2);
-        if ($month > 2) {
-            $month -= 3;
-        } else {
-            $month += 9;
-            if ($year) {
-                $year--;
-            } else {
-                $year = 99;
-                $century --;
-            }
-        }
-
-        return (floor((146097 * $century) / 4 ) +
-                floor((1461 * $year) / 4 ) +
-                floor((153 * $month + 2) / 5 ) +
-                $day + 1721119);
-    }
-
-    // }}}
-    // {{{ daysToDate()
-
-    /**
-     * Converts number of days to a distant unspecified epoch
-     *
-     * @param int    $days    the number of days since the Date_Calc epoch
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function daysToDate($days, $format = DATE_CALC_FORMAT)
-    {
-        $days   -= 1721119;
-        $century = floor((4 * $days - 1) / 146097);
-        $days    = floor(4 * $days - 1 - 146097 * $century);
-        $day     = floor($days / 4);
-
-        $year    = floor((4 * $day +  3) / 1461);
-        $day     = floor(4 * $day +  3 - 1461 * $year);
-        $day     = floor(($day +  4) / 4);
-
-        $month   = floor((5 * $day - 3) / 153);
-        $day     = floor(5 * $day - 3 - 153 * $month);
-        $day     = floor(($day +  5) /  5);
-
-        if ($month < 10) {
-            $month +=3;
-        } else {
-            $month -=9;
-            if ($year++ == 99) {
-                $year = 0;
-                $century++;
-            }
-        }
-
-        $century = sprintf('%02d', $century);
-        $year    = sprintf('%02d', $year);
-        return Date_Calc::dateFormat($day, $month, $century . $year, $format);
-    }
-
-    // }}}
-    // {{{ gregorianToISO()
-
-    /**
-     * Converts from Gregorian Year-Month-Day to ISO Year-WeekNumber-WeekDay
-     *
-     * Uses ISO 8601 definitions.  Algorithm by Rick McCarty, 1999 at
-     * http://personal.ecu.edu/mccartyr/ISOwdALG.txt .
-     * Transcribed to PHP by Jesus M. Castagnetto.
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return string  the date in ISO Year-WeekNumber-WeekDay format
-     *
-     * @access public
-     * @static
-     */
-    function gregorianToISO($day, $month, $year)
-    {
-        $mnth = array (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
-        $y_isleap = Date_Calc::isLeapYear($year);
-        $y_1_isleap = Date_Calc::isLeapYear($year - 1);
-        $day_of_year_number = $day + $mnth[$month - 1];
-        if ($y_isleap && $month > 2) {
-            $day_of_year_number++;
-        }
-        // find Jan 1 weekday (monday = 1, sunday = 7)
-        $yy = ($year - 1) % 100;
-        $c = ($year - 1) - $yy;
-        $g = $yy + intval($yy / 4);
-        $jan1_weekday = 1 + intval((((($c / 100) % 4) * 5) + $g) % 7);
-        // weekday for year-month-day
-        $h = $day_of_year_number + ($jan1_weekday - 1);
-        $weekday = 1 + intval(($h - 1) % 7);
-        // find if Y M D falls in YearNumber Y-1, WeekNumber 52 or
-        if ($day_of_year_number <= (8 - $jan1_weekday) && $jan1_weekday > 4){
-            $yearnumber = $year - 1;
-            if ($jan1_weekday == 5 || ($jan1_weekday == 6 && $y_1_isleap)) {
-                $weeknumber = 53;
-            } else {
-                $weeknumber = 52;
-            }
-        } else {
-            $yearnumber = $year;
-        }
-        // find if Y M D falls in YearNumber Y+1, WeekNumber 1
-        if ($yearnumber == $year) {
-            if ($y_isleap) {
-                $i = 366;
-            } else {
-                $i = 365;
-            }
-            if (($i - $day_of_year_number) < (4 - $weekday)) {
-                $yearnumber++;
-                $weeknumber = 1;
-            }
-        }
-        // find if Y M D falls in YearNumber Y, WeekNumber 1 through 53
-        if ($yearnumber == $year) {
-            $j = $day_of_year_number + (7 - $weekday) + ($jan1_weekday - 1);
-            $weeknumber = intval($j / 7);
-            if ($jan1_weekday > 4) {
-                $weeknumber--;
-            }
-        }
-        // put it all together
-        if ($weeknumber < 10) {
-            $weeknumber = '0'.$weeknumber;
-        }
-        return $yearnumber . '-' . $weeknumber . '-' . $weekday;
-    }
-
-    // }}}
-    // {{{ dateSeason()
-
-    /**
-     * Determines julian date of the given season
-     *
-     * Adapted from previous work in Java by James Mark Hamilton.
-     *
-     * @param string $season  the season to get the date for: VERNALEQUINOX,
-     *                         SUMMERSOLSTICE, AUTUMNALEQUINOX,
-     *                         or WINTERSOLSTICE
-     * @param string $year    the year in four digit format.  Must be between
-     *                         -1000BC and 3000AD.
-     *
-     * @return float  the julian date the season starts on
-     *
-     * @author James Mark Hamilton <mhamilton@qwest.net>
-     * @author Robert Butler <rob@maxwellcreek.org>
-     * @access public
-     * @static
-     */
-    function dateSeason($season, $year = 0)
-    {
-        if ($year == '') {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (($year >= -1000) && ($year <= 1000)) {
-            $y = $year / 1000.0;
-            switch ($season) {
-                case 'VERNALEQUINOX':
-                    $juliandate = (((((((-0.00071 * $y) - 0.00111) * $y) + 0.06134) * $y) + 365242.1374) * $y) + 1721139.29189;
-                    break;
-                case 'SUMMERSOLSTICE':
-                    $juliandate = (((((((0.00025 * $y) + 0.00907) * $y) - 0.05323) * $y) + 365241.72562) * $y) + 1721233.25401;
-                    break;
-                case 'AUTUMNALEQUINOX':
-                    $juliandate = (((((((0.00074 * $y) - 0.00297) * $y) - 0.11677) * $y) + 365242.49558) * $y) + 1721325.70455;
-                    break;
-                case 'WINTERSOLSTICE':
-                default:
-                    $juliandate = (((((((-0.00006 * $y) - 0.00933) * $y) - 0.00769) * $y) + 365242.88257) * $y) + 1721414.39987;
-            }
-        } elseif (($year > 1000) && ($year <= 3000)) {
-            $y = ($year - 2000) / 1000;
-            switch ($season) {
-                case 'VERNALEQUINOX':
-                    $juliandate = (((((((-0.00057 * $y) - 0.00411) * $y) + 0.05169) * $y) + 365242.37404) * $y) + 2451623.80984;
-                    break;
-                case 'SUMMERSOLSTICE':
-                    $juliandate = (((((((-0.0003 * $y) + 0.00888) * $y) + 0.00325) * $y) + 365241.62603) * $y) + 2451716.56767;
-                    break;
-                case 'AUTUMNALEQUINOX':
-                    $juliandate = (((((((0.00078 * $y) + 0.00337) * $y) - 0.11575) * $y) + 365242.01767) * $y) + 2451810.21715;
-                    break;
-                case 'WINTERSOLSTICE':
-                default:
-                    $juliandate = (((((((0.00032 * $y) - 0.00823) * $y) - 0.06223) * $y) + 365242.74049) * $y) + 2451900.05952;
-            }
-        }
-        return $juliandate;
-    }
-
-    // }}}
-    // {{{ dateNow()
-
-    /**
-     * Returns the current local date
-     *
-     * NOTE: This function retrieves the local date using strftime(),
-     * which may or may not be 32-bit safe on your system.
-     *
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the current date in the specified format
-     *
-     * @access public
-     * @static
-     */
-    function dateNow($format = DATE_CALC_FORMAT)
-    {
-        return strftime($format, time());
-    }
-
-    // }}}
-    // {{{ getYear()
-
-    /**
-     * Returns the current local year in format CCYY
-     *
-     * @return string  the current year in four digit format
-     *
-     * @access public
-     * @static
-     */
-    function getYear()
-    {
-        return Date_Calc::dateNow('%Y');
-    }
-
-    // }}}
-    // {{{ getMonth()
-
-    /**
-     * Returns the current local month in format MM
-     *
-     * @return string  the current month in two digit format
-     *
-     * @access public
-     * @static
-     */
-    function getMonth()
-    {
-        return Date_Calc::dateNow('%m');
-    }
-
-    // }}}
-    // {{{ getDay()
-
-    /**
-     * Returns the current local day in format DD
-     *
-     * @return string  the current day of the month in two digit format
-     *
-     * @access public
-     * @static
-     */
-    function getDay()
-    {
-        return Date_Calc::dateNow('%d');
-    }
-
-    // }}}
-    // {{{ julianDate()
-
-    /**
-     * Returns number of days since 31 December of year before given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the julian date for the date
-     *
-     * @access public
-     * @static
-     */
-    function julianDate($day = 0, $month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
-        $julian = ($days[$month - 1] + $day);
-        if ($month > 2 && Date_Calc::isLeapYear($year)) {
-            $julian++;
-        }
-        return $julian;
-    }
-
-    // }}}
-    // {{{ getWeekdayFullname()
-
-    /**
-     * Returns the full weekday name for the given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return string  the full name of the day of the week
-     *
-     * @access public
-     * @static
-     */
-    function getWeekdayFullname($day = 0, $month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $weekday_names = Date_Calc::getWeekDays();
-        $weekday = Date_Calc::dayOfWeek($day, $month, $year);
-        return $weekday_names[$weekday];
-    }
-
-    // }}}
-    // {{{ getWeekdayAbbrname()
-
-    /**
-     * Returns the abbreviated weekday name for the given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param int    $length  the length of abbreviation
-     *
-     * @return string  the abbreviated name of the day of the week
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::getWeekdayFullname()
-     */
-    function getWeekdayAbbrname($day = 0, $month = 0, $year = 0, $length = 3)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        return substr(Date_Calc::getWeekdayFullname($day, $month, $year),
-                      0, $length);
-    }
-
-    // }}}
-    // {{{ getMonthFullname()
-
-    /**
-     * Returns the full month name for the given month
-     *
-     * @param int    $month   the month
-     *
-     * @return string  the full name of the month
-     *
-     * @access public
-     * @static
-     */
-    function getMonthFullname($month)
-    {
-        $month = (int)$month;
-        if (empty($month)) {
-            $month = (int)Date_Calc::dateNow('%m');
-        }
-        $month_names = Date_Calc::getMonthNames();
-        return $month_names[$month];
-    }
-
-    // }}}
-    // {{{ getMonthAbbrname()
-
-    /**
-     * Returns the abbreviated month name for the given month
-     *
-     * @param int    $month   the month
-     * @param int    $length  the length of abbreviation
-     *
-     * @return string  the abbreviated name of the month
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::getMonthFullname
-     */
-    function getMonthAbbrname($month, $length = 3)
-    {
-        $month = (int)$month;
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        return substr(Date_Calc::getMonthFullname($month), 0, $length);
-    }
-
-    // }}}
-    // {{{ getMonthFromFullname()
-
-    /**
-     * Returns the numeric month from the month name or an abreviation
-     *
-     * Both August and Aug would return 8.
-     *
-     * @param string $month  the name of the month to examine.
-     *                        Case insensitive.
-     *
-     * @return integer  the month's number
-     *
-     * @access public
-     * @static
-     */
-    function getMonthFromFullName($month)
-    {
-        $month = strtolower($month);
-        $months = Date_Calc::getMonthNames();
-        while(list($id, $name) = each($months)) {
-            if (ereg($month, strtolower($name))) {
-                return $id;
-            }
-        }
-        return 0;
-    }
-
-    // }}}
-    // {{{ getMonthNames()
-
-    /**
-     * Returns an array of month names
-     *
-     * Used to take advantage of the setlocale function to return
-     * language specific month names.
-     *
-     * TODO: cache values to some global array to avoid preformace
-     * hits when called more than once.
-     *
-     * @returns array  an array of month names
-     *
-     * @access public
-     * @static
-     */
-    function getMonthNames()
-    {
-        $months = array();
-        for ($i = 1; $i < 13; $i++) {
-            $months[$i] = strftime('%B', mktime(0, 0, 0, $i, 1, 2001));
-        }
-        return $months;
-    }
-
-    // }}}
-    // {{{ getWeekDays()
-
-    /**
-     * Returns an array of week days
-     *
-     * Used to take advantage of the setlocale function to
-     * return language specific week days.
-     *
-     * TODO: cache values to some global array to avoid preformace
-     * hits when called more than once.
-     *
-     * @returns array  an array of week day names
-     *
-     * @access public
-     * @static
-     */
-    function getWeekDays()
-    {
-        $weekdays = array();
-        for ($i = 0; $i < 7; $i++) {
-            $weekdays[$i] = strftime('%A', mktime(0, 0, 0, 1, $i, 2001));
-        }
-        return $weekdays;
-    }
-
-    // }}}
-    // {{{ dayOfWeek()
-
-    /**
-     * Returns day of week for given date (0 = Sunday)
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the number of the day in the week
-     *
-     * @access public
-     * @static
-     */
-    function dayOfWeek($day = 0, $month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        if ($month > 2) {
-            $month -= 2;
-        } else {
-            $month += 10;
-            $year--;
-        }
-
-        $day = (floor((13 * $month - 1) / 5) +
-                $day + ($year % 100) +
-                floor(($year % 100) / 4) +
-                floor(($year / 100) / 4) - 2 *
-                floor($year / 100) + 77);
-
-        $weekday_number = $day - 7 * floor($day / 7);
-        return $weekday_number;
-    }
-
-    // }}}
-    // {{{ weekOfYear()
-
-    /**
-     * Returns week of the year, first Sunday is first day of first week
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the number of the week in the year
-     *
-     * @access public
-     * @static
-     */
-    function weekOfYear($day = 0, $month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $iso    = Date_Calc::gregorianToISO($day, $month, $year);
-        $parts  = explode('-', $iso);
-        $week_number = intval($parts[1]);
-        return $week_number;
-    }
-
-    // }}}
-    // {{{ quarterOfYear()
-
-    /**
-     * Returns quarter of the year for given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the number of the quarter in the year
-     *
-     * @access public
-     * @static
-     */
-    function quarterOfYear($day = 0, $month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $year_quarter = intval(($month - 1) / 3 + 1);
-        return $year_quarter;
-    }
-
-    // }}}
-    // {{{ daysInMonth()
-
-    /**
-     * Find the number of days in the given month
-     *
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the number of days the month has
-     *
-     * @access public
-     * @static
-     */
-    function daysInMonth($month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-
-        if ($year == 1582 && $month == 10) {
-            return 21;  // October 1582 only had 1st-4th and 15th-31st
-        }
-
-        if ($month == 2) {
-            if (Date_Calc::isLeapYear($year)) {
-                return 29;
-             } else {
-                return 28;
-            }
-        } elseif ($month == 4 or $month == 6 or $month == 9 or $month == 11) {
-            return 30;
-        } else {
-            return 31;
-        }
-    }
-
-    // }}}
-    // {{{ weeksInMonth()
-
-    /**
-     * Returns the number of rows on a calendar month
-     *
-     * Useful for determining the number of rows when displaying a typical
-     * month calendar.
-     *
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int  the number of weeks the month has
-     *
-     * @access public
-     * @static
-     */
-    function weeksInMonth($month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        $FDOM = Date_Calc::firstOfMonthWeekday($month, $year);
-        if (DATE_CALC_BEGIN_WEEKDAY==1 && $FDOM==0) {
-            $first_week_days = 7 - $FDOM + DATE_CALC_BEGIN_WEEKDAY;
-            $weeks = 1;
-        } elseif (DATE_CALC_BEGIN_WEEKDAY==0 && $FDOM == 6) {
-            $first_week_days = 7 - $FDOM + DATE_CALC_BEGIN_WEEKDAY;
-            $weeks = 1;
-        } else {
-            $first_week_days = DATE_CALC_BEGIN_WEEKDAY - $FDOM;
-            $weeks = 0;
-        }
-        $first_week_days %= 7;
-        return ceil((Date_Calc::daysInMonth($month, $year)
-                     - $first_week_days) / 7) + $weeks;
-    }
-
-    // }}}
-    // {{{ getCalendarWeek()
-
-    /**
-     * Return an array with days in week
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return array $week[$weekday]
-     *
-     * @access public
-     * @static
-     */
-    function getCalendarWeek($day = 0, $month = 0, $year = 0,
-                             $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-
-        $week_array = array();
-
-        // date for the column of week
-
-        $curr_day = Date_Calc::beginOfWeek($day, $month, $year,'%E');
-
-        for ($counter = 0; $counter <= 6; $counter++) {
-            $week_array[$counter] = Date_Calc::daysToDate($curr_day, $format);
-            $curr_day++;
-        }
-        return $week_array;
-    }
-
-    // }}}
-    // {{{ getCalendarMonth()
-
-    /**
-     * Return a set of arrays to construct a calendar month for the given date
-     *
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return array $month[$row][$col]
-     *
-     * @access public
-     * @static
-     */
-    function getCalendarMonth($month = 0, $year = 0,
-                              $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-
-        $month_array = array();
-
-        // date for the first row, first column of calendar month
-        if (DATE_CALC_BEGIN_WEEKDAY == 1) {
-            if (Date_Calc::firstOfMonthWeekday($month, $year) == 0) {
-                $curr_day = Date_Calc::dateToDays('01', $month, $year) - 6;
-            } else {
-                $curr_day = Date_Calc::dateToDays('01', $month, $year)
-                    - Date_Calc::firstOfMonthWeekday($month, $year) + 1;
-            }
-        } else {
-            $curr_day = (Date_Calc::dateToDays('01', $month, $year)
-                - Date_Calc::firstOfMonthWeekday($month, $year));
-        }
-
-        // number of days in this month
-        $daysInMonth = Date_Calc::daysInMonth($month, $year);
-
-        $weeksInMonth = Date_Calc::weeksInMonth($month, $year);
-        for ($row_counter = 0; $row_counter < $weeksInMonth; $row_counter++) {
-            for ($column_counter = 0; $column_counter <= 6; $column_counter++) {
-                $month_array[$row_counter][$column_counter] =
-                        Date_Calc::daysToDate($curr_day , $format);
-                $curr_day++;
-            }
-        }
-
-        return $month_array;
-    }
-
-    // }}}
-    // {{{ getCalendarYear()
-
-    /**
-     * Return a set of arrays to construct a calendar year for the given date
-     *
-     * @param int    $year    the year in four digit format, default current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return array $year[$month][$row][$col]
-     *
-     * @access public
-     * @static
-     */
-    function getCalendarYear($year = 0, $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-
-        $year_array = array();
-
-        for ($curr_month = 0; $curr_month <= 11; $curr_month++) {
-            $year_array[$curr_month] =
-                    Date_Calc::getCalendarMonth($curr_month + 1,
-                                                $year, $format);
-        }
-
-        return $year_array;
-    }
-
-    // }}}
-    // {{{ prevDay()
-
-    /**
-     * Returns date of day before given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function prevDay($day = 0, $month = 0, $year = 0,
-                     $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        return Date_Calc::daysToDate($days - 1, $format);
-    }
-
-    // }}}
-    // {{{ nextDay()
-
-    /**
-     * Returns date of day after given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function nextDay($day = 0, $month = 0, $year = 0,
-                     $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        return Date_Calc::daysToDate($days + 1, $format);
-    }
-
-    // }}}
-    // {{{ prevWeekday()
-
-    /**
-     * Returns date of the previous weekday, skipping from Monday to Friday
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function prevWeekday($day = 0, $month = 0, $year = 0,
-                         $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        if (Date_Calc::dayOfWeek($day, $month, $year) == 1) {
-            $days -= 3;
-        } elseif (Date_Calc::dayOfWeek($day, $month, $year) == 0) {
-            $days -= 2;
-        } else {
-            $days -= 1;
-        }
-        return Date_Calc::daysToDate($days, $format);
-    }
-
-    // }}}
-    // {{{ nextWeekday()
-
-    /**
-     * Returns date of the next weekday of given date, skipping from
-     * Friday to Monday
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function nextWeekday($day = 0, $month = 0, $year = 0,
-                         $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        if (Date_Calc::dayOfWeek($day, $month, $year) == 5) {
-            $days += 3;
-        } elseif (Date_Calc::dayOfWeek($day, $month, $year) == 6) {
-            $days += 2;
-        } else {
-            $days += 1;
-        }
-        return Date_Calc::daysToDate($days, $format);
-    }
-
-    // }}}
-    // {{{ prevDayOfWeek()
-
-    /**
-     * Returns date of the previous specific day of the week
-     * from the given date
-     *
-     * @param int day of week, 0=Sunday
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param bool   $onOrBefore  if true and days are same, returns current day
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function prevDayOfWeek($dow, $day = 0, $month = 0, $year = 0,
-                           $format = DATE_CALC_FORMAT, $onOrBefore = false)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        $curr_weekday = Date_Calc::dayOfWeek($day, $month, $year);
-        if ($curr_weekday == $dow) {
-            if (!$onOrBefore) {
-                $days -= 7;
-            }
-        } elseif ($curr_weekday < $dow) {
-            $days -= 7 - ($dow - $curr_weekday);
-        } else {
-            $days -= $curr_weekday - $dow;
-        }
-        return Date_Calc::daysToDate($days, $format);
-    }
-
-    // }}}
-    // {{{ nextDayOfWeek()
-
-    /**
-     * Returns date of the next specific day of the week
-     * from the given date
-     *
-     * @param int    $dow     the day of the week (0 = Sunday)
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param bool   $onOrAfter  if true and days are same, returns current day
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function nextDayOfWeek($dow, $day = 0, $month = 0, $year = 0,
-                           $format = DATE_CALC_FORMAT, $onOrAfter = false)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-
-        $days = Date_Calc::dateToDays($day, $month, $year);
-        $curr_weekday = Date_Calc::dayOfWeek($day, $month, $year);
-
-        if ($curr_weekday == $dow) {
-            if (!$onOrAfter) {
-                $days += 7;
-            }
-        } elseif ($curr_weekday > $dow) {
-            $days += 7 - ($curr_weekday - $dow);
-        } else {
-            $days += $dow - $curr_weekday;
-        }
-
-        return Date_Calc::daysToDate($days, $format);
-    }
-
-    // }}}
-    // {{{ prevDayOfWeekOnOrBefore()
-
-    /**
-     * Returns date of the previous specific day of the week
-     * on or before the given date
-     *
-     * @param int    $dow     the day of the week (0 = Sunday)
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function prevDayOfWeekOnOrBefore($dow, $day = 0, $month = 0, $year = 0,
-                                     $format = DATE_CALC_FORMAT)
-    {
-        return Date_Calc::prevDayOfWeek($dow, $day, $month, $year, $format,
-                                        true);
-    }
-
-    // }}}
-    // {{{ nextDayOfWeekOnOrAfter()
-
-    /**
-     * Returns date of the next specific day of the week
-     * on or after the given date
-     *
-     * @param int    $dow     the day of the week (0 = Sunday)
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function nextDayOfWeekOnOrAfter($dow, $day = 0, $month = 0, $year = 0,
-                                    $format = DATE_CALC_FORMAT)
-    {
-        return Date_Calc::nextDayOfWeek($dow, $day, $month, $year, $format,
-                                        true);
-    }
-
-    // }}}
-    // {{{ beginOfWeek()
-
-    /**
-     * Find the month day of the beginning of week for given date,
-     * using DATE_CALC_BEGIN_WEEKDAY
-     *
-     * Can return weekday of prev month.
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function beginOfWeek($day = 0, $month = 0, $year = 0,
-                         $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $this_weekday = Date_Calc::dayOfWeek($day, $month, $year);
-        $interval = (7 - DATE_CALC_BEGIN_WEEKDAY + $this_weekday) % 7;
-        return Date_Calc::daysToDate(Date_Calc::dateToDays($day, $month, $year)
-                                     - $interval, $format);
-    }
-
-    // }}}
-    // {{{ endOfWeek()
-
-    /**
-     * Find the month day of the end of week for given date,
-     * using DATE_CALC_BEGIN_WEEKDAY
-     *
-     * Can return weekday of following month.
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function endOfWeek($day = 0, $month = 0, $year = 0,
-                       $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        $this_weekday = Date_Calc::dayOfWeek($day, $month, $year);
-        $interval = (6 + DATE_CALC_BEGIN_WEEKDAY - $this_weekday) % 7;
-        return Date_Calc::daysToDate(Date_Calc::dateToDays($day, $month, $year)
-                                     + $interval, $format);
-    }
-
-    // }}}
-    // {{{ beginOfPrevWeek()
-
-    /**
-     * Find the month day of the beginning of week before given date,
-     * using DATE_CALC_BEGIN_WEEKDAY
-     *
-     * Can return weekday of prev month.
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function beginOfPrevWeek($day = 0, $month = 0, $year = 0,
-                             $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-
-        $date = Date_Calc::daysToDate(Date_Calc::dateToDays($day-7,
-                                                            $month,
-                                                            $year),
-                                      '%Y%m%d');
-
-        $prev_week_year  = substr($date, 0, 4);
-        $prev_week_month = substr($date, 4, 2);
-        $prev_week_day   = substr($date, 6, 2);
-
-        return Date_Calc::beginOfWeek($prev_week_day, $prev_week_month,
-                                      $prev_week_year, $format);
-    }
-
-    // }}}
-    // {{{ beginOfNextWeek()
-
-    /**
-     * Find the month day of the beginning of week after given date,
-     * using DATE_CALC_BEGIN_WEEKDAY
-     *
-     * Can return weekday of prev month.
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function beginOfNextWeek($day = 0, $month = 0, $year = 0,
-                             $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-
-        $date = Date_Calc::daysToDate(Date_Calc::dateToDays($day + 7,
-                                                            $month,
-                                                            $year),
-                                      '%Y%m%d');
-
-        $next_week_year  = substr($date, 0, 4);
-        $next_week_month = substr($date, 4, 2);
-        $next_week_day   = substr($date, 6, 2);
-
-        return Date_Calc::beginOfWeek($next_week_day, $next_week_month,
-                                      $next_week_year, $format);
-    }
-
-    // }}}
-    // {{{ beginOfMonth()
-
-    /**
-     * Return date of first day of month of given date
-     *
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::beginOfMonthBySpan()
-     * @deprecated Method deprecated in Release 1.4.4
-     */
-    function beginOfMonth($month = 0, $year = 0, $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        return Date_Calc::dateFormat('01', $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ beginOfPrevMonth()
-
-    /**
-     * Returns date of the first day of previous month of given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::beginOfMonthBySpan()
-     * @deprecated Method deprecated in Release 1.4.4
-     */
-    function beginOfPrevMonth($day = 0, $month = 0, $year = 0,
-                              $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        if ($month > 1) {
-            $month--;
-            $day = 1;
-        } else {
-            $year--;
-            $month = 12;
-            $day   = 1;
-        }
-        return Date_Calc::dateFormat($day, $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ endOfPrevMonth()
-
-    /**
-     * Returns date of the last day of previous month for given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::endOfMonthBySpan()
-     * @deprecated Method deprecated in Release 1.4.4
-     */
-    function endOfPrevMonth($day = 0, $month = 0, $year = 0,
-                            $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        if ($month > 1) {
-            $month--;
-        } else {
-            $year--;
-            $month = 12;
-        }
-        $day = Date_Calc::daysInMonth($month, $year);
-        return Date_Calc::dateFormat($day, $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ beginOfNextMonth()
-
-    /**
-     * Returns date of begin of next month of given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::beginOfMonthBySpan()
-     * @deprecated Method deprecated in Release 1.4.4
-     */
-    function beginOfNextMonth($day = 0, $month = 0, $year = 0,
-                              $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        if ($month < 12) {
-            $month++;
-            $day = 1;
-        } else {
-            $year++;
-            $month = 1;
-            $day = 1;
-        }
-        return Date_Calc::dateFormat($day, $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ endOfNextMonth()
-
-    /**
-     * Returns date of the last day of next month of given date
-     *
-     * @param int    $day     the day of the month, default is current local day
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @see Date_Calc::endOfMonthBySpan()
-     * @deprecated Method deprecated in Release 1.4.4
-     */
-    function endOfNextMonth($day = 0, $month = 0, $year = 0,
-                            $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if (empty($day)) {
-            $day = Date_Calc::dateNow('%d');
-        }
-        if ($month < 12) {
-            $month++;
-        } else {
-            $year++;
-            $month = 1;
-        }
-        $day = Date_Calc::daysInMonth($month, $year);
-        return Date_Calc::dateFormat($day, $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ beginOfMonthBySpan()
-
-    /**
-     * Returns date of the first day of the month in the number of months
-     * from the given date
-     *
-     * @param int    $months  the number of months from the date provided.
-     *                         Positive numbers go into the future.
-     *                         Negative numbers go into the past.
-     *                         0 is the month presented in $month.
-     * @param string $month   the month, default is current local month
-     * @param string $year    the year in four digit format, default is the
-     *                         current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @since  Method available since Release 1.4.4
-     */
-    function beginOfMonthBySpan($months = 0, $month = 0, $year = 0,
-                                $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if ($months > 0) {
-            // future month
-            $tmp_mo = $month + $months;
-            $month  = $tmp_mo % 12;
-            if ($month == 0) {
-                $month = 12;
-                $year = $year + floor(($tmp_mo - 1) / 12);
-            } else {
-                $year = $year + floor($tmp_mo / 12);
-            }
-        } else {
-            // past or present month
-            $tmp_mo = $month + $months;
-            if ($tmp_mo > 0) {
-                // same year
-                $month = $tmp_mo;
-            } elseif ($tmp_mo == 0) {
-                // prior dec
-                $month = 12;
-                $year--;
-            } else {
-                // some time in a prior year
-                $month = 12 + ($tmp_mo % 12);
-                $year  = $year + floor($tmp_mo / 12);
-            }
-        }
-        return Date_Calc::dateFormat(1, $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ endOfMonthBySpan()
-
-    /**
-     * Returns date of the last day of the month in the number of months
-     * from the given date
-     *
-     * @param int    $months  the number of months from the date provided.
-     *                         Positive numbers go into the future.
-     *                         Negative numbers go into the past.
-     *                         0 is the month presented in $month.
-     * @param string $month   the month, default is current local month
-     * @param string $year    the year in four digit format, default is the
-     *                         current local year
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     * @since  Method available since Release 1.4.4
-     */
-    function endOfMonthBySpan($months = 0, $month = 0, $year = 0,
-                              $format = DATE_CALC_FORMAT)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        if ($months > 0) {
-            // future month
-            $tmp_mo = $month + $months;
-            $month  = $tmp_mo % 12;
-            if ($month == 0) {
-                $month = 12;
-                $year = $year + floor(($tmp_mo - 1) / 12);
-            } else {
-                $year = $year + floor($tmp_mo / 12);
-            }
-        } else {
-            // past or present month
-            $tmp_mo = $month + $months;
-            if ($tmp_mo > 0) {
-                // same year
-                $month = $tmp_mo;
-            } elseif ($tmp_mo == 0) {
-                // prior dec
-                $month = 12;
-                $year--;
-            } else {
-                // some time in a prior year
-                $month = 12 + ($tmp_mo % 12);
-                $year  = $year + floor($tmp_mo / 12);
-            }
-        }
-        return Date_Calc::dateFormat(Date_Calc::daysInMonth($month, $year),
-                                     $month, $year, $format);
-    }
-
-    // }}}
-    // {{{ firstOfMonthWeekday()
-
-    /**
-     * Find the day of the week for the first of the month of given date
-     *
-     * @param int    $month   the month, default is current local month
-     * @param int    $year    the year in four digit format, default is current local year
-     *
-     * @return int number of weekday for the first day, 0=Sunday
-     *
-     * @access public
-     * @static
-     */
-    function firstOfMonthWeekday($month = 0, $year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (empty($month)) {
-            $month = Date_Calc::dateNow('%m');
-        }
-        return Date_Calc::dayOfWeek('01', $month, $year);
-    }
-
-    // }}}
-    // {{{ NWeekdayOfMonth()
-
-    /**
-     * Calculates the date of the Nth weekday of the month,
-     * such as the second Saturday of January 2000
-     *
-     * @param int    $week    the number of the week to get
-     *                         (1 = first, etc.  Also can be 'last'.)
-     * @param int    $dow     the day of the week (0 = Sunday)
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     * @param string $format  the string indicating how to format the output
-     *
-     * @return string  the date in the desired format
-     *
-     * @access public
-     * @static
-     */
-    function NWeekdayOfMonth($week, $dow, $month, $year,
-                             $format = DATE_CALC_FORMAT)
-    {
-        if (is_numeric($week)) {
-            $DOW1day = ($week - 1) * 7 + 1;
-            $DOW1    = Date_Calc::dayOfWeek($DOW1day, $month, $year);
-            $wdate   = ($week - 1) * 7 + 1 + (7 + $dow - $DOW1) % 7;
-            if ($wdate > Date_Calc::daysInMonth($month, $year)) {
-                return -1;
-            } else {
-                return Date_Calc::dateFormat($wdate, $month, $year, $format);
-            }
-        } elseif ($week == 'last' && $dow < 7) {
-            $lastday = Date_Calc::daysInMonth($month, $year);
-            $lastdow = Date_Calc::dayOfWeek($lastday, $month, $year);
-            $diff    = $dow - $lastdow;
-            if ($diff > 0) {
-                return Date_Calc::dateFormat($lastday - (7 - $diff), $month,
-                                             $year, $format);
-            } else {
-                return Date_Calc::dateFormat($lastday + $diff, $month,
-                                             $year, $format);
-            }
-        } else {
-            return -1;
-        }
-    }
-
-    // }}}
-    // {{{ isValidDate()
-
-    /**
-     * Returns true for valid date, false for invalid date
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return boolean
-     *
-     * @access public
-     * @static
-     */
-    function isValidDate($day, $month, $year)
-    {
-        if ($year < 0 || $year > 9999) {
-            return false;
-        }
-        if (!checkdate($month, $day, $year)) {
-            return false;
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ isLeapYear()
-
-    /**
-     * Returns true for a leap year, else false
-     *
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return boolean
-     *
-     * @access public
-     * @static
-     */
-    function isLeapYear($year = 0)
-    {
-        if (empty($year)) {
-            $year = Date_Calc::dateNow('%Y');
-        }
-        if (preg_match('/\D/', $year)) {
-            return false;
-        }
-        if ($year < 1000) {
-            return false;
-        }
-        if ($year < 1582) {
-            // pre Gregorio XIII - 1582
-            return ($year % 4 == 0);
-        } else {
-            // post Gregorio XIII - 1582
-            return (($year % 4 == 0) && ($year % 100 != 0)) || ($year % 400 == 0);
-        }
-    }
-
-    // }}}
-    // {{{ isFutureDate()
-
-    /**
-     * Determines if given date is a future date from now
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return boolean
-     *
-     * @access public
-     * @static
-     */
-    function isFutureDate($day, $month, $year)
-    {
-        $this_year  = Date_Calc::dateNow('%Y');
-        $this_month = Date_Calc::dateNow('%m');
-        $this_day   = Date_Calc::dateNow('%d');
-
-        if ($year > $this_year) {
-            return true;
-        } elseif ($year == $this_year) {
-            if ($month > $this_month) {
-                return true;
-            } elseif ($month == $this_month) {
-                if ($day > $this_day) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ isPastDate()
-
-    /**
-     * Determines if given date is a past date from now
-     *
-     * @param int    $day     the day of the month
-     * @param int    $month   the month
-     * @param int    $year    the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return boolean
-     *
-     * @access public
-     * @static
-     */
-    function isPastDate($day, $month, $year)
-    {
-        $this_year  = Date_Calc::dateNow('%Y');
-        $this_month = Date_Calc::dateNow('%m');
-        $this_day   = Date_Calc::dateNow('%d');
-
-        if ($year < $this_year) {
-            return true;
-        } elseif ($year == $this_year) {
-            if ($month < $this_month) {
-                return true;
-            } elseif ($month == $this_month) {
-                if ($day < $this_day) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ dateDiff()
-
-    /**
-     * Returns number of days between two given dates
-     *
-     * @param int    $day1    the day of the month
-     * @param int    $month1  the month
-     * @param int    $year1   the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     * @param int    $day2    the day of the month
-     * @param int    $month2  the month
-     * @param int    $year2   the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return int  the absolute number of days between the two dates.
-     *               If an error occurs, -1 is returned.
-     *
-     * @access public
-     * @static
-     */
-    function dateDiff($day1, $month1, $year1, $day2, $month2, $year2)
-    {
-        if (!Date_Calc::isValidDate($day1, $month1, $year1)) {
-            return -1;
-        }
-        if (!Date_Calc::isValidDate($day2, $month2, $year2)) {
-            return -1;
-        }
-        return abs(Date_Calc::dateToDays($day1, $month1, $year1)
-                   - Date_Calc::dateToDays($day2, $month2, $year2));
-    }
-
-    // }}}
-    // {{{ compareDates()
-
-    /**
-     * Compares two dates
-     *
-     * @param int    $day1    the day of the month
-     * @param int    $month1  the month
-     * @param int    $year1   the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     * @param int    $day2    the day of the month
-     * @param int    $month2  the month
-     * @param int    $year2   the year.  Use the complete year instead of the
-     *                         abbreviated version.  E.g. use 2005, not 05.
-     *                         Do not add leading 0's for years prior to 1000.
-     *
-     * @return int  0 if the dates are equal. 1 if date 1 is later, -1 if
-     *               date 1 is earlier.
-     *
-     * @access public
-     * @static
-     */
-    function compareDates($day1, $month1, $year1, $day2, $month2, $year2)
-    {
-        $ndays1 = Date_Calc::dateToDays($day1, $month1, $year1);
-        $ndays2 = Date_Calc::dateToDays($day2, $month2, $year2);
-        if ($ndays1 == $ndays2) {
-            return 0;
-        }
-        return ($ndays1 > $ndays2) ? 1 : -1;
-    }
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/php/Date/Human.php b/lib/php/Date/Human.php
deleted file mode 100644
index 4f8d3b2970a49650e8298888e9208b1792acb966..0000000000000000000000000000000000000000
--- a/lib/php/Date/Human.php
+++ /dev/null
@@ -1,242 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
-// {{{ Header
-
-/**
- * Class to convert date strings between Gregorian and Human calendar formats
- *
- * The Human Calendar format has been proposed by Scott Flansburg and can be
- * explained as follows:
- *  The year is made up of 13 months
- *  Each month has 28 days
- *  Counting of months starts from 0 (zero) so the months will run from 0 to 12
- *  New Years day (00) is a monthless day
- *  Note: Leap Years are not yet accounted for in the Human Calendar system
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 1997-2006 Allan Kent
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted under the terms of the BSD License.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Allan Kent <allan@lodestone.co.za>
- * @copyright  1997-2006 Allan Kent
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    CVS: $Id: Human.php,v 1.6 2006/11/21 17:38:15 firman Exp $
- * @link       http://pear.php.net/package/Date
- * @since      File available since Release 1.3
- */
-
-// }}}
-// {{{ Class: Date_Human
-
-/**
- * Class to convert date strings between Gregorian and Human calendar formats
- *
- * The Human Calendar format has been proposed by Scott Flansburg and can be
- * explained as follows:
- *  The year is made up of 13 months
- *  Each month has 28 days
- *  Counting of months starts from 0 (zero) so the months will run from 0 to 12
- *  New Years day (00) is a monthless day
- *  Note: Leap Years are not yet accounted for in the Human Calendar system
- *
- * @author     Allan Kent <allan@lodestone.co.za>
- * @copyright  1997-2005 Allan Kent
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    Release: 1.4.7
- * @link       http://pear.php.net/package/Date
- * @since      Class available since Release 1.3
- */
-class Date_Human
-{
-    // {{{ gregorianToHuman()
-
-    /**
-     * Returns an associative array containing the converted date information
-     * in 'Human Calendar' format.
-     *
-     * @param int day in DD format, default current local day
-     * @param int month in MM format, default current local month
-     * @param int year in CCYY format, default to current local year
-     *
-     * @access public
-     *
-     * @return associative array(
-     *               hdom,       // Human Day Of Month, starting at 1
-     *               hdow,       // Human Day Of Week, starting at 1
-     *               hwom,       // Human Week of Month, starting at 1
-     *               hwoy,       // Human Week of Year, starting at 1
-     *               hmoy,       // Human Month of Year, starting at 0
-     *               )
-     *
-     * If the day is New Years Day, the function will return
-     * "hdom" =>  0
-     * "hdow" =>  0
-     * "hwom" =>  0
-     * "hwoy" =>  0
-     * "hmoy" => -1
-     *  Since 0 is a valid month number under the Human Calendar, I have left
-     *  the month as -1 for New Years Day.
-     */
-    function gregorianToHuman($day=0, $month=0, $year=0)
-    {
-        /*
-         * Check to see if any of the arguments are empty
-         * If they are then populate the $dateinfo array
-         * Then check to see which arguments are empty and fill
-         * those with the current date info
-         */
-        if ((empty($day) || (empty($month)) || empty($year))) {
-            $dateinfo = getdate(time());
-        }
-        if (empty($day)) {
-            $day = $dateinfo["mday"];
-        }
-        if (empty($month)) {
-            $month = $dateinfo["mon"];
-        }
-        if (empty($year)) {
-            $year = $dateinfo["year"];
-        }
-        /*
-         * We need to know how many days into the year we are
-         */
-        $dateinfo = getdate(mktime(0, 0, 0, $month, $day, $year));
-        $dayofyear = $dateinfo["yday"];
-        /*
-         * Human Calendar starts at 0 for months and the first day of the year
-         * is designated 00, so we need to start our day of the year at 0 for
-         * these calculations.
-         * Also, the day of the month is calculated with a modulus of 28.
-         * Because a day is 28 days, the last day of the month would have a
-         * remainder of 0 and not 28 as it should be.  Decrementing $dayofyear
-         * gets around this.
-         */
-        $dayofyear--;
-        /*
-         * 28 days in a month...
-         */
-        $humanMonthOfYear = floor($dayofyear / 28);
-        /*
-         * If we are in the first month then the day of the month is $dayofyear
-         * else we need to find the modulus of 28.
-         */
-        if ($humanMonthOfYear == 0) {
-            $humanDayOfMonth = $dayofyear;
-        } else {
-            $humanDayOfMonth = ($dayofyear) % 28;
-        }
-        /*
-         * Day of the week is modulus 7
-         */
-        $humanDayOfWeek = $dayofyear % 7;
-        /*
-         * We can now increment $dayofyear back to it's correct value for
-         * the remainder of the calculations
-         */
-        $dayofyear++;
-        /*
-         * $humanDayOfMonth needs to be incremented now - recall that we fudged
-         * it a bit by decrementing $dayofyear earlier
-         * Same goes for $humanDayOfWeek
-         */
-        $humanDayOfMonth++;
-        $humanDayOfWeek++;
-        /*
-         * Week of the month is day of the month divided by 7, rounded up
-         * Same for week of the year, but use $dayofyear instead $humanDayOfMonth
-         */
-        $humanWeekOfMonth = ceil($humanDayOfMonth / 7);
-        $humanWeekOfYear = ceil($dayofyear / 7);
-        /*
-         * Return an associative array of the values
-         */
-        return array(
-                     "hdom" => $humanDayOfMonth,
-                     "hdow" => $humanDayOfWeek,
-                     "hwom" => $humanWeekOfMonth,
-                     "hwoy" => $humanWeekOfYear,
-                     "hmoy" => $humanMonthOfYear );
-    }
-
-    // }}}
-    // {{{ humanToGregorian()
-
-    /**
-     * Returns unix timestamp for a given Human Calendar date
-     *
-     * @param int day in DD format
-     * @param int month in MM format
-     * @param int year in CCYY format, default to current local year
-     *
-     * @access public
-     *
-     * @return int unix timestamp of date
-     */
-    function humanToGregorian($day, $month, $year=0)
-    {
-        /*
-         * Check to see if the year has been passed through.
-         * If not get current year
-         */
-        if (empty($year)) {
-            $dateinfo = getdate(time());
-            $year = $dateinfo["year"];
-        }
-        /*
-         * We need to get the day of the year that we are currently at so that
-         * we can work out the Gregorian Month and day
-         */
-        $DayOfYear = $month * 28;
-        $DayOfYear += $day;
-        /*
-         * Human Calendar starts at 0, so we need to increment $DayOfYear
-         * to take into account the day 00
-         */
-        $DayOfYear++;
-        /*
-         * the mktime() function will correctly calculate the date for out of
-         * range values, so putting $DayOfYear instead of the day of the month
-         * will work fine.
-         */
-        $GregorianTimeStamp = mktime(0, 0, 0, 1, $DayOfYear, $year);
-        return $GregorianTimeStamp;
-    }
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/php/Date/Span.php b/lib/php/Date/Span.php
deleted file mode 100644
index 32b7bab0a2d46466183bbba55f29d604722c7eb5..0000000000000000000000000000000000000000
--- a/lib/php/Date/Span.php
+++ /dev/null
@@ -1,1083 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
-// {{{ Header
-
-/**
- * Generic time span handling class for PEAR
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 1997-2005 Leandro Lucarella, Pierre-Alain Joye
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted under the terms of the BSD License.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Leandro Lucarella <llucax@php.net>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @copyright  1997-2006 Leandro Lucarella, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    CVS: $Id: Span.php,v 1.9 2006/11/21 17:38:15 firman Exp $
- * @link       http://pear.php.net/package/Date
- * @since      File available since Release 1.4
- */
-
-// }}}
-// {{{ Includes
-
-/**
- * Get the Date class
- */
-require_once 'Date.php';
-
-/**
- * Get the Date_Calc class
- */
-require_once 'Date/Calc.php';
-
-// }}}
-// {{{ Constants
-
-/**
- * Non Numeric Separated Values (NNSV) Input Format.
- *
- * Input format guessed from something like this:
- * days<sep>hours<sep>minutes<sep>seconds
- * Where <sep> is any quantity of non numeric chars. If no values are
- * given, time span is set to zero, if one value is given, it's used for
- * hours, if two values are given it's used for hours and minutes and if
- * three values are given, it's used for hours, minutes and seconds.<br>
- * Examples:<br>
- * ''                   -> 0, 0, 0, 0 (days, hours, minutes, seconds)<br>
- * '12'                 -> 0, 12, 0, 0
- * '12.30'              -> 0, 12, 30, 0<br>
- * '12:30:18'           -> 0, 12, 30, 18<br>
- * '3-12-30-18'         -> 3, 12, 30, 18<br>
- * '3 days, 12-30-18'   -> 3, 12, 30, 18<br>
- * '12:30 with 18 secs' -> 0, 12, 30, 18<br>
- *
- * @const int
- */
-define('DATE_SPAN_INPUT_FORMAT_NNSV', 1);
-
-// }}}
-// {{{ Global Variables
-
-/**
- * Default time format when converting to a string.
- *
- * @global string
- */
-$GLOBALS['_DATE_SPAN_FORMAT']  = '%C';
-
-/**
- * Default time format when converting from a string.
- *
- * @global mixed
- */
-$GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = DATE_SPAN_INPUT_FORMAT_NNSV;
-
-// }}}
-// {{{ Class: Date_Span
-
-/**
- * Generic time span handling class for PEAR
- *
- * @author     Leandro Lucarella <llucax@php.net>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @copyright  1997-2006 Leandro Lucarella, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    Release: 1.4.7
- * @link       http://pear.php.net/package/Date
- * @since      Class available since Release 1.4
- */
-class Date_Span
-{
-    // {{{ Properties
-
-    /**
-     * @var int
-     */
-    var $day;
-
-    /**
-     * @var int
-     */
-    var $hour;
-
-    /**
-     * @var int
-     */
-    var $minute;
-
-    /**
-     * @var int
-     */
-    var $second;
-
-    // }}}
-    // {{{ Constructor
-
-    /**
-     * Constructor.
-     *
-     * Creates the time span object calling the set() method.
-     *
-     * @param  mixed $time   Time span expression.
-     * @param  mixed $format Format string to set it from a string or the
-     *                       second date set it from a date diff.
-     *
-     * @see    set()
-     * @access public
-     */
-    function Date_Span($time = 0, $format = null)
-    {
-        $this->set($time, $format);
-    }
-
-    // }}}
-    // {{{ set()
-
-    /**
-     * Set the time span to a new value in a 'smart' way.
-     *
-     * Sets the time span depending on the argument types, calling
-     * to the appropriate setFromXxx() method.
-     *
-     * @param  mixed $time   Time span expression.
-     * @param  mixed $format Format string to set it from a string or the
-     *                       second date set it from a date diff.
-     *
-     * @return bool  true on success.
-     *
-     * @see    setFromObject()
-     * @see    setFromArray()
-     * @see    setFromString()
-     * @see    setFromSeconds()
-     * @see    setFromDateDiff()
-     * @access public
-     */
-    function set($time = 0, $format = null)
-    {
-        if (is_a($time, 'date_span')) {
-            return $this->copy($time);
-        } elseif (is_a($time, 'date') and is_a($format, 'date')) {
-            return $this->setFromDateDiff($time, $format);
-        } elseif (is_array($time)) {
-            return $this->setFromArray($time);
-        } elseif (is_string($time)) {
-            return $this->setFromString($time, $format);
-        } elseif (is_int($time)) {
-            return $this->setFromSeconds($time);
-        } else {
-            return $this->setFromSeconds(0);
-        }
-    }
-
-    // }}}
-    // {{{ setFromArray()
-
-    /**
-     * Set the time span from an array.
-     *
-     * Set the time span from an array. Any value can be a float (but it
-     * has no sense in seconds), for example array(23.5, 20, 0) is
-     * interpreted as 23 hours, .5*60 + 20 = 50 minutes and 0 seconds.
-     *
-     * @param  array $time Items are counted from right to left. First
-     *                     item is for seconds, second for minutes, third
-     *                     for hours and fourth for days. If there are
-     *                     less items than 4, zero (0) is assumed for the
-     *                     absent values.
-     *
-     * @return bool  True on success.
-     *
-     * @access public
-     */
-    function setFromArray($time)
-    {
-        if (!is_array($time)) {
-            return false;
-        }
-        $tmp1 = new Date_Span;
-        if (!$tmp1->setFromSeconds(@array_pop($time))) {
-            return false;
-        }
-        $tmp2 = new Date_Span;
-        if (!$tmp2->setFromMinutes(@array_pop($time))) {
-            return false;
-        }
-        $tmp1->add($tmp2);
-        if (!$tmp2->setFromHours(@array_pop($time))) {
-            return false;
-        }
-        $tmp1->add($tmp2);
-        if (!$tmp2->setFromDays(@array_pop($time))) {
-            return false;
-        }
-        $tmp1->add($tmp2);
-        return $this->copy($tmp1);
-    }
-
-    // }}}
-    // {{{ setFromString()
-
-    /**
-     * Set the time span from a string based on an input format.
-     *
-     * Set the time span from a string based on an input format. This is
-     * some like a mix of format() method and sscanf() PHP function. The
-     * error checking and validation of this function is very primitive,
-     * so you should be carefull when using it with unknown $time strings.
-     * With this method you are assigning day, hour, minute and second
-     * values, and the last values are used. This means that if you use
-     * something like setFromString('10, 20', '%H, %h') your time span
-     * would be 20 hours long. Allways remember that this method set
-     * <b>all</b> the values, so if you had a $time span 30 minutes long
-     * and you make $time->setFromString('20 hours', '%H hours'), $time
-     * span would be 20 hours long (and not 20 hours and 30 minutes).
-     * Input format options:<br>
-     *  <code>%C</code> Days with time, same as "%D, %H:%M:%S".<br>
-     *  <code>%d</code> Total days as a float number
-     *                  (2 days, 12 hours = 2.5 days).<br>
-     *  <code>%D</code> Days as a decimal number.<br>
-     *  <code>%e</code> Total hours as a float number
-     *                  (1 day, 2 hours, 30 minutes = 26.5 hours).<br>
-     *  <code>%f</code> Total minutes as a float number
-     *                  (2 minutes, 30 seconds = 2.5 minutes).<br>
-     *  <code>%g</code> Total seconds as a decimal number
-     *                  (2 minutes, 30 seconds = 90 seconds).<br>
-     *  <code>%h</code> Hours as decimal number.<br>
-     *  <code>%H</code> Hours as decimal number limited to 2 digits.<br>
-     *  <code>%m</code> Minutes as a decimal number.<br>
-     *  <code>%M</code> Minutes as a decimal number limited to 2 digits.<br>
-     *  <code>%n</code> Newline character (\n).<br>
-     *  <code>%p</code> Either 'am' or 'pm' depending on the time. If 'pm'
-     *                  is detected it adds 12 hours to the resulting time
-     *                  span (without any checks). This is case
-     *                  insensitive.<br>
-     *  <code>%r</code> Time in am/pm notation, same as "%H:%M:%S %p".<br>
-     *  <code>%R</code> Time in 24-hour notation, same as "%H:%M".<br>
-     *  <code>%s</code> Seconds as a decimal number.<br>
-     *  <code>%S</code> Seconds as a decimal number limited to 2 digits.<br>
-     *  <code>%t</code> Tab character (\t).<br>
-     *  <code>%T</code> Current time equivalent, same as "%H:%M:%S".<br>
-     *  <code>%%</code> Literal '%'.<br>
-     *
-     * @param  string $time   String from where to get the time span
-     *                        information.
-     * @param  string $format Format string.
-     *
-     * @return bool   True on success.
-     *
-     * @access public
-     */
-    function setFromString($time, $format = null)
-    {
-        if (is_null($format)) {
-            $format = $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
-        }
-        // If format is a string, it parses the string format.
-        if (is_string($format)) {
-            $str = '';
-            $vars = array();
-            $pm = 'am';
-            $day = $hour = $minute = $second = 0;
-            for ($i = 0; $i < strlen($format); $i++) {
-                $char = $format{$i};
-                if ($char == '%') {
-                    $nextchar = $format{++$i};
-                    switch ($nextchar) {
-                        case 'c':
-                            $str .= '%d, %d:%d:%d';
-                            array_push(
-                                $vars, 'day', 'hour', 'minute', 'second');
-                            break;
-                        case 'C':
-                            $str .= '%d, %2d:%2d:%2d';
-                            array_push(
-                                $vars, 'day', 'hour', 'minute', 'second');
-                            break;
-                        case 'd':
-                            $str .= '%f';
-                            array_push($vars, 'day');
-                            break;
-                        case 'D':
-                            $str .= '%d';
-                            array_push($vars, 'day');
-                            break;
-                        case 'e':
-                            $str .= '%f';
-                            array_push($vars, 'hour');
-                            break;
-                        case 'f':
-                            $str .= '%f';
-                            array_push($vars, 'minute');
-                            break;
-                        case 'g':
-                            $str .= '%f';
-                            array_push($vars, 'second');
-                            break;
-                        case 'h':
-                            $str .= '%d';
-                            array_push($vars, 'hour');
-                            break;
-                        case 'H':
-                            $str .= '%2d';
-                            array_push($vars, 'hour');
-                            break;
-                        case 'm':
-                            $str .= '%d';
-                            array_push($vars, 'minute');
-                            break;
-                        case 'M':
-                            $str .= '%2d';
-                            array_push($vars, 'minute');
-                            break;
-                        case 'n':
-                            $str .= "\n";
-                            break;
-                        case 'p':
-                            $str .= '%2s';
-                            array_push($vars, 'pm');
-                            break;
-                        case 'r':
-                            $str .= '%2d:%2d:%2d %2s';
-                            array_push(
-                                $vars, 'hour', 'minute', 'second', 'pm');
-                            break;
-                        case 'R':
-                            $str .= '%2d:%2d';
-                            array_push($vars, 'hour', 'minute');
-                            break;
-                        case 's':
-                            $str .= '%d';
-                            array_push($vars, 'second');
-                            break;
-                        case 'S':
-                            $str .= '%2d';
-                            array_push($vars, 'second');
-                            break;
-                        case 't':
-                            $str .= "\t";
-                            break;
-                        case 'T':
-                            $str .= '%2d:%2d:%2d';
-                            array_push($vars, 'hour', 'minute', 'second');
-                            break;
-                        case '%':
-                            $str .= "%";
-                            break;
-                        default:
-                            $str .= $char . $nextchar;
-                    }
-                } else {
-                    $str .= $char;
-                }
-            }
-            $vals = sscanf($time, $str);
-            foreach ($vals as $i => $val) {
-                if (is_null($val)) {
-                    return false;
-                }
-                $$vars[$i] = $val;
-            }
-            if (strcasecmp($pm, 'pm') == 0) {
-                $hour += 12;
-            } elseif (strcasecmp($pm, 'am') != 0) {
-                return false;
-            }
-            $this->setFromArray(array($day, $hour, $minute, $second));
-        // If format is a integer, it uses a predefined format
-        // detection method.
-        } elseif (is_integer($format)) {
-            switch ($format) {
-                case DATE_SPAN_INPUT_FORMAT_NNSV:
-                    $time = preg_split('/\D+/', $time);
-                    switch (count($time)) {
-                        case 0:
-                            return $this->setFromArray(
-                                array(0, 0, 0, 0));
-                        case 1:
-                            return $this->setFromArray(
-                                array(0, $time[0], 0, 0));
-                        case 2:
-                            return $this->setFromArray(
-                                array(0, $time[0], $time[1], 0));
-                        case 3:
-                            return $this->setFromArray(
-                                array(0, $time[0], $time[1], $time[2]));
-                        default:
-                            return $this->setFromArray($time);
-                    }
-                    break;
-            }
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ setFromSeconds()
-
-    /**
-     * Set the time span from a total number of seconds.
-     *
-     * @param  int  $seconds Total number of seconds.
-     *
-     * @return bool True on success.
-     *
-     * @access public
-     */
-    function setFromSeconds($seconds)
-    {
-        if ($seconds < 0) {
-            return false;
-        }
-        $sec  = intval($seconds);
-        $min  = floor($sec / 60);
-        $hour = floor($min / 60);
-        $day  = intval(floor($hour / 24));
-        $this->second = $sec % 60;
-        $this->minute = $min % 60;
-        $this->hour   = $hour % 24;
-        $this->day    = $day;
-        return true;
-    }
-
-    // }}}
-    // {{{ setFromMinutes()
-
-    /**
-     * Set the time span from a total number of minutes.
-     *
-     * @param  float $minutes Total number of minutes.
-     *
-     * @return bool  True on success.
-     *
-     * @access public
-     */
-    function setFromMinutes($minutes)
-    {
-        return $this->setFromSeconds(round($minutes * 60));
-    }
-
-    // }}}
-    // {{{ setFromHours()
-
-    /**
-     * Set the time span from a total number of hours.
-     *
-     * @param  float $hours Total number of hours.
-     *
-     * @return bool  True on success.
-     *
-     * @access public
-     */
-    function setFromHours($hours)
-    {
-        return $this->setFromSeconds(round($hours * 3600));
-    }
-
-    // }}}
-    // {{{ setFromDays()
-
-    /**
-     * Set the time span from a total number of days.
-     *
-     * @param  float $days Total number of days.
-     *
-     * @return bool  True on success.
-     *
-     * @access public
-     */
-    function setFromDays($days)
-    {
-        return $this->setFromSeconds(round($days * 86400));
-    }
-
-    // }}}
-    // {{{ setFromDateDiff()
-
-    /**
-     * Set the span from the elapsed time between two dates.
-     *
-     * Set the span from the elapsed time between two dates. The time span
-     * is allways positive, so the date's order is not important.
-     *
-     * @param  object Date $date1 First Date.
-     * @param  object Date $date2 Second Date.
-     *
-     * @return bool  True on success.
-     *
-     * @access public
-     */
-    function setFromDateDiff($date1, $date2)
-    {
-        if (!is_a($date1, 'date') or !is_a($date2, 'date')) {
-            return false;
-        }
-        $date1->toUTC();
-        $date2->toUTC();
-        if ($date1->after($date2)) {
-            list($date1, $date2) = array($date2, $date1);
-        }
-        $days = Date_Calc::dateDiff(
-            $date1->getDay(), $date1->getMonth(), $date1->getYear(),
-            $date2->getDay(), $date2->getMonth(), $date2->getYear()
-        );
-        $hours = $date2->getHour() - $date1->getHour();
-        $mins  = $date2->getMinute() - $date1->getMinute();
-        $secs  = $date2->getSecond() - $date1->getSecond();
-        $this->setFromSeconds(
-            $days * 86400 + $hours * 3600 + $mins * 60 + $secs
-        );
-        return true;
-    }
-
-    // }}}
-    // {{{ copy()
-
-    /**
-     * Set the time span from another time object.
-     *
-     * @param  object Date_Span $time Source time span object.
-     *
-     * @return bool   True on success.
-     *
-     * @access public
-     */
-    function copy($time)
-    {
-        if (is_a($time, 'date_span')) {
-            $this->second = $time->second;
-            $this->minute = $time->minute;
-            $this->hour   = $time->hour;
-            $this->day    = $time->day;
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ format()
-
-    /**
-     * Time span pretty printing (similar to Date::format()).
-     *
-     * Formats the time span in the given format, similar to
-     * strftime() and Date::format().<br>
-     * <br>
-     * Formatting options:<br>
-     *  <code>%C</code> Days with time, same as "%D, %H:%M:%S".<br>
-     *  <code>%d</code> Total days as a float number
-     *                  (2 days, 12 hours = 2.5 days).<br>
-     *  <code>%D</code> Days as a decimal number.<br>
-     *  <code>%e</code> Total hours as a float number
-     *                  (1 day, 2 hours, 30 minutes = 26.5 hours).<br>
-     *  <code>%E</code> Total hours as a decimal number
-     *                  (1 day, 2 hours, 40 minutes = 26 hours).<br>
-     *  <code>%f</code> Total minutes as a float number
-     *                  (2 minutes, 30 seconds = 2.5 minutes).<br>
-     *  <code>%F</code> Total minutes as a decimal number
-     *                  (1 hour, 2 minutes, 40 seconds = 62 minutes).<br>
-     *  <code>%g</code> Total seconds as a decimal number
-     *                  (2 minutes, 30 seconds = 90 seconds).<br>
-     *  <code>%h</code> Hours as decimal number (0 to 23).<br>
-     *  <code>%H</code> Hours as decimal number (00 to 23).<br>
-     *  <code>%i</code> Hours as decimal number on 12-hour clock
-     *                  (1 to 12).<br>
-     *  <code>%I</code> Hours as decimal number on 12-hour clock
-     *                  (01 to 12).<br>
-     *  <code>%m</code> Minutes as a decimal number (0 to 59).<br>
-     *  <code>%M</code> Minutes as a decimal number (00 to 59).<br>
-     *  <code>%n</code> Newline character (\n).<br>
-     *  <code>%p</code> Either 'am' or 'pm' depending on the time.<br>
-     *  <code>%P</code> Either 'AM' or 'PM' depending on the time.<br>
-     *  <code>%r</code> Time in am/pm notation, same as "%I:%M:%S %p".<br>
-     *  <code>%R</code> Time in 24-hour notation, same as "%H:%M".<br>
-     *  <code>%s</code> Seconds as a decimal number (0 to 59).<br>
-     *  <code>%S</code> Seconds as a decimal number (00 to 59).<br>
-     *  <code>%t</code> Tab character (\t).<br>
-     *  <code>%T</code> Current time equivalent, same as "%H:%M:%S".<br>
-     *  <code>%%</code> Literal '%'.<br>
-     *
-     * @param  string $format The format string for returned time span.
-     *
-     * @return string The time span in specified format.
-     *
-     * @access public
-     */
-    function format($format = null)
-    {
-        if (is_null($format)) {
-            $format = $GLOBALS['_DATE_SPAN_FORMAT'];
-        }
-        $output = '';
-        for ($i = 0; $i < strlen($format); $i++) {
-            $char = $format{$i};
-            if ($char == '%') {
-                $nextchar = $format{++$i};
-                switch ($nextchar) {
-                    case 'C':
-                        $output .= sprintf(
-                            '%d, %02d:%02d:%02d',
-                            $this->day,
-                            $this->hour,
-                            $this->minute,
-                            $this->second
-                        );
-                        break;
-                    case 'd':
-                        $output .= $this->toDays();
-                        break;
-                    case 'D':
-                        $output .= $this->day;
-                        break;
-                    case 'e':
-                        $output .= $this->toHours();
-                        break;
-                    case 'E':
-                        $output .= floor($this->toHours());
-                        break;
-                    case 'f':
-                        $output .= $this->toMinutes();
-                        break;
-                    case 'F':
-                        $output .= floor($this->toMinutes());
-                        break;
-                    case 'g':
-                        $output .= $this->toSeconds();
-                        break;
-                    case 'h':
-                        $output .= $this->hour;
-                        break;
-                    case 'H':
-                        $output .= sprintf('%02d', $this->hour);
-                        break;
-                    case 'i':
-                        $hour =
-                            ($this->hour + 1) > 12 ?
-                            $this->hour - 12 :
-                            $this->hour;
-                        $output .= ($hour == 0) ? 12 : $hour;
-                        break;
-                    case 'I':
-                        $hour =
-                            ($this->hour + 1) > 12 ?
-                            $this->hour - 12 :
-                            $this->hour;
-                        $output .= sprintf('%02d', $hour==0 ? 12 : $hour);
-                        break;
-                    case 'm':
-                        $output .= $this->minute;
-                        break;
-                    case 'M':
-                        $output .= sprintf('%02d',$this->minute);
-                        break;
-                    case 'n':
-                        $output .= "\n";
-                        break;
-                    case 'p':
-                        $output .= $this->hour >= 12 ? 'pm' : 'am';
-                        break;
-                    case 'P':
-                        $output .= $this->hour >= 12 ? 'PM' : 'AM';
-                        break;
-                    case 'r':
-                        $hour =
-                            ($this->hour + 1) > 12 ?
-                            $this->hour - 12 :
-                            $this->hour;
-                        $output .= sprintf(
-                            '%02d:%02d:%02d %s',
-                            $hour==0 ?  12 : $hour,
-                            $this->minute,
-                            $this->second,
-                            $this->hour >= 12 ? 'pm' : 'am'
-                        );
-                        break;
-                    case 'R':
-                        $output .= sprintf(
-                            '%02d:%02d', $this->hour, $this->minute
-                        );
-                        break;
-                    case 's':
-                        $output .= $this->second;
-                        break;
-                    case 'S':
-                        $output .= sprintf('%02d', $this->second);
-                        break;
-                    case 't':
-                        $output .= "\t";
-                        break;
-                    case 'T':
-                        $output .= sprintf(
-                            '%02d:%02d:%02d',
-                            $this->hour, $this->minute, $this->second
-                        );
-                        break;
-                    case '%':
-                        $output .= "%";
-                        break;
-                    default:
-                        $output .= $char . $nextchar;
-                }
-            } else {
-                $output .= $char;
-            }
-        }
-        return $output;
-    }
-
-    // }}}
-    // {{{ toSeconds()
-
-    /**
-     * Convert time span to seconds.
-     *
-     * @return int Time span as an integer number of seconds.
-     *
-     * @access public
-     */
-    function toSeconds()
-    {
-        return $this->day * 86400 + $this->hour * 3600 +
-            $this->minute * 60 + $this->second;
-    }
-
-    // }}}
-    // {{{ toMinutes()
-
-    /**
-     * Convert time span to minutes.
-     *
-     * @return float Time span as a decimal number of minutes.
-     *
-     * @access public
-     */
-    function toMinutes()
-    {
-        return $this->day * 1440 + $this->hour * 60 + $this->minute +
-            $this->second / 60;
-    }
-
-    // }}}
-    // {{{ toHours()
-
-    /**
-     * Convert time span to hours.
-     *
-     * @return float Time span as a decimal number of hours.
-     *
-     * @access public
-     */
-    function toHours()
-    {
-        return $this->day * 24 + $this->hour + $this->minute / 60 +
-            $this->second / 3600;
-    }
-
-    // }}}
-    // {{{ toDays()
-
-    /**
-     * Convert time span to days.
-     *
-     * @return float Time span as a decimal number of days.
-     *
-     * @access public
-     */
-    function toDays()
-    {
-        return $this->day + $this->hour / 24 + $this->minute / 1440 +
-            $this->second / 86400;
-    }
-
-    // }}}
-    // {{{ add()
-
-    /**
-     * Adds a time span.
-     *
-     * @param  object Date_Span $time Time span to add.
-     *
-     * @access public
-     */
-    function add($time)
-    {
-        return $this->setFromSeconds(
-            $this->toSeconds() + $time->toSeconds()
-        );
-    }
-
-    // }}}
-    // {{{ substract()
-
-    /**
-     * Subtracts a time span.
-     *
-     * Subtracts a time span. If the time span to subtract is larger
-     * than the original, the result is zero (there's no sense in
-     * negative time spans).
-     *
-     * @param  object Date_Span $time Time span to subtract.
-     *
-     * @access public
-     */
-    function subtract($time)
-    {
-        $sub = $this->toSeconds() - $time->toSeconds();
-        if ($sub < 0) {
-            $this->setFromSeconds(0);
-        } else {
-            $this->setFromSeconds($sub);
-        }
-    }
-
-    // }}}
-    // {{{ equal()
-
-    /**
-     * Tells if time span is equal to $time.
-     *
-     * @param  object Date_Span $time Time span to compare to.
-     *
-     * @return bool   True if the time spans are equal.
-     *
-     * @access public
-     */
-    function equal($time)
-    {
-        return $this->toSeconds() == $time->toSeconds();
-    }
-
-    // }}}
-    // {{{ greaterEqual()
-
-    /**
-     * Tells if this time span is greater or equal than $time.
-     *
-     * @param  object Date_Span $time Time span to compare to.
-     *
-     * @return bool   True if this time span is greater or equal than $time.
-     *
-     * @access public
-     */
-    function greaterEqual($time)
-    {
-        return $this->toSeconds() >= $time->toSeconds();
-    }
-
-    // }}}
-    // {{{ lowerEqual()
-
-    /**
-     * Tells if this time span is lower or equal than $time.
-     *
-     * @param  object Date_Span $time Time span to compare to.
-     *
-     * @return bool   True if this time span is lower or equal than $time.
-     *
-     * @access public
-     */
-    function lowerEqual($time)
-    {
-        return $this->toSeconds() <= $time->toSeconds();
-    }
-
-    // }}}
-    // {{{ greater()
-
-    /**
-     * Tells if this time span is greater than $time.
-     *
-     * @param  object Date_Span $time Time span to compare to.
-     *
-     * @return bool   True if this time span is greater than $time.
-     *
-     * @access public
-     */
-    function greater($time)
-    {
-        return $this->toSeconds() > $time->toSeconds();
-    }
-
-    // }}}
-    // {{{ lower()
-
-    /**
-     * Tells if this time span is lower than $time.
-     *
-     * @param  object Date_Span $time Time span to compare to.
-     *
-     * @return bool   True if this time span is lower than $time.
-     *
-     * @access public
-     */
-    function lower($time)
-    {
-        return $this->toSeconds() < $time->toSeconds();
-    }
-
-    // }}}
-    // {{{ compare()
-
-    /**
-     * Compares two time spans.
-     *
-     * Compares two time spans. Suitable for use in sorting functions.
-     *
-     * @param  object Date_Span $time1 The first time span.
-     * @param  object Date_Span $time2 The second time span.
-     *
-     * @return int    0 if the time spans are equal, -1 if time1 is lower
-     *                than time2, 1 if time1 is greater than time2.
-     *
-     * @static
-     * @access public
-     */
-    function compare($time1, $time2)
-    {
-        if ($time1->equal($time2)) {
-            return 0;
-        } elseif ($time1->lower($time2)) {
-            return -1;
-        } else {
-            return 1;
-        }
-    }
-
-    // }}}
-    // {{{ isEmpty()
-
-    /**
-     * Tells if the time span is empty (zero length).
-     *
-     * @return bool True is it's empty.
-     */
-    function isEmpty()
-    {
-        return !$this->day && !$this->hour && !$this->minute && !$this->second;
-    }
-
-    // }}}
-    // {{{ setDefaultInputFormat()
-
-    /**
-     * Set the default input format.
-     *
-     * @param  mixed $format New default input format.
-     *
-     * @return mixed Previous default input format.
-     *
-     * @static
-     */
-    function setDefaultInputFormat($format)
-    {
-        $old = $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
-        $GLOBALS['_DATE_SPAN_INPUT_FORMAT'] = $format;
-        return $old;
-    }
-
-    // }}}
-    // {{{ getDefaultInputFormat()
-
-    /**
-     * Get the default input format.
-     *
-     * @return mixed Default input format.
-     *
-     * @static
-     */
-    function getDefaultInputFormat()
-    {
-        return $GLOBALS['_DATE_SPAN_INPUT_FORMAT'];
-    }
-
-    // }}}
-    // {{{ setDefaultFormat()
-
-    /**
-     * Set the default format.
-     *
-     * @param  mixed $format New default format.
-     *
-     * @return mixed Previous default format.
-     *
-     * @static
-     */
-    function setDefaultFormat($format)
-    {
-        $old = $GLOBALS['_DATE_SPAN_FORMAT'];
-        $GLOBALS['_DATE_SPAN_FORMAT'] = $format;
-        return $old;
-    }
-
-    // }}}
-    // {{{ getDefaultFormat()
-
-    /**
-     * Get the default format.
-     *
-     * @return mixed Default format.
-     *
-     * @static
-     */
-    function getDefaultFormat()
-    {
-        return $GLOBALS['_DATE_SPAN_FORMAT'];
-    }
-
-    // }}}
-    // {{{ __clone()
-
-    /**
-     * Returns a copy of the object (workarround for PHP5 forward compatibility).
-     *
-     * @return object Date_Span Copy of the object.
-     */
-    function __clone() {
-        $c = get_class($this);
-        $s = new $c;
-        $s->day    = $this->day;
-        $s->hour   = $this->hour;
-        $s->minute = $this->minute;
-        $s->second = $this->second;
-        return $s;
-    }
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/php/Date/TimeZone.php b/lib/php/Date/TimeZone.php
deleted file mode 100644
index 78c9d3ff4750dc54a5ccfd86652f4011a1d50d62..0000000000000000000000000000000000000000
--- a/lib/php/Date/TimeZone.php
+++ /dev/null
@@ -1,4731 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-
-// {{{ Header
-
-/**
- * TimeZone representation class, along with time zone information data
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 1997-2006 Baba Buehler, Pierre-Alain Joye
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted under the terms of the BSD License.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Baba Buehler <baba@babaz.com>
- * @author     Pierre-Alain Joye <pajoye@php.net>
- * @copyright  1997-2006 Baba Buehler, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    CVS: $Id: TimeZone.php,v 1.14 2006/11/22 01:03:12 firman Exp $
- * @link       http://pear.php.net/package/Date
- */
-
-// }}}
-// {{{ Class: Date_TimeZone
-
-/**
- * TimeZone representation class, along with time zone information data
- *
- * The default timezone is set from the first valid timezone id found
- * in one of the following places, in this order:
- *   + global $_DATE_TIMEZONE_DEFAULT
- *   + system environment variable PHP_TZ
- *   + system environment variable TZ
- *   + the result of date('T')
- *
- * If no valid timezone id is found, the default timezone is set to 'UTC'.
- * You may also manually set the default timezone by passing a valid id to
- * Date_TimeZone::setDefault().
- *
- * This class includes time zone data (from zoneinfo) in the form of a
- * global array, $_DATE_TIMEZONE_DATA.
- *
- * @author     Baba Buehler <baba@babaz.com>
- * @copyright  1997-2006 Baba Buehler, Pierre-Alain Joye
- * @license    http://www.opensource.org/licenses/bsd-license.php
- *             BSD License
- * @version    Release: 1.4.7
- * @link       http://pear.php.net/package/Date
- */
-class Date_TimeZone
-{
-    // {{{ Properties
-
-    /**
-     * Time Zone ID of this time zone
-     * @var string
-     */
-    var $id;
-
-    /**
-     * Long Name of this time zone (ie Central Standard Time)
-     * @var string
-     */
-    var $longname;
-
-    /**
-     * Short Name of this time zone (ie CST)
-     * @var string
-     */
-    var $shortname;
-
-    /**
-     * true if this time zone observes daylight savings time
-     * @var boolean
-     */
-    var $hasdst;
-
-    /**
-     * DST Long Name of this time zone
-     * @var string
-     */
-    var $dstlongname;
-
-    /**
-     * DST Short Name of this timezone
-     * @var string
-     */
-    var $dstshortname;
-
-    /**
-     * offset, in milliseconds, of this timezone
-     * @var int
-     */
-    var $offset;
-
-    /**
-     * System Default Time Zone
-     * @var object Date_TimeZone
-     */
-    var $default;
-
-    // }}}
-    // {{{ Constructor
-
-    /**
-     * Constructor
-     *
-     * Creates a new Date::TimeZone object, representing the time zone
-     * specified in $id.  If the supplied ID is invalid, the created
-     * time zone is UTC.
-     *
-     * @access public
-     * @param string $id the time zone id
-     * @return object Date_TimeZone the new Date_TimeZone object
-     */
-    function Date_TimeZone($id)
-    {
-        $_DATE_TIMEZONE_DATA =& $GLOBALS['_DATE_TIMEZONE_DATA'];
-        if(Date_TimeZone::isValidID($id)) {
-            $this->id = $id;
-            $this->longname = $_DATE_TIMEZONE_DATA[$id]['longname'];
-            $this->shortname = $_DATE_TIMEZONE_DATA[$id]['shortname'];
-            $this->offset = $_DATE_TIMEZONE_DATA[$id]['offset'];
-            if($_DATE_TIMEZONE_DATA[$id]['hasdst']) {
-                $this->hasdst = true;
-                $this->dstlongname = $_DATE_TIMEZONE_DATA[$id]['dstlongname'];
-                $this->dstshortname = $_DATE_TIMEZONE_DATA[$id]['dstshortname'];
-            } else {
-                $this->hasdst = false;
-                $this->dstlongname = $this->longname;
-                $this->dstshortname = $this->shortname;
-            }
-        } else {
-            $this->id = 'UTC';
-            $this->longname = $_DATE_TIMEZONE_DATA[$this->id]['longname'];
-            $this->shortname = $_DATE_TIMEZONE_DATA[$this->id]['shortname'];
-            $this->hasdst = $_DATE_TIMEZONE_DATA[$this->id]['hasdst'];
-            $this->offset = $_DATE_TIMEZONE_DATA[$this->id]['offset'];
-        }
-    }
-
-    // }}}
-    // {{{ getDefault()
-
-    /**
-     * Return a TimeZone object representing the system default time zone
-     *
-     * Return a TimeZone object representing the system default time zone,
-     * which is initialized during the loading of TimeZone.php.
-     *
-     * @access public
-     * @return object Date_TimeZone the default time zone
-     */
-    function getDefault()
-    {
-        return new Date_TimeZone($GLOBALS['_DATE_TIMEZONE_DEFAULT']);
-    }
-
-    // }}}
-    // {{{ setDefault()
-
-    /**
-     * Sets the system default time zone to the time zone in $id
-     *
-     * Sets the system default time zone to the time zone in $id
-     *
-     * @access public
-     * @param string $id the time zone id to use
-     */
-    function setDefault($id)
-    {
-        if(Date_TimeZone::isValidID($id)) {
-            $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = $id;
-        }
-    }
-
-    // }}}
-    // {{{ isValidID()
-
-    /**
-     * Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data
-     *
-     * Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data
-     *
-     * @access public
-     * @param string $id the id to test
-     * @return boolean true if the supplied ID is valid
-     */
-    function isValidID($id)
-    {
-        if(isset($GLOBALS['_DATE_TIMEZONE_DATA'][$id])) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ isEqual()
-
-    /**
-     * Is this time zone equal to another
-     *
-     * Tests to see if this time zone is equal (ids match)
-     * to a given Date_TimeZone object.
-     *
-     * @access public
-     * @param object Date_TimeZone $tz the timezone to test
-     * @return boolean true if this time zone is equal to the supplied time zone
-     */
-    function isEqual($tz)
-    {
-        if(strcasecmp($this->id, $tz->id) == 0) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ isEquivalent()
-
-    /**
-     * Is this time zone equivalent to another
-     *
-     * Tests to see if this time zone is equivalent to
-     * a given time zone object.  Equivalence in this context
-     * is defined by the two time zones having an equal raw
-     * offset and an equal setting of "hasdst".  This is not true
-     * equivalence, as the two time zones may have different rules
-     * for the observance of DST, but this implementation does not
-     * know DST rules.
-     *
-     * @access public
-     * @param object Date_TimeZone $tz the timezone object to test
-     * @return boolean true if this time zone is equivalent to the supplied time zone
-     */
-    function isEquivalent($tz)
-    {
-        if($this->offset == $tz->offset && $this->hasdst == $tz->hasdst) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // }}}
-    // {{{ hasDaylightTime()
-
-    /**
-     * Returns true if this zone observes daylight savings time
-     *
-     * Returns true if this zone observes daylight savings time
-     *
-     * @access public
-     * @return boolean true if this time zone has DST
-     */
-    function hasDaylightTime()
-    {
-        return $this->hasdst;
-    }
-
-    // }}}
-    // {{{ inDaylightTime()
-
-    /**
-     * Is the given date/time in DST for this time zone
-     *
-     * Attempts to determine if a given Date object represents a date/time
-     * that is in DST for this time zone.  WARNINGS: this basically attempts to
-     * "trick" the system into telling us if we're in DST for a given time zone.
-     * This uses putenv() which may not work in safe mode, and relies on unix time
-     * which is only valid for dates from 1970 to ~2038.  This relies on the
-     * underlying OS calls, so it may not work on Windows or on a system where
-     * zoneinfo is not installed or configured properly.
-     *
-     * @access public
-     * @param object Date $date the date/time to test
-     * @return boolean true if this date is in DST for this time zone
-     */
-    function inDaylightTime($date)
-    {
-        $env_tz = '';
-        if(isset($_ENV['TZ']) && getenv('TZ')) {
-            $env_tz = getenv('TZ');
-        }
-
-        putenv('TZ=' . $this->id);
-        $ltime = localtime($date->getTime(), true);
-        if ($env_tz != '') {
-            putenv('TZ=' . $env_tz);
-        }
-        return $ltime['tm_isdst'];
-    }
-
-    // }}}
-    // {{{ getDSTSavings()
-
-    /**
-     * Get the DST offset for this time zone
-     *
-     * Returns the DST offset of this time zone, in milliseconds,
-     * if the zone observes DST, zero otherwise.  Currently the
-     * DST offset is hard-coded to one hour.
-     *
-     * @access public
-     * @return int the DST offset, in milliseconds or zero if the zone does not observe DST
-     */
-    function getDSTSavings()
-    {
-        if($this->hasdst) {
-            return 3600000;
-        } else {
-            return 0;
-        }
-    }
-
-    // }}}
-    // {{{ getOffset()
-
-    /**
-     * Get the DST-corrected offset to UTC for the given date
-     *
-     * Attempts to get the offset to UTC for a given date/time, taking into
-     * account daylight savings time, if the time zone observes it and if
-     * it is in effect.  Please see the WARNINGS on Date::TimeZone::inDaylightTime().
-     *
-     *
-     * @access public
-     * @param object Date $date the Date to test
-     * @return int the corrected offset to UTC in milliseconds
-     */
-    function getOffset($date)
-    {
-        if($this->inDaylightTime($date)) {
-            return $this->offset + $this->getDSTSavings();
-        } else {
-            return $this->offset;
-        }
-    }
-
-    // }}}
-    // {{{ getAvailableIDs()
-
-    /**
-     * Returns the list of valid time zone id strings
-     *
-     * Returns the list of valid time zone id strings
-     *
-     * @access public
-     * @return mixed an array of strings with the valid time zone IDs
-     */
-    function getAvailableIDs()
-    {
-        return array_keys($GLOBALS['_DATE_TIMEZONE_DATA']);
-    }
-
-    // }}}
-    // {{{ getID()
-
-    /**
-     * Returns the id for this time zone
-     *
-     * Returns the time zone id  for this time zone, i.e. "America/Chicago"
-     *
-     * @access public
-     * @return string the id
-     */
-    function getID()
-    {
-        return $this->id;
-    }
-
-    // }}}
-    // {{{ getLongName()
-
-    /**
-     * Returns the long name for this time zone
-     *
-     * Returns the long name for this time zone,
-     * i.e. "Central Standard Time"
-     *
-     * @access public
-     * @return string the long name
-     */
-    function getLongName()
-    {
-        return $this->longname;
-    }
-
-    // }}}
-    // {{{ getShortName()
-
-    /**
-     * Returns the short name for this time zone
-     *
-     * Returns the short name for this time zone, i.e. "CST"
-     *
-     * @access public
-     * @return string the short name
-     */
-    function getShortName()
-    {
-        return $this->shortname;
-    }
-
-    // }}}
-    // {{{ getDSTLongName()
-
-    /**
-     * Returns the DST long name for this time zone
-     *
-     * Returns the DST long name for this time zone, i.e. "Central Daylight Time"
-     *
-     * @access public
-     * @return string the daylight savings time long name
-     */
-    function getDSTLongName()
-    {
-        return $this->dstlongname;
-    }
-
-    // }}}
-    // {{{ getDSTShortName()
-
-    /**
-     * Returns the DST short name for this time zone
-     *
-     * Returns the DST short name for this time zone, i.e. "CDT"
-     *
-     * @access public
-     * @return string the daylight savings time short name
-     */
-    function getDSTShortName()
-    {
-        return $this->dstshortname;
-    }
-
-    // }}}
-    // {{{ getRawOffset()
-
-    /**
-     * Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone
-     *
-     * Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone
-     *
-     * @access public
-     * @return int the offset, in milliseconds
-     */
-    function getRawOffset()
-    {
-        return $this->offset;
-    }
-
-    // }}}
-}
-
-// }}}
-
-/**
- * Time Zone Data offset is in miliseconds
- *
- * @global array $GLOBALS['_DATE_TIMEZONE_DATA']
- */
-$GLOBALS['_DATE_TIMEZONE_DATA'] = array(
-    'Etc/GMT+12' => array(
-        'offset' => -43200000,
-        'longname' => 'GMT-12:00',
-        'shortname' => 'GMT-12:00',
-        'hasdst' => false ),
-    'Etc/GMT+11' => array(
-        'offset' => -39600000,
-        'longname' => 'GMT-11:00',
-        'shortname' => 'GMT-11:00',
-        'hasdst' => false ),
-    'MIT' => array(
-        'offset' => -39600000,
-        'longname' => 'West Samoa Time',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Pacific/Apia' => array(
-        'offset' => -39600000,
-        'longname' => 'West Samoa Time',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Pacific/Midway' => array(
-        'offset' => -39600000,
-        'longname' => 'Samoa Standard Time',
-        'shortname' => 'SST',
-        'hasdst' => false ),
-    'Pacific/Niue' => array(
-        'offset' => -39600000,
-        'longname' => 'Niue Time',
-        'shortname' => 'NUT',
-        'hasdst' => false ),
-    'Pacific/Pago_Pago' => array(
-        'offset' => -39600000,
-        'longname' => 'Samoa Standard Time',
-        'shortname' => 'SST',
-        'hasdst' => false ),
-    'Pacific/Samoa' => array(
-        'offset' => -39600000,
-        'longname' => 'Samoa Standard Time',
-        'shortname' => 'SST',
-        'hasdst' => false ),
-    'US/Samoa' => array(
-        'offset' => -39600000,
-        'longname' => 'Samoa Standard Time',
-        'shortname' => 'SST',
-        'hasdst' => false ),
-    'America/Adak' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii-Aleutian Standard Time',
-        'shortname' => 'HAST',
-        'hasdst' => true,
-        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
-        'dstshortname' => 'HADT' ),
-    'America/Atka' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii-Aleutian Standard Time',
-        'shortname' => 'HAST',
-        'hasdst' => true,
-        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
-        'dstshortname' => 'HADT' ),
-    'Etc/GMT+10' => array(
-        'offset' => -36000000,
-        'longname' => 'GMT-10:00',
-        'shortname' => 'GMT-10:00',
-        'hasdst' => false ),
-    'HST' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'Pacific/Fakaofo' => array(
-        'offset' => -36000000,
-        'longname' => 'Tokelau Time',
-        'shortname' => 'TKT',
-        'hasdst' => false ),
-    'Pacific/Honolulu' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'Pacific/Johnston' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'Pacific/Rarotonga' => array(
-        'offset' => -36000000,
-        'longname' => 'Cook Is. Time',
-        'shortname' => 'CKT',
-        'hasdst' => false ),
-    'Pacific/Tahiti' => array(
-        'offset' => -36000000,
-        'longname' => 'Tahiti Time',
-        'shortname' => 'TAHT',
-        'hasdst' => false ),
-    'SystemV/HST10' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'US/Aleutian' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii-Aleutian Standard Time',
-        'shortname' => 'HAST',
-        'hasdst' => true,
-        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
-        'dstshortname' => 'HADT' ),
-    'US/Hawaii' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'Pacific/Marquesas' => array(
-        'offset' => -34200000,
-        'longname' => 'Marquesas Time',
-        'shortname' => 'MART',
-        'hasdst' => false ),
-    'AST' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'America/Anchorage' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'America/Juneau' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'America/Nome' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'America/Yakutat' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'Etc/GMT+9' => array(
-        'offset' => -32400000,
-        'longname' => 'GMT-09:00',
-        'shortname' => 'GMT-09:00',
-        'hasdst' => false ),
-    'Pacific/Gambier' => array(
-        'offset' => -32400000,
-        'longname' => 'Gambier Time',
-        'shortname' => 'GAMT',
-        'hasdst' => false ),
-    'SystemV/YST9' => array(
-        'offset' => -32400000,
-        'longname' => 'Gambier Time',
-        'shortname' => 'GAMT',
-        'hasdst' => false ),
-    'SystemV/YST9YDT' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'US/Alaska' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'America/Dawson' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Ensenada' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Los_Angeles' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Tijuana' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Vancouver' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Whitehorse' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'Canada/Pacific' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'Canada/Yukon' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'Etc/GMT+8' => array(
-        'offset' => -28800000,
-        'longname' => 'GMT-08:00',
-        'shortname' => 'GMT-08:00',
-        'hasdst' => false ),
-    'Mexico/BajaNorte' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'PST' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'PST8PDT' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'Pacific/Pitcairn' => array(
-        'offset' => -28800000,
-        'longname' => 'Pitcairn Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => false ),
-    'SystemV/PST8' => array(
-        'offset' => -28800000,
-        'longname' => 'Pitcairn Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => false ),
-    'SystemV/PST8PDT' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'US/Pacific' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'US/Pacific-New' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'America/Boise' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Cambridge_Bay' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Chihuahua' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Dawson_Creek' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'America/Denver' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Edmonton' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Hermosillo' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'America/Inuvik' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Mazatlan' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Phoenix' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'America/Shiprock' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Yellowknife' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'Canada/Mountain' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'Etc/GMT+7' => array(
-        'offset' => -25200000,
-        'longname' => 'GMT-07:00',
-        'shortname' => 'GMT-07:00',
-        'hasdst' => false ),
-    'MST' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'MST7MDT' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'Mexico/BajaSur' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'Navajo' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'PNT' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'SystemV/MST7' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'SystemV/MST7MDT' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'US/Arizona' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => false ),
-    'US/Mountain' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'America/Belize' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Cancun' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Chicago' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Costa_Rica' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/El_Salvador' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Guatemala' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Managua' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Menominee' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Merida' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Mexico_City' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Monterrey' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/North_Dakota/Center' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Rainy_River' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Rankin_Inlet' => array(
-        'offset' => -21600000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Regina' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Swift_Current' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Tegucigalpa' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'America/Winnipeg' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'CST' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'CST6CDT' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'Canada/Central' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'Canada/East-Saskatchewan' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Canada/Saskatchewan' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Chile/EasterIsland' => array(
-        'offset' => -21600000,
-        'longname' => 'Easter Is. Time',
-        'shortname' => 'EAST',
-        'hasdst' => true,
-        'dstlongname' => 'Easter Is. Summer Time',
-        'dstshortname' => 'EASST' ),
-    'Etc/GMT+6' => array(
-        'offset' => -21600000,
-        'longname' => 'GMT-06:00',
-        'shortname' => 'GMT-06:00',
-        'hasdst' => false ),
-    'Mexico/General' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Pacific/Easter' => array(
-        'offset' => -21600000,
-        'longname' => 'Easter Is. Time',
-        'shortname' => 'EAST',
-        'hasdst' => true,
-        'dstlongname' => 'Easter Is. Summer Time',
-        'dstshortname' => 'EASST' ),
-    'Pacific/Galapagos' => array(
-        'offset' => -21600000,
-        'longname' => 'Galapagos Time',
-        'shortname' => 'GALT',
-        'hasdst' => false ),
-    'SystemV/CST6' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'SystemV/CST6CDT' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'US/Central' => array(
-        'offset' => -21600000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Bogota' => array(
-        'offset' => -18000000,
-        'longname' => 'Colombia Time',
-        'shortname' => 'COT',
-        'hasdst' => false ),
-    'America/Cayman' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Detroit' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Eirunepe' => array(
-        'offset' => -18000000,
-        'longname' => 'Acre Time',
-        'shortname' => 'ACT',
-        'hasdst' => false ),
-    'America/Fort_Wayne' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Grand_Turk' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Guayaquil' => array(
-        'offset' => -18000000,
-        'longname' => 'Ecuador Time',
-        'shortname' => 'ECT',
-        'hasdst' => false ),
-    'America/Havana' => array(
-        'offset' => -18000000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'America/Indiana/Indianapolis' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Indiana/Knox' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Indiana/Marengo' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Indiana/Vevay' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Indianapolis' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Iqaluit' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Jamaica' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Kentucky/Louisville' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Kentucky/Monticello' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Knox_IN' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Lima' => array(
-        'offset' => -18000000,
-        'longname' => 'Peru Time',
-        'shortname' => 'PET',
-        'hasdst' => false ),
-    'America/Louisville' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Montreal' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Nassau' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/New_York' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Nipigon' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Panama' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Pangnirtung' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Port-au-Prince' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'America/Porto_Acre' => array(
-        'offset' => -18000000,
-        'longname' => 'Acre Time',
-        'shortname' => 'ACT',
-        'hasdst' => false ),
-    'America/Rio_Branco' => array(
-        'offset' => -18000000,
-        'longname' => 'Acre Time',
-        'shortname' => 'ACT',
-        'hasdst' => false ),
-    'America/Thunder_Bay' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'Brazil/Acre' => array(
-        'offset' => -18000000,
-        'longname' => 'Acre Time',
-        'shortname' => 'ACT',
-        'hasdst' => false ),
-    'Canada/Eastern' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'Cuba' => array(
-        'offset' => -18000000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'EST' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'EST5EDT' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'Etc/GMT+5' => array(
-        'offset' => -18000000,
-        'longname' => 'GMT-05:00',
-        'shortname' => 'GMT-05:00',
-        'hasdst' => false ),
-    'IET' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'Jamaica' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'SystemV/EST5' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'SystemV/EST5EDT' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'US/East-Indiana' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'US/Eastern' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'US/Indiana-Starke' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'US/Michigan' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'America/Anguilla' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Antigua' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Aruba' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Asuncion' => array(
-        'offset' => -14400000,
-        'longname' => 'Paraguay Time',
-        'shortname' => 'PYT',
-        'hasdst' => true,
-        'dstlongname' => 'Paraguay Summer Time',
-        'dstshortname' => 'PYST' ),
-    'America/Barbados' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Boa_Vista' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => false ),
-    'America/Caracas' => array(
-        'offset' => -14400000,
-        'longname' => 'Venezuela Time',
-        'shortname' => 'VET',
-        'hasdst' => false ),
-    'America/Cuiaba' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => true,
-        'dstlongname' => 'Amazon Summer Time',
-        'dstshortname' => 'AMST' ),
-    'America/Curacao' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Dominica' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Glace_Bay' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'America/Goose_Bay' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'America/Grenada' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Guadeloupe' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Guyana' => array(
-        'offset' => -14400000,
-        'longname' => 'Guyana Time',
-        'shortname' => 'GYT',
-        'hasdst' => false ),
-    'America/Halifax' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'America/La_Paz' => array(
-        'offset' => -14400000,
-        'longname' => 'Bolivia Time',
-        'shortname' => 'BOT',
-        'hasdst' => false ),
-    'America/Manaus' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => false ),
-    'America/Martinique' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Montserrat' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Port_of_Spain' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Porto_Velho' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => false ),
-    'America/Puerto_Rico' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Santiago' => array(
-        'offset' => -14400000,
-        'longname' => 'Chile Time',
-        'shortname' => 'CLT',
-        'hasdst' => true,
-        'dstlongname' => 'Chile Summer Time',
-        'dstshortname' => 'CLST' ),
-    'America/Santo_Domingo' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/St_Kitts' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/St_Lucia' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/St_Thomas' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/St_Vincent' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Thule' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Tortola' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'America/Virgin' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'Antarctica/Palmer' => array(
-        'offset' => -14400000,
-        'longname' => 'Chile Time',
-        'shortname' => 'CLT',
-        'hasdst' => true,
-        'dstlongname' => 'Chile Summer Time',
-        'dstshortname' => 'CLST' ),
-    'Atlantic/Bermuda' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'Atlantic/Stanley' => array(
-        'offset' => -14400000,
-        'longname' => 'Falkland Is. Time',
-        'shortname' => 'FKT',
-        'hasdst' => true,
-        'dstlongname' => 'Falkland Is. Summer Time',
-        'dstshortname' => 'FKST' ),
-    'Brazil/West' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => false ),
-    'Canada/Atlantic' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'Chile/Continental' => array(
-        'offset' => -14400000,
-        'longname' => 'Chile Time',
-        'shortname' => 'CLT',
-        'hasdst' => true,
-        'dstlongname' => 'Chile Summer Time',
-        'dstshortname' => 'CLST' ),
-    'Etc/GMT+4' => array(
-        'offset' => -14400000,
-        'longname' => 'GMT-04:00',
-        'shortname' => 'GMT-04:00',
-        'hasdst' => false ),
-    'PRT' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'SystemV/AST4' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'SystemV/AST4ADT' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'America/St_Johns' => array(
-        'offset' => -12600000,
-        'longname' => 'Newfoundland Standard Time',
-        'shortname' => 'NST',
-        'hasdst' => true,
-        'dstlongname' => 'Newfoundland Daylight Time',
-        'dstshortname' => 'NDT' ),
-    'CNT' => array(
-        'offset' => -12600000,
-        'longname' => 'Newfoundland Standard Time',
-        'shortname' => 'NST',
-        'hasdst' => true,
-        'dstlongname' => 'Newfoundland Daylight Time',
-        'dstshortname' => 'NDT' ),
-    'Canada/Newfoundland' => array(
-        'offset' => -12600000,
-        'longname' => 'Newfoundland Standard Time',
-        'shortname' => 'NST',
-        'hasdst' => true,
-        'dstlongname' => 'Newfoundland Daylight Time',
-        'dstshortname' => 'NDT' ),
-    'AGT' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Araguaina' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'America/Belem' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => false ),
-    'America/Buenos_Aires' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Catamarca' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Cayenne' => array(
-        'offset' => -10800000,
-        'longname' => 'French Guiana Time',
-        'shortname' => 'GFT',
-        'hasdst' => false ),
-    'America/Cordoba' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Fortaleza' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'America/Godthab' => array(
-        'offset' => -10800000,
-        'longname' => 'Western Greenland Time',
-        'shortname' => 'WGT',
-        'hasdst' => true,
-        'dstlongname' => 'Western Greenland Summer Time',
-        'dstshortname' => 'WGST' ),
-    'America/Jujuy' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Maceio' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'America/Mendoza' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Miquelon' => array(
-        'offset' => -10800000,
-        'longname' => 'Pierre & Miquelon Standard Time',
-        'shortname' => 'PMST',
-        'hasdst' => true,
-        'dstlongname' => 'Pierre & Miquelon Daylight Time',
-        'dstshortname' => 'PMDT' ),
-    'America/Montevideo' => array(
-        'offset' => -10800000,
-        'longname' => 'Uruguay Time',
-        'shortname' => 'UYT',
-        'hasdst' => false ),
-    'America/Paramaribo' => array(
-        'offset' => -10800000,
-        'longname' => 'Suriname Time',
-        'shortname' => 'SRT',
-        'hasdst' => false ),
-    'America/Recife' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'America/Rosario' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'America/Sao_Paulo' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'BET' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'Brazil/East' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'Etc/GMT+3' => array(
-        'offset' => -10800000,
-        'longname' => 'GMT-03:00',
-        'shortname' => 'GMT-03:00',
-        'hasdst' => false ),
-    'America/Noronha' => array(
-        'offset' => -7200000,
-        'longname' => 'Fernando de Noronha Time',
-        'shortname' => 'FNT',
-        'hasdst' => false ),
-    'Atlantic/South_Georgia' => array(
-        'offset' => -7200000,
-        'longname' => 'South Georgia Standard Time',
-        'shortname' => 'GST',
-        'hasdst' => false ),
-    'Brazil/DeNoronha' => array(
-        'offset' => -7200000,
-        'longname' => 'Fernando de Noronha Time',
-        'shortname' => 'FNT',
-        'hasdst' => false ),
-    'Etc/GMT+2' => array(
-        'offset' => -7200000,
-        'longname' => 'GMT-02:00',
-        'shortname' => 'GMT-02:00',
-        'hasdst' => false ),
-    'America/Scoresbysund' => array(
-        'offset' => -3600000,
-        'longname' => 'Eastern Greenland Time',
-        'shortname' => 'EGT',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Greenland Summer Time',
-        'dstshortname' => 'EGST' ),
-    'Atlantic/Azores' => array(
-        'offset' => -3600000,
-        'longname' => 'Azores Time',
-        'shortname' => 'AZOT',
-        'hasdst' => true,
-        'dstlongname' => 'Azores Summer Time',
-        'dstshortname' => 'AZOST' ),
-    'Atlantic/Cape_Verde' => array(
-        'offset' => -3600000,
-        'longname' => 'Cape Verde Time',
-        'shortname' => 'CVT',
-        'hasdst' => false ),
-    'Etc/GMT+1' => array(
-        'offset' => -3600000,
-        'longname' => 'GMT-01:00',
-        'shortname' => 'GMT-01:00',
-        'hasdst' => false ),
-    'Africa/Abidjan' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Accra' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Bamako' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Banjul' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Bissau' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Casablanca' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => false ),
-    'Africa/Conakry' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Dakar' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/El_Aaiun' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => false ),
-    'Africa/Freetown' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Lome' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Monrovia' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Nouakchott' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Ouagadougou' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Sao_Tome' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Africa/Timbuktu' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'America/Danmarkshavn' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Atlantic/Canary' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'Atlantic/Faeroe' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'Atlantic/Madeira' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'Atlantic/Reykjavik' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Atlantic/St_Helena' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Eire' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'Irish Summer Time',
-        'dstshortname' => 'IST' ),
-    'Etc/GMT' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Etc/GMT+0' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Etc/GMT-0' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Etc/GMT0' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Etc/Greenwich' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Etc/UCT' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Etc/UTC' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Etc/Universal' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Etc/Zulu' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Europe/Belfast' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'British Summer Time',
-        'dstshortname' => 'BST' ),
-    'Europe/Dublin' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'Irish Summer Time',
-        'dstshortname' => 'IST' ),
-    'Europe/Lisbon' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'Europe/London' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'British Summer Time',
-        'dstshortname' => 'BST' ),
-    'GB' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'British Summer Time',
-        'dstshortname' => 'BST' ),
-    'GB-Eire' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => true,
-        'dstlongname' => 'British Summer Time',
-        'dstshortname' => 'BST' ),
-    'GMT' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'GMT0' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Greenwich' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Iceland' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Portugal' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'UCT' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'UTC' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Universal' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'WET' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'Zulu' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Africa/Algiers' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => false ),
-    'Africa/Bangui' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Brazzaville' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Ceuta' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Africa/Douala' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Kinshasa' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Lagos' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Libreville' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Luanda' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Malabo' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Ndjamena' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Niamey' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Porto-Novo' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => false ),
-    'Africa/Tunis' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => false ),
-    'Africa/Windhoek' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => true,
-        'dstlongname' => 'Western African Summer Time',
-        'dstshortname' => 'WAST' ),
-    'Arctic/Longyearbyen' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Atlantic/Jan_Mayen' => array(
-        'offset' => 3600000,
-        'longname' => 'Eastern Greenland Time',
-        'shortname' => 'EGT',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Greenland Summer Time',
-        'dstshortname' => 'EGST' ),
-    'CET' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'CEST' => array(
-        'offset' => 3600000,
-        'longname' => "Central European Time",
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => "Central European Summer Time",
-        'dstshortname' => 'CEST' ),
-    'ECT' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Etc/GMT-1' => array(
-        'offset' => 3600000,
-        'longname' => 'GMT+01:00',
-        'shortname' => 'GMT+01:00',
-        'hasdst' => false ),
-    'Europe/Amsterdam' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Andorra' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Belgrade' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Berlin' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Bratislava' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Brussels' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Budapest' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Copenhagen' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Gibraltar' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Ljubljana' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Luxembourg' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Madrid' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Malta' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Monaco' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Oslo' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Paris' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Prague' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Rome' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/San_Marino' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Sarajevo' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Skopje' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Stockholm' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Tirane' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Vaduz' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Vatican' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Vienna' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Warsaw' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Zagreb' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Europe/Zurich' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'MET' => array(
-        'offset' => 3600000,
-        'longname' => 'Middle Europe Time',
-        'shortname' => 'MET',
-        'hasdst' => true,
-        'dstlongname' => 'Middle Europe Summer Time',
-        'dstshortname' => 'MEST' ),
-    'Poland' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'ART' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Africa/Blantyre' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Bujumbura' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Cairo' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Africa/Gaborone' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Harare' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Johannesburg' => array(
-        'offset' => 7200000,
-        'longname' => 'South Africa Standard Time',
-        'shortname' => 'SAST',
-        'hasdst' => false ),
-    'Africa/Kigali' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Lubumbashi' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Lusaka' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Maputo' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'Africa/Maseru' => array(
-        'offset' => 7200000,
-        'longname' => 'South Africa Standard Time',
-        'shortname' => 'SAST',
-        'hasdst' => false ),
-    'Africa/Mbabane' => array(
-        'offset' => 7200000,
-        'longname' => 'South Africa Standard Time',
-        'shortname' => 'SAST',
-        'hasdst' => false ),
-    'Africa/Tripoli' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => false ),
-    'Asia/Amman' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Beirut' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Damascus' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Gaza' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Istanbul' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Jerusalem' => array(
-        'offset' => 7200000,
-        'longname' => 'Israel Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => true,
-        'dstlongname' => 'Israel Daylight Time',
-        'dstshortname' => 'IDT' ),
-    'Asia/Nicosia' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Asia/Tel_Aviv' => array(
-        'offset' => 7200000,
-        'longname' => 'Israel Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => true,
-        'dstlongname' => 'Israel Daylight Time',
-        'dstshortname' => 'IDT' ),
-    'CAT' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'EET' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Egypt' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Etc/GMT-2' => array(
-        'offset' => 7200000,
-        'longname' => 'GMT+02:00',
-        'shortname' => 'GMT+02:00',
-        'hasdst' => false ),
-    'Europe/Athens' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Bucharest' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Chisinau' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Helsinki' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Istanbul' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Kaliningrad' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Kiev' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Minsk' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Nicosia' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Riga' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Simferopol' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Sofia' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Tallinn' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => false ),
-    'Europe/Tiraspol' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Uzhgorod' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Europe/Vilnius' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => false ),
-    'Europe/Zaporozhye' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Israel' => array(
-        'offset' => 7200000,
-        'longname' => 'Israel Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => true,
-        'dstlongname' => 'Israel Daylight Time',
-        'dstshortname' => 'IDT' ),
-    'Libya' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => false ),
-    'Turkey' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Africa/Addis_Ababa' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Asmera' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Dar_es_Salaam' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Djibouti' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Kampala' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Khartoum' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Mogadishu' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Africa/Nairobi' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Antarctica/Syowa' => array(
-        'offset' => 10800000,
-        'longname' => 'Syowa Time',
-        'shortname' => 'SYOT',
-        'hasdst' => false ),
-    'Asia/Aden' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'Asia/Baghdad' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Arabia Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'Asia/Bahrain' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'Asia/Kuwait' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'Asia/Qatar' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'Asia/Riyadh' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'EAT' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Etc/GMT-3' => array(
-        'offset' => 10800000,
-        'longname' => 'GMT+03:00',
-        'shortname' => 'GMT+03:00',
-        'hasdst' => false ),
-    'Europe/Moscow' => array(
-        'offset' => 10800000,
-        'longname' => 'Moscow Standard Time',
-        'shortname' => 'MSK',
-        'hasdst' => true,
-        'dstlongname' => 'Moscow Daylight Time',
-        'dstshortname' => 'MSD' ),
-    'Indian/Antananarivo' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Indian/Comoro' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Indian/Mayotte' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'W-SU' => array(
-        'offset' => 10800000,
-        'longname' => 'Moscow Standard Time',
-        'shortname' => 'MSK',
-        'hasdst' => true,
-        'dstlongname' => 'Moscow Daylight Time',
-        'dstshortname' => 'MSD' ),
-    'Asia/Riyadh87' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Asia/Riyadh88' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Asia/Riyadh89' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Mideast/Riyadh87' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Mideast/Riyadh88' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Mideast/Riyadh89' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Asia/Tehran' => array(
-        'offset' => 12600000,
-        'longname' => 'Iran Time',
-        'shortname' => 'IRT',
-        'hasdst' => true,
-        'dstlongname' => 'Iran Sumer Time',
-        'dstshortname' => 'IRST' ),
-    'Iran' => array(
-        'offset' => 12600000,
-        'longname' => 'Iran Time',
-        'shortname' => 'IRT',
-        'hasdst' => true,
-        'dstlongname' => 'Iran Sumer Time',
-        'dstshortname' => 'IRST' ),
-    'Asia/Aqtau' => array(
-        'offset' => 14400000,
-        'longname' => 'Aqtau Time',
-        'shortname' => 'AQTT',
-        'hasdst' => true,
-        'dstlongname' => 'Aqtau Summer Time',
-        'dstshortname' => 'AQTST' ),
-    'Asia/Baku' => array(
-        'offset' => 14400000,
-        'longname' => 'Azerbaijan Time',
-        'shortname' => 'AZT',
-        'hasdst' => true,
-        'dstlongname' => 'Azerbaijan Summer Time',
-        'dstshortname' => 'AZST' ),
-    'Asia/Dubai' => array(
-        'offset' => 14400000,
-        'longname' => 'Gulf Standard Time',
-        'shortname' => 'GST',
-        'hasdst' => false ),
-    'Asia/Muscat' => array(
-        'offset' => 14400000,
-        'longname' => 'Gulf Standard Time',
-        'shortname' => 'GST',
-        'hasdst' => false ),
-    'Asia/Tbilisi' => array(
-        'offset' => 14400000,
-        'longname' => 'Georgia Time',
-        'shortname' => 'GET',
-        'hasdst' => true,
-        'dstlongname' => 'Georgia Summer Time',
-        'dstshortname' => 'GEST' ),
-    'Asia/Yerevan' => array(
-        'offset' => 14400000,
-        'longname' => 'Armenia Time',
-        'shortname' => 'AMT',
-        'hasdst' => true,
-        'dstlongname' => 'Armenia Summer Time',
-        'dstshortname' => 'AMST' ),
-    'Etc/GMT-4' => array(
-        'offset' => 14400000,
-        'longname' => 'GMT+04:00',
-        'shortname' => 'GMT+04:00',
-        'hasdst' => false ),
-    'Europe/Samara' => array(
-        'offset' => 14400000,
-        'longname' => 'Samara Time',
-        'shortname' => 'SAMT',
-        'hasdst' => true,
-        'dstlongname' => 'Samara Summer Time',
-        'dstshortname' => 'SAMST' ),
-    'Indian/Mahe' => array(
-        'offset' => 14400000,
-        'longname' => 'Seychelles Time',
-        'shortname' => 'SCT',
-        'hasdst' => false ),
-    'Indian/Mauritius' => array(
-        'offset' => 14400000,
-        'longname' => 'Mauritius Time',
-        'shortname' => 'MUT',
-        'hasdst' => false ),
-    'Indian/Reunion' => array(
-        'offset' => 14400000,
-        'longname' => 'Reunion Time',
-        'shortname' => 'RET',
-        'hasdst' => false ),
-    'NET' => array(
-        'offset' => 14400000,
-        'longname' => 'Armenia Time',
-        'shortname' => 'AMT',
-        'hasdst' => true,
-        'dstlongname' => 'Armenia Summer Time',
-        'dstshortname' => 'AMST' ),
-    'Asia/Kabul' => array(
-        'offset' => 16200000,
-        'longname' => 'Afghanistan Time',
-        'shortname' => 'AFT',
-        'hasdst' => false ),
-    'Asia/Aqtobe' => array(
-        'offset' => 18000000,
-        'longname' => 'Aqtobe Time',
-        'shortname' => 'AQTT',
-        'hasdst' => true,
-        'dstlongname' => 'Aqtobe Summer Time',
-        'dstshortname' => 'AQTST' ),
-    'Asia/Ashgabat' => array(
-        'offset' => 18000000,
-        'longname' => 'Turkmenistan Time',
-        'shortname' => 'TMT',
-        'hasdst' => false ),
-    'Asia/Ashkhabad' => array(
-        'offset' => 18000000,
-        'longname' => 'Turkmenistan Time',
-        'shortname' => 'TMT',
-        'hasdst' => false ),
-    'Asia/Bishkek' => array(
-        'offset' => 18000000,
-        'longname' => 'Kirgizstan Time',
-        'shortname' => 'KGT',
-        'hasdst' => true,
-        'dstlongname' => 'Kirgizstan Summer Time',
-        'dstshortname' => 'KGST' ),
-    'Asia/Dushanbe' => array(
-        'offset' => 18000000,
-        'longname' => 'Tajikistan Time',
-        'shortname' => 'TJT',
-        'hasdst' => false ),
-    'Asia/Karachi' => array(
-        'offset' => 18000000,
-        'longname' => 'Pakistan Time',
-        'shortname' => 'PKT',
-        'hasdst' => false ),
-    'Asia/Samarkand' => array(
-        'offset' => 18000000,
-        'longname' => 'Turkmenistan Time',
-        'shortname' => 'TMT',
-        'hasdst' => false ),
-    'Asia/Tashkent' => array(
-        'offset' => 18000000,
-        'longname' => 'Uzbekistan Time',
-        'shortname' => 'UZT',
-        'hasdst' => false ),
-    'Asia/Yekaterinburg' => array(
-        'offset' => 18000000,
-        'longname' => 'Yekaterinburg Time',
-        'shortname' => 'YEKT',
-        'hasdst' => true,
-        'dstlongname' => 'Yekaterinburg Summer Time',
-        'dstshortname' => 'YEKST' ),
-    'Etc/GMT-5' => array(
-        'offset' => 18000000,
-        'longname' => 'GMT+05:00',
-        'shortname' => 'GMT+05:00',
-        'hasdst' => false ),
-    'Indian/Kerguelen' => array(
-        'offset' => 18000000,
-        'longname' => 'French Southern & Antarctic Lands Time',
-        'shortname' => 'TFT',
-        'hasdst' => false ),
-    'Indian/Maldives' => array(
-        'offset' => 18000000,
-        'longname' => 'Maldives Time',
-        'shortname' => 'MVT',
-        'hasdst' => false ),
-    'PLT' => array(
-        'offset' => 18000000,
-        'longname' => 'Pakistan Time',
-        'shortname' => 'PKT',
-        'hasdst' => false ),
-    'Asia/Calcutta' => array(
-        'offset' => 19800000,
-        'longname' => 'India Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => false ),
-    'IST' => array(
-        'offset' => 19800000,
-        'longname' => 'India Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => false ),
-    'Asia/Katmandu' => array(
-        'offset' => 20700000,
-        'longname' => 'Nepal Time',
-        'shortname' => 'NPT',
-        'hasdst' => false ),
-    'Antarctica/Mawson' => array(
-        'offset' => 21600000,
-        'longname' => 'Mawson Time',
-        'shortname' => 'MAWT',
-        'hasdst' => false ),
-    'Antarctica/Vostok' => array(
-        'offset' => 21600000,
-        'longname' => 'Vostok time',
-        'shortname' => 'VOST',
-        'hasdst' => false ),
-    'Asia/Almaty' => array(
-        'offset' => 21600000,
-        'longname' => 'Alma-Ata Time',
-        'shortname' => 'ALMT',
-        'hasdst' => true,
-        'dstlongname' => 'Alma-Ata Summer Time',
-        'dstshortname' => 'ALMST' ),
-    'Asia/Colombo' => array(
-        'offset' => 21600000,
-        'longname' => 'Sri Lanka Time',
-        'shortname' => 'LKT',
-        'hasdst' => false ),
-    'Asia/Dacca' => array(
-        'offset' => 21600000,
-        'longname' => 'Bangladesh Time',
-        'shortname' => 'BDT',
-        'hasdst' => false ),
-    'Asia/Dhaka' => array(
-        'offset' => 21600000,
-        'longname' => 'Bangladesh Time',
-        'shortname' => 'BDT',
-        'hasdst' => false ),
-    'Asia/Novosibirsk' => array(
-        'offset' => 21600000,
-        'longname' => 'Novosibirsk Time',
-        'shortname' => 'NOVT',
-        'hasdst' => true,
-        'dstlongname' => 'Novosibirsk Summer Time',
-        'dstshortname' => 'NOVST' ),
-    'Asia/Omsk' => array(
-        'offset' => 21600000,
-        'longname' => 'Omsk Time',
-        'shortname' => 'OMST',
-        'hasdst' => true,
-        'dstlongname' => 'Omsk Summer Time',
-        'dstshortname' => 'OMSST' ),
-    'Asia/Thimbu' => array(
-        'offset' => 21600000,
-        'longname' => 'Bhutan Time',
-        'shortname' => 'BTT',
-        'hasdst' => false ),
-    'Asia/Thimphu' => array(
-        'offset' => 21600000,
-        'longname' => 'Bhutan Time',
-        'shortname' => 'BTT',
-        'hasdst' => false ),
-    'BDT' => array(
-        'offset' => 21600000,
-        'longname' => 'Bangladesh Time',
-        'shortname' => 'BDT',
-        'hasdst' => false ),
-    'Etc/GMT-6' => array(
-        'offset' => 21600000,
-        'longname' => 'GMT+06:00',
-        'shortname' => 'GMT+06:00',
-        'hasdst' => false ),
-    'Indian/Chagos' => array(
-        'offset' => 21600000,
-        'longname' => 'Indian Ocean Territory Time',
-        'shortname' => 'IOT',
-        'hasdst' => false ),
-    'Asia/Rangoon' => array(
-        'offset' => 23400000,
-        'longname' => 'Myanmar Time',
-        'shortname' => 'MMT',
-        'hasdst' => false ),
-    'Indian/Cocos' => array(
-        'offset' => 23400000,
-        'longname' => 'Cocos Islands Time',
-        'shortname' => 'CCT',
-        'hasdst' => false ),
-    'Antarctica/Davis' => array(
-        'offset' => 25200000,
-        'longname' => 'Davis Time',
-        'shortname' => 'DAVT',
-        'hasdst' => false ),
-    'Asia/Bangkok' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Asia/Hovd' => array(
-        'offset' => 25200000,
-        'longname' => 'Hovd Time',
-        'shortname' => 'HOVT',
-        'hasdst' => false ),
-    'Asia/Jakarta' => array(
-        'offset' => 25200000,
-        'longname' => 'West Indonesia Time',
-        'shortname' => 'WIT',
-        'hasdst' => false ),
-    'Asia/Krasnoyarsk' => array(
-        'offset' => 25200000,
-        'longname' => 'Krasnoyarsk Time',
-        'shortname' => 'KRAT',
-        'hasdst' => true,
-        'dstlongname' => 'Krasnoyarsk Summer Time',
-        'dstshortname' => 'KRAST' ),
-    'Asia/Phnom_Penh' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Asia/Pontianak' => array(
-        'offset' => 25200000,
-        'longname' => 'West Indonesia Time',
-        'shortname' => 'WIT',
-        'hasdst' => false ),
-    'Asia/Saigon' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Asia/Vientiane' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Etc/GMT-7' => array(
-        'offset' => 25200000,
-        'longname' => 'GMT+07:00',
-        'shortname' => 'GMT+07:00',
-        'hasdst' => false ),
-    'Indian/Christmas' => array(
-        'offset' => 25200000,
-        'longname' => 'Christmas Island Time',
-        'shortname' => 'CXT',
-        'hasdst' => false ),
-    'VST' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Antarctica/Casey' => array(
-        'offset' => 28800000,
-        'longname' => 'Western Standard Time (Australia)',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Asia/Brunei' => array(
-        'offset' => 28800000,
-        'longname' => 'Brunei Time',
-        'shortname' => 'BNT',
-        'hasdst' => false ),
-    'Asia/Chongqing' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Chungking' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Harbin' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Hong_Kong' => array(
-        'offset' => 28800000,
-        'longname' => 'Hong Kong Time',
-        'shortname' => 'HKT',
-        'hasdst' => false ),
-    'Asia/Irkutsk' => array(
-        'offset' => 28800000,
-        'longname' => 'Irkutsk Time',
-        'shortname' => 'IRKT',
-        'hasdst' => true,
-        'dstlongname' => 'Irkutsk Summer Time',
-        'dstshortname' => 'IRKST' ),
-    'Asia/Kashgar' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Kuala_Lumpur' => array(
-        'offset' => 28800000,
-        'longname' => 'Malaysia Time',
-        'shortname' => 'MYT',
-        'hasdst' => false ),
-    'Asia/Kuching' => array(
-        'offset' => 28800000,
-        'longname' => 'Malaysia Time',
-        'shortname' => 'MYT',
-        'hasdst' => false ),
-    'Asia/Macao' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Manila' => array(
-        'offset' => 28800000,
-        'longname' => 'Philippines Time',
-        'shortname' => 'PHT',
-        'hasdst' => false ),
-    'Asia/Shanghai' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Singapore' => array(
-        'offset' => 28800000,
-        'longname' => 'Singapore Time',
-        'shortname' => 'SGT',
-        'hasdst' => false ),
-    'Asia/Taipei' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Asia/Ujung_Pandang' => array(
-        'offset' => 28800000,
-        'longname' => 'Central Indonesia Time',
-        'shortname' => 'CIT',
-        'hasdst' => false ),
-    'Asia/Ulaanbaatar' => array(
-        'offset' => 28800000,
-        'longname' => 'Ulaanbaatar Time',
-        'shortname' => 'ULAT',
-        'hasdst' => false ),
-    'Asia/Ulan_Bator' => array(
-        'offset' => 28800000,
-        'longname' => 'Ulaanbaatar Time',
-        'shortname' => 'ULAT',
-        'hasdst' => false ),
-    'Asia/Urumqi' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Australia/Perth' => array(
-        'offset' => 28800000,
-        'longname' => 'Western Standard Time (Australia)',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Australia/West' => array(
-        'offset' => 28800000,
-        'longname' => 'Western Standard Time (Australia)',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'CTT' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Etc/GMT-8' => array(
-        'offset' => 28800000,
-        'longname' => 'GMT+08:00',
-        'shortname' => 'GMT+08:00',
-        'hasdst' => false ),
-    'Hongkong' => array(
-        'offset' => 28800000,
-        'longname' => 'Hong Kong Time',
-        'shortname' => 'HKT',
-        'hasdst' => false ),
-    'PRC' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Singapore' => array(
-        'offset' => 28800000,
-        'longname' => 'Singapore Time',
-        'shortname' => 'SGT',
-        'hasdst' => false ),
-    'Asia/Choibalsan' => array(
-        'offset' => 32400000,
-        'longname' => 'Choibalsan Time',
-        'shortname' => 'CHOT',
-        'hasdst' => false ),
-    'Asia/Dili' => array(
-        'offset' => 32400000,
-        'longname' => 'East Timor Time',
-        'shortname' => 'TPT',
-        'hasdst' => false ),
-    'Asia/Jayapura' => array(
-        'offset' => 32400000,
-        'longname' => 'East Indonesia Time',
-        'shortname' => 'EIT',
-        'hasdst' => false ),
-    'Asia/Pyongyang' => array(
-        'offset' => 32400000,
-        'longname' => 'Korea Standard Time',
-        'shortname' => 'KST',
-        'hasdst' => false ),
-    'Asia/Seoul' => array(
-        'offset' => 32400000,
-        'longname' => 'Korea Standard Time',
-        'shortname' => 'KST',
-        'hasdst' => false ),
-    'Asia/Tokyo' => array(
-        'offset' => 32400000,
-        'longname' => 'Japan Standard Time',
-        'shortname' => 'JST',
-        'hasdst' => false ),
-    'Asia/Yakutsk' => array(
-        'offset' => 32400000,
-        'longname' => 'Yakutsk Time',
-        'shortname' => 'YAKT',
-        'hasdst' => true,
-        'dstlongname' => 'Yaktsk Summer Time',
-        'dstshortname' => 'YAKST' ),
-    'Etc/GMT-9' => array(
-        'offset' => 32400000,
-        'longname' => 'GMT+09:00',
-        'shortname' => 'GMT+09:00',
-        'hasdst' => false ),
-    'JST' => array(
-        'offset' => 32400000,
-        'longname' => 'Japan Standard Time',
-        'shortname' => 'JST',
-        'hasdst' => false ),
-    'Japan' => array(
-        'offset' => 32400000,
-        'longname' => 'Japan Standard Time',
-        'shortname' => 'JST',
-        'hasdst' => false ),
-    'Pacific/Palau' => array(
-        'offset' => 32400000,
-        'longname' => 'Palau Time',
-        'shortname' => 'PWT',
-        'hasdst' => false ),
-    'ROK' => array(
-        'offset' => 32400000,
-        'longname' => 'Korea Standard Time',
-        'shortname' => 'KST',
-        'hasdst' => false ),
-    'ACT' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (Northern Territory)',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Australia/Adelaide' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia)',
-        'dstshortname' => 'CST' ),
-    'Australia/Broken_Hill' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia/New South Wales)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)',
-        'dstshortname' => 'CST' ),
-    'Australia/Darwin' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (Northern Territory)',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Australia/North' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (Northern Territory)',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Australia/South' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia)',
-        'dstshortname' => 'CST' ),
-    'Australia/Yancowinna' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia/New South Wales)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)',
-        'dstshortname' => 'CST' ),
-    'AET' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Antarctica/DumontDUrville' => array(
-        'offset' => 36000000,
-        'longname' => 'Dumont-d\'Urville Time',
-        'shortname' => 'DDUT',
-        'hasdst' => false ),
-    'Asia/Sakhalin' => array(
-        'offset' => 36000000,
-        'longname' => 'Sakhalin Time',
-        'shortname' => 'SAKT',
-        'hasdst' => true,
-        'dstlongname' => 'Sakhalin Summer Time',
-        'dstshortname' => 'SAKST' ),
-    'Asia/Vladivostok' => array(
-        'offset' => 36000000,
-        'longname' => 'Vladivostok Time',
-        'shortname' => 'VLAT',
-        'hasdst' => true,
-        'dstlongname' => 'Vladivostok Summer Time',
-        'dstshortname' => 'VLAST' ),
-    'Australia/ACT' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Australia/Brisbane' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Queensland)',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'Australia/Canberra' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Australia/Hobart' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Tasmania)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Tasmania)',
-        'dstshortname' => 'EST' ),
-    'Australia/Lindeman' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Queensland)',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'Australia/Melbourne' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Victoria)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Victoria)',
-        'dstshortname' => 'EST' ),
-    'Australia/NSW' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Australia/Queensland' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Queensland)',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'Australia/Sydney' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Australia/Tasmania' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Tasmania)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Tasmania)',
-        'dstshortname' => 'EST' ),
-    'Australia/Victoria' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Victoria)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Victoria)',
-        'dstshortname' => 'EST' ),
-    'Etc/GMT-10' => array(
-        'offset' => 36000000,
-        'longname' => 'GMT+10:00',
-        'shortname' => 'GMT+10:00',
-        'hasdst' => false ),
-    'Pacific/Guam' => array(
-        'offset' => 36000000,
-        'longname' => 'Chamorro Standard Time',
-        'shortname' => 'ChST',
-        'hasdst' => false ),
-    'Pacific/Port_Moresby' => array(
-        'offset' => 36000000,
-        'longname' => 'Papua New Guinea Time',
-        'shortname' => 'PGT',
-        'hasdst' => false ),
-    'Pacific/Saipan' => array(
-        'offset' => 36000000,
-        'longname' => 'Chamorro Standard Time',
-        'shortname' => 'ChST',
-        'hasdst' => false ),
-    'Pacific/Truk' => array(
-        'offset' => 36000000,
-        'longname' => 'Truk Time',
-        'shortname' => 'TRUT',
-        'hasdst' => false ),
-    'Pacific/Yap' => array(
-        'offset' => 36000000,
-        'longname' => 'Yap Time',
-        'shortname' => 'YAPT',
-        'hasdst' => false ),
-    'Australia/LHI' => array(
-        'offset' => 37800000,
-        'longname' => 'Load Howe Standard Time',
-        'shortname' => 'LHST',
-        'hasdst' => true,
-        'dstlongname' => 'Load Howe Summer Time',
-        'dstshortname' => 'LHST' ),
-    'Australia/Lord_Howe' => array(
-        'offset' => 37800000,
-        'longname' => 'Load Howe Standard Time',
-        'shortname' => 'LHST',
-        'hasdst' => true,
-        'dstlongname' => 'Load Howe Summer Time',
-        'dstshortname' => 'LHST' ),
-    'Asia/Magadan' => array(
-        'offset' => 39600000,
-        'longname' => 'Magadan Time',
-        'shortname' => 'MAGT',
-        'hasdst' => true,
-        'dstlongname' => 'Magadan Summer Time',
-        'dstshortname' => 'MAGST' ),
-    'Etc/GMT-11' => array(
-        'offset' => 39600000,
-        'longname' => 'GMT+11:00',
-        'shortname' => 'GMT+11:00',
-        'hasdst' => false ),
-    'Pacific/Efate' => array(
-        'offset' => 39600000,
-        'longname' => 'Vanuatu Time',
-        'shortname' => 'VUT',
-        'hasdst' => false ),
-    'Pacific/Guadalcanal' => array(
-        'offset' => 39600000,
-        'longname' => 'Solomon Is. Time',
-        'shortname' => 'SBT',
-        'hasdst' => false ),
-    'Pacific/Kosrae' => array(
-        'offset' => 39600000,
-        'longname' => 'Kosrae Time',
-        'shortname' => 'KOST',
-        'hasdst' => false ),
-    'Pacific/Noumea' => array(
-        'offset' => 39600000,
-        'longname' => 'New Caledonia Time',
-        'shortname' => 'NCT',
-        'hasdst' => false ),
-    'Pacific/Ponape' => array(
-        'offset' => 39600000,
-        'longname' => 'Ponape Time',
-        'shortname' => 'PONT',
-        'hasdst' => false ),
-    'SST' => array(
-        'offset' => 39600000,
-        'longname' => 'Solomon Is. Time',
-        'shortname' => 'SBT',
-        'hasdst' => false ),
-    'Pacific/Norfolk' => array(
-        'offset' => 41400000,
-        'longname' => 'Norfolk Time',
-        'shortname' => 'NFT',
-        'hasdst' => false ),
-    'Antarctica/McMurdo' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'Antarctica/South_Pole' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'Asia/Anadyr' => array(
-        'offset' => 43200000,
-        'longname' => 'Anadyr Time',
-        'shortname' => 'ANAT',
-        'hasdst' => true,
-        'dstlongname' => 'Anadyr Summer Time',
-        'dstshortname' => 'ANAST' ),
-    'Asia/Kamchatka' => array(
-        'offset' => 43200000,
-        'longname' => 'Petropavlovsk-Kamchatski Time',
-        'shortname' => 'PETT',
-        'hasdst' => true,
-        'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time',
-        'dstshortname' => 'PETST' ),
-    'Etc/GMT-12' => array(
-        'offset' => 43200000,
-        'longname' => 'GMT+12:00',
-        'shortname' => 'GMT+12:00',
-        'hasdst' => false ),
-    'Kwajalein' => array(
-        'offset' => 43200000,
-        'longname' => 'Marshall Islands Time',
-        'shortname' => 'MHT',
-        'hasdst' => false ),
-    'NST' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'NZ' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'Pacific/Auckland' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'Pacific/Fiji' => array(
-        'offset' => 43200000,
-        'longname' => 'Fiji Time',
-        'shortname' => 'FJT',
-        'hasdst' => false ),
-    'Pacific/Funafuti' => array(
-        'offset' => 43200000,
-        'longname' => 'Tuvalu Time',
-        'shortname' => 'TVT',
-        'hasdst' => false ),
-    'Pacific/Kwajalein' => array(
-        'offset' => 43200000,
-        'longname' => 'Marshall Islands Time',
-        'shortname' => 'MHT',
-        'hasdst' => false ),
-    'Pacific/Majuro' => array(
-        'offset' => 43200000,
-        'longname' => 'Marshall Islands Time',
-        'shortname' => 'MHT',
-        'hasdst' => false ),
-    'Pacific/Nauru' => array(
-        'offset' => 43200000,
-        'longname' => 'Nauru Time',
-        'shortname' => 'NRT',
-        'hasdst' => false ),
-    'Pacific/Tarawa' => array(
-        'offset' => 43200000,
-        'longname' => 'Gilbert Is. Time',
-        'shortname' => 'GILT',
-        'hasdst' => false ),
-    'Pacific/Wake' => array(
-        'offset' => 43200000,
-        'longname' => 'Wake Time',
-        'shortname' => 'WAKT',
-        'hasdst' => false ),
-    'Pacific/Wallis' => array(
-        'offset' => 43200000,
-        'longname' => 'Wallis & Futuna Time',
-        'shortname' => 'WFT',
-        'hasdst' => false ),
-    'NZ-CHAT' => array(
-        'offset' => 45900000,
-        'longname' => 'Chatham Standard Time',
-        'shortname' => 'CHAST',
-        'hasdst' => true,
-        'dstlongname' => 'Chatham Daylight Time',
-        'dstshortname' => 'CHADT' ),
-    'Pacific/Chatham' => array(
-        'offset' => 45900000,
-        'longname' => 'Chatham Standard Time',
-        'shortname' => 'CHAST',
-        'hasdst' => true,
-        'dstlongname' => 'Chatham Daylight Time',
-        'dstshortname' => 'CHADT' ),
-    'Etc/GMT-13' => array(
-        'offset' => 46800000,
-        'longname' => 'GMT+13:00',
-        'shortname' => 'GMT+13:00',
-        'hasdst' => false ),
-    'Pacific/Enderbury' => array(
-        'offset' => 46800000,
-        'longname' => 'Phoenix Is. Time',
-        'shortname' => 'PHOT',
-        'hasdst' => false ),
-    'Pacific/Tongatapu' => array(
-        'offset' => 46800000,
-        'longname' => 'Tonga Time',
-        'shortname' => 'TOT',
-        'hasdst' => false ),
-    'Etc/GMT-14' => array(
-        'offset' => 50400000,
-        'longname' => 'GMT+14:00',
-        'shortname' => 'GMT+14:00',
-        'hasdst' => false ),
-    'Pacific/Kiritimati' => array(
-        'offset' => 50400000,
-        'longname' => 'Line Is. Time',
-        'shortname' => 'LINT',
-        'hasdst' => false ),
-    'GMT-12:00' => array(
-        'offset' => -43200000,
-        'longname' => 'GMT-12:00',
-        'shortname' => 'GMT-12:00',
-        'hasdst' => false ),
-    'GMT-11:00' => array(
-        'offset' => -39600000,
-        'longname' => 'GMT-11:00',
-        'shortname' => 'GMT-11:00',
-        'hasdst' => false ),
-    'West Samoa Time' => array(
-        'offset' => -39600000,
-        'longname' => 'West Samoa Time',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Samoa Standard Time' => array(
-        'offset' => -39600000,
-        'longname' => 'Samoa Standard Time',
-        'shortname' => 'SST',
-        'hasdst' => false ),
-    'Niue Time' => array(
-        'offset' => -39600000,
-        'longname' => 'Niue Time',
-        'shortname' => 'NUT',
-        'hasdst' => false ),
-    'Hawaii-Aleutian Standard Time' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii-Aleutian Standard Time',
-        'shortname' => 'HAST',
-        'hasdst' => true,
-        'dstlongname' => 'Hawaii-Aleutian Daylight Time',
-        'dstshortname' => 'HADT' ),
-    'GMT-10:00' => array(
-        'offset' => -36000000,
-        'longname' => 'GMT-10:00',
-        'shortname' => 'GMT-10:00',
-        'hasdst' => false ),
-    'Hawaii Standard Time' => array(
-        'offset' => -36000000,
-        'longname' => 'Hawaii Standard Time',
-        'shortname' => 'HST',
-        'hasdst' => false ),
-    'Tokelau Time' => array(
-        'offset' => -36000000,
-        'longname' => 'Tokelau Time',
-        'shortname' => 'TKT',
-        'hasdst' => false ),
-    'Cook Is. Time' => array(
-        'offset' => -36000000,
-        'longname' => 'Cook Is. Time',
-        'shortname' => 'CKT',
-        'hasdst' => false ),
-    'Tahiti Time' => array(
-        'offset' => -36000000,
-        'longname' => 'Tahiti Time',
-        'shortname' => 'TAHT',
-        'hasdst' => false ),
-    'Marquesas Time' => array(
-        'offset' => -34200000,
-        'longname' => 'Marquesas Time',
-        'shortname' => 'MART',
-        'hasdst' => false ),
-    'Alaska Standard Time' => array(
-        'offset' => -32400000,
-        'longname' => 'Alaska Standard Time',
-        'shortname' => 'AKST',
-        'hasdst' => true,
-        'dstlongname' => 'Alaska Daylight Time',
-        'dstshortname' => 'AKDT' ),
-    'GMT-09:00' => array(
-        'offset' => -32400000,
-        'longname' => 'GMT-09:00',
-        'shortname' => 'GMT-09:00',
-        'hasdst' => false ),
-    'Gambier Time' => array(
-        'offset' => -32400000,
-        'longname' => 'Gambier Time',
-        'shortname' => 'GAMT',
-        'hasdst' => false ),
-    'Pacific Standard Time' => array(
-        'offset' => -28800000,
-        'longname' => 'Pacific Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => true,
-        'dstlongname' => 'Pacific Daylight Time',
-        'dstshortname' => 'PDT' ),
-    'GMT-08:00' => array(
-        'offset' => -28800000,
-        'longname' => 'GMT-08:00',
-        'shortname' => 'GMT-08:00',
-        'hasdst' => false ),
-    'Pitcairn Standard Time' => array(
-        'offset' => -28800000,
-        'longname' => 'Pitcairn Standard Time',
-        'shortname' => 'PST',
-        'hasdst' => false ),
-    'Mountain Standard Time' => array(
-        'offset' => -25200000,
-        'longname' => 'Mountain Standard Time',
-        'shortname' => 'MST',
-        'hasdst' => true,
-        'dstlongname' => 'Mountain Daylight Time',
-        'dstshortname' => 'MDT' ),
-    'GMT-07:00' => array(
-        'offset' => -25200000,
-        'longname' => 'GMT-07:00',
-        'shortname' => 'GMT-07:00',
-        'hasdst' => false ),
-    'Central Standard Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Central Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Daylight Time',
-        'dstshortname' => 'CDT' ),
-    'Eastern Standard Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Eastern Standard Time',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Daylight Time',
-        'dstshortname' => 'EDT' ),
-    'Easter Is. Time' => array(
-        'offset' => -21600000,
-        'longname' => 'Easter Is. Time',
-        'shortname' => 'EAST',
-        'hasdst' => true,
-        'dstlongname' => 'Easter Is. Summer Time',
-        'dstshortname' => 'EASST' ),
-    'GMT-06:00' => array(
-        'offset' => -21600000,
-        'longname' => 'GMT-06:00',
-        'shortname' => 'GMT-06:00',
-        'hasdst' => false ),
-    'Galapagos Time' => array(
-        'offset' => -21600000,
-        'longname' => 'Galapagos Time',
-        'shortname' => 'GALT',
-        'hasdst' => false ),
-    'Colombia Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Colombia Time',
-        'shortname' => 'COT',
-        'hasdst' => false ),
-    'Acre Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Acre Time',
-        'shortname' => 'ACT',
-        'hasdst' => false ),
-    'Ecuador Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Ecuador Time',
-        'shortname' => 'ECT',
-        'hasdst' => false ),
-    'Peru Time' => array(
-        'offset' => -18000000,
-        'longname' => 'Peru Time',
-        'shortname' => 'PET',
-        'hasdst' => false ),
-    'GMT-05:00' => array(
-        'offset' => -18000000,
-        'longname' => 'GMT-05:00',
-        'shortname' => 'GMT-05:00',
-        'hasdst' => false ),
-    'Atlantic Standard Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Atlantic Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => true,
-        'dstlongname' => 'Atlantic Daylight Time',
-        'dstshortname' => 'ADT' ),
-    'Paraguay Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Paraguay Time',
-        'shortname' => 'PYT',
-        'hasdst' => true,
-        'dstlongname' => 'Paraguay Summer Time',
-        'dstshortname' => 'PYST' ),
-    'Amazon Standard Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Amazon Standard Time',
-        'shortname' => 'AMT',
-        'hasdst' => false ),
-    'Venezuela Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Venezuela Time',
-        'shortname' => 'VET',
-        'hasdst' => false ),
-    'Guyana Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Guyana Time',
-        'shortname' => 'GYT',
-        'hasdst' => false ),
-    'Bolivia Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Bolivia Time',
-        'shortname' => 'BOT',
-        'hasdst' => false ),
-    'Chile Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Chile Time',
-        'shortname' => 'CLT',
-        'hasdst' => true,
-        'dstlongname' => 'Chile Summer Time',
-        'dstshortname' => 'CLST' ),
-    'Falkland Is. Time' => array(
-        'offset' => -14400000,
-        'longname' => 'Falkland Is. Time',
-        'shortname' => 'FKT',
-        'hasdst' => true,
-        'dstlongname' => 'Falkland Is. Summer Time',
-        'dstshortname' => 'FKST' ),
-    'GMT-04:00' => array(
-        'offset' => -14400000,
-        'longname' => 'GMT-04:00',
-        'shortname' => 'GMT-04:00',
-        'hasdst' => false ),
-    'Newfoundland Standard Time' => array(
-        'offset' => -12600000,
-        'longname' => 'Newfoundland Standard Time',
-        'shortname' => 'NST',
-        'hasdst' => true,
-        'dstlongname' => 'Newfoundland Daylight Time',
-        'dstshortname' => 'NDT' ),
-    'Argentine Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Argentine Time',
-        'shortname' => 'ART',
-        'hasdst' => false ),
-    'Brazil Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Brazil Time',
-        'shortname' => 'BRT',
-        'hasdst' => true,
-        'dstlongname' => 'Brazil Summer Time',
-        'dstshortname' => 'BRST' ),
-    'French Guiana Time' => array(
-        'offset' => -10800000,
-        'longname' => 'French Guiana Time',
-        'shortname' => 'GFT',
-        'hasdst' => false ),
-    'Western Greenland Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Western Greenland Time',
-        'shortname' => 'WGT',
-        'hasdst' => true,
-        'dstlongname' => 'Western Greenland Summer Time',
-        'dstshortname' => 'WGST' ),
-    'Pierre & Miquelon Standard Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Pierre & Miquelon Standard Time',
-        'shortname' => 'PMST',
-        'hasdst' => true,
-        'dstlongname' => 'Pierre & Miquelon Daylight Time',
-        'dstshortname' => 'PMDT' ),
-    'Uruguay Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Uruguay Time',
-        'shortname' => 'UYT',
-        'hasdst' => false ),
-    'Suriname Time' => array(
-        'offset' => -10800000,
-        'longname' => 'Suriname Time',
-        'shortname' => 'SRT',
-        'hasdst' => false ),
-    'GMT-03:00' => array(
-        'offset' => -10800000,
-        'longname' => 'GMT-03:00',
-        'shortname' => 'GMT-03:00',
-        'hasdst' => false ),
-    'Fernando de Noronha Time' => array(
-        'offset' => -7200000,
-        'longname' => 'Fernando de Noronha Time',
-        'shortname' => 'FNT',
-        'hasdst' => false ),
-    'South Georgia Standard Time' => array(
-        'offset' => -7200000,
-        'longname' => 'South Georgia Standard Time',
-        'shortname' => 'GST',
-        'hasdst' => false ),
-    'GMT-02:00' => array(
-        'offset' => -7200000,
-        'longname' => 'GMT-02:00',
-        'shortname' => 'GMT-02:00',
-        'hasdst' => false ),
-    'Eastern Greenland Time' => array(
-        'offset' => 3600000,
-        'longname' => 'Eastern Greenland Time',
-        'shortname' => 'EGT',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Greenland Summer Time',
-        'dstshortname' => 'EGST' ),
-    'Azores Time' => array(
-        'offset' => -3600000,
-        'longname' => 'Azores Time',
-        'shortname' => 'AZOT',
-        'hasdst' => true,
-        'dstlongname' => 'Azores Summer Time',
-        'dstshortname' => 'AZOST' ),
-    'Cape Verde Time' => array(
-        'offset' => -3600000,
-        'longname' => 'Cape Verde Time',
-        'shortname' => 'CVT',
-        'hasdst' => false ),
-    'GMT-01:00' => array(
-        'offset' => -3600000,
-        'longname' => 'GMT-01:00',
-        'shortname' => 'GMT-01:00',
-        'hasdst' => false ),
-    'Greenwich Mean Time' => array(
-        'offset' => 0,
-        'longname' => 'Greenwich Mean Time',
-        'shortname' => 'GMT',
-        'hasdst' => false ),
-    'Western European Time' => array(
-        'offset' => 0,
-        'longname' => 'Western European Time',
-        'shortname' => 'WET',
-        'hasdst' => true,
-        'dstlongname' => 'Western European Summer Time',
-        'dstshortname' => 'WEST' ),
-    'GMT+00:00' => array(
-        'offset' => 0,
-        'longname' => 'GMT+00:00',
-        'shortname' => 'GMT+00:00',
-        'hasdst' => false ),
-    'Coordinated Universal Time' => array(
-        'offset' => 0,
-        'longname' => 'Coordinated Universal Time',
-        'shortname' => 'UTC',
-        'hasdst' => false ),
-    'Central European Time' => array(
-        'offset' => 3600000,
-        'longname' => 'Central European Time',
-        'shortname' => 'CET',
-        'hasdst' => true,
-        'dstlongname' => 'Central European Summer Time',
-        'dstshortname' => 'CEST' ),
-    'Western African Time' => array(
-        'offset' => 3600000,
-        'longname' => 'Western African Time',
-        'shortname' => 'WAT',
-        'hasdst' => true,
-        'dstlongname' => 'Western African Summer Time',
-        'dstshortname' => 'WAST' ),
-    'GMT+01:00' => array(
-        'offset' => 3600000,
-        'longname' => 'GMT+01:00',
-        'shortname' => 'GMT+01:00',
-        'hasdst' => false ),
-    'Middle Europe Time' => array(
-        'offset' => 3600000,
-        'longname' => 'Middle Europe Time',
-        'shortname' => 'MET',
-        'hasdst' => true,
-        'dstlongname' => 'Middle Europe Summer Time',
-        'dstshortname' => 'MEST' ),
-    'Eastern European Time' => array(
-        'offset' => 7200000,
-        'longname' => 'Eastern European Time',
-        'shortname' => 'EET',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern European Summer Time',
-        'dstshortname' => 'EEST' ),
-    'Central African Time' => array(
-        'offset' => 7200000,
-        'longname' => 'Central African Time',
-        'shortname' => 'CAT',
-        'hasdst' => false ),
-    'South Africa Standard Time' => array(
-        'offset' => 7200000,
-        'longname' => 'South Africa Standard Time',
-        'shortname' => 'SAST',
-        'hasdst' => false ),
-    'Israel Standard Time' => array(
-        'offset' => 7200000,
-        'longname' => 'Israel Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => true,
-        'dstlongname' => 'Israel Daylight Time',
-        'dstshortname' => 'IDT' ),
-    'GMT+02:00' => array(
-        'offset' => 7200000,
-        'longname' => 'GMT+02:00',
-        'shortname' => 'GMT+02:00',
-        'hasdst' => false ),
-    'Eastern African Time' => array(
-        'offset' => 10800000,
-        'longname' => 'Eastern African Time',
-        'shortname' => 'EAT',
-        'hasdst' => false ),
-    'Syowa Time' => array(
-        'offset' => 10800000,
-        'longname' => 'Syowa Time',
-        'shortname' => 'SYOT',
-        'hasdst' => false ),
-    'Arabia Standard Time' => array(
-        'offset' => 10800000,
-        'longname' => 'Arabia Standard Time',
-        'shortname' => 'AST',
-        'hasdst' => false ),
-    'GMT+03:00' => array(
-        'offset' => 10800000,
-        'longname' => 'GMT+03:00',
-        'shortname' => 'GMT+03:00',
-        'hasdst' => false ),
-    'Moscow Standard Time' => array(
-        'offset' => 10800000,
-        'longname' => 'Moscow Standard Time',
-        'shortname' => 'MSK',
-        'hasdst' => true,
-        'dstlongname' => 'Moscow Daylight Time',
-        'dstshortname' => 'MSD' ),
-    'GMT+03:07' => array(
-        'offset' => 11224000,
-        'longname' => 'GMT+03:07',
-        'shortname' => 'GMT+03:07',
-        'hasdst' => false ),
-    'Iran Time' => array(
-        'offset' => 12600000,
-        'longname' => 'Iran Time',
-        'shortname' => 'IRT',
-        'hasdst' => true,
-        'dstlongname' => 'Iran Sumer Time',
-        'dstshortname' => 'IRST' ),
-    'Aqtau Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Aqtau Time',
-        'shortname' => 'AQTT',
-        'hasdst' => true,
-        'dstlongname' => 'Aqtau Summer Time',
-        'dstshortname' => 'AQTST' ),
-    'Azerbaijan Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Azerbaijan Time',
-        'shortname' => 'AZT',
-        'hasdst' => true,
-        'dstlongname' => 'Azerbaijan Summer Time',
-        'dstshortname' => 'AZST' ),
-    'Gulf Standard Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Gulf Standard Time',
-        'shortname' => 'GST',
-        'hasdst' => false ),
-    'Georgia Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Georgia Time',
-        'shortname' => 'GET',
-        'hasdst' => true,
-        'dstlongname' => 'Georgia Summer Time',
-        'dstshortname' => 'GEST' ),
-    'Armenia Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Armenia Time',
-        'shortname' => 'AMT',
-        'hasdst' => true,
-        'dstlongname' => 'Armenia Summer Time',
-        'dstshortname' => 'AMST' ),
-    'GMT+04:00' => array(
-        'offset' => 14400000,
-        'longname' => 'GMT+04:00',
-        'shortname' => 'GMT+04:00',
-        'hasdst' => false ),
-    'Samara Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Samara Time',
-        'shortname' => 'SAMT',
-        'hasdst' => true,
-        'dstlongname' => 'Samara Summer Time',
-        'dstshortname' => 'SAMST' ),
-    'Seychelles Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Seychelles Time',
-        'shortname' => 'SCT',
-        'hasdst' => false ),
-    'Mauritius Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Mauritius Time',
-        'shortname' => 'MUT',
-        'hasdst' => false ),
-    'Reunion Time' => array(
-        'offset' => 14400000,
-        'longname' => 'Reunion Time',
-        'shortname' => 'RET',
-        'hasdst' => false ),
-    'Afghanistan Time' => array(
-        'offset' => 16200000,
-        'longname' => 'Afghanistan Time',
-        'shortname' => 'AFT',
-        'hasdst' => false ),
-    'Aqtobe Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Aqtobe Time',
-        'shortname' => 'AQTT',
-        'hasdst' => true,
-        'dstlongname' => 'Aqtobe Summer Time',
-        'dstshortname' => 'AQTST' ),
-    'Turkmenistan Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Turkmenistan Time',
-        'shortname' => 'TMT',
-        'hasdst' => false ),
-    'Kirgizstan Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Kirgizstan Time',
-        'shortname' => 'KGT',
-        'hasdst' => true,
-        'dstlongname' => 'Kirgizstan Summer Time',
-        'dstshortname' => 'KGST' ),
-    'Tajikistan Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Tajikistan Time',
-        'shortname' => 'TJT',
-        'hasdst' => false ),
-    'Pakistan Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Pakistan Time',
-        'shortname' => 'PKT',
-        'hasdst' => false ),
-    'Uzbekistan Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Uzbekistan Time',
-        'shortname' => 'UZT',
-        'hasdst' => false ),
-    'Yekaterinburg Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Yekaterinburg Time',
-        'shortname' => 'YEKT',
-        'hasdst' => true,
-        'dstlongname' => 'Yekaterinburg Summer Time',
-        'dstshortname' => 'YEKST' ),
-    'GMT+05:00' => array(
-        'offset' => 18000000,
-        'longname' => 'GMT+05:00',
-        'shortname' => 'GMT+05:00',
-        'hasdst' => false ),
-    'French Southern & Antarctic Lands Time' => array(
-        'offset' => 18000000,
-        'longname' => 'French Southern & Antarctic Lands Time',
-        'shortname' => 'TFT',
-        'hasdst' => false ),
-    'Maldives Time' => array(
-        'offset' => 18000000,
-        'longname' => 'Maldives Time',
-        'shortname' => 'MVT',
-        'hasdst' => false ),
-    'India Standard Time' => array(
-        'offset' => 19800000,
-        'longname' => 'India Standard Time',
-        'shortname' => 'IST',
-        'hasdst' => false ),
-    'Nepal Time' => array(
-        'offset' => 20700000,
-        'longname' => 'Nepal Time',
-        'shortname' => 'NPT',
-        'hasdst' => false ),
-    'Mawson Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Mawson Time',
-        'shortname' => 'MAWT',
-        'hasdst' => false ),
-    'Vostok time' => array(
-        'offset' => 21600000,
-        'longname' => 'Vostok time',
-        'shortname' => 'VOST',
-        'hasdst' => false ),
-    'Alma-Ata Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Alma-Ata Time',
-        'shortname' => 'ALMT',
-        'hasdst' => true,
-        'dstlongname' => 'Alma-Ata Summer Time',
-        'dstshortname' => 'ALMST' ),
-    'Sri Lanka Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Sri Lanka Time',
-        'shortname' => 'LKT',
-        'hasdst' => false ),
-    'Bangladesh Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Bangladesh Time',
-        'shortname' => 'BDT',
-        'hasdst' => false ),
-    'Novosibirsk Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Novosibirsk Time',
-        'shortname' => 'NOVT',
-        'hasdst' => true,
-        'dstlongname' => 'Novosibirsk Summer Time',
-        'dstshortname' => 'NOVST' ),
-    'Omsk Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Omsk Time',
-        'shortname' => 'OMST',
-        'hasdst' => true,
-        'dstlongname' => 'Omsk Summer Time',
-        'dstshortname' => 'OMSST' ),
-    'Bhutan Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Bhutan Time',
-        'shortname' => 'BTT',
-        'hasdst' => false ),
-    'GMT+06:00' => array(
-        'offset' => 21600000,
-        'longname' => 'GMT+06:00',
-        'shortname' => 'GMT+06:00',
-        'hasdst' => false ),
-    'Indian Ocean Territory Time' => array(
-        'offset' => 21600000,
-        'longname' => 'Indian Ocean Territory Time',
-        'shortname' => 'IOT',
-        'hasdst' => false ),
-    'Myanmar Time' => array(
-        'offset' => 23400000,
-        'longname' => 'Myanmar Time',
-        'shortname' => 'MMT',
-        'hasdst' => false ),
-    'Cocos Islands Time' => array(
-        'offset' => 23400000,
-        'longname' => 'Cocos Islands Time',
-        'shortname' => 'CCT',
-        'hasdst' => false ),
-    'Davis Time' => array(
-        'offset' => 25200000,
-        'longname' => 'Davis Time',
-        'shortname' => 'DAVT',
-        'hasdst' => false ),
-    'Indochina Time' => array(
-        'offset' => 25200000,
-        'longname' => 'Indochina Time',
-        'shortname' => 'ICT',
-        'hasdst' => false ),
-    'Hovd Time' => array(
-        'offset' => 25200000,
-        'longname' => 'Hovd Time',
-        'shortname' => 'HOVT',
-        'hasdst' => false ),
-    'West Indonesia Time' => array(
-        'offset' => 25200000,
-        'longname' => 'West Indonesia Time',
-        'shortname' => 'WIT',
-        'hasdst' => false ),
-    'Krasnoyarsk Time' => array(
-        'offset' => 25200000,
-        'longname' => 'Krasnoyarsk Time',
-        'shortname' => 'KRAT',
-        'hasdst' => true,
-        'dstlongname' => 'Krasnoyarsk Summer Time',
-        'dstshortname' => 'KRAST' ),
-    'GMT+07:00' => array(
-        'offset' => 25200000,
-        'longname' => 'GMT+07:00',
-        'shortname' => 'GMT+07:00',
-        'hasdst' => false ),
-    'Christmas Island Time' => array(
-        'offset' => 25200000,
-        'longname' => 'Christmas Island Time',
-        'shortname' => 'CXT',
-        'hasdst' => false ),
-    'Western Standard Time (Australia)' => array(
-        'offset' => 28800000,
-        'longname' => 'Western Standard Time (Australia)',
-        'shortname' => 'WST',
-        'hasdst' => false ),
-    'Brunei Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Brunei Time',
-        'shortname' => 'BNT',
-        'hasdst' => false ),
-    'China Standard Time' => array(
-        'offset' => 28800000,
-        'longname' => 'China Standard Time',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Hong Kong Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Hong Kong Time',
-        'shortname' => 'HKT',
-        'hasdst' => false ),
-    'Irkutsk Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Irkutsk Time',
-        'shortname' => 'IRKT',
-        'hasdst' => true,
-        'dstlongname' => 'Irkutsk Summer Time',
-        'dstshortname' => 'IRKST' ),
-    'Malaysia Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Malaysia Time',
-        'shortname' => 'MYT',
-        'hasdst' => false ),
-    'Philippines Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Philippines Time',
-        'shortname' => 'PHT',
-        'hasdst' => false ),
-    'Singapore Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Singapore Time',
-        'shortname' => 'SGT',
-        'hasdst' => false ),
-    'Central Indonesia Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Central Indonesia Time',
-        'shortname' => 'CIT',
-        'hasdst' => false ),
-    'Ulaanbaatar Time' => array(
-        'offset' => 28800000,
-        'longname' => 'Ulaanbaatar Time',
-        'shortname' => 'ULAT',
-        'hasdst' => false ),
-    'GMT+08:00' => array(
-        'offset' => 28800000,
-        'longname' => 'GMT+08:00',
-        'shortname' => 'GMT+08:00',
-        'hasdst' => false ),
-    'Choibalsan Time' => array(
-        'offset' => 32400000,
-        'longname' => 'Choibalsan Time',
-        'shortname' => 'CHOT',
-        'hasdst' => false ),
-    'East Timor Time' => array(
-        'offset' => 32400000,
-        'longname' => 'East Timor Time',
-        'shortname' => 'TPT',
-        'hasdst' => false ),
-    'East Indonesia Time' => array(
-        'offset' => 32400000,
-        'longname' => 'East Indonesia Time',
-        'shortname' => 'EIT',
-        'hasdst' => false ),
-    'Korea Standard Time' => array(
-        'offset' => 32400000,
-        'longname' => 'Korea Standard Time',
-        'shortname' => 'KST',
-        'hasdst' => false ),
-    'Japan Standard Time' => array(
-        'offset' => 32400000,
-        'longname' => 'Japan Standard Time',
-        'shortname' => 'JST',
-        'hasdst' => false ),
-    'Yakutsk Time' => array(
-        'offset' => 32400000,
-        'longname' => 'Yakutsk Time',
-        'shortname' => 'YAKT',
-        'hasdst' => true,
-        'dstlongname' => 'Yaktsk Summer Time',
-        'dstshortname' => 'YAKST' ),
-    'GMT+09:00' => array(
-        'offset' => 32400000,
-        'longname' => 'GMT+09:00',
-        'shortname' => 'GMT+09:00',
-        'hasdst' => false ),
-    'Palau Time' => array(
-        'offset' => 32400000,
-        'longname' => 'Palau Time',
-        'shortname' => 'PWT',
-        'hasdst' => false ),
-    'Central Standard Time (Northern Territory)' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (Northern Territory)',
-        'shortname' => 'CST',
-        'hasdst' => false ),
-    'Central Standard Time (South Australia)' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia)',
-        'dstshortname' => 'CST' ),
-    'Central Standard Time (South Australia/New South Wales)' => array(
-        'offset' => 34200000,
-        'longname' => 'Central Standard Time (South Australia/New South Wales)',
-        'shortname' => 'CST',
-        'hasdst' => true,
-        'dstlongname' => 'Central Summer Time (South Australia/New South Wales)',
-        'dstshortname' => 'CST' ),
-    'Eastern Standard Time (New South Wales)' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (New South Wales)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (New South Wales)',
-        'dstshortname' => 'EST' ),
-    'Dumont-d\'Urville Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Dumont-d\'Urville Time',
-        'shortname' => 'DDUT',
-        'hasdst' => false ),
-    'Sakhalin Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Sakhalin Time',
-        'shortname' => 'SAKT',
-        'hasdst' => true,
-        'dstlongname' => 'Sakhalin Summer Time',
-        'dstshortname' => 'SAKST' ),
-    'Vladivostok Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Vladivostok Time',
-        'shortname' => 'VLAT',
-        'hasdst' => true,
-        'dstlongname' => 'Vladivostok Summer Time',
-        'dstshortname' => 'VLAST' ),
-    'Eastern Standard Time (Queensland)' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Queensland)',
-        'shortname' => 'EST',
-        'hasdst' => false ),
-    'Eastern Standard Time (Tasmania)' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Tasmania)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Tasmania)',
-        'dstshortname' => 'EST' ),
-    'Eastern Standard Time (Victoria)' => array(
-        'offset' => 36000000,
-        'longname' => 'Eastern Standard Time (Victoria)',
-        'shortname' => 'EST',
-        'hasdst' => true,
-        'dstlongname' => 'Eastern Summer Time (Victoria)',
-        'dstshortname' => 'EST' ),
-    'GMT+10:00' => array(
-        'offset' => 36000000,
-        'longname' => 'GMT+10:00',
-        'shortname' => 'GMT+10:00',
-        'hasdst' => false ),
-    'Chamorro Standard Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Chamorro Standard Time',
-        'shortname' => 'ChST',
-        'hasdst' => false ),
-    'Papua New Guinea Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Papua New Guinea Time',
-        'shortname' => 'PGT',
-        'hasdst' => false ),
-    'Truk Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Truk Time',
-        'shortname' => 'TRUT',
-        'hasdst' => false ),
-    'Yap Time' => array(
-        'offset' => 36000000,
-        'longname' => 'Yap Time',
-        'shortname' => 'YAPT',
-        'hasdst' => false ),
-    'Load Howe Standard Time' => array(
-        'offset' => 37800000,
-        'longname' => 'Load Howe Standard Time',
-        'shortname' => 'LHST',
-        'hasdst' => true,
-        'dstlongname' => 'Load Howe Summer Time',
-        'dstshortname' => 'LHST' ),
-    'Magadan Time' => array(
-        'offset' => 39600000,
-        'longname' => 'Magadan Time',
-        'shortname' => 'MAGT',
-        'hasdst' => true,
-        'dstlongname' => 'Magadan Summer Time',
-        'dstshortname' => 'MAGST' ),
-    'GMT+11:00' => array(
-        'offset' => 39600000,
-        'longname' => 'GMT+11:00',
-        'shortname' => 'GMT+11:00',
-        'hasdst' => false ),
-    'Vanuatu Time' => array(
-        'offset' => 39600000,
-        'longname' => 'Vanuatu Time',
-        'shortname' => 'VUT',
-        'hasdst' => false ),
-    'Solomon Is. Time' => array(
-        'offset' => 39600000,
-        'longname' => 'Solomon Is. Time',
-        'shortname' => 'SBT',
-        'hasdst' => false ),
-    'Kosrae Time' => array(
-        'offset' => 39600000,
-        'longname' => 'Kosrae Time',
-        'shortname' => 'KOST',
-        'hasdst' => false ),
-    'New Caledonia Time' => array(
-        'offset' => 39600000,
-        'longname' => 'New Caledonia Time',
-        'shortname' => 'NCT',
-        'hasdst' => false ),
-    'Ponape Time' => array(
-        'offset' => 39600000,
-        'longname' => 'Ponape Time',
-        'shortname' => 'PONT',
-        'hasdst' => false ),
-    'Norfolk Time' => array(
-        'offset' => 41400000,
-        'longname' => 'Norfolk Time',
-        'shortname' => 'NFT',
-        'hasdst' => false ),
-    'New Zealand Standard Time' => array(
-        'offset' => 43200000,
-        'longname' => 'New Zealand Standard Time',
-        'shortname' => 'NZST',
-        'hasdst' => true,
-        'dstlongname' => 'New Zealand Daylight Time',
-        'dstshortname' => 'NZDT' ),
-    'Anadyr Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Anadyr Time',
-        'shortname' => 'ANAT',
-        'hasdst' => true,
-        'dstlongname' => 'Anadyr Summer Time',
-        'dstshortname' => 'ANAST' ),
-    'Petropavlovsk-Kamchatski Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Petropavlovsk-Kamchatski Time',
-        'shortname' => 'PETT',
-        'hasdst' => true,
-        'dstlongname' => 'Petropavlovsk-Kamchatski Summer Time',
-        'dstshortname' => 'PETST' ),
-    'GMT+12:00' => array(
-        'offset' => 43200000,
-        'longname' => 'GMT+12:00',
-        'shortname' => 'GMT+12:00',
-        'hasdst' => false ),
-    'Marshall Islands Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Marshall Islands Time',
-        'shortname' => 'MHT',
-        'hasdst' => false ),
-    'Fiji Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Fiji Time',
-        'shortname' => 'FJT',
-        'hasdst' => false ),
-    'Tuvalu Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Tuvalu Time',
-        'shortname' => 'TVT',
-        'hasdst' => false ),
-    'Nauru Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Nauru Time',
-        'shortname' => 'NRT',
-        'hasdst' => false ),
-    'Gilbert Is. Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Gilbert Is. Time',
-        'shortname' => 'GILT',
-        'hasdst' => false ),
-    'Wake Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Wake Time',
-        'shortname' => 'WAKT',
-        'hasdst' => false ),
-    'Wallis & Futuna Time' => array(
-        'offset' => 43200000,
-        'longname' => 'Wallis & Futuna Time',
-        'shortname' => 'WFT',
-        'hasdst' => false ),
-    'Chatham Standard Time' => array(
-        'offset' => 45900000,
-        'longname' => 'Chatham Standard Time',
-        'shortname' => 'CHAST',
-        'hasdst' => true,
-        'dstlongname' => 'Chatham Daylight Time',
-        'dstshortname' => 'CHADT' ),
-    'GMT+13:00' => array(
-        'offset' => 46800000,
-        'longname' => 'GMT+13:00',
-        'shortname' => 'GMT+13:00',
-        'hasdst' => false ),
-    'Phoenix Is. Time' => array(
-        'offset' => 46800000,
-        'longname' => 'Phoenix Is. Time',
-        'shortname' => 'PHOT',
-        'hasdst' => false ),
-    'Tonga Time' => array(
-        'offset' => 46800000,
-        'longname' => 'Tonga Time',
-        'shortname' => 'TOT',
-        'hasdst' => false ),
-    'GMT+14:00' => array(
-        'offset' => 50400000,
-        'longname' => 'GMT+14:00',
-        'shortname' => 'GMT+14:00',
-        'hasdst' => false ),
-    'Line Is. Time' => array(
-        'offset' => 50400000,
-        'longname' => 'Line Is. Time',
-        'shortname' => 'LINT',
-        'hasdst' => false ),
-);
-
-/**
- * Initialize default timezone
- *
- * First try _DATE_TIMEZONE_DEFAULT global, then PHP_TZ environment var,
- * then TZ environment var
- */
-if(isset($GLOBALS['_DATE_TIMEZONE_DEFAULT'])
-   && Date_TimeZone::isValidID($GLOBALS['_DATE_TIMEZONE_DEFAULT']))
-{
-    Date_TimeZone::setDefault($GLOBALS['_DATE_TIMEZONE_DEFAULT']);
-} elseif (getenv('PHP_TZ') && Date_TimeZone::isValidID(getenv('PHP_TZ'))) {
-    Date_TimeZone::setDefault(getenv('PHP_TZ'));
-} elseif (getenv('TZ') && Date_TimeZone::isValidID(getenv('TZ'))) {
-    Date_TimeZone::setDefault(getenv('TZ'));
-} elseif (Date_TimeZone::isValidID(date('T'))) {
-    Date_TimeZone::setDefault(date('T'));
-} else {
-    Date_TimeZone::setDefault('UTC');
-}
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2.php b/lib/php/MDB2.php
deleted file mode 100644
index e52507985ca24a223256b82eeb96e27f45e59c4b..0000000000000000000000000000000000000000
--- a/lib/php/MDB2.php
+++ /dev/null
@@ -1,4358 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2.php,v 1.335 2008/11/29 14:57:01 afz Exp $
-//
-
-/**
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-
-require_once 'PEAR.php';
-
-// {{{ Error constants
-
-/**
- * The method mapErrorCode in each MDB2_dbtype implementation maps
- * native error codes to one of these.
- *
- * If you add an error code here, make sure you also add a textual
- * version of it in MDB2::errorMessage().
- */
-
-define('MDB2_OK',                      true);
-define('MDB2_ERROR',                     -1);
-define('MDB2_ERROR_SYNTAX',              -2);
-define('MDB2_ERROR_CONSTRAINT',          -3);
-define('MDB2_ERROR_NOT_FOUND',           -4);
-define('MDB2_ERROR_ALREADY_EXISTS',      -5);
-define('MDB2_ERROR_UNSUPPORTED',         -6);
-define('MDB2_ERROR_MISMATCH',            -7);
-define('MDB2_ERROR_INVALID',             -8);
-define('MDB2_ERROR_NOT_CAPABLE',         -9);
-define('MDB2_ERROR_TRUNCATED',          -10);
-define('MDB2_ERROR_INVALID_NUMBER',     -11);
-define('MDB2_ERROR_INVALID_DATE',       -12);
-define('MDB2_ERROR_DIVZERO',            -13);
-define('MDB2_ERROR_NODBSELECTED',       -14);
-define('MDB2_ERROR_CANNOT_CREATE',      -15);
-define('MDB2_ERROR_CANNOT_DELETE',      -16);
-define('MDB2_ERROR_CANNOT_DROP',        -17);
-define('MDB2_ERROR_NOSUCHTABLE',        -18);
-define('MDB2_ERROR_NOSUCHFIELD',        -19);
-define('MDB2_ERROR_NEED_MORE_DATA',     -20);
-define('MDB2_ERROR_NOT_LOCKED',         -21);
-define('MDB2_ERROR_VALUE_COUNT_ON_ROW', -22);
-define('MDB2_ERROR_INVALID_DSN',        -23);
-define('MDB2_ERROR_CONNECT_FAILED',     -24);
-define('MDB2_ERROR_EXTENSION_NOT_FOUND',-25);
-define('MDB2_ERROR_NOSUCHDB',           -26);
-define('MDB2_ERROR_ACCESS_VIOLATION',   -27);
-define('MDB2_ERROR_CANNOT_REPLACE',     -28);
-define('MDB2_ERROR_CONSTRAINT_NOT_NULL',-29);
-define('MDB2_ERROR_DEADLOCK',           -30);
-define('MDB2_ERROR_CANNOT_ALTER',       -31);
-define('MDB2_ERROR_MANAGER',            -32);
-define('MDB2_ERROR_MANAGER_PARSE',      -33);
-define('MDB2_ERROR_LOADMODULE',         -34);
-define('MDB2_ERROR_INSUFFICIENT_DATA',  -35);
-define('MDB2_ERROR_NO_PERMISSION',      -36);
-define('MDB2_ERROR_DISCONNECT_FAILED',  -37);
-
-// }}}
-// {{{ Verbose constants
-/**
- * These are just helper constants to more verbosely express parameters to prepare()
- */
-
-define('MDB2_PREPARE_MANIP', false);
-define('MDB2_PREPARE_RESULT', null);
-
-// }}}
-// {{{ Fetchmode constants
-
-/**
- * This is a special constant that tells MDB2 the user hasn't specified
- * any particular get mode, so the default should be used.
- */
-define('MDB2_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-define('MDB2_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-define('MDB2_FETCHMODE_ASSOC', 2);
-
-/**
- * Column data as object properties
- */
-define('MDB2_FETCHMODE_OBJECT', 3);
-
-/**
- * For multi-dimensional results: normally the first level of arrays
- * is the row number, and the second level indexed by column number or name.
- * MDB2_FETCHMODE_FLIPPED switches this order, so the first level of arrays
- * is the column name, and the second level the row number.
- */
-define('MDB2_FETCHMODE_FLIPPED', 4);
-
-// }}}
-// {{{ Portability mode constants
-
-/**
- * Portability: turn off all portability features.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_NONE', 0);
-
-/**
- * Portability: convert names of tables and fields to case defined in the
- * "field_case" option when using the query*(), fetch*() and tableInfo() methods.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_FIX_CASE', 1);
-
-/**
- * Portability: right trim the data output by query*() and fetch*().
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_RTRIM', 2);
-
-/**
- * Portability: force reporting the number of rows deleted.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_DELETE_COUNT', 4);
-
-/**
- * Portability: not needed in MDB2 (just left here for compatibility to DB)
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_NUMROWS', 8);
-
-/**
- * Portability: makes certain error messages in certain drivers compatible
- * with those from other DBMS's.
- *
- * + mysql, mysqli:  change unique/primary key constraints
- *   MDB2_ERROR_ALREADY_EXISTS -> MDB2_ERROR_CONSTRAINT
- *
- * + odbc(access):  MS's ODBC driver reports 'no such field' as code
- *   07001, which means 'too few parameters.'  When this option is on
- *   that code gets mapped to MDB2_ERROR_NOSUCHFIELD.
- *
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_ERRORS', 16);
-
-/**
- * Portability: convert empty values to null strings in data output by
- * query*() and fetch*().
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_EMPTY_TO_NULL', 32);
-
-/**
- * Portability: removes database/table qualifiers from associative indexes
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES', 64);
-
-/**
- * Portability: turn on all portability features.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_ALL', 127);
-
-// }}}
-// {{{ Globals for class instance tracking
-
-/**
- * These are global variables that are used to track the various class instances
- */
-
-$GLOBALS['_MDB2_databases'] = array();
-$GLOBALS['_MDB2_dsninfo_default'] = array(
-    'phptype'  => false,
-    'dbsyntax' => false,
-    'username' => false,
-    'password' => false,
-    'protocol' => false,
-    'hostspec' => false,
-    'port'     => false,
-    'socket'   => false,
-    'database' => false,
-    'mode'     => false,
-);
-
-// }}}
-// {{{ class MDB2
-
-/**
- * The main 'MDB2' class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of MDB2 is as follows (indentation means inheritance):
- *
- * MDB2          The main MDB2 class.  This is simply a utility class
- *              with some 'static' methods for creating MDB2 objects as
- *              well as common utility functions for other MDB2 classes.
- *
- * MDB2_Driver_Common   The base for each MDB2 implementation.  Provides default
- * |            implementations (in OO lingo virtual methods) for
- * |            the actual DB implementations as well as a bunch of
- * |            query utility functions.
- * |
- * +-MDB2_Driver_mysql  The MDB2 implementation for MySQL. Inherits MDB2_Driver_Common.
- *              When calling MDB2::factory or MDB2::connect for MySQL
- *              connections, the object returned is an instance of this
- *              class.
- * +-MDB2_Driver_pgsql  The MDB2 implementation for PostGreSQL. Inherits MDB2_Driver_Common.
- *              When calling MDB2::factory or MDB2::connect for PostGreSQL
- *              connections, the object returned is an instance of this
- *              class.
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2
-{
-    // {{{ function setOptions(&$db, $options)
-
-    /**
-     * set option array   in an exiting database object
-     *
-     * @param   MDB2_Driver_Common  MDB2 object
-     * @param   array   An associative array of option names and their values.
-     *
-     * @return mixed   MDB2_OK or a PEAR Error object
-     *
-     * @access  public
-     */
-    function setOptions(&$db, $options)
-    {
-        if (is_array($options)) {
-            foreach ($options as $option => $value) {
-                $test = $db->setOption($option, $value);
-                if (PEAR::isError($test)) {
-                    return $test;
-                }
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function classExists($classname)
-
-    /**
-     * Checks if a class exists without triggering __autoload
-     *
-     * @param   string  classname
-     *
-     * @return  bool    true success and false on error
-     * @static
-     * @access  public
-     */
-    function classExists($classname)
-    {
-        if (version_compare(phpversion(), "5.0", ">=")) {
-            return class_exists($classname, false);
-        }
-        return class_exists($classname);
-    }
-
-    // }}}
-    // {{{ function loadClass($class_name, $debug)
-
-    /**
-     * Loads a PEAR class.
-     *
-     * @param   string  classname to load
-     * @param   bool    if errors should be suppressed
-     *
-     * @return  mixed   true success or PEAR_Error on failure
-     *
-     * @access  public
-     */
-    function loadClass($class_name, $debug)
-    {
-        if (!MDB2::classExists($class_name)) {
-            $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
-            if ($debug) {
-                $include = include_once($file_name);
-            } else {
-                $include = @include_once($file_name);
-            }
-            if (!$include) {
-                if (!MDB2::fileExists($file_name)) {
-                    $msg = "unable to find package '$class_name' file '$file_name'";
-                } else {
-                    $msg = "unable to load class '$class_name' from file '$file_name'";
-                }
-                $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
-                return $err;
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function &factory($dsn, $options = false)
-
-    /**
-     * Create a new MDB2 object for the specified database type
-     *
-     * IMPORTANT: In order for MDB2 to work properly it is necessary that
-     * you make sure that you work with a reference of the original
-     * object instead of a copy (this is a PHP4 quirk).
-     *
-     * For example:
-     *     $db =& MDB2::factory($dsn);
-     *          ^^
-     * And not:
-     *     $db = MDB2::factory($dsn);
-     *
-     * @param   mixed   'data source name', see the MDB2::parseDSN
-     *                      method for a description of the dsn format.
-     *                      Can also be specified as an array of the
-     *                      format returned by MDB2::parseDSN.
-     * @param   array   An associative array of option names and
-     *                            their values.
-     *
-     * @return  mixed   a newly created MDB2 object, or false on error
-     *
-     * @access  public
-     */
-    function &factory($dsn, $options = false)
-    {
-        $dsninfo = MDB2::parseDSN($dsn);
-        if (empty($dsninfo['phptype'])) {
-            $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND,
-                null, null, 'no RDBMS driver specified');
-            return $err;
-        }
-        $class_name = 'MDB2_Driver_'.$dsninfo['phptype'];
-
-        $debug = (!empty($options['debug']));
-        $err = MDB2::loadClass($class_name, $debug);
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-
-        $db =& new $class_name();
-        $db->setDSN($dsninfo);
-        $err = MDB2::setOptions($db, $options);
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-
-        return $db;
-    }
-
-    // }}}
-    // {{{ function &connect($dsn, $options = false)
-
-    /**
-     * Create a new MDB2_Driver_* connection object and connect to the specified
-     * database
-     *
-     * IMPORTANT: In order for MDB2 to work properly it is necessary that
-     * you make sure that you work with a reference of the original
-     * object instead of a copy (this is a PHP4 quirk).
-     *
-     * For example:
-     *     $db =& MDB2::connect($dsn);
-     *          ^^
-     * And not:
-     *     $db = MDB2::connect($dsn);
-     *          ^^
-     *
-     * @param mixed $dsn     'data source name', see the MDB2::parseDSN
-     *                       method for a description of the dsn format.
-     *                       Can also be specified as an array of the
-     *                       format returned by MDB2::parseDSN.
-     * @param array $options An associative array of option names and
-     *                       their values.
-     *
-     * @return mixed a newly created MDB2 connection object, or a MDB2
-     *               error object on error
-     *
-     * @access  public
-     * @see     MDB2::parseDSN
-     */
-    function &connect($dsn, $options = false)
-    {
-        $db =& MDB2::factory($dsn, $options);
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $err = $db->connect();
-        if (PEAR::isError($err)) {
-            $dsn = $db->getDSN('string', 'xxx');
-            $db->disconnect();
-            $err->addUserInfo($dsn);
-            return $err;
-        }
-
-        return $db;
-    }
-
-    // }}}
-    // {{{ function &singleton($dsn = null, $options = false)
-
-    /**
-     * Returns a MDB2 connection with the requested DSN.
-     * A new MDB2 connection object is only created if no object with the
-     * requested DSN exists yet.
-     *
-     * IMPORTANT: In order for MDB2 to work properly it is necessary that
-     * you make sure that you work with a reference of the original
-     * object instead of a copy (this is a PHP4 quirk).
-     *
-     * For example:
-     *     $db =& MDB2::singleton($dsn);
-     *          ^^
-     * And not:
-     *     $db = MDB2::singleton($dsn);
-     *          ^^
-     *
-     * @param   mixed   'data source name', see the MDB2::parseDSN
-     *                            method for a description of the dsn format.
-     *                            Can also be specified as an array of the
-     *                            format returned by MDB2::parseDSN.
-     * @param   array   An associative array of option names and
-     *                            their values.
-     *
-     * @return  mixed   a newly created MDB2 connection object, or a MDB2
-     *                  error object on error
-     *
-     * @access  public
-     * @see     MDB2::parseDSN
-     */
-    function &singleton($dsn = null, $options = false)
-    {
-        if ($dsn) {
-            $dsninfo = MDB2::parseDSN($dsn);
-            $dsninfo = array_merge($GLOBALS['_MDB2_dsninfo_default'], $dsninfo);
-            $keys = array_keys($GLOBALS['_MDB2_databases']);
-            for ($i=0, $j=count($keys); $i<$j; ++$i) {
-                if (isset($GLOBALS['_MDB2_databases'][$keys[$i]])) {
-                    $tmp_dsn = $GLOBALS['_MDB2_databases'][$keys[$i]]->getDSN('array');
-                    if (count(array_diff_assoc($tmp_dsn, $dsninfo)) == 0) {
-                        MDB2::setOptions($GLOBALS['_MDB2_databases'][$keys[$i]], $options);
-                        return $GLOBALS['_MDB2_databases'][$keys[$i]];
-                    }
-                }
-            }
-        } elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) {
-            $db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
-            return $db;
-        }
-        $db =& MDB2::factory($dsn, $options);
-        return $db;
-    }
-
-    // }}}
-    // {{{ function areEquals()
-
-    /**
-     * It looks like there's a memory leak in array_diff() in PHP 5.1.x,
-     * so use this method instead.
-     * @see http://pear.php.net/bugs/bug.php?id=11790
-     *
-     * @param array $arr1
-     * @param array $arr2
-     * @return boolean
-     */
-    function areEquals($arr1, $arr2)
-    {
-        if (count($arr1) != count($arr2)) {
-            return false;
-        }
-        foreach (array_keys($arr1) as $k) {
-            if (!array_key_exists($k, $arr2) || $arr1[$k] != $arr2[$k]) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ function loadFile($file)
-
-    /**
-     * load a file (like 'Date')
-     *
-     * @param   string  name of the file in the MDB2 directory (without '.php')
-     *
-     * @return  string  name of the file that was included
-     *
-     * @access  public
-     */
-    function loadFile($file)
-    {
-        $file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php';
-        if (!MDB2::fileExists($file_name)) {
-            return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'unable to find: '.$file_name);
-        }
-        if (!include_once($file_name)) {
-            return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'unable to load driver class: '.$file_name);
-        }
-        return $file_name;
-    }
-
-    // }}}
-    // {{{ function apiVersion()
-
-    /**
-     * Return the MDB2 API version
-     *
-     * @return  string  the MDB2 API version number
-     *
-     * @access  public
-     */
-    function apiVersion()
-    {
-        return '2.5.0b2';
-    }
-
-    // }}}
-    // {{{ function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
-
-    /**
-     * This method is used to communicate an error and invoke error
-     * callbacks etc.  Basically a wrapper for PEAR::raiseError
-     * without the message string.
-     *
-     * @param   mixed  int error code
-     *
-     * @param   int    error mode, see PEAR_Error docs
-     *
-     * @param   mixed  If error mode is PEAR_ERROR_TRIGGER, this is the
-     *                 error level (E_USER_NOTICE etc).  If error mode is
-     *                 PEAR_ERROR_CALLBACK, this is the callback function,
-     *                 either as a function name, or as an array of an
-     *                 object and method name.  For other error modes this
-     *                 parameter is ignored.
-     *
-     * @param   string Extra debug information.  Defaults to the last
-     *                 query and native error code.
-     *
-     * @return PEAR_Error instance of a PEAR Error object
-     *
-     * @access  private
-     * @see     PEAR_Error
-     */
-    function &raiseError($code = null,
-                         $mode = null,
-                         $options = null,
-                         $userinfo = null,
-                         $dummy1 = null,
-                         $dummy2 = null,
-                         $dummy3 = false)
-    {
-        $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
-        return $err;
-    }
-
-    // }}}
-    // {{{ function isError($data, $code = null)
-
-    /**
-     * Tell whether a value is a MDB2 error.
-     *
-     * @param   mixed   the value to test
-     * @param   int     if is an error object, return true
-     *                        only if $code is a string and
-     *                        $db->getMessage() == $code or
-     *                        $code is an integer and $db->getCode() == $code
-     *
-     * @return  bool    true if parameter is an error
-     *
-     * @access  public
-     */
-    function isError($data, $code = null)
-    {
-        if (is_a($data, 'MDB2_Error')) {
-            if (is_null($code)) {
-                return true;
-            } elseif (is_string($code)) {
-                return $data->getMessage() === $code;
-            } else {
-                $code = (array)$code;
-                return in_array($data->getCode(), $code);
-            }
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ function isConnection($value)
-
-    /**
-     * Tell whether a value is a MDB2 connection
-     *
-     * @param   mixed   value to test
-     *
-     * @return  bool    whether $value is a MDB2 connection
-     *
-     * @access  public
-     */
-    function isConnection($value)
-    {
-        return is_a($value, 'MDB2_Driver_Common');
-    }
-
-    // }}}
-    // {{{ function isResult($value)
-
-    /**
-     * Tell whether a value is a MDB2 result
-     *
-     * @param   mixed   value to test
-     *
-     * @return  bool    whether $value is a MDB2 result
-     *
-     * @access  public
-     */
-    function isResult($value)
-    {
-        return is_a($value, 'MDB2_Result');
-    }
-
-    // }}}
-    // {{{ function isResultCommon($value)
-
-    /**
-     * Tell whether a value is a MDB2 result implementing the common interface
-     *
-     * @param   mixed   value to test
-     *
-     * @return  bool    whether $value is a MDB2 result implementing the common interface
-     *
-     * @access  public
-     */
-    function isResultCommon($value)
-    {
-        return is_a($value, 'MDB2_Result_Common');
-    }
-
-    // }}}
-    // {{{ function isStatement($value)
-
-    /**
-     * Tell whether a value is a MDB2 statement interface
-     *
-     * @param   mixed   value to test
-     *
-     * @return  bool    whether $value is a MDB2 statement interface
-     *
-     * @access  public
-     */
-    function isStatement($value)
-    {
-        return is_a($value, 'MDB2_Statement_Common');
-    }
-
-    // }}}
-    // {{{ function errorMessage($value = null)
-
-    /**
-     * Return a textual error message for a MDB2 error code
-     *
-     * @param   int|array   integer error code,
-                                null to get the current error code-message map,
-                                or an array with a new error code-message map
-     *
-     * @return  string  error message, or false if the error code was
-     *                  not recognized
-     *
-     * @access  public
-     */
-    function errorMessage($value = null)
-    {
-        static $errorMessages;
-
-        if (is_array($value)) {
-            $errorMessages = $value;
-            return MDB2_OK;
-        }
-
-        if (!isset($errorMessages)) {
-            $errorMessages = array(
-                MDB2_OK                       => 'no error',
-                MDB2_ERROR                    => 'unknown error',
-                MDB2_ERROR_ALREADY_EXISTS     => 'already exists',
-                MDB2_ERROR_CANNOT_CREATE      => 'can not create',
-                MDB2_ERROR_CANNOT_ALTER       => 'can not alter',
-                MDB2_ERROR_CANNOT_REPLACE     => 'can not replace',
-                MDB2_ERROR_CANNOT_DELETE      => 'can not delete',
-                MDB2_ERROR_CANNOT_DROP        => 'can not drop',
-                MDB2_ERROR_CONSTRAINT         => 'constraint violation',
-                MDB2_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
-                MDB2_ERROR_DIVZERO            => 'division by zero',
-                MDB2_ERROR_INVALID            => 'invalid',
-                MDB2_ERROR_INVALID_DATE       => 'invalid date or time',
-                MDB2_ERROR_INVALID_NUMBER     => 'invalid number',
-                MDB2_ERROR_MISMATCH           => 'mismatch',
-                MDB2_ERROR_NODBSELECTED       => 'no database selected',
-                MDB2_ERROR_NOSUCHFIELD        => 'no such field',
-                MDB2_ERROR_NOSUCHTABLE        => 'no such table',
-                MDB2_ERROR_NOT_CAPABLE        => 'MDB2 backend not capable',
-                MDB2_ERROR_NOT_FOUND          => 'not found',
-                MDB2_ERROR_NOT_LOCKED         => 'not locked',
-                MDB2_ERROR_SYNTAX             => 'syntax error',
-                MDB2_ERROR_UNSUPPORTED        => 'not supported',
-                MDB2_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
-                MDB2_ERROR_INVALID_DSN        => 'invalid DSN',
-                MDB2_ERROR_CONNECT_FAILED     => 'connect failed',
-                MDB2_ERROR_NEED_MORE_DATA     => 'insufficient data supplied',
-                MDB2_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
-                MDB2_ERROR_NOSUCHDB           => 'no such database',
-                MDB2_ERROR_ACCESS_VIOLATION   => 'insufficient permissions',
-                MDB2_ERROR_LOADMODULE         => 'error while including on demand module',
-                MDB2_ERROR_TRUNCATED          => 'truncated',
-                MDB2_ERROR_DEADLOCK           => 'deadlock detected',
-                MDB2_ERROR_NO_PERMISSION      => 'no permission',
-                MDB2_ERROR_DISCONNECT_FAILED  => 'disconnect failed',
-            );
-        }
-
-        if (is_null($value)) {
-            return $errorMessages;
-        }
-
-        if (PEAR::isError($value)) {
-            $value = $value->getCode();
-        }
-
-        return isset($errorMessages[$value]) ?
-           $errorMessages[$value] : $errorMessages[MDB2_ERROR];
-    }
-
-    // }}}
-    // {{{ function parseDSN($dsn)
-
-    /**
-     * Parse a data source name.
-     *
-     * Additional keys can be added by appending a URI query string to the
-     * end of the DSN.
-     *
-     * The format of the supplied DSN is in its fullest form:
-     * <code>
-     *  phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
-     * </code>
-     *
-     * Most variations are allowed:
-     * <code>
-     *  phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
-     *  phptype://username:password@hostspec/database_name
-     *  phptype://username:password@hostspec
-     *  phptype://username@hostspec
-     *  phptype://hostspec/database
-     *  phptype://hostspec
-     *  phptype(dbsyntax)
-     *  phptype
-     * </code>
-     *
-     * @param   string  Data Source Name to be parsed
-     *
-     * @return  array   an associative array with the following keys:
-     *  + phptype:  Database backend used in PHP (mysql, odbc etc.)
-     *  + dbsyntax: Database used with regards to SQL syntax etc.
-     *  + protocol: Communication protocol to use (tcp, unix etc.)
-     *  + hostspec: Host specification (hostname[:port])
-     *  + database: Database to use on the DBMS server
-     *  + username: User name for login
-     *  + password: Password for login
-     *
-     * @access  public
-     * @author  Tomas V.V.Cox <cox@idecnet.com>
-     */
-    function parseDSN($dsn)
-    {
-        $parsed = $GLOBALS['_MDB2_dsninfo_default'];
-
-        if (is_array($dsn)) {
-            $dsn = array_merge($parsed, $dsn);
-            if (!$dsn['dbsyntax']) {
-                $dsn['dbsyntax'] = $dsn['phptype'];
-            }
-            return $dsn;
-        }
-
-        // Find phptype and dbsyntax
-        if (($pos = strpos($dsn, '://')) !== false) {
-            $str = substr($dsn, 0, $pos);
-            $dsn = substr($dsn, $pos + 3);
-        } else {
-            $str = $dsn;
-            $dsn = null;
-        }
-
-        // Get phptype and dbsyntax
-        // $str => phptype(dbsyntax)
-        if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
-            $parsed['phptype']  = $arr[1];
-            $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
-        } else {
-            $parsed['phptype']  = $str;
-            $parsed['dbsyntax'] = $str;
-        }
-
-        if (!count($dsn)) {
-            return $parsed;
-        }
-
-        // Get (if found): username and password
-        // $dsn => username:password@protocol+hostspec/database
-        if (($at = strrpos($dsn,'@')) !== false) {
-            $str = substr($dsn, 0, $at);
-            $dsn = substr($dsn, $at + 1);
-            if (($pos = strpos($str, ':')) !== false) {
-                $parsed['username'] = rawurldecode(substr($str, 0, $pos));
-                $parsed['password'] = rawurldecode(substr($str, $pos + 1));
-            } else {
-                $parsed['username'] = rawurldecode($str);
-            }
-        }
-
-        // Find protocol and hostspec
-
-        // $dsn => proto(proto_opts)/database
-        if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
-            $proto       = $match[1];
-            $proto_opts  = $match[2] ? $match[2] : false;
-            $dsn         = $match[3];
-
-        // $dsn => protocol+hostspec/database (old format)
-        } else {
-            if (strpos($dsn, '+') !== false) {
-                list($proto, $dsn) = explode('+', $dsn, 2);
-            }
-            if (   strpos($dsn, '//') === 0
-                && strpos($dsn, '/', 2) !== false
-                && $parsed['phptype'] == 'oci8'
-            ) {
-                //oracle's "Easy Connect" syntax:
-                //"username/password@[//]host[:port][/service_name]"
-                //e.g. "scott/tiger@//mymachine:1521/oracle"
-                $proto_opts = $dsn;
-                $dsn = substr($proto_opts, strrpos($proto_opts, '/') + 1);
-            } elseif (strpos($dsn, '/') !== false) {
-                list($proto_opts, $dsn) = explode('/', $dsn, 2);
-            } else {
-                $proto_opts = $dsn;
-                $dsn = null;
-            }
-        }
-
-        // process the different protocol options
-        $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
-        $proto_opts = rawurldecode($proto_opts);
-        if (strpos($proto_opts, ':') !== false) {
-            list($proto_opts, $parsed['port']) = explode(':', $proto_opts);
-        }
-        if ($parsed['protocol'] == 'tcp') {
-            $parsed['hostspec'] = $proto_opts;
-        } elseif ($parsed['protocol'] == 'unix') {
-            $parsed['socket'] = $proto_opts;
-        }
-
-        // Get dabase if any
-        // $dsn => database
-        if ($dsn) {
-            // /database
-            if (($pos = strpos($dsn, '?')) === false) {
-                $parsed['database'] = $dsn;
-            // /database?param1=value1&param2=value2
-            } else {
-                $parsed['database'] = substr($dsn, 0, $pos);
-                $dsn = substr($dsn, $pos + 1);
-                if (strpos($dsn, '&') !== false) {
-                    $opts = explode('&', $dsn);
-                } else { // database?param1=value1
-                    $opts = array($dsn);
-                }
-                foreach ($opts as $opt) {
-                    list($key, $value) = explode('=', $opt);
-                    if (!isset($parsed[$key])) {
-                        // don't allow params overwrite
-                        $parsed[$key] = rawurldecode($value);
-                    }
-                }
-            }
-        }
-
-        return $parsed;
-    }
-
-    // }}}
-    // {{{ function fileExists($file)
-
-    /**
-     * Checks if a file exists in the include path
-     *
-     * @param   string  filename
-     *
-     * @return  bool    true success and false on error
-     *
-     * @access  public
-     */
-    function fileExists($file)
-    {
-        // safe_mode does notwork with is_readable()
-        if (!@ini_get('safe_mode')) {
-             $dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
-             foreach ($dirs as $dir) {
-                 if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
-                     return true;
-                 }
-            }
-        } else {
-            $fp = @fopen($file, 'r', true);
-            if (is_resource($fp)) {
-                @fclose($fp);
-                return true;
-            }
-        }
-        return false;
-    }
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Error extends PEAR_Error
-
-/**
- * MDB2_Error implements a class for reporting portable database error
- * messages.
- *
- * @package     MDB2
- * @category    Database
- * @author Stig Bakken <ssb@fast.no>
- */
-class MDB2_Error extends PEAR_Error
-{
-    // {{{ constructor: function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
-
-    /**
-     * MDB2_Error constructor.
-     *
-     * @param   mixed   MDB2 error code, or string with error message.
-     * @param   int     what 'error mode' to operate in
-     * @param   int     what error level to use for $mode & PEAR_ERROR_TRIGGER
-     * @param   mixed   additional debug info, such as the last query
-     */
-    function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
-              $level = E_USER_NOTICE, $debuginfo = null, $dummy = null)
-    {
-        if (is_null($code)) {
-            $code = MDB2_ERROR;
-        }
-        $this->PEAR_Error('MDB2 Error: '.MDB2::errorMessage($code), $code,
-            $mode, $level, $debuginfo);
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Driver_Common extends PEAR
-
-/**
- * MDB2_Driver_Common: Base class that is extended by each MDB2 driver
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Common extends PEAR
-{
-    // {{{ Variables (Properties)
-
-    /**
-     * index of the MDB2 object within the $GLOBALS['_MDB2_databases'] array
-     * @var     int
-     * @access  public
-     */
-    var $db_index = 0;
-
-    /**
-     * DSN used for the next query
-     * @var     array
-     * @access  protected
-     */
-    var $dsn = array();
-
-    /**
-     * DSN that was used to create the current connection
-     * @var     array
-     * @access  protected
-     */
-    var $connected_dsn = array();
-
-    /**
-     * connection resource
-     * @var     mixed
-     * @access  protected
-     */
-    var $connection = 0;
-
-    /**
-     * if the current opened connection is a persistent connection
-     * @var     bool
-     * @access  protected
-     */
-    var $opened_persistent;
-
-    /**
-     * the name of the database for the next query
-     * @var     string
-     * @access  protected
-     */
-    var $database_name = '';
-
-    /**
-     * the name of the database currently selected
-     * @var     string
-     * @access  protected
-     */
-    var $connected_database_name = '';
-
-    /**
-     * server version information
-     * @var     string
-     * @access  protected
-     */
-    var $connected_server_info = '';
-
-    /**
-     * list of all supported features of the given driver
-     * @var     array
-     * @access  public
-     */
-    var $supported = array(
-        'sequences' => false,
-        'indexes' => false,
-        'affected_rows' => false,
-        'summary_functions' => false,
-        'order_by_text' => false,
-        'transactions' => false,
-        'savepoints' => false,
-        'current_id' => false,
-        'limit_queries' => false,
-        'LOBs' => false,
-        'replace' => false,
-        'sub_selects' => false,
-        'triggers' => false,
-        'auto_increment' => false,
-        'primary_key' => false,
-        'result_introspection' => false,
-        'prepared_statements' => false,
-        'identifier_quoting' => false,
-        'pattern_escaping' => false,
-        'new_link' => false,
-    );
-
-    /**
-     * Array of supported options that can be passed to the MDB2 instance.
-     * 
-     * The options can be set during object creation, using
-     * MDB2::connect(), MDB2::factory() or MDB2::singleton(). The options can 
-     * also be set after the object is created, using MDB2::setOptions() or 
-     * MDB2_Driver_Common::setOption().
-     * The list of available option includes:
-     * <ul>
-     *  <li>$options['ssl'] -> boolean: determines if ssl should be used for connections</li>
-     *  <li>$options['field_case'] -> CASE_LOWER|CASE_UPPER: determines what case to force on field/table names</li>
-     *  <li>$options['disable_query'] -> boolean: determines if queries should be executed</li>
-     *  <li>$options['result_class'] -> string: class used for result sets</li>
-     *  <li>$options['buffered_result_class'] -> string: class used for buffered result sets</li>
-     *  <li>$options['result_wrap_class'] -> string: class used to wrap result sets into</li>
-     *  <li>$options['result_buffering'] -> boolean should results be buffered or not?</li>
-     *  <li>$options['fetch_class'] -> string: class to use when fetch mode object is used</li>
-     *  <li>$options['persistent'] -> boolean: persistent connection?</li>
-     *  <li>$options['debug'] -> integer: numeric debug level</li>
-     *  <li>$options['debug_handler'] -> string: function/method that captures debug messages</li>
-     *  <li>$options['debug_expanded_output'] -> bool: BC option to determine if more context information should be send to the debug handler</li>
-     *  <li>$options['default_text_field_length'] -> integer: default text field length to use</li>
-     *  <li>$options['lob_buffer_length'] -> integer: LOB buffer length</li>
-     *  <li>$options['log_line_break'] -> string: line-break format</li>
-     *  <li>$options['idxname_format'] -> string: pattern for index name</li>
-     *  <li>$options['seqname_format'] -> string: pattern for sequence name</li>
-     *  <li>$options['savepoint_format'] -> string: pattern for auto generated savepoint names</li>
-     *  <li>$options['statement_format'] -> string: pattern for prepared statement names</li>
-     *  <li>$options['seqcol_name'] -> string: sequence column name</li>
-     *  <li>$options['quote_identifier'] -> boolean: if identifier quoting should be done when check_option is used</li>
-     *  <li>$options['use_transactions'] -> boolean: if transaction use should be enabled</li>
-     *  <li>$options['decimal_places'] -> integer: number of decimal places to handle</li>
-     *  <li>$options['portability'] -> integer: portability constant</li>
-     *  <li>$options['modules'] -> array: short to long module name mapping for __call()</li>
-     *  <li>$options['emulate_prepared'] -> boolean: force prepared statements to be emulated</li>
-     *  <li>$options['datatype_map'] -> array: map user defined datatypes to other primitive datatypes</li>
-     *  <li>$options['datatype_map_callback'] -> array: callback function/method that should be called</li>
-     *  <li>$options['bindname_format'] -> string: regular expression pattern for named parameters</li>
-     *  <li>$options['multi_query'] -> boolean: determines if queries returning multiple result sets should be executed</li>
-     *  <li>$options['max_identifiers_length'] -> integer: max identifier length</li>
-     *  <li>$options['default_fk_action_onupdate'] -> string: default FOREIGN KEY ON UPDATE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']</li>
-     *  <li>$options['default_fk_action_ondelete'] -> string: default FOREIGN KEY ON DELETE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']</li>
-     * </ul>
-     *
-     * @var     array
-     * @access  public
-     * @see     MDB2::connect()
-     * @see     MDB2::factory()
-     * @see     MDB2::singleton()
-     * @see     MDB2_Driver_Common::setOption()
-     */
-    var $options = array(
-        'ssl' => false,
-        'field_case' => CASE_LOWER,
-        'disable_query' => false,
-        'result_class' => 'MDB2_Result_%s',
-        'buffered_result_class' => 'MDB2_BufferedResult_%s',
-        'result_wrap_class' => false,
-        'result_buffering' => true,
-        'fetch_class' => 'stdClass',
-        'persistent' => false,
-        'debug' => 0,
-        'debug_handler' => 'MDB2_defaultDebugOutput',
-        'debug_expanded_output' => false,
-        'default_text_field_length' => 4096,
-        'lob_buffer_length' => 8192,
-        'log_line_break' => "\n",
-        'idxname_format' => '%s_idx',
-        'seqname_format' => '%s_seq',
-        'savepoint_format' => 'MDB2_SAVEPOINT_%s',
-        'statement_format' => 'MDB2_STATEMENT_%1$s_%2$s',
-        'seqcol_name' => 'sequence',
-        'quote_identifier' => false,
-        'use_transactions' => true,
-        'decimal_places' => 2,
-        'portability' => MDB2_PORTABILITY_ALL,
-        'modules' => array(
-            'ex' => 'Extended',
-            'dt' => 'Datatype',
-            'mg' => 'Manager',
-            'rv' => 'Reverse',
-            'na' => 'Native',
-            'fc' => 'Function',
-        ),
-        'emulate_prepared' => false,
-        'datatype_map' => array(),
-        'datatype_map_callback' => array(),
-        'nativetype_map_callback' => array(),
-        'lob_allow_url_include' => false,
-        'bindname_format' => '(?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)',
-        'max_identifiers_length' => 30,
-        'default_fk_action_onupdate' => 'RESTRICT',
-        'default_fk_action_ondelete' => 'RESTRICT',
-    );
-
-    /**
-     * string array
-     * @var     string
-     * @access  protected
-     */
-    var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => false, 'escape_pattern' => false);
-
-    /**
-     * identifier quoting
-     * @var     array
-     * @access  protected
-     */
-    var $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"');
-
-    /**
-     * sql comments
-     * @var     array
-     * @access  protected
-     */
-    var $sql_comments = array(
-        array('start' => '--', 'end' => "\n", 'escape' => false),
-        array('start' => '/*', 'end' => '*/', 'escape' => false),
-    );
-
-    /**
-     * comparision wildcards
-     * @var     array
-     * @access  protected
-     */
-    var $wildcards = array('%', '_');
-
-    /**
-     * column alias keyword
-     * @var     string
-     * @access  protected
-     */
-    var $as_keyword = ' AS ';
-
-    /**
-     * warnings
-     * @var     array
-     * @access  protected
-     */
-    var $warnings = array();
-
-    /**
-     * string with the debugging information
-     * @var     string
-     * @access  public
-     */
-    var $debug_output = '';
-
-    /**
-     * determine if there is an open transaction
-     * @var     bool
-     * @access  protected
-     */
-    var $in_transaction = false;
-
-    /**
-     * the smart transaction nesting depth
-     * @var     int
-     * @access  protected
-     */
-    var $nested_transaction_counter = null;
-
-    /**
-     * the first error that occured inside a nested transaction
-     * @var     MDB2_Error|bool
-     * @access  protected
-     */
-    var $has_transaction_error = false;
-
-    /**
-     * result offset used in the next query
-     * @var     int
-     * @access  protected
-     */
-    var $offset = 0;
-
-    /**
-     * result limit used in the next query
-     * @var     int
-     * @access  protected
-     */
-    var $limit = 0;
-
-    /**
-     * Database backend used in PHP (mysql, odbc etc.)
-     * @var     string
-     * @access  public
-     */
-    var $phptype;
-
-    /**
-     * Database used with regards to SQL syntax etc.
-     * @var     string
-     * @access  public
-     */
-    var $dbsyntax;
-
-    /**
-     * the last query sent to the driver
-     * @var     string
-     * @access  public
-     */
-    var $last_query;
-
-    /**
-     * the default fetchmode used
-     * @var     int
-     * @access  protected
-     */
-    var $fetchmode = MDB2_FETCHMODE_ORDERED;
-
-    /**
-     * array of module instances
-     * @var     array
-     * @access  protected
-     */
-    var $modules = array();
-
-    /**
-     * determines of the PHP4 destructor emulation has been enabled yet
-     * @var     array
-     * @access  protected
-     */
-    var $destructor_registered = true;
-
-    // }}}
-    // {{{ constructor: function __construct()
-
-    /**
-     * Constructor
-     */
-    function __construct()
-    {
-        end($GLOBALS['_MDB2_databases']);
-        $db_index = key($GLOBALS['_MDB2_databases']) + 1;
-        $GLOBALS['_MDB2_databases'][$db_index] = &$this;
-        $this->db_index = $db_index;
-    }
-
-    // }}}
-    // {{{ function MDB2_Driver_Common()
-
-    /**
-     * PHP 4 Constructor
-     */
-    function MDB2_Driver_Common()
-    {
-        $this->destructor_registered = false;
-        $this->__construct();
-    }
-
-    // }}}
-    // {{{ destructor: function __destruct()
-
-    /**
-     *  Destructor
-     */
-    function __destruct()
-    {
-        $this->disconnect(false);
-    }
-
-    // }}}
-    // {{{ function free()
-
-    /**
-     * Free the internal references so that the instance can be destroyed
-     *
-     * @return  bool    true on success, false if result is invalid
-     *
-     * @access  public
-     */
-    function free()
-    {
-        unset($GLOBALS['_MDB2_databases'][$this->db_index]);
-        unset($this->db_index);
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function __toString()
-
-    /**
-     * String conversation
-     *
-     * @return  string representation of the object
-     *
-     * @access  public
-     */
-    function __toString()
-    {
-        $info = get_class($this);
-        $info.= ': (phptype = '.$this->phptype.', dbsyntax = '.$this->dbsyntax.')';
-        if ($this->connection) {
-            $info.= ' [connected]';
-        }
-        return $info;
-    }
-
-    // }}}
-    // {{{ function errorInfo($error = null)
-
-    /**
-     * This method is used to collect information about an error
-     *
-     * @param   mixed   error code or resource
-     *
-     * @return  array   with MDB2 errorcode, native error code, native message
-     *
-     * @access  public
-     */
-    function errorInfo($error = null)
-    {
-        return array($error, null, null);
-    }
-
-    // }}}
-    // {{{ function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
-
-    /**
-     * This method is used to communicate an error and invoke error
-     * callbacks etc.  Basically a wrapper for PEAR::raiseError
-     * without the message string.
-     *
-     * @param mixed  $code     integer error code, or a PEAR error object (all 
-     *                         other parameters are ignored if this parameter is
-     *                         an object
-     * @param int    $mode     error mode, see PEAR_Error docs
-     * @param mixed  $options  If error mode is PEAR_ERROR_TRIGGER, this is the
-     *                         error level (E_USER_NOTICE etc). If error mode is
-     *                         PEAR_ERROR_CALLBACK, this is the callback function,
-     *                         either as a function name, or as an array of an
-     *                         object and method name. For other error modes this
-     *                         parameter is ignored.
-     * @param string $userinfo Extra debug information. Defaults to the last
-     *                         query and native error code.
-     * @param string $method   name of the method that triggered the error
-     * @param string $dummy1   not used
-     * @param bool   $dummy2   not used
-     *
-     * @return PEAR_Error instance of a PEAR Error object
-     * @access public
-     * @see    PEAR_Error
-     */
-    function &raiseError($code = null,
-                         $mode = null,
-                         $options = null,
-                         $userinfo = null,
-                         $method = null,
-                         $dummy1 = null,
-                         $dummy2 = false
-    ) {
-        $userinfo = "[Error message: $userinfo]\n";
-        // The error is yet a MDB2 error object
-        if (PEAR::isError($code)) {
-            // because we use the static PEAR::raiseError, our global
-            // handler should be used if it is set
-            if (is_null($mode) && !empty($this->_default_error_mode)) {
-                $mode    = $this->_default_error_mode;
-                $options = $this->_default_error_options;
-            }
-            if (is_null($userinfo)) {
-                $userinfo = $code->getUserinfo();
-            }
-            $code = $code->getCode();
-        } elseif ($code == MDB2_ERROR_NOT_FOUND) {
-            // extension not loaded: don't call $this->errorInfo() or the script
-            // will die
-        } elseif (isset($this->connection)) {
-            if (!empty($this->last_query)) {
-                $userinfo.= "[Last executed query: {$this->last_query}]\n";
-            }
-            $native_errno = $native_msg = null;
-            list($code, $native_errno, $native_msg) = $this->errorInfo($code);
-            if (!is_null($native_errno) && $native_errno !== '') {
-                $userinfo.= "[Native code: $native_errno]\n";
-            }
-            if (!is_null($native_msg) && $native_msg !== '') {
-                $userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n";
-            }
-            if (!is_null($method)) {
-                $userinfo = $method.': '.$userinfo;
-            }
-        }
-
-        $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
-        if ($err->getMode() !== PEAR_ERROR_RETURN
-            && isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
-            $this->has_transaction_error =& $err;
-        }
-        return $err;
-    }
-
-    // }}}
-    // {{{ function resetWarnings()
-
-    /**
-     * reset the warning array
-     *
-     * @return void
-     *
-     * @access  public
-     */
-    function resetWarnings()
-    {
-        $this->warnings = array();
-    }
-
-    // }}}
-    // {{{ function getWarnings()
-
-    /**
-     * Get all warnings in reverse order.
-     * This means that the last warning is the first element in the array
-     *
-     * @return  array   with warnings
-     *
-     * @access  public
-     * @see     resetWarnings()
-     */
-    function getWarnings()
-    {
-        return array_reverse($this->warnings);
-    }
-
-    // }}}
-    // {{{ function setFetchMode($fetchmode, $object_class = 'stdClass')
-
-    /**
-     * Sets which fetch mode should be used by default on queries
-     * on this connection
-     *
-     * @param   int     MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC
-     *                               or MDB2_FETCHMODE_OBJECT
-     * @param   string  the class name of the object to be returned
-     *                               by the fetch methods when the
-     *                               MDB2_FETCHMODE_OBJECT mode is selected.
-     *                               If no class is specified by default a cast
-     *                               to object from the assoc array row will be
-     *                               done.  There is also the possibility to use
-     *                               and extend the 'MDB2_row' class.
-     *
-     * @return  mixed   MDB2_OK or MDB2 Error Object
-     *
-     * @access  public
-     * @see     MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_OBJECT
-     */
-    function setFetchMode($fetchmode, $object_class = 'stdClass')
-    {
-        switch ($fetchmode) {
-        case MDB2_FETCHMODE_OBJECT:
-            $this->options['fetch_class'] = $object_class;
-        case MDB2_FETCHMODE_ORDERED:
-        case MDB2_FETCHMODE_ASSOC:
-            $this->fetchmode = $fetchmode;
-            break;
-        default:
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'invalid fetchmode mode', __FUNCTION__);
-        }
-
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function setOption($option, $value)
-
-    /**
-     * set the option for the db class
-     *
-     * @param   string  option name
-     * @param   mixed   value for the option
-     *
-     * @return  mixed   MDB2_OK or MDB2 Error Object
-     *
-     * @access  public
-     */
-    function setOption($option, $value)
-    {
-        if (array_key_exists($option, $this->options)) {
-            $this->options[$option] = $value;
-            return MDB2_OK;
-        }
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            "unknown option $option", __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function getOption($option)
-
-    /**
-     * Returns the value of an option
-     *
-     * @param   string  option name
-     *
-     * @return  mixed   the option value or error object
-     *
-     * @access  public
-     */
-    function getOption($option)
-    {
-        if (array_key_exists($option, $this->options)) {
-            return $this->options[$option];
-        }
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            "unknown option $option", __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function debug($message, $scope = '', $is_manip = null)
-
-    /**
-     * set a debug message
-     *
-     * @param   string  message that should be appended to the debug variable
-     * @param   string  usually the method name that triggered the debug call:
-     *                  for example 'query', 'prepare', 'execute', 'parameters',
-     *                  'beginTransaction', 'commit', 'rollback'
-     * @param   array   contains context information about the debug() call
-     *                  common keys are: is_manip, time, result etc.
-     *
-     * @return void
-     *
-     * @access  public
-     */
-    function debug($message, $scope = '', $context = array())
-    {
-        if ($this->options['debug'] && $this->options['debug_handler']) {
-            if (!$this->options['debug_expanded_output']) {
-                if (!empty($context['when']) && $context['when'] !== 'pre') {
-                    return null;
-                }
-                $context = empty($context['is_manip']) ? false : $context['is_manip'];
-            }
-            return call_user_func_array($this->options['debug_handler'], array(&$this, $scope, $message, $context));
-        }
-        return null;
-    }
-
-    // }}}
-    // {{{ function getDebugOutput()
-
-    /**
-     * output debug info
-     *
-     * @return  string  content of the debug_output class variable
-     *
-     * @access  public
-     */
-    function getDebugOutput()
-    {
-        return $this->debug_output;
-    }
-
-    // }}}
-    // {{{ function escape($text)
-
-    /**
-     * Quotes a string so it can be safely used in a query. It will quote
-     * the text so it can safely be used within a query.
-     *
-     * @param   string  the input string to quote
-     * @param   bool    escape wildcards
-     *
-     * @return  string  quoted string
-     *
-     * @access  public
-     */
-    function escape($text, $escape_wildcards = false)
-    {
-        if ($escape_wildcards) {
-            $text = $this->escapePattern($text);
-        }
-
-        $text = str_replace($this->string_quoting['end'], $this->string_quoting['escape'] . $this->string_quoting['end'], $text);
-        return $text;
-    }
-
-    // }}}
-    // {{{ function escapePattern($text)
-
-    /**
-     * Quotes pattern (% and _) characters in a string)
-     *
-     * @param   string  the input string to quote
-     *
-     * @return  string  quoted string
-     *
-     * @access  public
-     */
-    function escapePattern($text)
-    {
-        if ($this->string_quoting['escape_pattern']) {
-            $text = str_replace($this->string_quoting['escape_pattern'], $this->string_quoting['escape_pattern'] . $this->string_quoting['escape_pattern'], $text);
-            foreach ($this->wildcards as $wildcard) {
-                $text = str_replace($wildcard, $this->string_quoting['escape_pattern'] . $wildcard, $text);
-            }
-        }
-        return $text;
-    }
-
-    // }}}
-    // {{{ function quoteIdentifier($str, $check_option = false)
-
-    /**
-     * Quote a string so it can be safely used as a table or column name
-     *
-     * Delimiting style depends on which database driver is being used.
-     *
-     * NOTE: just because you CAN use delimited identifiers doesn't mean
-     * you SHOULD use them.  In general, they end up causing way more
-     * problems than they solve.
-     *
-     * NOTE: if you have table names containing periods, don't use this method
-     * (@see bug #11906)
-     *
-     * Portability is broken by using the following characters inside
-     * delimited identifiers:
-     *   + backtick (<kbd>`</kbd>) -- due to MySQL
-     *   + double quote (<kbd>"</kbd>) -- due to Oracle
-     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
-     *
-     * Delimited identifiers are known to generally work correctly under
-     * the following drivers:
-     *   + mssql
-     *   + mysql
-     *   + mysqli
-     *   + oci8
-     *   + pgsql
-     *   + sqlite
-     *
-     * InterBase doesn't seem to be able to use delimited identifiers
-     * via PHP 4.  They work fine under PHP 5.
-     *
-     * @param   string  identifier name to be quoted
-     * @param   bool    check the 'quote_identifier' option
-     *
-     * @return  string  quoted identifier string
-     *
-     * @access  public
-     */
-    function quoteIdentifier($str, $check_option = false)
-    {
-        if ($check_option && !$this->options['quote_identifier']) {
-            return $str;
-        }
-        $str = str_replace($this->identifier_quoting['end'], $this->identifier_quoting['escape'] . $this->identifier_quoting['end'], $str);
-        $parts = explode('.', $str);
-        foreach (array_keys($parts) as $k) {
-            $parts[$k] = $this->identifier_quoting['start'] . $parts[$k] . $this->identifier_quoting['end'];
-        }
-        return implode('.', $parts);
-    }
-
-    // }}}
-    // {{{ function getAsKeyword()
-
-    /**
-     * Gets the string to alias column
-     *
-     * @return string to use when aliasing a column
-     */
-    function getAsKeyword()
-    {
-        return $this->as_keyword;
-    }
-
-    // }}}
-    // {{{ function getConnection()
-
-    /**
-     * Returns a native connection
-     *
-     * @return  mixed   a valid MDB2 connection object,
-     *                  or a MDB2 error object on error
-     *
-     * @access  public
-     */
-    function getConnection()
-    {
-        $result = $this->connect();
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return $this->connection;
-    }
-
-     // }}}
-    // {{{ function _fixResultArrayValues(&$row, $mode)
-
-    /**
-     * Do all necessary conversions on result arrays to fix DBMS quirks
-     *
-     * @param   array   the array to be fixed (passed by reference)
-     * @param   array   bit-wise addition of the required portability modes
-     *
-     * @return  void
-     *
-     * @access  protected
-     */
-    function _fixResultArrayValues(&$row, $mode)
-    {
-        switch ($mode) {
-        case MDB2_PORTABILITY_EMPTY_TO_NULL:
-            foreach ($row as $key => $value) {
-                if ($value === '') {
-                    $row[$key] = null;
-                }
-            }
-            break;
-        case MDB2_PORTABILITY_RTRIM:
-            foreach ($row as $key => $value) {
-                if (is_string($value)) {
-                    $row[$key] = rtrim($value);
-                }
-            }
-            break;
-        case MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES:
-            $tmp_row = array();
-            foreach ($row as $key => $value) {
-                $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
-            }
-            $row = $tmp_row;
-            break;
-        case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_EMPTY_TO_NULL):
-            foreach ($row as $key => $value) {
-                if ($value === '') {
-                    $row[$key] = null;
-                } elseif (is_string($value)) {
-                    $row[$key] = rtrim($value);
-                }
-            }
-            break;
-        case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
-            $tmp_row = array();
-            foreach ($row as $key => $value) {
-                if (is_string($value)) {
-                    $value = rtrim($value);
-                }
-                $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
-            }
-            $row = $tmp_row;
-            break;
-        case (MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
-            $tmp_row = array();
-            foreach ($row as $key => $value) {
-                if ($value === '') {
-                    $value = null;
-                }
-                $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
-            }
-            $row = $tmp_row;
-            break;
-        case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
-            $tmp_row = array();
-            foreach ($row as $key => $value) {
-                if ($value === '') {
-                    $value = null;
-                } elseif (is_string($value)) {
-                    $value = rtrim($value);
-                }
-                $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
-            }
-            $row = $tmp_row;
-            break;
-        }
-    }
-
-    // }}}
-    // {{{ function &loadModule($module, $property = null, $phptype_specific = null)
-
-    /**
-     * loads a module
-     *
-     * @param   string  name of the module that should be loaded
-     *                  (only used for error messages)
-     * @param   string  name of the property into which the class will be loaded
-     * @param   bool    if the class to load for the module is specific to the
-     *                  phptype
-     *
-     * @return  object  on success a reference to the given module is returned
-     *                  and on failure a PEAR error
-     *
-     * @access  public
-     */
-    function &loadModule($module, $property = null, $phptype_specific = null)
-    {
-        if (!$property) {
-            $property = strtolower($module);
-        }
-
-        if (!isset($this->{$property})) {
-            $version = $phptype_specific;
-            if ($phptype_specific !== false) {
-                $version = true;
-                $class_name = 'MDB2_Driver_'.$module.'_'.$this->phptype;
-                $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
-            }
-            if ($phptype_specific === false
-                || (!MDB2::classExists($class_name) && !MDB2::fileExists($file_name))
-            ) {
-                $version = false;
-                $class_name = 'MDB2_'.$module;
-                $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
-            }
-
-            $err = MDB2::loadClass($class_name, $this->getOption('debug'));
-            if (PEAR::isError($err)) {
-                return $err;
-            }
-
-            // load module in a specific version
-            if ($version) {
-                if (method_exists($class_name, 'getClassName')) {
-                    $class_name_new = call_user_func(array($class_name, 'getClassName'), $this->db_index);
-                    if ($class_name != $class_name_new) {
-                        $class_name = $class_name_new;
-                        $err = MDB2::loadClass($class_name, $this->getOption('debug'));
-                        if (PEAR::isError($err)) {
-                            return $err;
-                        }
-                    }
-                }
-            }
-
-            if (!MDB2::classExists($class_name)) {
-                $err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
-                    "unable to load module '$module' into property '$property'", __FUNCTION__);
-                return $err;
-            }
-            $this->{$property} = new $class_name($this->db_index);
-            $this->modules[$module] =& $this->{$property};
-            if ($version) {
-                // this will be used in the connect method to determine if the module
-                // needs to be loaded with a different version if the server
-                // version changed in between connects
-                $this->loaded_version_modules[] = $property;
-            }
-        }
-
-        return $this->{$property};
-    }
-
-    // }}}
-    // {{{ function __call($method, $params)
-
-    /**
-     * Calls a module method using the __call magic method
-     *
-     * @param   string  Method name.
-     * @param   array   Arguments.
-     *
-     * @return  mixed   Returned value.
-     */
-    function __call($method, $params)
-    {
-        $module = null;
-        if (preg_match('/^([a-z]+)([A-Z])(.*)$/', $method, $match)
-            && isset($this->options['modules'][$match[1]])
-        ) {
-            $module = $this->options['modules'][$match[1]];
-            $method = strtolower($match[2]).$match[3];
-            if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) {
-                $result =& $this->loadModule($module);
-                if (PEAR::isError($result)) {
-                    return $result;
-                }
-            }
-        } else {
-            foreach ($this->modules as $key => $foo) {
-                if (is_object($this->modules[$key])
-                    && method_exists($this->modules[$key], $method)
-                ) {
-                    $module = $key;
-                    break;
-                }
-            }
-        }
-        if (!is_null($module)) {
-            return call_user_func_array(array(&$this->modules[$module], $method), $params);
-        }
-        trigger_error(sprintf('Call to undefined function: %s::%s().', get_class($this), $method), E_USER_ERROR);
-    }
-
-    // }}}
-    // {{{ function beginTransaction($savepoint = null)
-
-    /**
-     * Start a transaction or set a savepoint.
-     *
-     * @param   string  name of a savepoint to set
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function beginTransaction($savepoint = null)
-    {
-        $this->debug('Starting transaction', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'transactions are not supported', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function commit($savepoint = null)
-
-    /**
-     * Commit the database changes done during a transaction that is in
-     * progress or release a savepoint. This function may only be called when
-     * auto-committing is disabled, otherwise it will fail. Therefore, a new
-     * transaction is implicitly started after committing the pending changes.
-     *
-     * @param   string  name of a savepoint to release
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function commit($savepoint = null)
-    {
-        $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'commiting transactions is not supported', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function rollback($savepoint = null)
-
-    /**
-     * Cancel any database changes done during a transaction or since a specific
-     * savepoint that is in progress. This function may only be called when
-     * auto-committing is disabled, otherwise it will fail. Therefore, a new
-     * transaction is implicitly started after canceling the pending changes.
-     *
-     * @param   string  name of a savepoint to rollback to
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function rollback($savepoint = null)
-    {
-        $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'rolling back transactions is not supported', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function inTransaction($ignore_nested = false)
-
-    /**
-     * If a transaction is currently open.
-     *
-     * @param   bool    if the nested transaction count should be ignored
-     * @return  int|bool    - an integer with the nesting depth is returned if a
-     *                      nested transaction is open
-     *                      - true is returned for a normal open transaction
-     *                      - false is returned if no transaction is open
-     *
-     * @access  public
-     */
-    function inTransaction($ignore_nested = false)
-    {
-        if (!$ignore_nested && isset($this->nested_transaction_counter)) {
-            return $this->nested_transaction_counter;
-        }
-        return $this->in_transaction;
-    }
-
-    // }}}
-    // {{{ function setTransactionIsolation($isolation)
-
-    /**
-     * Set the transacton isolation level.
-     *
-     * @param   string  standard isolation level
-     *                  READ UNCOMMITTED (allows dirty reads)
-     *                  READ COMMITTED (prevents dirty reads)
-     *                  REPEATABLE READ (prevents nonrepeatable reads)
-     *                  SERIALIZABLE (prevents phantom reads)
-     * @param   array some transaction options:
-     *                  'wait' => 'WAIT' | 'NO WAIT'
-     *                  'rw'   => 'READ WRITE' | 'READ ONLY'
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function setTransactionIsolation($isolation, $options = array())
-    {
-        $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'isolation level setting is not supported', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function beginNestedTransaction($savepoint = false)
-
-    /**
-     * Start a nested transaction.
-     *
-     * @return  mixed   MDB2_OK on success/savepoint name, a MDB2 error on failure
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function beginNestedTransaction()
-    {
-        if ($this->in_transaction) {
-            ++$this->nested_transaction_counter;
-            $savepoint = sprintf($this->options['savepoint_format'], $this->nested_transaction_counter);
-            if ($this->supports('savepoints') && $savepoint) {
-                return $this->beginTransaction($savepoint);
-            }
-            return MDB2_OK;
-        }
-        $this->has_transaction_error = false;
-        $result = $this->beginTransaction();
-        $this->nested_transaction_counter = 1;
-        return $result;
-    }
-
-    // }}}
-    // {{{ function completeNestedTransaction($force_rollback = false, $release = false)
-
-    /**
-     * Finish a nested transaction by rolling back if an error occured or
-     * committing otherwise.
-     *
-     * @param   bool    if the transaction should be rolled back regardless
-     *                  even if no error was set within the nested transaction
-     * @return  mixed   MDB_OK on commit/counter decrementing, false on rollback
-     *                  and a MDB2 error on failure
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function completeNestedTransaction($force_rollback = false)
-    {
-        if ($this->nested_transaction_counter > 1) {
-            $savepoint = sprintf($this->options['savepoint_format'], $this->nested_transaction_counter);
-            if ($this->supports('savepoints') && $savepoint) {
-                if ($force_rollback || $this->has_transaction_error) {
-                    $result = $this->rollback($savepoint);
-                    if (!PEAR::isError($result)) {
-                        $result = false;
-                        $this->has_transaction_error = false;
-                    }
-                } else {
-                    $result = $this->commit($savepoint);
-                }
-            } else {
-                $result = MDB2_OK;
-            }
-            --$this->nested_transaction_counter;
-            return $result;
-        }
-
-        $this->nested_transaction_counter = null;
-        $result = MDB2_OK;
-
-        // transaction has not yet been rolled back
-        if ($this->in_transaction) {
-            if ($force_rollback || $this->has_transaction_error) {
-                $result = $this->rollback();
-                if (!PEAR::isError($result)) {
-                    $result = false;
-                }
-            } else {
-                $result = $this->commit();
-            }
-        }
-        $this->has_transaction_error = false;
-        return $result;
-    }
-
-    // }}}
-    // {{{ function failNestedTransaction($error = null, $immediately = false)
-
-    /**
-     * Force setting nested transaction to failed.
-     *
-     * @param   mixed   value to return in getNestededTransactionError()
-     * @param   bool    if the transaction should be rolled back immediately
-     * @return  bool    MDB2_OK
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function failNestedTransaction($error = null, $immediately = false)
-    {
-        if (is_null($error)) {
-            $error = $this->has_transaction_error ? $this->has_transaction_error : true;
-        } elseif (!$error) {
-            $error = true;
-        }
-        $this->has_transaction_error = $error;
-        if (!$immediately) {
-            return MDB2_OK;
-        }
-        return $this->rollback();
-    }
-
-    // }}}
-    // {{{ function getNestedTransactionError()
-
-    /**
-     * The first error that occured since the transaction start.
-     *
-     * @return  MDB2_Error|bool     MDB2 error object if an error occured or false.
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function getNestedTransactionError()
-    {
-        return $this->has_transaction_error;
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database
-     *
-     * @return true on success, MDB2 Error Object on failure
-     */
-    function connect()
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ databaseExists()
-
-    /**
-     * check if given database name is exists?
-     *
-     * @param string $name    name of the database that should be checked
-     *
-     * @return mixed true/false on success, a MDB2 error on failure
-     * @access public
-     */
-    function databaseExists($name)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ setCharset($charset, $connection = null)
-
-    /**
-     * Set the charset on the current connection
-     *
-     * @param string    charset
-     * @param resource  connection handle
-     *
-     * @return true on success, MDB2 Error Object on failure
-     */
-    function setCharset($charset, $connection = null)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function disconnect($force = true)
-
-    /**
-     * Log out and disconnect from the database.
-     *
-     * @param boolean $force whether the disconnect should be forced even if the
-     *                       connection is opened persistently
-     *
-     * @return mixed true on success, false if not connected and error object on error
-     *
-     * @access  public
-     */
-    function disconnect($force = true)
-    {
-        $this->connection = 0;
-        $this->connected_dsn = array();
-        $this->connected_database_name = '';
-        $this->opened_persistent = null;
-        $this->connected_server_info = '';
-        $this->in_transaction = null;
-        $this->nested_transaction_counter = null;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function setDatabase($name)
-
-    /**
-     * Select a different database
-     *
-     * @param   string  name of the database that should be selected
-     *
-     * @return  string  name of the database previously connected to
-     *
-     * @access  public
-     */
-    function setDatabase($name)
-    {
-        $previous_database_name = (isset($this->database_name)) ? $this->database_name : '';
-        $this->database_name = $name;
-        if (!empty($this->connected_database_name) && ($this->connected_database_name != $this->database_name)) {
-            $this->disconnect(false);
-        }
-        return $previous_database_name;
-    }
-
-    // }}}
-    // {{{ function getDatabase()
-
-    /**
-     * Get the current database
-     *
-     * @return  string  name of the database
-     *
-     * @access  public
-     */
-    function getDatabase()
-    {
-        return $this->database_name;
-    }
-
-    // }}}
-    // {{{ function setDSN($dsn)
-
-    /**
-     * set the DSN
-     *
-     * @param   mixed   DSN string or array
-     *
-     * @return  MDB2_OK
-     *
-     * @access  public
-     */
-    function setDSN($dsn)
-    {
-        $dsn_default = $GLOBALS['_MDB2_dsninfo_default'];
-        $dsn = MDB2::parseDSN($dsn);
-        if (array_key_exists('database', $dsn)) {
-            $this->database_name = $dsn['database'];
-            unset($dsn['database']);
-        }
-        $this->dsn = array_merge($dsn_default, $dsn);
-        return $this->disconnect(false);
-    }
-
-    // }}}
-    // {{{ function getDSN($type = 'string', $hidepw = false)
-
-    /**
-     * return the DSN as a string
-     *
-     * @param   string  format to return ("array", "string")
-     * @param   string  string to hide the password with
-     *
-     * @return  mixed   DSN in the chosen type
-     *
-     * @access  public
-     */
-    function getDSN($type = 'string', $hidepw = false)
-    {
-        $dsn = array_merge($GLOBALS['_MDB2_dsninfo_default'], $this->dsn);
-        $dsn['phptype'] = $this->phptype;
-        $dsn['database'] = $this->database_name;
-        if ($hidepw) {
-            $dsn['password'] = $hidepw;
-        }
-        switch ($type) {
-        // expand to include all possible options
-        case 'string':
-           $dsn = $dsn['phptype'].
-               ($dsn['dbsyntax'] ? ('('.$dsn['dbsyntax'].')') : '').
-               '://'.$dsn['username'].':'.
-                $dsn['password'].'@'.$dsn['hostspec'].
-                ($dsn['port'] ? (':'.$dsn['port']) : '').
-                '/'.$dsn['database'];
-            break;
-        case 'array':
-        default:
-            break;
-        }
-        return $dsn;
-    }
-
-    // }}}
-    // {{{ _isNewLinkSet()
-
-    /**
-     * Check if the 'new_link' option is set
-     *
-     * @return boolean
-     *
-     * @access protected
-     */
-    function _isNewLinkSet()
-    {
-        return (isset($this->dsn['new_link'])
-            && ($this->dsn['new_link'] === true
-             || (is_string($this->dsn['new_link']) && preg_match('/^true$/i', $this->dsn['new_link']))
-             || (is_numeric($this->dsn['new_link']) && 0 != (int)$this->dsn['new_link'])
-            )
-        );
-    }
-
-    // }}}
-    // {{{ function &standaloneQuery($query, $types = null, $is_manip = false)
-
-   /**
-     * execute a query as database administrator
-     *
-     * @param   string  the SQL query
-     * @param   mixed   array that contains the types of the columns in
-     *                        the result set
-     * @param   bool    if the query is a manipulation query
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function &standaloneQuery($query, $types = null, $is_manip = false)
-    {
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $result =& $this->_doQuery($query, $is_manip, $connection, false);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        if ($is_manip) {
-            $affected_rows =  $this->_affectedRows($connection, $result);
-            return $affected_rows;
-        }
-        $result =& $this->_wrapResult($result, $types, true, false, $limit, $offset);
-        return $result;
-    }
-
-    // }}}
-    // {{{ function _modifyQuery($query, $is_manip, $limit, $offset)
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * @param   string  query to modify
-     * @param   bool    if it is a DML query
-     * @param   int  limit the number of rows
-     * @param   int  start reading from given offset
-     *
-     * @return  string  modified query
-     *
-     * @access  protected
-     */
-    function _modifyQuery($query, $is_manip, $limit, $offset)
-    {
-        return $query;
-    }
-
-    // }}}
-    // {{{ function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
-
-    /**
-     * Execute a query
-     * @param   string  query
-     * @param   bool    if the query is a manipulation query
-     * @param   resource connection handle
-     * @param   string  database name
-     *
-     * @return  result or error object
-     *
-     * @access  protected
-     */
-    function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
-    {
-        $this->last_query = $query;
-        $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
-        if ($result) {
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            $query = $result;
-        }
-        $err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-        return $err;
-    }
-
-    // }}}
-    // {{{ function _affectedRows($connection, $result = null)
-
-    /**
-     * Returns the number of rows affected
-     *
-     * @param   resource result handle
-     * @param   resource connection handle
-     *
-     * @return  mixed   MDB2 Error Object or the number of rows affected
-     *
-     * @access  private
-     */
-    function _affectedRows($connection, $result = null)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function &exec($query)
-
-    /**
-     * Execute a manipulation query to the database and return the number of affected rows
-     *
-     * @param   string  the SQL query
-     *
-     * @return  mixed   number of affected rows on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function &exec($query)
-    {
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $query = $this->_modifyQuery($query, true, $limit, $offset);
-
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $result =& $this->_doQuery($query, true, $connection, $this->database_name);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        $affectedRows = $this->_affectedRows($connection, $result);
-        return $affectedRows;
-    }
-
-    // }}}
-    // {{{ function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
-
-    /**
-     * Send a query to the database and return any results
-     *
-     * @param   string  the SQL query
-     * @param   mixed   array that contains the types of the columns in
-     *                        the result set
-     * @param   mixed   string which specifies which result class to use
-     * @param   mixed   string which specifies which class to wrap results in
-     *
-     * @return mixed   an MDB2_Result handle on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
-    {
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $query = $this->_modifyQuery($query, false, $limit, $offset);
-
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $result =& $this->_doQuery($query, false, $connection, $this->database_name);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        $result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
-        return $result;
-    }
-
-    // }}}
-    // {{{ function &_wrapResult($result, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null)
-
-    /**
-     * wrap a result set into the correct class
-     *
-     * @param   resource result handle
-     * @param   mixed   array that contains the types of the columns in
-     *                        the result set
-     * @param   mixed   string which specifies which result class to use
-     * @param   mixed   string which specifies which class to wrap results in
-     * @param   string  number of rows to select
-     * @param   string  first row to select
-     *
-     * @return mixed   an MDB2_Result, a MDB2 error on failure
-     *
-     * @access  protected
-     */
-    function &_wrapResult($result, $types = array(), $result_class = true,
-        $result_wrap_class = false, $limit = null, $offset = null)
-    {
-        if ($types === true) {
-            if ($this->supports('result_introspection')) {
-                $this->loadModule('Reverse', null, true);
-                $tableInfo = $this->reverse->tableInfo($result);
-                if (PEAR::isError($tableInfo)) {
-                    return $tableInfo;
-                }
-                $types = array();
-                foreach ($tableInfo as $field) {
-                    $types[] = $field['mdb2type'];
-                }
-            } else {
-                $types = null;
-            }
-        }
-
-        if ($result_class === true) {
-            $result_class = $this->options['result_buffering']
-                ? $this->options['buffered_result_class'] : $this->options['result_class'];
-        }
-
-        if ($result_class) {
-            $class_name = sprintf($result_class, $this->phptype);
-            if (!MDB2::classExists($class_name)) {
-                $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                    'result class does not exist '.$class_name, __FUNCTION__);
-                return $err;
-            }
-            $result =& new $class_name($this, $result, $limit, $offset);
-            if (!MDB2::isResultCommon($result)) {
-                $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                    'result class is not extended from MDB2_Result_Common', __FUNCTION__);
-                return $err;
-            }
-            if (!empty($types)) {
-                $err = $result->setResultTypes($types);
-                if (PEAR::isError($err)) {
-                    $result->free();
-                    return $err;
-                }
-            }
-        }
-        if ($result_wrap_class === true) {
-            $result_wrap_class = $this->options['result_wrap_class'];
-        }
-        if ($result_wrap_class) {
-            if (!MDB2::classExists($result_wrap_class)) {
-                $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                    'result wrap class does not exist '.$result_wrap_class, __FUNCTION__);
-                return $err;
-            }
-            $result = new $result_wrap_class($result, $this->fetchmode);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ function getServerVersion($native = false)
-
-    /**
-     * return version information about the server
-     *
-     * @param   bool    determines if the raw version string should be returned
-     *
-     * @return  mixed   array with version information or row string
-     *
-     * @access  public
-     */
-    function getServerVersion($native = false)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function setLimit($limit, $offset = null)
-
-    /**
-     * set the range of the next query
-     *
-     * @param   string  number of rows to select
-     * @param   string  first row to select
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function setLimit($limit, $offset = null)
-    {
-        if (!$this->supports('limit_queries')) {
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'limit is not supported by this driver', __FUNCTION__);
-        }
-        $limit = (int)$limit;
-        if ($limit < 0) {
-            return $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                'it was not specified a valid selected range row limit', __FUNCTION__);
-        }
-        $this->limit = $limit;
-        if (!is_null($offset)) {
-            $offset = (int)$offset;
-            if ($offset < 0) {
-                return $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                    'it was not specified a valid first selected range row', __FUNCTION__);
-            }
-            $this->offset = $offset;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function subSelect($query, $type = false)
-
-    /**
-     * simple subselect emulation: leaves the query untouched for all RDBMS
-     * that support subselects
-     *
-     * @param   string  the SQL query for the subselect that may only
-     *                      return a column
-     * @param   string  determines type of the field
-     *
-     * @return  string  the query
-     *
-     * @access  public
-     */
-    function subSelect($query, $type = false)
-    {
-        if ($this->supports('sub_selects') === true) {
-            return $query;
-        }
-
-        if (!$this->supports('sub_selects')) {
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'method not implemented', __FUNCTION__);
-        }
-
-        $col = $this->queryCol($query, $type);
-        if (PEAR::isError($col)) {
-            return $col;
-        }
-        if (!is_array($col) || count($col) == 0) {
-            return 'NULL';
-        }
-        if ($type) {
-            $this->loadModule('Datatype', null, true);
-            return $this->datatype->implodeArray($col, $type);
-        }
-        return implode(', ', $col);
-    }
-
-    // }}}
-    // {{{ function replace($table, $fields)
-
-    /**
-     * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
-     * query, except that if there is already a row in the table with the same
-     * key field values, the old row is deleted before the new row is inserted.
-     *
-     * The REPLACE type of query does not make part of the SQL standards. Since
-     * practically only MySQL and SQLite implement it natively, this type of
-     * query isemulated through this method for other DBMS using standard types
-     * of queries inside a transaction to assure the atomicity of the operation.
-     *
-     * @param   string  name of the table on which the REPLACE query will
-     *       be executed.
-     * @param   array   associative array   that describes the fields and the
-     *       values that will be inserted or updated in the specified table. The
-     *       indexes of the array are the names of all the fields of the table.
-     *       The values of the array are also associative arrays that describe
-     *       the values and other properties of the table fields.
-     *
-     *       Here follows a list of field properties that need to be specified:
-     *
-     *       value
-     *           Value to be assigned to the specified field. This value may be
-     *           of specified in database independent type format as this
-     *           function can perform the necessary datatype conversions.
-     *
-     *           Default: this property is required unless the Null property is
-     *           set to 1.
-     *
-     *       type
-     *           Name of the type of the field. Currently, all types MDB2
-     *           are supported except for clob and blob.
-     *
-     *           Default: no type conversion
-     *
-     *       null
-     *           bool    property that indicates that the value for this field
-     *           should be set to null.
-     *
-     *           The default value for fields missing in INSERT queries may be
-     *           specified the definition of a table. Often, the default value
-     *           is already null, but since the REPLACE may be emulated using
-     *           an UPDATE query, make sure that all fields of the table are
-     *           listed in this function argument array.
-     *
-     *           Default: 0
-     *
-     *       key
-     *           bool    property that indicates that this field should be
-     *           handled as a primary key or at least as part of the compound
-     *           unique index of the table that will determine the row that will
-     *           updated if it exists or inserted a new row otherwise.
-     *
-     *           This function will fail if no key field is specified or if the
-     *           value of a key field is set to null because fields that are
-     *           part of unique index they may not be null.
-     *
-     *           Default: 0
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function replace($table, $fields)
-    {
-        if (!$this->supports('replace')) {
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'replace query is not supported', __FUNCTION__);
-        }
-        $count = count($fields);
-        $condition = $values = array();
-        for ($colnum = 0, reset($fields); $colnum < $count; next($fields), $colnum++) {
-            $name = key($fields);
-            if (isset($fields[$name]['null']) && $fields[$name]['null']) {
-                $value = 'NULL';
-            } else {
-                $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
-                $value = $this->quote($fields[$name]['value'], $type);
-            }
-            $values[$name] = $value;
-            if (isset($fields[$name]['key']) && $fields[$name]['key']) {
-                if ($value === 'NULL') {
-                    return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
-                        'key value '.$name.' may not be NULL', __FUNCTION__);
-                }
-                $condition[] = $this->quoteIdentifier($name, true) . '=' . $value;
-            }
-        }
-        if (empty($condition)) {
-            return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
-                'not specified which fields are keys', __FUNCTION__);
-        }
-
-        $result = null;
-        $in_transaction = $this->in_transaction;
-        if (!$in_transaction && PEAR::isError($result = $this->beginTransaction())) {
-            return $result;
-        }
-
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $condition = ' WHERE '.implode(' AND ', $condition);
-        $query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition;
-        $result =& $this->_doQuery($query, true, $connection);
-        if (!PEAR::isError($result)) {
-            $affected_rows = $this->_affectedRows($connection, $result);
-            $insert = '';
-            foreach ($values as $key => $value) {
-                $insert .= ($insert?', ':'') . $this->quoteIdentifier($key, true);
-            }
-            $values = implode(', ', $values);
-            $query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)";
-            $result =& $this->_doQuery($query, true, $connection);
-            if (!PEAR::isError($result)) {
-                $affected_rows += $this->_affectedRows($connection, $result);;
-            }
-        }
-
-        if (!$in_transaction) {
-            if (PEAR::isError($result)) {
-                $this->rollback();
-            } else {
-                $result = $this->commit();
-            }
-        }
-
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        return $affected_rows;
-    }
-
-    // }}}
-    // {{{ function &prepare($query, $types = null, $result_types = null, $lobs = array())
-
-    /**
-     * Prepares a query for multiple execution with execute().
-     * With some database backends, this is emulated.
-     * prepare() requires a generic query as string like
-     * 'INSERT INTO numbers VALUES(?,?)' or
-     * 'INSERT INTO numbers VALUES(:foo,:bar)'.
-     * The ? and :name and are placeholders which can be set using
-     * bindParam() and the query can be sent off using the execute() method.
-     * The allowed format for :name can be set with the 'bindname_format' option.
-     *
-     * @param   string  the query to prepare
-     * @param   mixed   array that contains the types of the placeholders
-     * @param   mixed   array that contains the types of the columns in
-     *                        the result set or MDB2_PREPARE_RESULT, if set to
-     *                        MDB2_PREPARE_MANIP the query is handled as a manipulation query
-     * @param   mixed   key (field) value (parameter) pair for all lob placeholders
-     *
-     * @return  mixed   resource handle for the prepared query on success, 
-     *                  a MDB2 error on failure
-     *
-     * @access  public
-     * @see     bindParam, execute
-     */
-    function &prepare($query, $types = null, $result_types = null, $lobs = array())
-    {
-        $is_manip = ($result_types === MDB2_PREPARE_MANIP);
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
-        if ($result) {
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            $query = $result;
-        }
-        $placeholder_type_guess = $placeholder_type = null;
-        $question  = '?';
-        $colon     = ':';
-        $positions = array();
-        $position  = 0;
-        while ($position < strlen($query)) {
-            $q_position = strpos($query, $question, $position);
-            $c_position = strpos($query, $colon, $position);
-            if ($q_position && $c_position) {
-                $p_position = min($q_position, $c_position);
-            } elseif ($q_position) {
-                $p_position = $q_position;
-            } elseif ($c_position) {
-                $p_position = $c_position;
-            } else {
-                break;
-            }
-            if (is_null($placeholder_type)) {
-                $placeholder_type_guess = $query[$p_position];
-            }
-
-            $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
-            if (PEAR::isError($new_pos)) {
-                return $new_pos;
-            }
-            if ($new_pos != $position) {
-                $position = $new_pos;
-                continue; //evaluate again starting from the new position
-            }
-
-            if ($query[$position] == $placeholder_type_guess) {
-                if (is_null($placeholder_type)) {
-                    $placeholder_type = $query[$p_position];
-                    $question = $colon = $placeholder_type;
-                    if (!empty($types) && is_array($types)) {
-                        if ($placeholder_type == ':') {
-                            if (is_int(key($types))) {
-                                $types_tmp = $types;
-                                $types = array();
-                                $count = -1;
-                            }
-                        } else {
-                            $types = array_values($types);
-                        }
-                    }
-                }
-                if ($placeholder_type == ':') {
-                    $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
-                    $parameter = preg_replace($regexp, '\\1', $query);
-                    if ($parameter === '') {
-                        $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                            'named parameter name must match "bindname_format" option', __FUNCTION__);
-                        return $err;
-                    }
-                    $positions[$p_position] = $parameter;
-                    $query = substr_replace($query, '?', $position, strlen($parameter)+1);
-                    // use parameter name in type array
-                    if (isset($count) && isset($types_tmp[++$count])) {
-                        $types[$parameter] = $types_tmp[$count];
-                    }
-                } else {
-                    $positions[$p_position] = count($positions);
-                }
-                $position = $p_position + 1;
-            } else {
-                $position = $p_position;
-            }
-        }
-        $class_name = 'MDB2_Statement_'.$this->phptype;
-        $statement = null;
-        $obj = new $class_name($this, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
-        $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
-        return $obj;
-    }
-
-    // }}}
-    // {{{ function _skipDelimitedStrings($query, $position, $p_position)
-    
-    /**
-     * Utility method, used by prepare() to avoid replacing placeholders within delimited strings.
-     * Check if the placeholder is contained within a delimited string.
-     * If so, skip it and advance the position, otherwise return the current position,
-     * which is valid
-     *
-     * @param string $query
-     * @param integer $position current string cursor position
-     * @param integer $p_position placeholder position
-     *
-     * @return mixed integer $new_position on success
-     *               MDB2_Error on failure
-     *
-     * @access  protected
-     */
-    function _skipDelimitedStrings($query, $position, $p_position)
-    {
-        $ignores = $this->string_quoting;
-        $ignores[] = $this->identifier_quoting;
-        $ignores = array_merge($ignores, $this->sql_comments);
-        
-        foreach ($ignores as $ignore) {
-            if (!empty($ignore['start'])) {
-                if (is_int($start_quote = strpos($query, $ignore['start'], $position)) && $start_quote < $p_position) {
-                    $end_quote = $start_quote;
-                    do {
-                        if (!is_int($end_quote = strpos($query, $ignore['end'], $end_quote + 1))) {
-                            if ($ignore['end'] === "\n") {
-                                $end_quote = strlen($query) - 1;
-                            } else {
-                                $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                                    'query with an unterminated text string specified', __FUNCTION__);
-                                return $err;
-                            }
-                        }
-                    } while ($ignore['escape']
-                        && $end_quote-1 != $start_quote
-                        && $query[($end_quote - 1)] == $ignore['escape']
-                        && (   $ignore['escape_pattern'] !== $ignore['escape']
-                            || $query[($end_quote - 2)] != $ignore['escape'])
-                    );
-
-                    $position = $end_quote + 1;
-                    return $position;
-                }
-            }
-        }
-        return $position;
-    }
-    
-    // }}}
-    // {{{ function quote($value, $type = null, $quote = true)
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param   string  text string value that is intended to be converted.
-     * @param   string  type to which the value should be converted to
-     * @param   bool    quote
-     * @param   bool    escape wildcards
-     *
-     * @return  string  text string that represents the given argument value in
-     *       a DBMS specific format.
-     *
-     * @access  public
-     */
-    function quote($value, $type = null, $quote = true, $escape_wildcards = false)
-    {
-        $result = $this->loadModule('Datatype', null, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        return $this->datatype->quote($value, $type, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ function getDeclaration($type, $name, $field)
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare
-     * of the given type
-     *
-     * @param   string  type to which the value should be converted to
-     * @param   string  name the field to be declared.
-     * @param   string  definition of the field
-     *
-     * @return  string  DBMS specific SQL code portion that should be used to
-     *                 declare the specified field.
-     *
-     * @access  public
-     */
-    function getDeclaration($type, $name, $field)
-    {
-        $result = $this->loadModule('Datatype', null, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return $this->datatype->getDeclaration($type, $name, $field);
-    }
-
-    // }}}
-    // {{{ function compareDefinition($current, $previous)
-
-    /**
-     * Obtain an array of changes that may need to applied
-     *
-     * @param   array   new definition
-     * @param   array   old definition
-     *
-     * @return  array   containing all changes that will need to be applied
-     *
-     * @access  public
-     */
-    function compareDefinition($current, $previous)
-    {
-        $result = $this->loadModule('Datatype', null, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return $this->datatype->compareDefinition($current, $previous);
-    }
-
-    // }}}
-    // {{{ function supports($feature)
-
-    /**
-     * Tell whether a DB implementation or its backend extension
-     * supports a given feature.
-     *
-     * @param   string  name of the feature (see the MDB2 class doc)
-     *
-     * @return  bool|string if this DB implementation supports a given feature
-     *                      false means no, true means native,
-     *                      'emulated' means emulated
-     *
-     * @access  public
-     */
-    function supports($feature)
-    {
-        if (array_key_exists($feature, $this->supported)) {
-            return $this->supported[$feature];
-        }
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            "unknown support feature $feature", __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function getSequenceName($sqn)
-
-    /**
-     * adds sequence name formatting to a sequence name
-     *
-     * @param   string  name of the sequence
-     *
-     * @return  string  formatted sequence name
-     *
-     * @access  public
-     */
-    function getSequenceName($sqn)
-    {
-        return sprintf($this->options['seqname_format'],
-            preg_replace('/[^a-z0-9_\-\$.]/i', '_', $sqn));
-    }
-
-    // }}}
-    // {{{ function getIndexName($idx)
-
-    /**
-     * adds index name formatting to a index name
-     *
-     * @param   string  name of the index
-     *
-     * @return  string  formatted index name
-     *
-     * @access  public
-     */
-    function getIndexName($idx)
-    {
-        return sprintf($this->options['idxname_format'],
-            preg_replace('/[^a-z0-9_\-\$.]/i', '_', $idx));
-    }
-
-    // }}}
-    // {{{ function nextID($seq_name, $ondemand = true)
-
-    /**
-     * Returns the next free id of a sequence
-     *
-     * @param   string  name of the sequence
-     * @param   bool    when true missing sequences are automatic created
-     *
-     * @return  mixed   MDB2 Error Object or id
-     *
-     * @access  public
-     */
-    function nextID($seq_name, $ondemand = true)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function lastInsertID($table = null, $field = null)
-
-    /**
-     * Returns the autoincrement ID if supported or $id or fetches the current
-     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
-     *
-     * @param   string  name of the table into which a new row was inserted
-     * @param   string  name of the field into which a new row was inserted
-     *
-     * @return  mixed   MDB2 Error Object or id
-     *
-     * @access  public
-     */
-    function lastInsertID($table = null, $field = null)
-    {
-        return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function currID($seq_name)
-
-    /**
-     * Returns the current id of a sequence
-     *
-     * @param   string  name of the sequence
-     *
-     * @return  mixed   MDB2 Error Object or id
-     *
-     * @access  public
-     */
-    function currID($seq_name)
-    {
-        $this->warnings[] = 'database does not support getting current
-            sequence value, the sequence value was incremented';
-        return $this->nextID($seq_name);
-    }
-
-    // }}}
-    // {{{ function queryOne($query, $type = null, $colnum = 0)
-
-    /**
-     * Execute the specified query, fetch the value from the first column of
-     * the first row of the result set and then frees
-     * the result set.
-     *
-     * @param string $query  the SELECT query statement to be executed.
-     * @param string $type   optional argument that specifies the expected
-     *                       datatype of the result set field, so that an eventual
-     *                       conversion may be performed. The default datatype is
-     *                       text, meaning that no conversion is performed
-     * @param mixed  $colnum the column number (or name) to fetch
-     *
-     * @return  mixed   MDB2_OK or field value on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function queryOne($query, $type = null, $colnum = 0)
-    {
-        $result = $this->query($query, $type);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $one = $result->fetchOne($colnum);
-        $result->free();
-        return $one;
-    }
-
-    // }}}
-    // {{{ function queryRow($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
-
-    /**
-     * Execute the specified query, fetch the values from the first
-     * row of the result set into an array and then frees
-     * the result set.
-     *
-     * @param   string  the SELECT query statement to be executed.
-     * @param   array   optional array argument that specifies a list of
-     *       expected datatypes of the result set columns, so that the eventual
-     *       conversions may be performed. The default list of datatypes is
-     *       empty, meaning that no conversion is performed.
-     * @param   int     how the array data should be indexed
-     *
-     * @return  mixed   MDB2_OK or data array on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function queryRow($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
-    {
-        $result = $this->query($query, $types);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $row = $result->fetchRow($fetchmode);
-        $result->free();
-        return $row;
-    }
-
-    // }}}
-    // {{{ function queryCol($query, $type = null, $colnum = 0)
-
-    /**
-     * Execute the specified query, fetch the value from the first column of
-     * each row of the result set into an array and then frees the result set.
-     *
-     * @param string $query  the SELECT query statement to be executed.
-     * @param string $type   optional argument that specifies the expected
-     *                       datatype of the result set field, so that an eventual
-     *                       conversion may be performed. The default datatype is text,
-     *                       meaning that no conversion is performed
-     * @param mixed  $colnum the column number (or name) to fetch
-     *
-     * @return  mixed   MDB2_OK or data array on success, a MDB2 error on failure
-     * @access  public
-     */
-    function queryCol($query, $type = null, $colnum = 0)
-    {
-        $result = $this->query($query, $type);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $col = $result->fetchCol($colnum);
-        $result->free();
-        return $col;
-    }
-
-    // }}}
-    // {{{ function queryAll($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false, $force_array = false, $group = false)
-
-    /**
-     * Execute the specified query, fetch all the rows of the result set into
-     * a two dimensional array and then frees the result set.
-     *
-     * @param   string  the SELECT query statement to be executed.
-     * @param   array   optional array argument that specifies a list of
-     *       expected datatypes of the result set columns, so that the eventual
-     *       conversions may be performed. The default list of datatypes is
-     *       empty, meaning that no conversion is performed.
-     * @param   int     how the array data should be indexed
-     * @param   bool    if set to true, the $all will have the first
-     *       column as its first dimension
-     * @param   bool    used only when the query returns exactly
-     *       two columns. If true, the values of the returned array will be
-     *       one-element arrays instead of scalars.
-     * @param   bool    if true, the values of the returned array is
-     *       wrapped in another array.  If the same key value (in the first
-     *       column) repeats itself, the values will be appended to this array
-     *       instead of overwriting the existing values.
-     *
-     * @return  mixed   MDB2_OK or data array on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function queryAll($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT,
-        $rekey = false, $force_array = false, $group = false)
-    {
-        $result = $this->query($query, $types);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $all = $result->fetchAll($fetchmode, $rekey, $force_array, $group);
-        $result->free();
-        return $all;
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Result
-
-/**
- * The dummy class that all user space result classes should extend from
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result
-{
-}
-
-// }}}
-// {{{ class MDB2_Result_Common extends MDB2_Result
-
-/**
- * The common result class for MDB2 result objects
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_Common extends MDB2_Result
-{
-    // {{{ Variables (Properties)
-
-    var $db;
-    var $result;
-    var $rownum = -1;
-    var $types = array();
-    var $values = array();
-    var $offset;
-    var $offset_count = 0;
-    var $limit;
-    var $column_names;
-
-    // }}}
-    // {{{ constructor: function __construct(&$db, &$result, $limit = 0, $offset = 0)
-
-    /**
-     * Constructor
-     */
-    function __construct(&$db, &$result, $limit = 0, $offset = 0)
-    {
-        $this->db =& $db;
-        $this->result =& $result;
-        $this->offset = $offset;
-        $this->limit = max(0, $limit - 1);
-    }
-
-    // }}}
-    // {{{ function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
-
-    /**
-     * PHP 4 Constructor
-     */
-    function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
-    {
-        $this->__construct($db, $result, $limit, $offset);
-    }
-
-    // }}}
-    // {{{ function setResultTypes($types)
-
-    /**
-     * Define the list of types to be associated with the columns of a given
-     * result set.
-     *
-     * This function may be called before invoking fetchRow(), fetchOne(),
-     * fetchCol() and fetchAll() so that the necessary data type
-     * conversions are performed on the data to be retrieved by them. If this
-     * function is not called, the type of all result set columns is assumed
-     * to be text, thus leading to not perform any conversions.
-     *
-     * @param   array   variable that lists the
-     *       data types to be expected in the result set columns. If this array
-     *       contains less types than the number of columns that are returned
-     *       in the result set, the remaining columns are assumed to be of the
-     *       type text. Currently, the types clob and blob are not fully
-     *       supported.
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function setResultTypes($types)
-    {
-        $load = $this->db->loadModule('Datatype', null, true);
-        if (PEAR::isError($load)) {
-            return $load;
-        }
-        $types = $this->db->datatype->checkResultTypes($types);
-        if (PEAR::isError($types)) {
-            return $types;
-        }
-        $this->types = $types;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function seek($rownum = 0)
-
-    /**
-     * Seek to a specific row in a result set
-     *
-     * @param   int     number of the row where the data can be found
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function seek($rownum = 0)
-    {
-        $target_rownum = $rownum - 1;
-        if ($this->rownum > $target_rownum) {
-            return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'seeking to previous rows not implemented', __FUNCTION__);
-        }
-        while ($this->rownum < $target_rownum) {
-            $this->fetchRow();
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
-
-    /**
-     * Fetch and return a row of data
-     *
-     * @param   int     how the array data should be indexed
-     * @param   int     number of the row where the data can be found
-     *
-     * @return  int     data array on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
-    {
-        $err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-        return $err;
-    }
-
-    // }}}
-    // {{{ function fetchOne($colnum = 0)
-
-    /**
-     * fetch single column from the next row from a result set
-     *
-     * @param int|string the column number (or name) to fetch
-     * @param int        number of the row where the data can be found
-     *
-     * @return string data on success, a MDB2 error on failure
-     * @access  public
-     */
-    function fetchOne($colnum = 0, $rownum = null)
-    {
-        $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC;
-        $row = $this->fetchRow($fetchmode, $rownum);
-        if (!is_array($row) || PEAR::isError($row)) {
-            return $row;
-        }
-        if (!array_key_exists($colnum, $row)) {
-            return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null,
-                'column is not defined in the result set: '.$colnum, __FUNCTION__);
-        }
-        return $row[$colnum];
-    }
-
-    // }}}
-    // {{{ function fetchCol($colnum = 0)
-
-    /**
-     * Fetch and return a column from the current row pointer position
-     *
-     * @param int|string the column number (or name) to fetch
-     *
-     * @return  mixed data array on success, a MDB2 error on failure
-     * @access  public
-     */
-    function fetchCol($colnum = 0)
-    {
-        $column = array();
-        $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC;
-        $row = $this->fetchRow($fetchmode);
-        if (is_array($row)) {
-            if (!array_key_exists($colnum, $row)) {
-                return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null,
-                    'column is not defined in the result set: '.$colnum, __FUNCTION__);
-            }
-            do {
-                $column[] = $row[$colnum];
-            } while (is_array($row = $this->fetchRow($fetchmode)));
-        }
-        if (PEAR::isError($row)) {
-            return $row;
-        }
-        return $column;
-    }
-
-    // }}}
-    // {{{ function fetchAll($fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false, $force_array = false, $group = false)
-
-    /**
-     * Fetch and return all rows from the current row pointer position
-     *
-     * @param   int     $fetchmode  the fetch mode to use:
-     *                            + MDB2_FETCHMODE_ORDERED
-     *                            + MDB2_FETCHMODE_ASSOC
-     *                            + MDB2_FETCHMODE_ORDERED | MDB2_FETCHMODE_FLIPPED
-     *                            + MDB2_FETCHMODE_ASSOC | MDB2_FETCHMODE_FLIPPED
-     * @param   bool    if set to true, the $all will have the first
-     *       column as its first dimension
-     * @param   bool    used only when the query returns exactly
-     *       two columns. If true, the values of the returned array will be
-     *       one-element arrays instead of scalars.
-     * @param   bool    if true, the values of the returned array is
-     *       wrapped in another array.  If the same key value (in the first
-     *       column) repeats itself, the values will be appended to this array
-     *       instead of overwriting the existing values.
-     *
-     * @return  mixed   data array on success, a MDB2 error on failure
-     *
-     * @access  public
-     * @see     getAssoc()
-     */
-    function fetchAll($fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false,
-        $force_array = false, $group = false)
-    {
-        $all = array();
-        $row = $this->fetchRow($fetchmode);
-        if (PEAR::isError($row)) {
-            return $row;
-        } elseif (!$row) {
-            return $all;
-        }
-
-        $shift_array = $rekey ? false : null;
-        if (!is_null($shift_array)) {
-            if (is_object($row)) {
-                $colnum = count(get_object_vars($row));
-            } else {
-                $colnum = count($row);
-            }
-            if ($colnum < 2) {
-                return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null,
-                    'rekey feature requires atleast 2 column', __FUNCTION__);
-            }
-            $shift_array = (!$force_array && $colnum == 2);
-        }
-
-        if ($rekey) {
-            do {
-                if (is_object($row)) {
-                    $arr = get_object_vars($row);
-                    $key = reset($arr);
-                    unset($row->{$key});
-                } else {
-                    if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
-                        $key = reset($row);
-                        unset($row[key($row)]);
-                    } else {
-                        $key = array_shift($row);
-                    }
-                    if ($shift_array) {
-                        $row = array_shift($row);
-                    }
-                }
-                if ($group) {
-                    $all[$key][] = $row;
-                } else {
-                    $all[$key] = $row;
-                }
-            } while (($row = $this->fetchRow($fetchmode)));
-        } elseif ($fetchmode & MDB2_FETCHMODE_FLIPPED) {
-            do {
-                foreach ($row as $key => $val) {
-                    $all[$key][] = $val;
-                }
-            } while (($row = $this->fetchRow($fetchmode)));
-        } else {
-            do {
-                $all[] = $row;
-            } while (($row = $this->fetchRow($fetchmode)));
-        }
-
-        return $all;
-    }
-
-    // }}}
-    // {{{ function rowCount()
-    /**
-     * Returns the actual row number that was last fetched (count from 0)
-     * @return  int
-     *
-     * @access  public
-     */
-    function rowCount()
-    {
-        return $this->rownum + 1;
-    }
-
-    // }}}
-    // {{{ function numRows()
-
-    /**
-     * Returns the number of rows in a result object
-     *
-     * @return  mixed   MDB2 Error Object or the number of rows
-     *
-     * @access  public
-     */
-    function numRows()
-    {
-        return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function nextResult()
-
-    /**
-     * Move the internal result pointer to the next available result
-     *
-     * @return  true on success, false if there is no more result set or an error object on failure
-     *
-     * @access  public
-     */
-    function nextResult()
-    {
-        return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function getColumnNames()
-
-    /**
-     * Retrieve the names of columns returned by the DBMS in a query result or
-     * from the cache.
-     *
-     * @param   bool    If set to true the values are the column names,
-     *                  otherwise the names of the columns are the keys.
-     * @return  mixed   Array variable that holds the names of columns or an
-     *                  MDB2 error on failure.
-     *                  Some DBMS may not return any columns when the result set
-     *                  does not contain any rows.
-     *
-     * @access  public
-     */
-    function getColumnNames($flip = false)
-    {
-        if (!isset($this->column_names)) {
-            $result = $this->_getColumnNames();
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            $this->column_names = $result;
-        }
-        if ($flip) {
-            return array_flip($this->column_names);
-        }
-        return $this->column_names;
-    }
-
-    // }}}
-    // {{{ function _getColumnNames()
-
-    /**
-     * Retrieve the names of columns returned by the DBMS in a query result.
-     *
-     * @return  mixed   Array variable that holds the names of columns as keys
-     *                  or an MDB2 error on failure.
-     *                  Some DBMS may not return any columns when the result set
-     *                  does not contain any rows.
-     *
-     * @access  private
-     */
-    function _getColumnNames()
-    {
-        return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function numCols()
-
-    /**
-     * Count the number of columns returned by the DBMS in a query result.
-     *
-     * @return  mixed   integer value with the number of columns, a MDB2 error
-     *       on failure
-     *
-     * @access  public
-     */
-    function numCols()
-    {
-        return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ function getResource()
-
-    /**
-     * return the resource associated with the result object
-     *
-     * @return  resource
-     *
-     * @access  public
-     */
-    function getResource()
-    {
-        return $this->result;
-    }
-
-    // }}}
-    // {{{ function bindColumn($column, &$value, $type = null)
-
-    /**
-     * Set bind variable to a column.
-     *
-     * @param   int     column number or name
-     * @param   mixed   variable reference
-     * @param   string  specifies the type of the field
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function bindColumn($column, &$value, $type = null)
-    {
-        if (!is_numeric($column)) {
-            $column_names = $this->getColumnNames();
-            if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                if ($this->db->options['field_case'] == CASE_LOWER) {
-                    $column = strtolower($column);
-                } else {
-                    $column = strtoupper($column);
-                }
-            }
-            $column = $column_names[$column];
-        }
-        $this->values[$column] =& $value;
-        if (!is_null($type)) {
-            $this->types[$column] = $type;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function _assignBindColumns($row)
-
-    /**
-     * Bind a variable to a value in the result row.
-     *
-     * @param   array   row data
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  private
-     */
-    function _assignBindColumns($row)
-    {
-        $row = array_values($row);
-        foreach ($row as $column => $value) {
-            if (array_key_exists($column, $this->values)) {
-                $this->values[$column] = $value;
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function free()
-
-    /**
-     * Free the internal resources associated with result.
-     *
-     * @return  bool    true on success, false if result is invalid
-     *
-     * @access  public
-     */
-    function free()
-    {
-        $this->result = false;
-        return MDB2_OK;
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Row
-
-/**
- * The simple class that accepts row data as an array
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Row
-{
-    // {{{ constructor: function __construct(&$row)
-
-    /**
-     * constructor
-     *
-     * @param   resource    row data as array
-     */
-    function __construct(&$row)
-    {
-        foreach ($row as $key => $value) {
-            $this->$key = &$row[$key];
-        }
-    }
-
-    // }}}
-    // {{{ function MDB2_Row(&$row)
-
-    /**
-     * PHP 4 Constructor
-     *
-     * @param   resource    row data as array
-     */
-    function MDB2_Row(&$row)
-    {
-        $this->__construct($row);
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Statement_Common
-
-/**
- * The common statement class for MDB2 statement objects
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_Common
-{
-    // {{{ Variables (Properties)
-
-    var $db;
-    var $statement;
-    var $query;
-    var $result_types;
-    var $types;
-    var $values = array();
-    var $limit;
-    var $offset;
-    var $is_manip;
-
-    // }}}
-    // {{{ constructor: function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
-
-    /**
-     * Constructor
-     */
-    function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
-    {
-        $this->db =& $db;
-        $this->statement =& $statement;
-        $this->positions = $positions;
-        $this->query = $query;
-        $this->types = (array)$types;
-        $this->result_types = (array)$result_types;
-        $this->limit = $limit;
-        $this->is_manip = $is_manip;
-        $this->offset = $offset;
-    }
-
-    // }}}
-    // {{{ function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
-
-    /**
-     * PHP 4 Constructor
-     */
-    function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
-    {
-        $this->__construct($db, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
-    }
-
-    // }}}
-    // {{{ function bindValue($parameter, &$value, $type = null)
-
-    /**
-     * Set the value of a parameter of a prepared query.
-     *
-     * @param   int     the order number of the parameter in the query
-     *       statement. The order number of the first parameter is 1.
-     * @param   mixed   value that is meant to be assigned to specified
-     *       parameter. The type of the value depends on the $type argument.
-     * @param   string  specifies the type of the field
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function bindValue($parameter, $value, $type = null)
-    {
-        if (!is_numeric($parameter)) {
-            $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter);
-        }
-        if (!in_array($parameter, $this->positions)) {
-            return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
-        }
-        $this->values[$parameter] = $value;
-        if (!is_null($type)) {
-            $this->types[$parameter] = $type;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function bindValueArray($values, $types = null)
-
-    /**
-     * Set the values of multiple a parameter of a prepared query in bulk.
-     *
-     * @param   array   specifies all necessary information
-     *       for bindValue() the array elements must use keys corresponding to
-     *       the number of the position of the parameter.
-     * @param   array   specifies the types of the fields
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     * @see     bindParam()
-     */
-    function bindValueArray($values, $types = null)
-    {
-        $types = is_array($types) ? array_values($types) : array_fill(0, count($values), null);
-        $parameters = array_keys($values);
-        foreach ($parameters as $key => $parameter) {
-            $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
-            $this->db->expectError(MDB2_ERROR_NOT_FOUND);
-            $err = $this->bindValue($parameter, $values[$parameter], $types[$key]);
-            $this->db->popExpect();
-            $this->db->popErrorHandling();
-            if (PEAR::isError($err)) {
-                if ($err->getCode() == MDB2_ERROR_NOT_FOUND) {
-                    //ignore (extra value for missing placeholder)
-                    continue;
-                }
-                return $err;
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function bindParam($parameter, &$value, $type = null)
-
-    /**
-     * Bind a variable to a parameter of a prepared query.
-     *
-     * @param   int     the order number of the parameter in the query
-     *       statement. The order number of the first parameter is 1.
-     * @param   mixed   variable that is meant to be bound to specified
-     *       parameter. The type of the value depends on the $type argument.
-     * @param   string  specifies the type of the field
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function bindParam($parameter, &$value, $type = null)
-    {
-        if (!is_numeric($parameter)) {
-            $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter);
-        }
-        if (!in_array($parameter, $this->positions)) {
-            return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
-        }
-        $this->values[$parameter] =& $value;
-        if (!is_null($type)) {
-            $this->types[$parameter] = $type;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function bindParamArray(&$values, $types = null)
-
-    /**
-     * Bind the variables of multiple a parameter of a prepared query in bulk.
-     *
-     * @param   array   specifies all necessary information
-     *       for bindParam() the array elements must use keys corresponding to
-     *       the number of the position of the parameter.
-     * @param   array   specifies the types of the fields
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     * @see     bindParam()
-     */
-    function bindParamArray(&$values, $types = null)
-    {
-        $types = is_array($types) ? array_values($types) : array_fill(0, count($values), null);
-        $parameters = array_keys($values);
-        foreach ($parameters as $key => $parameter) {
-            $err = $this->bindParam($parameter, $values[$parameter], $types[$key]);
-            if (PEAR::isError($err)) {
-                return $err;
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function &execute($values = null, $result_class = true, $result_wrap_class = false)
-
-    /**
-     * Execute a prepared query statement.
-     *
-     * @param array specifies all necessary information
-     *              for bindParam() the array elements must use keys corresponding
-     *              to the number of the position of the parameter.
-     * @param mixed specifies which result class to use
-     * @param mixed specifies which class to wrap results in
-     *
-     * @return mixed MDB2_Result or integer (affected rows) on success,
-     *               a MDB2 error on failure
-     * @access public
-     */
-    function &execute($values = null, $result_class = true, $result_wrap_class = false)
-    {
-        if (is_null($this->positions)) {
-            return $this->db->raiseError(MDB2_ERROR, null, null,
-                'Prepared statement has already been freed', __FUNCTION__);
-        }
-
-        $values = (array)$values;
-        if (!empty($values)) {
-            $err = $this->bindValueArray($values);
-            if (PEAR::isError($err)) {
-                return $this->db->raiseError(MDB2_ERROR, null, null,
-                                            'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__);
-            }
-        }
-        $result =& $this->_execute($result_class, $result_wrap_class);
-        return $result;
-    }
-
-    // }}}
-    // {{{ function &_execute($result_class = true, $result_wrap_class = false)
-
-    /**
-     * Execute a prepared query statement helper method.
-     *
-     * @param   mixed   specifies which result class to use
-     * @param   mixed   specifies which class to wrap results in
-     *
-     * @return mixed MDB2_Result or integer (affected rows) on success,
-     *               a MDB2 error on failure
-     * @access  private
-     */
-    function &_execute($result_class = true, $result_wrap_class = false)
-    {
-        $this->last_query = $this->query;
-        $query = '';
-        $last_position = 0;
-        foreach ($this->positions as $current_position => $parameter) {
-            if (!array_key_exists($parameter, $this->values)) {
-                return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                    'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
-            }
-            $value = $this->values[$parameter];
-            $query.= substr($this->query, $last_position, $current_position - $last_position);
-            if (!isset($value)) {
-                $value_quoted = 'NULL';
-            } else {
-                $type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null;
-                $value_quoted = $this->db->quote($value, $type);
-                if (PEAR::isError($value_quoted)) {
-                    return $value_quoted;
-                }
-            }
-            $query.= $value_quoted;
-            $last_position = $current_position + 1;
-        }
-        $query.= substr($this->query, $last_position);
-
-        $this->db->offset = $this->offset;
-        $this->db->limit = $this->limit;
-        if ($this->is_manip) {
-            $result = $this->db->exec($query);
-        } else {
-            $result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ function free()
-
-    /**
-     * Release resources allocated for the specified prepared query.
-     *
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function free()
-    {
-        if (is_null($this->positions)) {
-            return $this->db->raiseError(MDB2_ERROR, null, null,
-                'Prepared statement has already been freed', __FUNCTION__);
-        }
-
-        $this->statement = null;
-        $this->positions = null;
-        $this->query = null;
-        $this->types = null;
-        $this->result_types = null;
-        $this->limit = null;
-        $this->is_manip = null;
-        $this->offset = null;
-        $this->values = null;
-
-        return MDB2_OK;
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ class MDB2_Module_Common
-
-/**
- * The common modules class for MDB2 module objects
- *
- * @package     MDB2
- * @category    Database
- * @author      Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Module_Common
-{
-    // {{{ Variables (Properties)
-
-    /**
-     * contains the key to the global MDB2 instance array of the associated
-     * MDB2 instance
-     *
-     * @var     int
-     * @access  protected
-     */
-    var $db_index;
-
-    // }}}
-    // {{{ constructor: function __construct($db_index)
-
-    /**
-     * Constructor
-     */
-    function __construct($db_index)
-    {
-        $this->db_index = $db_index;
-    }
-
-    // }}}
-    // {{{ function MDB2_Module_Common($db_index)
-
-    /**
-     * PHP 4 Constructor
-     */
-    function MDB2_Module_Common($db_index)
-    {
-        $this->__construct($db_index);
-    }
-
-    // }}}
-    // {{{ function &getDBInstance()
-
-    /**
-     * Get the instance of MDB2 associated with the module instance
-     *
-     * @return  object  MDB2 instance or a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function &getDBInstance()
-    {
-        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            $result =& $GLOBALS['_MDB2_databases'][$this->db_index];
-        } else {
-            $result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'could not find MDB2 instance');
-        }
-        return $result;
-    }
-
-    // }}}
-}
-
-// }}}
-// {{{ function MDB2_closeOpenTransactions()
-
-/**
- * Close any open transactions form persistent connections
- *
- * @return  void
- *
- * @access  public
- */
-
-function MDB2_closeOpenTransactions()
-{
-    reset($GLOBALS['_MDB2_databases']);
-    while (next($GLOBALS['_MDB2_databases'])) {
-        $key = key($GLOBALS['_MDB2_databases']);
-        if ($GLOBALS['_MDB2_databases'][$key]->opened_persistent
-            && $GLOBALS['_MDB2_databases'][$key]->in_transaction
-        ) {
-            $GLOBALS['_MDB2_databases'][$key]->rollback();
-        }
-    }
-}
-
-// }}}
-// {{{ function MDB2_defaultDebugOutput(&$db, $scope, $message, $is_manip = null)
-
-/**
- * default debug output handler
- *
- * @param   object  reference to an MDB2 database object
- * @param   string  usually the method name that triggered the debug call:
- *                  for example 'query', 'prepare', 'execute', 'parameters',
- *                  'beginTransaction', 'commit', 'rollback'
- * @param   string  message that should be appended to the debug variable
- * @param   array   contains context information about the debug() call
- *                  common keys are: is_manip, time, result etc.
- *
- * @return  void|string optionally return a modified message, this allows
- *                      rewriting a query before being issued or prepared
- *
- * @access  public
- */
-function MDB2_defaultDebugOutput(&$db, $scope, $message, $context = array())
-{
-    $db->debug_output.= $scope.'('.$db->db_index.'): ';
-    $db->debug_output.= $message.$db->getOption('log_line_break');
-    return $message;
-}
-
-// }}}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Date.php b/lib/php/MDB2/Date.php
deleted file mode 100644
index ce846543a50e8383fe1fa2140ec8903c8a48daf2..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Date.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Date.php,v 1.10 2006/03/01 12:15:32 lsmith Exp $
-//
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Several methods to convert the MDB2 native timestamp format (ISO based)
- * to and from data structures that are convenient to worth with in side of php.
- * For more complex date arithmetic please take a look at the Date package in PEAR
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Date
-{
-    // {{{ mdbNow()
-
-    /**
-     * return the current datetime
-     *
-     * @return string current datetime in the MDB2 format
-     * @access public
-     */
-    function mdbNow()
-    {
-        return date('Y-m-d H:i:s');
-    }
-    // }}}
-
-    // {{{ mdbToday()
-
-    /**
-     * return the current date
-     *
-     * @return string current date in the MDB2 format
-     * @access public
-     */
-    function mdbToday()
-    {
-        return date('Y-m-d');
-    }
-    // }}}
-
-    // {{{ mdbTime()
-
-    /**
-     * return the current time
-     *
-     * @return string current time in the MDB2 format
-     * @access public
-     */
-    function mdbTime()
-    {
-        return date('H:i:s');
-    }
-    // }}}
-
-    // {{{ date2Mdbstamp()
-
-    /**
-     * convert a date into a MDB2 timestamp
-     *
-     * @param int hour of the date
-     * @param int minute of the date
-     * @param int second of the date
-     * @param int month of the date
-     * @param int day of the date
-     * @param int year of the date
-     *
-     * @return string a valid MDB2 timestamp
-     * @access public
-     */
-    function date2Mdbstamp($hour = null, $minute = null, $second = null,
-        $month = null, $day = null, $year = null)
-    {
-        return MDB2_Date::unix2Mdbstamp(mktime($hour, $minute, $second, $month, $day, $year, -1));
-    }
-    // }}}
-
-    // {{{ unix2Mdbstamp()
-
-    /**
-     * convert a unix timestamp into a MDB2 timestamp
-     *
-     * @param int a valid unix timestamp
-     *
-     * @return string a valid MDB2 timestamp
-     * @access public
-     */
-    function unix2Mdbstamp($unix_timestamp)
-    {
-        return date('Y-m-d H:i:s', $unix_timestamp);
-    }
-    // }}}
-
-    // {{{ mdbstamp2Unix()
-
-    /**
-     * convert a MDB2 timestamp into a unix timestamp
-     *
-     * @param int a valid MDB2 timestamp
-     * @return string unix timestamp with the time stored in the MDB2 format
-     *
-     * @access public
-     */
-    function mdbstamp2Unix($mdb_timestamp)
-    {
-        $arr = MDB2_Date::mdbstamp2Date($mdb_timestamp);
-
-        return mktime($arr['hour'], $arr['minute'], $arr['second'], $arr['month'], $arr['day'], $arr['year'], -1);
-    }
-    // }}}
-
-    // {{{ mdbstamp2Date()
-
-    /**
-     * convert a MDB2 timestamp into an array containing all
-     * values necessary to pass to php's date() function
-     *
-     * @param int a valid MDB2 timestamp
-     *
-     * @return array with the time split
-     * @access public
-     */
-    function mdbstamp2Date($mdb_timestamp)
-    {
-        list($arr['year'], $arr['month'], $arr['day'], $arr['hour'], $arr['minute'], $arr['second']) =
-            sscanf($mdb_timestamp, "%04u-%02u-%02u %02u:%02u:%02u");
-        return $arr;
-    }
-    // }}}
-}
-
-?>
diff --git a/lib/php/MDB2/Driver/Datatype/Common.php b/lib/php/MDB2/Driver/Datatype/Common.php
deleted file mode 100644
index 329bd60768dbb383169aa281b562e341e045592e..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Datatype/Common.php
+++ /dev/null
@@ -1,1824 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Common.php,v 1.139 2008/12/04 11:50:42 afz Exp $
-
-require_once 'MDB2/LOB.php';
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * MDB2_Driver_Common: Base class that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Datatype');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
-{
-    var $valid_default_values = array(
-        'text'      => '',
-        'boolean'   => true,
-        'integer'   => 0,
-        'decimal'   => 0.0,
-        'float'     => 0.0,
-        'timestamp' => '1970-01-01 00:00:00',
-        'time'      => '00:00:00',
-        'date'      => '1970-01-01',
-        'clob'      => '',
-        'blob'      => '',
-    );
-
-    /**
-     * contains all LOB objects created with this MDB2 instance
-     * @var array
-     * @access protected
-     */
-    var $lobs = array();
-
-    // }}}
-    // {{{ getValidTypes()
-
-    /**
-     * Get the list of valid types
-     *
-     * This function returns an array of valid types as keys with the values
-     * being possible default values for all native datatypes and mapped types
-     * for custom datatypes.
-     *
-     * @return mixed array on success, a MDB2 error on failure
-     * @access public
-     */
-    function getValidTypes()
-    {
-        $types = $this->valid_default_values;
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        if (!empty($db->options['datatype_map'])) {
-            foreach ($db->options['datatype_map'] as $type => $mapped_type) {
-                if (array_key_exists($mapped_type, $types)) {
-                    $types[$type] = $types[$mapped_type];
-                } elseif (!empty($db->options['datatype_map_callback'][$type])) {
-                    $parameter = array('type' => $type, 'mapped_type' => $mapped_type);
-                    $default =  call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-                    $types[$type] = $default;
-                }
-            }
-        }
-        return $types;
-    }
-
-    // }}}
-    // {{{ checkResultTypes()
-
-    /**
-     * Define the list of types to be associated with the columns of a given
-     * result set.
-     *
-     * This function may be called before invoking fetchRow(), fetchOne()
-     * fetchCole() and fetchAll() so that the necessary data type
-     * conversions are performed on the data to be retrieved by them. If this
-     * function is not called, the type of all result set columns is assumed
-     * to be text, thus leading to not perform any conversions.
-     *
-     * @param array $types array variable that lists the
-     *       data types to be expected in the result set columns. If this array
-     *       contains less types than the number of columns that are returned
-     *       in the result set, the remaining columns are assumed to be of the
-     *       type text. Currently, the types clob and blob are not fully
-     *       supported.
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function checkResultTypes($types)
-    {
-        $types = is_array($types) ? $types : array($types);
-        foreach ($types as $key => $type) {
-            if (!isset($this->valid_default_values[$type])) {
-                $db =& $this->getDBInstance();
-                if (PEAR::isError($db)) {
-                    return $db;
-                }
-                if (empty($db->options['datatype_map'][$type])) {
-                    return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                        $type.' for '.$key.' is not a supported column type', __FUNCTION__);
-                }
-            }
-        }
-        return $types;
-    }
-
-    // }}}
-    // {{{ _baseConvertResult()
-
-    /**
-     * General type conversion method
-     *
-     * @param mixed   $value reference to a value to be converted
-     * @param string  $type  specifies which type to convert to
-     * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
-     * @return object an MDB2 error on failure
-     * @access protected
-     */
-    function _baseConvertResult($value, $type, $rtrim = true)
-    {
-        switch ($type) {
-        case 'text':
-            if ($rtrim) {
-                $value = rtrim($value);
-            }
-            return $value;
-        case 'integer':
-            return intval($value);
-        case 'boolean':
-            return !empty($value);
-        case 'decimal':
-            return $value;
-        case 'float':
-            return doubleval($value);
-        case 'date':
-            return $value;
-        case 'time':
-            return $value;
-        case 'timestamp':
-            return $value;
-        case 'clob':
-        case 'blob':
-            $this->lobs[] = array(
-                'buffer' => null,
-                'position' => 0,
-                'lob_index' => null,
-                'endOfLOB' => false,
-                'resource' => $value,
-                'value' => null,
-                'loaded' => false,
-            );
-            end($this->lobs);
-            $lob_index = key($this->lobs);
-            $this->lobs[$lob_index]['lob_index'] = $lob_index;
-            return fopen('MDB2LOB://'.$lob_index.'@'.$this->db_index, 'r+');
-        }
-
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_INVALID, null, null,
-            'attempt to convert result value to an unknown type :' . $type, __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ convertResult()
-
-    /**
-     * Convert a value to a RDBMS indipendent MDB2 type
-     *
-     * @param mixed   $value value to be converted
-     * @param string  $type  specifies which type to convert to
-     * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
-     * @return mixed converted value
-     * @access public
-     */
-    function convertResult($value, $type, $rtrim = true)
-    {
-        if (is_null($value)) {
-            return null;
-        }
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        if (!empty($db->options['datatype_map'][$type])) {
-            $type = $db->options['datatype_map'][$type];
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('type' => $type, 'value' => $value, 'rtrim' => $rtrim);
-                return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-            }
-        }
-        return $this->_baseConvertResult($value, $type, $rtrim);
-    }
-
-    // }}}
-    // {{{ convertResultRow()
-
-    /**
-     * Convert a result row
-     *
-     * @param array   $types
-     * @param array   $row   specifies the types to convert to
-     * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
-     * @return mixed MDB2_OK on success, an MDB2 error on failure
-     * @access public
-     */
-    function convertResultRow($types, $row, $rtrim = true)
-    {
-        $types = $this->_sortResultFieldTypes(array_keys($row), $types);
-        foreach ($row as $key => $value) {
-            if (empty($types[$key])) {
-                continue;
-            }
-            $value = $this->convertResult($row[$key], $types[$key], $rtrim);
-            if (PEAR::isError($value)) {
-                return $value;
-            }
-            $row[$key] = $value;
-        }
-        return $row;
-    }
-
-    // }}}
-    // {{{ _sortResultFieldTypes()
-
-    /**
-     * convert a result row
-     *
-     * @param array $types
-     * @param array $row specifies the types to convert to
-     * @param bool   $rtrim   if to rtrim text values or not
-     * @return mixed MDB2_OK on success,  a MDB2 error on failure
-     * @access public
-     */
-    function _sortResultFieldTypes($columns, $types)
-    {
-        $n_cols = count($columns);
-        $n_types = count($types);
-        if ($n_cols > $n_types) {
-            for ($i= $n_cols - $n_types; $i >= 0; $i--) {
-                $types[] = null;
-            }
-        }
-        $sorted_types = array();
-        foreach ($columns as $col) {
-            $sorted_types[$col] = null;
-        }
-        foreach ($types as $name => $type) {
-            if (array_key_exists($name, $sorted_types)) {
-                $sorted_types[$name] = $type;
-                unset($types[$name]);
-            }
-        }
-        // if there are left types in the array, fill the null values of the
-        // sorted array with them, in order.
-        if (count($types)) {
-            reset($types);
-            foreach (array_keys($sorted_types) as $k) {
-                if (is_null($sorted_types[$k])) {
-                    $sorted_types[$k] = current($types);
-                    next($types);
-                }
-            }
-        }
-        return $sorted_types;
-    }
-
-    // }}}
-    // {{{ getDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare
-     * of the given type
-     *
-     * @param string $type type to which the value should be converted to
-     * @param string  $name   name the field to be declared.
-     * @param string  $field  definition of the field
-     * @return string  DBMS specific SQL code portion that should be used to
-     *                 declare the specified field.
-     * @access public
-     */
-    function getDeclaration($type, $name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!empty($db->options['datatype_map'][$type])) {
-            $type = $db->options['datatype_map'][$type];
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('type' => $type, 'name' => $name, 'field' => $field);
-                return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-            }
-            $field['type'] = $type;
-        }
-
-        if (!method_exists($this, "_get{$type}Declaration")) {
-            return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'type not defined: '.$type, __FUNCTION__);
-        }
-        return $this->{"_get{$type}Declaration"}($name, $field);
-    }
-
-    // }}}
-    // {{{ getTypeDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an text type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param array $field  associative array with the name of the properties
-     *      of the field being declared as array indexes. Currently, the types
-     *      of supported field properties are as follows:
-     *
-     *      length
-     *          Integer value that determines the maximum length of the text
-     *          field. If this argument is missing the field should be
-     *          declared to have the longest length allowed by the DBMS.
-     *
-     *      default
-     *          Text value to be used as default for this field.
-     *
-     *      notnull
-     *          Boolean flag that indicates whether this field is constrained
-     *          to not be set to null.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *      declare the specified field.
-     * @access public
-     */
-    function getTypeDeclaration($field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        switch ($field['type']) {
-        case 'text':
-            $length = !empty($field['length']) ? $field['length'] : $db->options['default_text_field_length'];
-            $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
-            return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
-                : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
-        case 'clob':
-            return 'TEXT';
-        case 'blob':
-            return 'TEXT';
-        case 'integer':
-            return 'INT';
-        case 'boolean':
-            return 'INT';
-        case 'date':
-            return 'CHAR ('.strlen('YYYY-MM-DD').')';
-        case 'time':
-            return 'CHAR ('.strlen('HH:MM:SS').')';
-        case 'timestamp':
-            return 'CHAR ('.strlen('YYYY-MM-DD HH:MM:SS').')';
-        case 'float':
-            return 'TEXT';
-        case 'decimal':
-            return 'TEXT';
-        }
-        return '';
-    }
-
-    // }}}
-    // {{{ _getDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a generic type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name   name the field to be declared.
-     * @param array  $field  associative array with the name of the properties
-     *      of the field being declared as array indexes. Currently, the types
-     *      of supported field properties are as follows:
-     *
-     *      length
-     *          Integer value that determines the maximum length of the text
-     *          field. If this argument is missing the field should be
-     *          declared to have the longest length allowed by the DBMS.
-     *
-     *      default
-     *          Text value to be used as default for this field.
-     *
-     *      notnull
-     *          Boolean flag that indicates whether this field is constrained
-     *          to not be set to null.
-     *      charset
-     *          Text value with the default CHARACTER SET for this field.
-     *      collation
-     *          Text value with the default COLLATION for this field.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *      declare the specified field, or a MDB2_Error on failure
-     * @access protected
-     */
-    function _getDeclaration($name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        $declaration_options = $db->datatype->_getDeclarationOptions($field);
-        if (PEAR::isError($declaration_options)) {
-            return $declaration_options;
-        }
-        return $name.' '.$this->getTypeDeclaration($field).$declaration_options;
-    }
-
-    // }}}
-    // {{{ _getDeclarationOptions()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a generic type
-     * field to be used in statement like CREATE TABLE, without the field name
-     * and type values (ie. just the character set, default value, if the
-     * field is permitted to be NULL or not, and the collation options).
-     *
-     * @param array  $field  associative array with the name of the properties
-     *      of the field being declared as array indexes. Currently, the types
-     *      of supported field properties are as follows:
-     *
-     *      default
-     *          Text value to be used as default for this field.
-     *      notnull
-     *          Boolean flag that indicates whether this field is constrained
-     *          to not be set to null.
-     *      charset
-     *          Text value with the default CHARACTER SET for this field.
-     *      collation
-     *          Text value with the default COLLATION for this field.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *      declare the specified field's options.
-     * @access protected
-     */
-    function _getDeclarationOptions($field)
-    {
-        $charset = empty($field['charset']) ? '' :
-            ' '.$this->_getCharsetFieldDeclaration($field['charset']);
-
-        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
-        $default = '';
-        if (array_key_exists('default', $field)) {
-            if ($field['default'] === '') {
-                $db =& $this->getDBInstance();
-                if (PEAR::isError($db)) {
-                    return $db;
-                }
-                $valid_default_values = $this->getValidTypes();
-                $field['default'] = $valid_default_values[$field['type']];
-                if ($field['default'] === ''&& ($db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL)) {
-                    $field['default'] = ' ';
-                }
-            }
-            if (!is_null($field['default'])) {
-                $default = ' DEFAULT ' . $this->quote($field['default'], $field['type']);
-            }
-        }
-
-        $collation = empty($field['collation']) ? '' :
-            ' '.$this->_getCollationFieldDeclaration($field['collation']);
-
-        return $charset.$default.$notnull.$collation;
-    }
-
-    // }}}
-    // {{{ _getCharsetFieldDeclaration()
-    
-    /**
-     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
-     * of a field declaration to be used in statements like CREATE TABLE.
-     *
-     * @param string $charset   name of the charset
-     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET
-     *                 of a field declaration.
-     */
-    function _getCharsetFieldDeclaration($charset)
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ _getCollationFieldDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to set the COLLATION
-     * of a field declaration to be used in statements like CREATE TABLE.
-     *
-     * @param string $collation   name of the collation
-     * @return string  DBMS specific SQL code portion needed to set the COLLATION
-     *                 of a field declaration.
-     */
-    function _getCollationFieldDeclaration($collation)
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ _getIntegerDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an integer type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       unsigned
-     *           Boolean flag that indicates whether the field should be
-     *           declared as unsigned integer if possible.
-     *
-     *       default
-     *           Integer value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getIntegerDeclaration($name, $field)
-    {
-        if (!empty($field['unsigned'])) {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-
-            $db->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";
-        }
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getTextDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an text type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       length
-     *           Integer value that determines the maximum length of the text
-     *           field. If this argument is missing the field should be
-     *           declared to have the longest length allowed by the DBMS.
-     *
-     *       default
-     *           Text value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getTextDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getCLOBDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an character
-     * large object type field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *        of the field being declared as array indexes. Currently, the types
-     *        of supported field properties are as follows:
-     *
-     *        length
-     *            Integer value that determines the maximum length of the large
-     *            object field. If this argument is missing the field should be
-     *            declared to have the longest length allowed by the DBMS.
-     *
-     *        notnull
-     *            Boolean flag that indicates whether this field is constrained
-     *            to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *        declare the specified field.
-     * @access public
-     */
-    function _getCLOBDeclaration($name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
-        $name = $db->quoteIdentifier($name, true);
-        return $name.' '.$this->getTypeDeclaration($field).$notnull;
-    }
-
-    // }}}
-    // {{{ _getBLOBDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an binary large
-     * object type field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *        of the field being declared as array indexes. Currently, the types
-     *        of supported field properties are as follows:
-     *
-     *        length
-     *            Integer value that determines the maximum length of the large
-     *            object field. If this argument is missing the field should be
-     *            declared to have the longest length allowed by the DBMS.
-     *
-     *        notnull
-     *            Boolean flag that indicates whether this field is constrained
-     *            to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *        declare the specified field.
-     * @access protected
-     */
-    function _getBLOBDeclaration($name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
-        $name = $db->quoteIdentifier($name, true);
-        return $name.' '.$this->getTypeDeclaration($field).$notnull;
-    }
-
-    // }}}
-    // {{{ _getBooleanDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a boolean type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Boolean value to be used as default for this field.
-     *
-     *       notnullL
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getBooleanDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getDateDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a date type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Date value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getDateDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getTimestampDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a timestamp
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Timestamp value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getTimestampDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getTimeDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a time
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Time value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getTimeDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getFloatDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a float type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Float value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getFloatDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getDecimalDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare a decimal type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string $name name the field to be declared.
-     * @param array $field associative array with the name of the properties
-     *       of the field being declared as array indexes. Currently, the types
-     *       of supported field properties are as follows:
-     *
-     *       default
-     *           Decimal value to be used as default for this field.
-     *
-     *       notnull
-     *           Boolean flag that indicates whether this field is constrained
-     *           to not be set to null.
-     * @return string DBMS specific SQL code portion that should be used to
-     *       declare the specified field.
-     * @access protected
-     */
-    function _getDecimalDeclaration($name, $field)
-    {
-        return $this->_getDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ compareDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access public
-     */
-    function compareDefinition($current, $previous)
-    {
-        $type = !empty($current['type']) ? $current['type'] : null;
-
-        if (!method_exists($this, "_compare{$type}Definition")) {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('current' => $current, 'previous' => $previous);
-                $change =  call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-                return $change;
-            }
-            return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'type "'.$current['type'].'" is not yet supported', __FUNCTION__);
-        }
-
-        if (empty($previous['type']) || $previous['type'] != $type) {
-            return $current;
-        }
-
-        $change = $this->{"_compare{$type}Definition"}($current, $previous);
-
-        if ($previous['type'] != $type) {
-            $change['type'] = true;
-        }
-
-        $previous_notnull = !empty($previous['notnull']) ? $previous['notnull'] : false;
-        $notnull = !empty($current['notnull']) ? $current['notnull'] : false;
-        if ($previous_notnull != $notnull) {
-            $change['notnull'] = true;
-        }
-
-        $previous_default = array_key_exists('default', $previous) ? $previous['default'] :
-            ($previous_notnull ? '' : null);
-        $default = array_key_exists('default', $current) ? $current['default'] :
-            ($notnull ? '' : null);
-        if ($previous_default !== $default) {
-            $change['default'] = true;
-        }
-
-        return $change;
-    }
-
-    // }}}
-    // {{{ _compareIntegerDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an integer field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareIntegerDefinition($current, $previous)
-    {
-        $change = array();
-        $previous_unsigned = !empty($previous['unsigned']) ? $previous['unsigned'] : false;
-        $unsigned = !empty($current['unsigned']) ? $current['unsigned'] : false;
-        if ($previous_unsigned != $unsigned) {
-            $change['unsigned'] = true;
-        }
-        $previous_autoincrement = !empty($previous['autoincrement']) ? $previous['autoincrement'] : false;
-        $autoincrement = !empty($current['autoincrement']) ? $current['autoincrement'] : false;
-        if ($previous_autoincrement != $autoincrement) {
-            $change['autoincrement'] = true;
-        }
-        return $change;
-    }
-
-    // }}}
-    // {{{ _compareTextDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an text field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareTextDefinition($current, $previous)
-    {
-        $change = array();
-        $previous_length = !empty($previous['length']) ? $previous['length'] : 0;
-        $length = !empty($current['length']) ? $current['length'] : 0;
-        if ($previous_length != $length) {
-            $change['length'] = true;
-        }
-        $previous_fixed = !empty($previous['fixed']) ? $previous['fixed'] : 0;
-        $fixed = !empty($current['fixed']) ? $current['fixed'] : 0;
-        if ($previous_fixed != $fixed) {
-            $change['fixed'] = true;
-        }
-        return $change;
-    }
-
-    // }}}
-    // {{{ _compareCLOBDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an CLOB field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareCLOBDefinition($current, $previous)
-    {
-        return $this->_compareTextDefinition($current, $previous);
-    }
-
-    // }}}
-    // {{{ _compareBLOBDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an BLOB field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareBLOBDefinition($current, $previous)
-    {
-        return $this->_compareTextDefinition($current, $previous);
-    }
-
-    // }}}
-    // {{{ _compareDateDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an date field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareDateDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ _compareTimeDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an time field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareTimeDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ _compareTimestampDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an timestamp field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareTimestampDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ _compareBooleanDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an boolean field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareBooleanDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ _compareFloatDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an float field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareFloatDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ _compareDecimalDefinition()
-
-    /**
-     * Obtain an array of changes that may need to applied to an decimal field
-     *
-     * @param array $current new definition
-     * @param array  $previous old definition
-     * @return array  containing all changes that will need to be applied
-     * @access protected
-     */
-    function _compareDecimalDefinition($current, $previous)
-    {
-        return array();
-    }
-
-    // }}}
-    // {{{ quote()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param string $type type to which the value should be converted to
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access public
-     */
-    function quote($value, $type = null, $quote = true, $escape_wildcards = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (is_null($value)
-            || ($value === '' && $db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL)
-        ) {
-            if (!$quote) {
-                return null;
-            }
-            return 'NULL';
-        }
-
-        if (is_null($type)) {
-            switch (gettype($value)) {
-            case 'integer':
-                $type = 'integer';
-                break;
-            case 'double':
-                // todo: default to decimal as float is quite unusual
-                // $type = 'float';
-                $type = 'decimal';
-                break;
-            case 'boolean':
-                $type = 'boolean';
-                break;
-            case 'array':
-                 $value = serialize($value);
-            case 'object':
-                 $type = 'text';
-                break;
-            default:
-                if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/', $value)) {
-                    $type = 'timestamp';
-                } elseif (preg_match('/^\d{2}:\d{2}$/', $value)) {
-                    $type = 'time';
-                } elseif (preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
-                    $type = 'date';
-                } else {
-                    $type = 'text';
-                }
-                break;
-            }
-        } elseif (!empty($db->options['datatype_map'][$type])) {
-            $type = $db->options['datatype_map'][$type];
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('type' => $type, 'value' => $value, 'quote' => $quote, 'escape_wildcards' => $escape_wildcards);
-                return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-            }
-        }
-
-        if (!method_exists($this, "_quote{$type}")) {
-            return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'type not defined: '.$type, __FUNCTION__);
-        }
-        $value = $this->{"_quote{$type}"}($value, $quote, $escape_wildcards);
-        if ($quote && $escape_wildcards && $db->string_quoting['escape_pattern']
-            && $db->string_quoting['escape'] !== $db->string_quoting['escape_pattern']
-        ) {
-            $value.= $this->patternEscapeString();
-        }
-        return $value;
-    }
-
-    // }}}
-    // {{{ _quoteInteger()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteInteger($value, $quote, $escape_wildcards)
-    {
-        return (int)$value;
-    }
-
-    // }}}
-    // {{{ _quoteText()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that already contains any DBMS specific
-     *       escaped character sequences.
-     * @access protected
-     */
-    function _quoteText($value, $quote, $escape_wildcards)
-    {
-        if (!$quote) {
-            return $value;
-        }
-
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $value = $db->escape($value, $escape_wildcards);
-        if (PEAR::isError($value)) {
-            return $value;
-        }
-        return "'".$value."'";
-    }
-
-    // }}}
-    // {{{ _readFile()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _readFile($value)
-    {
-        $close = false;
-        if (preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
-            $close = true;
-            if ($match[1] == 'file://') {
-                $value = $match[2];
-            }
-            $value = @fopen($value, 'r');
-        }
-
-        if (is_resource($value)) {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-
-            $fp = $value;
-            $value = '';
-            while (!@feof($fp)) {
-                $value.= @fread($fp, $db->options['lob_buffer_length']);
-            }
-            if ($close) {
-                @fclose($fp);
-            }
-        }
-
-        return $value;
-    }
-
-    // }}}
-    // {{{ _quoteLOB()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteLOB($value, $quote, $escape_wildcards)
-    {
-        $value = $this->_readFile($value);
-        if (PEAR::isError($value)) {
-            return $value;
-        }
-        return $this->_quoteText($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteCLOB()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteCLOB($value, $quote, $escape_wildcards)
-    {
-        return $this->_quoteLOB($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteBLOB()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteBLOB($value, $quote, $escape_wildcards)
-    {
-        return $this->_quoteLOB($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteBoolean()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteBoolean($value, $quote, $escape_wildcards)
-    {
-        return ($value ? 1 : 0);
-    }
-
-    // }}}
-    // {{{ _quoteDate()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteDate($value, $quote, $escape_wildcards)
-    {
-        if ($value === 'CURRENT_DATE') {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-            if (isset($db->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
-                return $db->function->now('date');
-            }
-            return 'CURRENT_DATE';
-        }
-        return $this->_quoteText($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteTimestamp()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteTimestamp($value, $quote, $escape_wildcards)
-    {
-        if ($value === 'CURRENT_TIMESTAMP') {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-            if (isset($db->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
-                return $db->function->now('timestamp');
-            }
-            return 'CURRENT_TIMESTAMP';
-        }
-        return $this->_quoteText($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteTime()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     *       compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteTime($value, $quote, $escape_wildcards)
-    {
-        if ($value === 'CURRENT_TIME') {
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-            if (isset($db->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
-                return $db->function->now('time');
-            }
-            return 'CURRENT_TIME';
-        }
-        return $this->_quoteText($value, $quote, $escape_wildcards);
-    }
-
-    // }}}
-    // {{{ _quoteFloat()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteFloat($value, $quote, $escape_wildcards)
-    {
-        if (preg_match('/^(.*)e([-+])(\d+)$/i', $value, $matches)) {
-            $decimal = $this->_quoteDecimal($matches[1], $quote, $escape_wildcards);
-            $sign = $matches[2];
-            $exponent = str_pad($matches[3], 2, '0', STR_PAD_LEFT);
-            $value = $decimal.'E'.$sign.$exponent;
-        } else {
-            $value = $this->_quoteDecimal($value, $quote, $escape_wildcards);
-        }
-        return $value;
-    }
-
-    // }}}
-    // {{{ _quoteDecimal()
-
-    /**
-     * Convert a text value into a DBMS specific format that is suitable to
-     * compose query statements.
-     *
-     * @param string $value text string value that is intended to be converted.
-     * @param bool $quote determines if the value should be quoted and escaped
-     * @param bool $escape_wildcards if to escape escape wildcards
-     * @return string text string that represents the given argument value in
-     *       a DBMS specific format.
-     * @access protected
-     */
-    function _quoteDecimal($value, $quote, $escape_wildcards)
-    {
-        $value = (string)$value;
-        $value = preg_replace('/[^\d\.,\-+eE]/', '', $value);
-        if (preg_match('/[^\.\d]/', $value)) {
-            if (strpos($value, ',')) {
-                // 1000,00
-                if (!strpos($value, '.')) {
-                    // convert the last "," to a "."
-                    $value = strrev(str_replace(',', '.', strrev($value)));
-                // 1.000,00
-                } elseif (strpos($value, '.') && strpos($value, '.') < strpos($value, ',')) {
-                    $value = str_replace('.', '', $value);
-                    // convert the last "," to a "."
-                    $value = strrev(str_replace(',', '.', strrev($value)));
-                // 1,000.00
-                } else {
-                    $value = str_replace(',', '', $value);
-                }
-            }
-        }
-        return $value;
-    }
-
-    // }}}
-    // {{{ writeLOBToFile()
-
-    /**
-     * retrieve LOB from the database
-     *
-     * @param resource $lob stream handle
-     * @param string $file name of the file into which the LOb should be fetched
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access protected
-     */
-    function writeLOBToFile($lob, $file)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (preg_match('/^(\w+:\/\/)(.*)$/', $file, $match)) {
-            if ($match[1] == 'file://') {
-                $file = $match[2];
-            }
-        }
-
-        $fp = @fopen($file, 'wb');
-        while (!@feof($lob)) {
-            $result = @fread($lob, $db->options['lob_buffer_length']);
-            $read = strlen($result);
-            if (@fwrite($fp, $result, $read) != $read) {
-                @fclose($fp);
-                return $db->raiseError(MDB2_ERROR, null, null,
-                    'could not write to the output file', __FUNCTION__);
-            }
-        }
-        @fclose($fp);
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ _retrieveLOB()
-
-    /**
-     * retrieve LOB from the database
-     *
-     * @param array $lob array
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access protected
-     */
-    function _retrieveLOB(&$lob)
-    {
-        if (is_null($lob['value'])) {
-            $lob['value'] = $lob['resource'];
-        }
-        $lob['loaded'] = true;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ readLOB()
-
-    /**
-     * Read data from large object input stream.
-     *
-     * @param resource $lob stream handle
-     * @param string $data reference to a variable that will hold data
-     *                          to be read from the large object input stream
-     * @param integer $length    value that indicates the largest ammount ofdata
-     *                          to be read from the large object input stream.
-     * @return mixed the effective number of bytes read from the large object
-     *                      input stream on sucess or an MDB2 error object.
-     * @access public
-     * @see endOfLOB()
-     */
-    function _readLOB($lob, $length)
-    {
-        return substr($lob['value'], $lob['position'], $length);
-    }
-
-    // }}}
-    // {{{ _endOfLOB()
-
-    /**
-     * Determine whether it was reached the end of the large object and
-     * therefore there is no more data to be read for the its input stream.
-     *
-     * @param array $lob array
-     * @return mixed true or false on success, a MDB2 error on failure
-     * @access protected
-     */
-    function _endOfLOB($lob)
-    {
-        return $lob['endOfLOB'];
-    }
-
-    // }}}
-    // {{{ destroyLOB()
-
-    /**
-     * Free any resources allocated during the lifetime of the large object
-     * handler object.
-     *
-     * @param resource $lob stream handle
-     * @access public
-     */
-    function destroyLOB($lob)
-    {
-        $lob_data = stream_get_meta_data($lob);
-        $lob_index = $lob_data['wrapper_data']->lob_index;
-        fclose($lob);
-        if (isset($this->lobs[$lob_index])) {
-            $this->_destroyLOB($this->lobs[$lob_index]);
-            unset($this->lobs[$lob_index]);
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ _destroyLOB()
-
-    /**
-     * Free any resources allocated during the lifetime of the large object
-     * handler object.
-     *
-     * @param array $lob array
-     * @access private
-     */
-    function _destroyLOB(&$lob)
-    {
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ implodeArray()
-
-    /**
-     * apply a type to all values of an array and return as a comma seperated string
-     * useful for generating IN statements
-     *
-     * @access public
-     *
-     * @param array $array data array
-     * @param string $type determines type of the field
-     *
-     * @return string comma seperated values
-     */
-    function implodeArray($array, $type = false)
-    {
-        if (!is_array($array) || empty($array)) {
-            return 'NULL';
-        }
-        if ($type) {
-            foreach ($array as $value) {
-                $return[] = $this->quote($value, $type);
-            }
-        } else {
-            $return = $array;
-        }
-        return implode(', ', $return);
-    }
-
-    // }}}
-    // {{{ matchPattern()
-
-    /**
-     * build a pattern matching string
-     *
-     * @access public
-     *
-     * @param array $pattern even keys are strings, odd are patterns (% and _)
-     * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
-     * @param string $field optional field name that is being matched against
-     *                  (might be required when emulating ILIKE)
-     *
-     * @return string SQL pattern
-     */
-    function matchPattern($pattern, $operator = null, $field = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $match = '';
-        if (!is_null($operator)) {
-            $operator = strtoupper($operator);
-            switch ($operator) {
-            // case insensitive
-            case 'ILIKE':
-                if (is_null($field)) {
-                    return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                        'case insensitive LIKE matching requires passing the field name', __FUNCTION__);
-                }
-                $db->loadModule('Function', null, true);
-                $match = $db->function->lower($field).' LIKE ';
-                break;
-            // case sensitive
-            case 'LIKE':
-                $match = is_null($field) ? 'LIKE ' : $field.' LIKE ';
-                break;
-            default:
-                return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                    'not a supported operator type:'. $operator, __FUNCTION__);
-            }
-        }
-        $match.= "'";
-        foreach ($pattern as $key => $value) {
-            if ($key % 2) {
-                $match.= $value;
-            } else {
-                if ($operator === 'ILIKE') {
-                    $value = strtolower($value);
-                }
-                $escaped = $db->escape($value);
-                if (PEAR::isError($escaped)) {
-                    return $escaped;
-                }
-                $match.= $db->escapePattern($escaped);
-            }
-        }
-        $match.= "'";
-        $match.= $this->patternEscapeString();
-        return $match;
-    }
-
-    // }}}
-    // {{{ patternEscapeString()
-
-    /**
-     * build string to define pattern escape character
-     *
-     * @access public
-     *
-     * @return string define pattern escape character
-     */
-    function patternEscapeString()
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ mapNativeDatatype()
-
-    /**
-     * Maps a native array description of a field to a MDB2 datatype and length
-     *
-     * @param array  $field native field description
-     * @return array containing the various possible types, length, sign, fixed
-     * @access public
-     */
-    function mapNativeDatatype($field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        // If the user has specified an option to map the native field
-        // type to a custom MDB2 datatype...
-        $db_type = strtok($field['type'], '(), ');
-        if (!empty($db->options['nativetype_map_callback'][$db_type])) {
-            return call_user_func_array($db->options['nativetype_map_callback'][$db_type], array($db, $field));
-        }
-
-        // Otherwise perform the built-in (i.e. normal) MDB2 native type to
-        // MDB2 datatype conversion
-        return $this->_mapNativeDatatype($field);
-    }
-
-    // }}}
-    // {{{ _mapNativeDatatype()
-
-    /**
-     * Maps a native array description of a field to a MDB2 datatype and length
-     *
-     * @param array  $field native field description
-     * @return array containing the various possible types, length, sign, fixed
-     * @access public
-     */
-    function _mapNativeDatatype($field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ mapPrepareDatatype()
-
-    /**
-     * Maps an mdb2 datatype to mysqli prepare type
-     *
-     * @param string $type
-     * @return string
-     * @access public
-     */
-    function mapPrepareDatatype($type)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!empty($db->options['datatype_map'][$type])) {
-            $type = $db->options['datatype_map'][$type];
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('type' => $type);
-                return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-            }
-        }
-
-        return $type;
-    }
-}
-?>
diff --git a/lib/php/MDB2/Driver/Datatype/mysqli.php b/lib/php/MDB2/Driver/Datatype/mysqli.php
deleted file mode 100644
index 5105b1ad51d4b184b53897fed2c5edf4533144dc..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Datatype/mysqli.php
+++ /dev/null
@@ -1,590 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.63 2008/02/22 19:23:49 quipo Exp $
-//
-
-require_once 'MDB2/Driver/Datatype/Common.php';
-
-/**
- * MDB2 MySQLi driver
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
-{
-    // {{{ _getCharsetFieldDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
-     * of a field declaration to be used in statements like CREATE TABLE.
-     *
-     * @param string $charset   name of the charset
-     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET
-     *                 of a field declaration.
-     */
-    function _getCharsetFieldDeclaration($charset)
-    {
-        return 'CHARACTER SET '.$charset;
-    }
-
-    // }}}
-    // {{{ _getCollationFieldDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to set the COLLATION
-     * of a field declaration to be used in statements like CREATE TABLE.
-     *
-     * @param string $collation   name of the collation
-     * @return string  DBMS specific SQL code portion needed to set the COLLATION
-     *                 of a field declaration.
-     */
-    function _getCollationFieldDeclaration($collation)
-    {
-        return 'COLLATE '.$collation;
-    }
-
-    // }}}
-    // {{{ getTypeDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an text type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param array $field  associative array with the name of the properties
-     *      of the field being declared as array indexes. Currently, the types
-     *      of supported field properties are as follows:
-     *
-     *      length
-     *          Integer value that determines the maximum length of the text
-     *          field. If this argument is missing the field should be
-     *          declared to have the longest length allowed by the DBMS.
-     *
-     *      default
-     *          Text value to be used as default for this field.
-     *
-     *      notnull
-     *          Boolean flag that indicates whether this field is constrained
-     *          to not be set to null.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *      declare the specified field.
-     * @access public
-     */
-    function getTypeDeclaration($field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        switch ($field['type']) {
-        case 'text':
-            if (empty($field['length']) && array_key_exists('default', $field)) {
-                $field['length'] = $db->varchar_max_length;
-            }
-            $length = !empty($field['length']) ? $field['length'] : false;
-            $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
-            return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)')
-                : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
-        case 'clob':
-            if (!empty($field['length'])) {
-                $length = $field['length'];
-                if ($length <= 255) {
-                    return 'TINYTEXT';
-                } elseif ($length <= 65532) {
-                    return 'TEXT';
-                } elseif ($length <= 16777215) {
-                    return 'MEDIUMTEXT';
-                }
-            }
-            return 'LONGTEXT';
-        case 'blob':
-            if (!empty($field['length'])) {
-                $length = $field['length'];
-                if ($length <= 255) {
-                    return 'TINYBLOB';
-                } elseif ($length <= 65532) {
-                    return 'BLOB';
-                } elseif ($length <= 16777215) {
-                    return 'MEDIUMBLOB';
-                }
-            }
-            return 'LONGBLOB';
-        case 'integer':
-            if (!empty($field['length'])) {
-                $length = $field['length'];
-                if ($length <= 1) {
-                    return 'TINYINT';
-                } elseif ($length == 2) {
-                    return 'SMALLINT';
-                } elseif ($length == 3) {
-                    return 'MEDIUMINT';
-                } elseif ($length == 4) {
-                    return 'INT';
-                } elseif ($length > 4) {
-                    return 'BIGINT';
-                }
-            }
-            return 'INT';
-        case 'boolean':
-            return 'TINYINT(1)';
-        case 'date':
-            return 'DATE';
-        case 'time':
-            return 'TIME';
-        case 'timestamp':
-            return 'DATETIME';
-        case 'float':
-            return 'DOUBLE';
-        case 'decimal':
-            $length = !empty($field['length']) ? $field['length'] : 18;
-            $scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
-            return 'DECIMAL('.$length.','.$scale.')';
-        }
-        return '';
-    }
-
-    // }}}
-    // {{{ _getIntegerDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an integer type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string  $name   name the field to be declared.
-     * @param string  $field  associative array with the name of the properties
-     *                        of the field being declared as array indexes.
-     *                        Currently, the types of supported field
-     *                        properties are as follows:
-     *
-     *                       unsigned
-     *                        Boolean flag that indicates whether the field
-     *                        should be declared as unsigned integer if
-     *                        possible.
-     *
-     *                       default
-     *                        Integer value to be used as default for this
-     *                        field.
-     *
-     *                       notnull
-     *                        Boolean flag that indicates whether this field is
-     *                        constrained to not be set to null.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *                 declare the specified field.
-     * @access protected
-     */
-    function _getIntegerDeclaration($name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $default = $autoinc = '';
-        if (!empty($field['autoincrement'])) {
-            $autoinc = ' AUTO_INCREMENT PRIMARY KEY';
-        } elseif (array_key_exists('default', $field)) {
-            if ($field['default'] === '') {
-                $field['default'] = empty($field['notnull']) ? null : 0;
-            }
-            $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
-        }
-
-        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
-        $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
-        $name = $db->quoteIdentifier($name, true);
-        return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
-    }
-
-    // }}}
-    // {{{ _getFloatDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an float type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string  $name   name the field to be declared.
-     * @param string  $field  associative array with the name of the properties
-     *                        of the field being declared as array indexes.
-     *                        Currently, the types of supported field
-     *                        properties are as follows:
-     *
-     *                       unsigned
-     *                        Boolean flag that indicates whether the field
-     *                        should be declared as unsigned float if
-     *                        possible.
-     *
-     *                       default
-     *                        float value to be used as default for this
-     *                        field.
-     *
-     *                       notnull
-     *                        Boolean flag that indicates whether this field is
-     *                        constrained to not be set to null.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *                 declare the specified field.
-     * @access protected
-     */
-    function _getFloatDeclaration($name, $field)
-    {
-        // Since AUTO_INCREMENT can be used for integer or floating-point types,
-        // reuse the INTEGER declaration
-        // @see http://bugs.mysql.com/bug.php?id=31032
-        return $this->_getIntegerDeclaration($name, $field);
-    }
-
-    // }}}
-    // {{{ _getDecimalDeclaration()
-
-    /**
-     * Obtain DBMS specific SQL code portion needed to declare an decimal type
-     * field to be used in statements like CREATE TABLE.
-     *
-     * @param string  $name   name the field to be declared.
-     * @param string  $field  associative array with the name of the properties
-     *                        of the field being declared as array indexes.
-     *                        Currently, the types of supported field
-     *                        properties are as follows:
-     *
-     *                       unsigned
-     *                        Boolean flag that indicates whether the field
-     *                        should be declared as unsigned integer if
-     *                        possible.
-     *
-     *                       default
-     *                        Decimal value to be used as default for this
-     *                        field.
-     *
-     *                       notnull
-     *                        Boolean flag that indicates whether this field is
-     *                        constrained to not be set to null.
-     * @return string  DBMS specific SQL code portion that should be used to
-     *                 declare the specified field.
-     * @access protected
-     */
-    function _getDecimalDeclaration($name, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $default = '';
-        if (array_key_exists('default', $field)) {
-            if ($field['default'] === '') {
-                $field['default'] = empty($field['notnull']) ? null : 0;
-            }
-            $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
-        } elseif (empty($field['notnull'])) {
-            $default = ' DEFAULT NULL';
-        }
-
-        $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
-        $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
-        $name = $db->quoteIdentifier($name, true);
-        return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull;
-    }
-
-    // }}}
-    // {{{ matchPattern()
-
-    /**
-     * build a pattern matching string
-     *
-     * @access public
-     *
-     * @param array $pattern even keys are strings, odd are patterns (% and _)
-     * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
-     * @param string $field optional field name that is being matched against
-     *                  (might be required when emulating ILIKE)
-     *
-     * @return string SQL pattern
-     */
-    function matchPattern($pattern, $operator = null, $field = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $match = '';
-        if (!is_null($operator)) {
-            $field = is_null($field) ? '' : $field.' ';
-            $operator = strtoupper($operator);
-            switch ($operator) {
-            // case insensitive
-            case 'ILIKE':
-                $match = $field.'LIKE ';
-                break;
-            // case sensitive
-            case 'LIKE':
-                $match = $field.'LIKE BINARY ';
-                break;
-            default:
-                return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                    'not a supported operator type:'. $operator, __FUNCTION__);
-            }
-        }
-        $match.= "'";
-        foreach ($pattern as $key => $value) {
-            if ($key % 2) {
-                $match.= $value;
-            } else {
-                $match.= $db->escapePattern($db->escape($value));
-            }
-        }
-        $match.= "'";
-        $match.= $this->patternEscapeString();
-        return $match;
-    }
-
-    // }}}
-    // {{{ _mapNativeDatatype()
-
-    /**
-     * Maps a native array description of a field to a MDB2 datatype and length
-     *
-     * @param array  $field native field description
-     * @return array containing the various possible types, length, sign, fixed
-     * @access public
-     */
-    function _mapNativeDatatype($field)
-    {
-        $db_type = strtolower($field['type']);
-        $db_type = strtok($db_type, '(), ');
-        if ($db_type == 'national') {
-            $db_type = strtok('(), ');
-        }
-        if (!empty($field['length'])) {
-            $length = strtok($field['length'], ', ');
-            $decimal = strtok(', ');
-        } else {
-            $length = strtok('(), ');
-            $decimal = strtok('(), ');
-        }
-        $type = array();
-        $unsigned = $fixed = null;
-        switch ($db_type) {
-        case 'tinyint':
-            $type[] = 'integer';
-            $type[] = 'boolean';
-            if (preg_match('/^(is|has)/', $field['name'])) {
-                $type = array_reverse($type);
-            }
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            $length = 1;
-            break;
-        case 'smallint':
-            $type[] = 'integer';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            $length = 2;
-            break;
-        case 'mediumint':
-            $type[] = 'integer';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            $length = 3;
-            break;
-        case 'int':
-        case 'integer':
-            $type[] = 'integer';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            $length = 4;
-            break;
-        case 'bigint':
-            $type[] = 'integer';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            $length = 8;
-            break;
-        case 'tinytext':
-        case 'mediumtext':
-        case 'longtext':
-        case 'text':
-        case 'varchar':
-            $fixed = false;
-        case 'string':
-        case 'char':
-            $type[] = 'text';
-            if ($length == '1') {
-                $type[] = 'boolean';
-                if (preg_match('/^(is|has)/', $field['name'])) {
-                    $type = array_reverse($type);
-                }
-            } elseif (strstr($db_type, 'text')) {
-                $type[] = 'clob';
-                if ($decimal == 'binary') {
-                    $type[] = 'blob';
-                }
-                $type = array_reverse($type);
-            }
-            if ($fixed !== false) {
-                $fixed = true;
-            }
-            break;
-        case 'enum':
-            $type[] = 'text';
-            preg_match_all('/\'.+\'/U', $field['type'], $matches);
-            $length = 0;
-            $fixed = false;
-            if (is_array($matches)) {
-                foreach ($matches[0] as $value) {
-                    $length = max($length, strlen($value)-2);
-                }
-                if ($length == '1' && count($matches[0]) == 2) {
-                    $type[] = 'boolean';
-                    if (preg_match('/^(is|has)/', $field['name'])) {
-                        $type = array_reverse($type);
-                    }
-                }
-            }
-            $type[] = 'integer';
-        case 'set':
-            $fixed = false;
-            $type[] = 'text';
-            $type[] = 'integer';
-            break;
-        case 'date':
-            $type[] = 'date';
-            $length = null;
-            break;
-        case 'datetime':
-        case 'timestamp':
-            $type[] = 'timestamp';
-            $length = null;
-            break;
-        case 'time':
-            $type[] = 'time';
-            $length = null;
-            break;
-        case 'float':
-        case 'double':
-        case 'real':
-            $type[] = 'float';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            break;
-        case 'unknown':
-        case 'decimal':
-        case 'numeric':
-            $type[] = 'decimal';
-            $unsigned = preg_match('/ unsigned/i', $field['type']);
-            if ($decimal !== false) {
-                $length = $length.','.$decimal;
-            }
-            break;
-        case 'tinyblob':
-        case 'mediumblob':
-        case 'longblob':
-        case 'blob':
-            $type[] = 'blob';
-            $length = null;
-            break;
-        case 'binary':
-        case 'varbinary':
-            $type[] = 'blob';
-            break;
-        case 'year':
-            $type[] = 'integer';
-            $type[] = 'date';
-            $length = null;
-            break;
-        default:
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-
-            return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'unknown database attribute type: '.$db_type, __FUNCTION__);
-        }
-
-        if ((int)$length <= 0) {
-            $length = null;
-        }
-
-        return array($type, $length, $unsigned, $fixed);
-    }
-
-    // }}}
-    // {{{ mapPrepareDatatype()
-
-    /**
-     * Maps an MDB2 datatype to native prepare type
-     *
-     * @param string $type
-     * @return string
-     * @access public
-     */
-    function mapPrepareDatatype($type)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!empty($db->options['datatype_map'][$type])) {
-            $type = $db->options['datatype_map'][$type];
-            if (!empty($db->options['datatype_map_callback'][$type])) {
-                $parameter = array('type' => $type);
-                return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
-            }
-        }
-
-        switch ($type) {
-            case 'integer':
-                return 'i';
-            case 'float':
-                return 'd';
-            case 'blob':
-                return 'b';
-            default:
-                break;
-        }
-        return 's';
-    }
-    
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Function/Common.php b/lib/php/MDB2/Driver/Function/Common.php
deleted file mode 100644
index 731f06882ce52a603f1a7bd7ecef5b7c8c23a6f4..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Function/Common.php
+++ /dev/null
@@ -1,293 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Common.php,v 1.21 2008/02/17 18:51:39 quipo Exp $
-//
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Base class for the function modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Function');
- *
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_Common extends MDB2_Module_Common
-{
-    // {{{ executeStoredProc()
-
-    /**
-     * Execute a stored procedure and return any results
-     *
-     * @param string $name string that identifies the function to execute
-     * @param mixed  $params  array that contains the paramaters to pass the stored proc
-     * @param mixed   $types  array that contains the types of the columns in
-     *                        the result set
-     * @param mixed $result_class string which specifies which result class to use
-     * @param mixed $result_wrap_class string which specifies which class to wrap results in
-     *
-     * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-        return $error;
-    }
-
-    // }}}
-    // {{{ functionTable()
-
-    /**
-     * return string for internal table used when calling only a function
-     *
-     * @return string for internal table used when calling only a function
-     * @access public
-     */
-    function functionTable()
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ now()
-
-    /**
-     * Return string to call a variable with the current timestamp inside an SQL statement
-     * There are three special variables for current date and time:
-     * - CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
-     * - CURRENT_DATE (date, DATE type)
-     * - CURRENT_TIME (time, TIME type)
-     *
-     * @param string $type 'timestamp' | 'time' | 'date'
-     *
-     * @return string to call a variable with the current timestamp
-     * @access public
-     */
-    function now($type = 'timestamp')
-    {
-        switch ($type) {
-        case 'time':
-            return 'CURRENT_TIME';
-        case 'date':
-            return 'CURRENT_DATE';
-        case 'timestamp':
-        default:
-            return 'CURRENT_TIMESTAMP';
-        }
-    }
-
-    // }}}
-    // {{{ unixtimestamp()
-
-    /**
-     * return string to call a function to get the unix timestamp from a iso timestamp
-     *
-     * @param string $expression
-     *
-     * @return string to call a variable with the timestamp
-     * @access public
-     */
-    function unixtimestamp($expression)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-        return $error;
-    }
-
-    // }}}
-    // {{{ substring()
-
-    /**
-     * return string to call a function to get a substring inside an SQL statement
-     *
-     * @return string to call a function to get a substring
-     * @access public
-     */
-    function substring($value, $position = 1, $length = null)
-    {
-        if (!is_null($length)) {
-            return "SUBSTRING($value FROM $position FOR $length)";
-        }
-        return "SUBSTRING($value FROM $position)";
-    }
-
-    // }}}
-    // {{{ replace()
-
-    /**
-     * return string to call a function to get replace inside an SQL statement.
-     *
-     * @return string to call a function to get a replace
-     * @access public
-     */
-    function replace($str, $from_str, $to_str)
-    {
-        return "REPLACE($str, $from_str , $to_str)";
-    }
-
-    // }}}
-    // {{{ concat()
-
-    /**
-     * Returns string to concatenate two or more string parameters
-     *
-     * @param string $value1
-     * @param string $value2
-     * @param string $values...
-     *
-     * @return string to concatenate two strings
-     * @access public
-     */
-    function concat($value1, $value2)
-    {
-        $args = func_get_args();
-        return "(".implode(' || ', $args).")";
-    }
-
-    // }}}
-    // {{{ random()
-
-    /**
-     * return string to call a function to get random value inside an SQL statement
-     *
-     * @return return string to generate float between 0 and 1
-     * @access public
-     */
-    function random()
-    {
-        return 'RAND()';
-    }
-
-    // }}}
-    // {{{ lower()
-
-    /**
-     * return string to call a function to lower the case of an expression
-     *
-     * @param string $expression
-     *
-     * @return return string to lower case of an expression
-     * @access public
-     */
-    function lower($expression)
-    {
-        return "LOWER($expression)";
-    }
-
-    // }}}
-    // {{{ upper()
-
-    /**
-     * return string to call a function to upper the case of an expression
-     *
-     * @param string $expression
-     *
-     * @return return string to upper case of an expression
-     * @access public
-     */
-    function upper($expression)
-    {
-        return "UPPER($expression)";
-    }
-
-    // }}}
-    // {{{ length()
-
-    /**
-     * return string to call a function to get the length of a string expression
-     *
-     * @param string $expression
-     *
-     * @return return string to get the string expression length
-     * @access public
-     */
-    function length($expression)
-    {
-        return "LENGTH($expression)";
-    }
-
-    // }}}
-    // {{{ guid()
-
-    /**
-     * Returns global unique identifier
-     *
-     * @return string to get global unique identifier
-     * @access public
-     */
-    function guid()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-        return $error;
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Function/mysqli.php b/lib/php/MDB2/Driver/Function/mysqli.php
deleted file mode 100644
index 0781eab13612695a29a50788a08a154ee07f4748..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Function/mysqli.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.14 2008/02/17 18:54:08 quipo Exp $
-//
-
-require_once 'MDB2/Driver/Function/Common.php';
-
-/**
- * MDB2 MySQLi driver for the function modules
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common
-{
-     // }}}
-    // {{{ executeStoredProc()
-
-    /**
-     * Execute a stored procedure and return any results
-     *
-     * @param string $name string that identifies the function to execute
-     * @param mixed  $params  array that contains the paramaters to pass the stored proc
-     * @param mixed   $types  array that contains the types of the columns in
-     *                        the result set
-     * @param mixed $result_class string which specifies which result class to use
-     * @param mixed $result_wrap_class string which specifies which class to wrap results in
-     * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $multi_query = $db->getOption('multi_query');
-        if (!$multi_query) {
-            $db->setOption('multi_query', true);
-        }
-        $query = 'CALL '.$name;
-        $query .= $params ? '('.implode(', ', $params).')' : '()';
-        $result =& $db->query($query, $types, $result_class, $result_wrap_class);
-        if (!$multi_query) {
-            $db->setOption('multi_query', false);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ unixtimestamp()
-
-    /**
-     * return string to call a function to get the unix timestamp from a iso timestamp
-     *
-     * @param string $expression
-     *
-     * @return string to call a variable with the timestamp
-     * @access public
-     */
-    function unixtimestamp($expression)
-    {
-        return 'UNIX_TIMESTAMP('. $expression.')';
-    }
-
-    // }}}
-    // {{{ concat()
-
-    /**
-     * Returns string to concatenate two or more string parameters
-     *
-     * @param string $value1
-     * @param string $value2
-     * @param string $values...
-     * @return string to concatenate two strings
-     * @access public
-     **/
-    function concat($value1, $value2)
-    {
-        $args = func_get_args();
-        return "CONCAT(".implode(', ', $args).")";
-    }
-
-    // }}}
-    // {{{ guid()
-
-    /**
-     * Returns global unique identifier
-     *
-     * @return string to get global unique identifier
-     * @access public
-     */
-    function guid()
-    {
-        return 'UUID()';
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Manager/Common.php b/lib/php/MDB2/Driver/Manager/Common.php
deleted file mode 100644
index dd3d545e6cb2e4ac3b6a1fda9e2a3c70f271497f..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Manager/Common.php
+++ /dev/null
@@ -1,1014 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Authors: Lukas Smith <smith@pooteeweet.org>                          |
-// |          Lorenzo Alberton <l.alberton@quipo.it>                      |
-// +----------------------------------------------------------------------+
-//
-// $Id: Common.php,v 1.72 2009/01/14 15:00:40 quipo Exp $
-//
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- * @author   Lorenzo Alberton <l.alberton@quipo.it>
- */
-
-/**
- * Base class for the management modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Manager');
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Manager_Common extends MDB2_Module_Common
-{
-    // {{{ splitTableSchema()
-
-    /**
-     * Split the "[owner|schema].table" notation into an array
-     *
-     * @param string $table [schema and] table name
-     *
-     * @return array array(schema, table)
-     * @access private
-     */
-    function splitTableSchema($table)
-    {
-        $ret = array();
-        if (strpos($table, '.') !== false) {
-            return explode('.', $table);
-        }
-        return array(null, $table);
-    }
-
-    // }}}
-    // {{{ getFieldDeclarationList()
-
-    /**
-     * Get declaration of a number of field in bulk
-     *
-     * @param array $fields  a multidimensional associative array.
-     *      The first dimension determines the field name, while the second
-     *      dimension is keyed with the name of the properties
-     *      of the field being declared as array indexes. Currently, the types
-     *      of supported field properties are as follows:
-     *
-     *      default
-     *          Boolean value to be used as default for this field.
-     *
-     *      notnull
-     *          Boolean flag that indicates whether this field is constrained
-     *          to not be set to null.
-     *
-     * @return mixed string on success, a MDB2 error on failure
-     * @access public
-     */
-    function getFieldDeclarationList($fields)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!is_array($fields) || empty($fields)) {
-            return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                'missing any fields', __FUNCTION__);
-        }
-        foreach ($fields as $field_name => $field) {
-            $query = $db->getDeclaration($field['type'], $field_name, $field);
-            if (PEAR::isError($query)) {
-                return $query;
-            }
-            $query_fields[] = $query;
-        }
-        return implode(', ', $query_fields);
-    }
-
-    // }}}
-    // {{{ _fixSequenceName()
-
-    /**
-     * Removes any formatting in an sequence name using the 'seqname_format' option
-     *
-     * @param string $sqn string that containts name of a potential sequence
-     * @param bool $check if only formatted sequences should be returned
-     * @return string name of the sequence with possible formatting removed
-     * @access protected
-     */
-    function _fixSequenceName($sqn, $check = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $seq_pattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $db->options['seqname_format']).'$/i';
-        $seq_name = preg_replace($seq_pattern, '\\1', $sqn);
-        if ($seq_name && !strcasecmp($sqn, $db->getSequenceName($seq_name))) {
-            return $seq_name;
-        }
-        if ($check) {
-            return false;
-        }
-        return $sqn;
-    }
-
-    // }}}
-    // {{{ _fixIndexName()
-
-    /**
-     * Removes any formatting in an index name using the 'idxname_format' option
-     *
-     * @param string $idx string that containts name of anl index
-     * @return string name of the index with eventual formatting removed
-     * @access protected
-     */
-    function _fixIndexName($idx)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $idx_pattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $db->options['idxname_format']).'$/i';
-        $idx_name = preg_replace($idx_pattern, '\\1', $idx);
-        if ($idx_name && !strcasecmp($idx, $db->getIndexName($idx_name))) {
-            return $idx_name;
-        }
-        return $idx;
-    }
-
-    // }}}
-    // {{{ createDatabase()
-
-    /**
-     * create a new database
-     *
-     * @param string $name    name of the database that should be created
-     * @param array  $options array with charset, collation info
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createDatabase($database, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ alterDatabase()
-
-    /**
-     * alter an existing database
-     *
-     * @param string $name    name of the database that should be created
-     * @param array  $options array with charset, collation info
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function alterDatabase($database, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ dropDatabase()
-
-    /**
-     * drop an existing database
-     *
-     * @param string $name name of the database that should be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropDatabase($database)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ _getCreateTableQuery()
-
-    /**
-     * Create a basic SQL query for a new table creation
-     *
-     * @param string $name    Name of the database that should be created
-     * @param array  $fields  Associative array that contains the definition of each field of the new table
-     * @param array  $options An associative array of table options
-     *
-     * @return mixed string (the SQL query) on success, a MDB2 error on failure
-     * @see createTable()
-     */
-    function _getCreateTableQuery($name, $fields, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!$name) {
-            return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
-                'no valid table name specified', __FUNCTION__);
-        }
-        if (empty($fields)) {
-            return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
-                'no fields specified for table "'.$name.'"', __FUNCTION__);
-        }
-        $query_fields = $this->getFieldDeclarationList($fields);
-        if (PEAR::isError($query_fields)) {
-            return $query_fields;
-        }
-        if (!empty($options['primary'])) {
-            $query_fields.= ', PRIMARY KEY ('.implode(', ', array_keys($options['primary'])).')';
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        $result = 'CREATE ';
-        if (!empty($options['temporary'])) {
-            $result .= $this->_getTemporaryTableQuery();
-        }
-        $result .= " TABLE $name ($query_fields)";
-        return $result;
-    }
-
-    // }}}
-    // {{{ _getTemporaryTableQuery()
-
-    /**
-     * A method to return the required SQL string that fits between CREATE ... TABLE
-     * to create the table as a temporary table.
-     *
-     * Should be overridden in driver classes to return the correct string for the
-     * specific database type.
-     *
-     * The default is to return the string "TEMPORARY" - this will result in a
-     * SQL error for any database that does not support temporary tables, or that
-     * requires a different SQL command from "CREATE TEMPORARY TABLE".
-     *
-     * @return string The string required to be placed between "CREATE" and "TABLE"
-     *                to generate a temporary table, if possible.
-     */
-    function _getTemporaryTableQuery()
-    {
-        return 'TEMPORARY';
-    }
-
-    // }}}
-    // {{{ createTable()
-
-    /**
-     * create a new table
-     *
-     * @param string $name   Name of the database that should be created
-     * @param array $fields  Associative array that contains the definition of each field of the new table
-     *                       The indexes of the array entries are the names of the fields of the table an
-     *                       the array entry values are associative arrays like those that are meant to be
-     *                       passed with the field definitions to get[Type]Declaration() functions.
-     *                          array(
-     *                              'id' => array(
-     *                                  'type' => 'integer',
-     *                                  'unsigned' => 1
-     *                                  'notnull' => 1
-     *                                  'default' => 0
-     *                              ),
-     *                              'name' => array(
-     *                                  'type' => 'text',
-     *                                  'length' => 12
-     *                              ),
-     *                              'password' => array(
-     *                                  'type' => 'text',
-     *                                  'length' => 12
-     *                              )
-     *                          );
-     * @param array $options  An associative array of table options:
-     *                          array(
-     *                              'comment' => 'Foo',
-     *                              'temporary' => true|false,
-     *                          );
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createTable($name, $fields, $options = array())
-    {
-        $query = $this->_getCreateTableQuery($name, $fields, $options);
-        if (PEAR::isError($query)) {
-            return $query;
-        }
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        $result = $db->exec($query);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ dropTable()
-
-    /**
-     * drop an existing table
-     *
-     * @param string $name name of the table that should be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropTable($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        return $db->exec("DROP TABLE $name");
-    }
-
-    // }}}
-    // {{{ truncateTable()
-
-    /**
-     * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
-     * it falls back to a DELETE FROM TABLE query)
-     *
-     * @param string $name name of the table that should be truncated
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function truncateTable($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        return $db->exec("DELETE FROM $name");
-    }
-
-    // }}}
-    // {{{ vacuum()
-
-    /**
-     * Optimize (vacuum) all the tables in the db (or only the specified table)
-     * and optionally run ANALYZE.
-     *
-     * @param string $table table name (all the tables if empty)
-     * @param array  $options an array with driver-specific options:
-     *               - timeout [int] (in seconds) [mssql-only]
-     *               - analyze [boolean] [pgsql and mysql]
-     *               - full [boolean] [pgsql-only]
-     *               - freeze [boolean] [pgsql-only]
-     *
-     * @return mixed MDB2_OK success, a MDB2 error on failure
-     * @access public
-     */
-    function vacuum($table = null, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ alterTable()
-
-    /**
-     * alter an existing table
-     *
-     * @param string $name         name of the table that is intended to be changed.
-     * @param array $changes     associative array that contains the details of each type
-     *                             of change that is intended to be performed. The types of
-     *                             changes that are currently supported are defined as follows:
-     *
-     *                             name
-     *
-     *                                New name for the table.
-     *
-     *                            add
-     *
-     *                                Associative array with the names of fields to be added as
-     *                                 indexes of the array. The value of each entry of the array
-     *                                 should be set to another associative array with the properties
-     *                                 of the fields to be added. The properties of the fields should
-     *                                 be the same as defined by the MDB2 parser.
-     *
-     *
-     *                            remove
-     *
-     *                                Associative array with the names of fields to be removed as indexes
-     *                                 of the array. Currently the values assigned to each entry are ignored.
-     *                                 An empty array should be used for future compatibility.
-     *
-     *                            rename
-     *
-     *                                Associative array with the names of fields to be renamed as indexes
-     *                                 of the array. The value of each entry of the array should be set to
-     *                                 another associative array with the entry named name with the new
-     *                                 field name and the entry named Declaration that is expected to contain
-     *                                 the portion of the field declaration already in DBMS specific SQL code
-     *                                 as it is used in the CREATE TABLE statement.
-     *
-     *                            change
-     *
-     *                                Associative array with the names of the fields to be changed as indexes
-     *                                 of the array. Keep in mind that if it is intended to change either the
-     *                                 name of a field and any other properties, the change array entries
-     *                                 should have the new names of the fields as array indexes.
-     *
-     *                                The value of each entry of the array should be set to another associative
-     *                                 array with the properties of the fields to that are meant to be changed as
-     *                                 array entries. These entries should be assigned to the new values of the
-     *                                 respective properties. The properties of the fields should be the same
-     *                                 as defined by the MDB2 parser.
-     *
-     *                            Example
-     *                                array(
-     *                                    'name' => 'userlist',
-     *                                    'add' => array(
-     *                                        'quota' => array(
-     *                                            'type' => 'integer',
-     *                                            'unsigned' => 1
-     *                                        )
-     *                                    ),
-     *                                    'remove' => array(
-     *                                        'file_limit' => array(),
-     *                                        'time_limit' => array()
-     *                                    ),
-     *                                    'change' => array(
-     *                                        'name' => array(
-     *                                            'length' => '20',
-     *                                            'definition' => array(
-     *                                                'type' => 'text',
-     *                                                'length' => 20,
-     *                                            ),
-     *                                        )
-     *                                    ),
-     *                                    'rename' => array(
-     *                                        'sex' => array(
-     *                                            'name' => 'gender',
-     *                                            'definition' => array(
-     *                                                'type' => 'text',
-     *                                                'length' => 1,
-     *                                                'default' => 'M',
-     *                                            ),
-     *                                        )
-     *                                    )
-     *                                )
-     *
-     * @param boolean $check     indicates whether the function should just check if the DBMS driver
-     *                             can perform the requested table alterations if the value is true or
-     *                             actually perform them otherwise.
-     * @access public
-     *
-      * @return mixed MDB2_OK on success, a MDB2 error on failure
-     */
-    function alterTable($name, $changes, $check)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listDatabases()
-
-    /**
-     * list all databases
-     *
-     * @return mixed array of database names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listDatabases()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implementedd', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listUsers()
-
-    /**
-     * list all users
-     *
-     * @return mixed array of user names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listUsers()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listViews()
-
-    /**
-     * list all views in the current database
-     *
-     * @param string database, the current is default
-     *               NB: not all the drivers can get the view names from
-     *               a database other than the current one
-     * @return mixed array of view names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listViews($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listTableViews()
-
-    /**
-     * list the views in the database that reference a given table
-     *
-     * @param string table for which all referenced views should be found
-     * @return mixed array of view names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableViews($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listTableTriggers()
-
-    /**
-     * list all triggers in the database that reference a given table
-     *
-     * @param string table for which all referenced triggers should be found
-     * @return mixed array of trigger names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableTriggers($table = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listFunctions()
-
-    /**
-     * list all functions in the current database
-     *
-     * @return mixed array of function names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listFunctions()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listTables()
-
-    /**
-     * list all tables in the current database
-     *
-     * @param string database, the current is default.
-     *               NB: not all the drivers can get the table names from
-     *               a database other than the current one
-     * @return mixed array of table names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTables($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listTableFields()
-
-    /**
-     * list all fields in a table in the current database
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of field names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableFields($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ createIndex()
-
-    /**
-     * Get the stucture of a field into an array
-     *
-     * @param string    $table         name of the table on which the index is to be created
-     * @param string    $name         name of the index to be created
-     * @param array     $definition        associative array that defines properties of the index to be created.
-     *                                 Currently, only one property named FIELDS is supported. This property
-     *                                 is also an associative with the names of the index fields as array
-     *                                 indexes. Each entry of this array is set to another type of associative
-     *                                 array that specifies properties of the index that are specific to
-     *                                 each field.
-     *
-     *                                Currently, only the sorting property is supported. It should be used
-     *                                 to define the sorting direction of the index. It may be set to either
-     *                                 ascending or descending.
-     *
-     *                                Not all DBMS support index sorting direction configuration. The DBMS
-     *                                 drivers of those that do not support it ignore this property. Use the
-     *                                 function supports() to determine whether the DBMS driver can manage indexes.
-     *
-     *                                 Example
-     *                                    array(
-     *                                        'fields' => array(
-     *                                            'user_name' => array(
-     *                                                'sorting' => 'ascending'
-     *                                            ),
-     *                                            'last_login' => array()
-     *                                        )
-     *                                    )
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createIndex($table, $name, $definition)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        $query = "CREATE INDEX $name ON $table";
-        $fields = array();
-        foreach (array_keys($definition['fields']) as $field) {
-            $fields[] = $db->quoteIdentifier($field, true);
-        }
-        $query .= ' ('. implode(', ', $fields) . ')';
-        return $db->exec($query);
-    }
-
-    // }}}
-    // {{{ dropIndex()
-
-    /**
-     * drop existing index
-     *
-     * @param string    $table         name of table that should be used in method
-     * @param string    $name         name of the index to be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropIndex($table, $name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        return $db->exec("DROP INDEX $name");
-    }
-
-    // }}}
-    // {{{ listTableIndexes()
-
-    /**
-     * list all indexes in a table
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of index names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableIndexes($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ _getAdvancedFKOptions()
-
-    /**
-     * Return the FOREIGN KEY query section dealing with non-standard options
-     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
-     *
-     * @param array $definition
-     * @return string
-     * @access protected
-     */
-    function _getAdvancedFKOptions($definition)
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ createConstraint()
-
-    /**
-     * create a constraint on a table
-     *
-     * @param string    $table       name of the table on which the constraint is to be created
-     * @param string    $name        name of the constraint to be created
-     * @param array     $definition  associative array that defines properties of the constraint to be created.
-     *                               The full structure of the array looks like this:
-     *          <pre>
-     *          array (
-     *              [primary] => 0
-     *              [unique]  => 0
-     *              [foreign] => 1
-     *              [check]   => 0
-     *              [fields] => array (
-     *                  [field1name] => array() // one entry per each field covered
-     *                  [field2name] => array() // by the index
-     *                  [field3name] => array(
-     *                      [sorting]  => ascending
-     *                      [position] => 3
-     *                  )
-     *              )
-     *              [references] => array(
-     *                  [table] => name
-     *                  [fields] => array(
-     *                      [field1name] => array(  //one entry per each referenced field
-     *                           [position] => 1
-     *                      )
-     *                  )
-     *              )
-     *              [deferrable] => 0
-     *              [initiallydeferred] => 0
-     *              [onupdate] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
-     *              [ondelete] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
-     *              [match] => SIMPLE|PARTIAL|FULL
-     *          );
-     *          </pre>
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createConstraint($table, $name, $definition)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        $query = "ALTER TABLE $table ADD CONSTRAINT $name";
-        if (!empty($definition['primary'])) {
-            $query.= ' PRIMARY KEY';
-        } elseif (!empty($definition['unique'])) {
-            $query.= ' UNIQUE';
-        } elseif (!empty($definition['foreign'])) {
-            $query.= ' FOREIGN KEY';
-        }
-        $fields = array();
-        foreach (array_keys($definition['fields']) as $field) {
-            $fields[] = $db->quoteIdentifier($field, true);
-        }
-        $query .= ' ('. implode(', ', $fields) . ')';
-        if (!empty($definition['foreign'])) {
-            $query.= ' REFERENCES ' . $db->quoteIdentifier($definition['references']['table'], true);
-            $referenced_fields = array();
-            foreach (array_keys($definition['references']['fields']) as $field) {
-                $referenced_fields[] = $db->quoteIdentifier($field, true);
-            }
-            $query .= ' ('. implode(', ', $referenced_fields) . ')';
-            $query .= $this->_getAdvancedFKOptions($definition);
-        }
-        return $db->exec($query);
-    }
-
-    // }}}
-    // {{{ dropConstraint()
-
-    /**
-     * drop existing constraint
-     *
-     * @param string    $table        name of table that should be used in method
-     * @param string    $name         name of the constraint to be dropped
-     * @param string    $primary      hint if the constraint is primary
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropConstraint($table, $name, $primary = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        return $db->exec("ALTER TABLE $table DROP CONSTRAINT $name");
-    }
-
-    // }}}
-    // {{{ listTableConstraints()
-
-    /**
-     * list all constraints in a table
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of constraint names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableConstraints($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * create sequence
-     *
-     * @param string    $seq_name     name of the sequence to be created
-     * @param string    $start         start value of the sequence; default is 1
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createSequence($seq_name, $start = 1)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * drop existing sequence
-     *
-     * @param string    $seq_name     name of the sequence to be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropSequence($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ listSequences()
-
-    /**
-     * list all sequences in the current database
-     *
-     * @param string database, the current is default
-     *               NB: not all the drivers can get the sequence names from
-     *               a database other than the current one
-     * @return mixed array of sequence names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listSequences($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Manager/mysqli.php b/lib/php/MDB2/Driver/Manager/mysqli.php
deleted file mode 100644
index 80235ffe2089cbd6f23fc3cb5ff18e2fd17ab2ec..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Manager/mysqli.php
+++ /dev/null
@@ -1,1432 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.100 2008/11/23 20:30:29 quipo Exp $
-//
-
-require_once 'MDB2/Driver/Manager/Common.php';
-
-/**
- * MDB2 MySQLi driver for the management modules
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
-{
-
-    // }}}
-    // {{{ createDatabase()
-
-    /**
-     * create a new database
-     *
-     * @param string $name    name of the database that should be created
-     * @param array  $options array with charset, collation info
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createDatabase($name, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name  = $db->quoteIdentifier($name, true);
-        $query = 'CREATE DATABASE ' . $name;
-        if (!empty($options['charset'])) {
-            $query .= ' DEFAULT CHARACTER SET ' . $db->quote($options['charset'], 'text');
-        }
-        if (!empty($options['collation'])) {
-            $query .= ' COLLATE ' . $db->quote($options['collation'], 'text');
-        }
-        return $db->standaloneQuery($query, null, true);
-    }
-
-    // }}}
-    // {{{ alterDatabase()
-
-    /**
-     * alter an existing database
-     *
-     * @param string $name    name of the database that is intended to be changed
-     * @param array  $options array with charset, collation info
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function alterDatabase($name, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = 'ALTER DATABASE '. $db->quoteIdentifier($name, true);
-        if (!empty($options['charset'])) {
-            $query .= ' DEFAULT CHARACTER SET ' . $db->quote($options['charset'], 'text');
-        }
-        if (!empty($options['collation'])) {
-            $query .= ' COLLATE ' . $db->quote($options['collation'], 'text');
-        }
-        return $db->standaloneQuery($query, null, true);
-    }
-
-    // }}}
-    // {{{ dropDatabase()
-
-    /**
-     * drop an existing database
-     *
-     * @param string $name name of the database that should be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropDatabase($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        $query = "DROP DATABASE $name";
-        return $db->standaloneQuery($query, null, true);
-    }
-
-    // }}}
-    // {{{ _getAdvancedFKOptions()
-
-    /**
-     * Return the FOREIGN KEY query section dealing with non-standard options
-     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
-     *
-     * @param array $definition
-     * @return string
-     * @access protected
-     */
-    function _getAdvancedFKOptions($definition)
-    {
-        $query = '';
-        if (!empty($definition['match'])) {
-            $query .= ' MATCH '.$definition['match'];
-        }
-        if (!empty($definition['onupdate'])) {
-            $query .= ' ON UPDATE '.$definition['onupdate'];
-        }
-        if (!empty($definition['ondelete'])) {
-            $query .= ' ON DELETE '.$definition['ondelete'];
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ createTable()
-
-    /**
-     * create a new table
-     *
-     * @param string $name   Name of the database that should be created
-     * @param array $fields  Associative array that contains the definition of each field of the new table
-     *                       The indexes of the array entries are the names of the fields of the table an
-     *                       the array entry values are associative arrays like those that are meant to be
-     *                       passed with the field definitions to get[Type]Declaration() functions.
-     *                          array(
-     *                              'id' => array(
-     *                                  'type' => 'integer',
-     *                                  'unsigned' => 1
-     *                                  'notnull' => 1
-     *                                  'default' => 0
-     *                              ),
-     *                              'name' => array(
-     *                                  'type' => 'text',
-     *                                  'length' => 12
-     *                              ),
-     *                              'password' => array(
-     *                                  'type' => 'text',
-     *                                  'length' => 12
-     *                              )
-     *                          );
-     * @param array $options  An associative array of table options:
-     *                          array(
-     *                              'comment' => 'Foo',
-     *                              'charset' => 'utf8',
-     *                              'collate' => 'utf8_unicode_ci',
-     *                              'type'    => 'innodb',
-     *                          );
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createTable($name, $fields, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        // if we have an AUTO_INCREMENT column and a PK on more than one field,
-        // we have to handle it differently...
-        $autoincrement = null;
-        if (empty($options['primary'])) {
-            $pk_fields = array();
-            foreach ($fields as $fieldname => $def) {
-                if (!empty($def['primary'])) {
-                    $pk_fields[$fieldname] = true;
-                }
-                if (!empty($def['autoincrement'])) {
-                    $autoincrement = $fieldname;
-                }
-            }
-            if (!is_null($autoincrement) && count($pk_fields) > 1) {
-                $options['primary'] = $pk_fields;
-            } else {
-                // the PK constraint is on max one field => OK
-                $autoincrement = null;
-            }
-        }
-
-        $query = $this->_getCreateTableQuery($name, $fields, $options);
-        if (PEAR::isError($query)) {
-            return $query;
-        }
-
-        if (!is_null($autoincrement)) {
-            // we have to remove the PK clause added by _getIntegerDeclaration()
-            $query = str_replace('AUTO_INCREMENT PRIMARY KEY', 'AUTO_INCREMENT', $query);
-        }
-
-        $options_strings = array();
-
-        if (!empty($options['comment'])) {
-            $options_strings['comment'] = 'COMMENT = '.$db->quote($options['comment'], 'text');
-        }
-
-        if (!empty($options['charset'])) {
-            $options_strings['charset'] = 'DEFAULT CHARACTER SET '.$options['charset'];
-            if (!empty($options['collate'])) {
-                $options_strings['charset'].= ' COLLATE '.$options['collate'];
-            }
-        }
-
-        $type = false;
-        if (!empty($options['type'])) {
-            $type = $options['type'];
-        } elseif ($db->options['default_table_type']) {
-            $type = $db->options['default_table_type'];
-        }
-        if ($type) {
-            $options_strings[] = "ENGINE = $type";
-        }
-
-        if (!empty($options_strings)) {
-            $query .= ' '.implode(' ', $options_strings);
-        }
-        $result = $db->exec($query);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ dropTable()
-
-    /**
-     * drop an existing table
-     *
-     * @param string $name name of the table that should be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropTable($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        //delete the triggers associated to existing FK constraints
-        $constraints = $this->listTableConstraints($name);
-        if (!PEAR::isError($constraints) && !empty($constraints)) {
-            $db->loadModule('Reverse', null, true);
-            foreach ($constraints as $constraint) {
-                $definition = $db->reverse->getTableConstraintDefinition($name, $constraint);
-                if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
-                    $result = $this->_dropFKTriggers($name, $constraint, $definition['references']['table']);
-                    if (PEAR::isError($result)) {
-                        return $result;
-                    }
-                }
-            }
-        }
-
-        return parent::dropTable($name);
-    }
-
-    // }}}
-    // {{{ truncateTable()
-
-    /**
-     * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
-     * it falls back to a DELETE FROM TABLE query)
-     *
-     * @param string $name name of the table that should be truncated
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function truncateTable($name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        return $db->exec("TRUNCATE TABLE $name");
-    }
-
-    // }}}
-    // {{{ vacuum()
-
-    /**
-     * Optimize (vacuum) all the tables in the db (or only the specified table)
-     * and optionally run ANALYZE.
-     *
-     * @param string $table table name (all the tables if empty)
-     * @param array  $options an array with driver-specific options:
-     *               - timeout [int] (in seconds) [mssql-only]
-     *               - analyze [boolean] [pgsql and mysql]
-     *               - full [boolean] [pgsql-only]
-     *               - freeze [boolean] [pgsql-only]
-     *
-     * @return mixed MDB2_OK success, a MDB2 error on failure
-     * @access public
-     */
-    function vacuum($table = null, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (empty($table)) {
-            $table = $this->listTables();
-            if (PEAR::isError($table)) {
-                return $table;
-            }
-        }
-        if (is_array($table)) {
-            foreach (array_keys($table) as $k) {
-            	$table[$k] = $db->quoteIdentifier($table[$k], true);
-            }
-            $table = implode(', ', $table);
-        } else {
-            $table = $db->quoteIdentifier($table, true);
-        }
-
-        $result = $db->exec('OPTIMIZE TABLE '.$table);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if (!empty($options['analyze'])) {
-            return $db->exec('ANALYZE TABLE '.$table);
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ alterTable()
-
-    /**
-     * alter an existing table
-     *
-     * @param string $name         name of the table that is intended to be changed.
-     * @param array $changes     associative array that contains the details of each type
-     *                             of change that is intended to be performed. The types of
-     *                             changes that are currently supported are defined as follows:
-     *
-     *                             name
-     *
-     *                                New name for the table.
-     *
-     *                            add
-     *
-     *                                Associative array with the names of fields to be added as
-     *                                 indexes of the array. The value of each entry of the array
-     *                                 should be set to another associative array with the properties
-     *                                 of the fields to be added. The properties of the fields should
-     *                                 be the same as defined by the MDB2 parser.
-     *
-     *
-     *                            remove
-     *
-     *                                Associative array with the names of fields to be removed as indexes
-     *                                 of the array. Currently the values assigned to each entry are ignored.
-     *                                 An empty array should be used for future compatibility.
-     *
-     *                            rename
-     *
-     *                                Associative array with the names of fields to be renamed as indexes
-     *                                 of the array. The value of each entry of the array should be set to
-     *                                 another associative array with the entry named name with the new
-     *                                 field name and the entry named Declaration that is expected to contain
-     *                                 the portion of the field declaration already in DBMS specific SQL code
-     *                                 as it is used in the CREATE TABLE statement.
-     *
-     *                            change
-     *
-     *                                Associative array with the names of the fields to be changed as indexes
-     *                                 of the array. Keep in mind that if it is intended to change either the
-     *                                 name of a field and any other properties, the change array entries
-     *                                 should have the new names of the fields as array indexes.
-     *
-     *                                The value of each entry of the array should be set to another associative
-     *                                 array with the properties of the fields to that are meant to be changed as
-     *                                 array entries. These entries should be assigned to the new values of the
-     *                                 respective properties. The properties of the fields should be the same
-     *                                 as defined by the MDB2 parser.
-     *
-     *                            Example
-     *                                array(
-     *                                    'name' => 'userlist',
-     *                                    'add' => array(
-     *                                        'quota' => array(
-     *                                            'type' => 'integer',
-     *                                            'unsigned' => 1
-     *                                        )
-     *                                    ),
-     *                                    'remove' => array(
-     *                                        'file_limit' => array(),
-     *                                        'time_limit' => array()
-     *                                    ),
-     *                                    'change' => array(
-     *                                        'name' => array(
-     *                                            'length' => '20',
-     *                                            'definition' => array(
-     *                                                'type' => 'text',
-     *                                                'length' => 20,
-     *                                            ),
-     *                                        )
-     *                                    ),
-     *                                    'rename' => array(
-     *                                        'sex' => array(
-     *                                            'name' => 'gender',
-     *                                            'definition' => array(
-     *                                                'type' => 'text',
-     *                                                'length' => 1,
-     *                                                'default' => 'M',
-     *                                            ),
-     *                                        )
-     *                                    )
-     *                                )
-     *
-     * @param boolean $check     indicates whether the function should just check if the DBMS driver
-     *                             can perform the requested table alterations if the value is true or
-     *                             actually perform them otherwise.
-     * @access public
-     *
-      * @return mixed MDB2_OK on success, a MDB2 error on failure
-     */
-    function alterTable($name, $changes, $check)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        foreach ($changes as $change_name => $change) {
-            switch ($change_name) {
-            case 'add':
-            case 'remove':
-            case 'change':
-            case 'rename':
-            case 'name':
-                break;
-            default:
-                return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
-                    'change type "'.$change_name.'" not yet supported', __FUNCTION__);
-            }
-        }
-
-        if ($check) {
-            return MDB2_OK;
-        }
-
-        $query = '';
-        if (!empty($changes['name'])) {
-            $change_name = $db->quoteIdentifier($changes['name'], true);
-            $query .= 'RENAME TO ' . $change_name;
-        }
-
-        if (!empty($changes['add']) && is_array($changes['add'])) {
-            foreach ($changes['add'] as $field_name => $field) {
-                if ($query) {
-                    $query.= ', ';
-                }
-                $query.= 'ADD ' . $db->getDeclaration($field['type'], $field_name, $field);
-            }
-        }
-
-        if (!empty($changes['remove']) && is_array($changes['remove'])) {
-            foreach ($changes['remove'] as $field_name => $field) {
-                if ($query) {
-                    $query.= ', ';
-                }
-                $field_name = $db->quoteIdentifier($field_name, true);
-                $query.= 'DROP ' . $field_name;
-            }
-        }
-
-        $rename = array();
-        if (!empty($changes['rename']) && is_array($changes['rename'])) {
-            foreach ($changes['rename'] as $field_name => $field) {
-                $rename[$field['name']] = $field_name;
-            }
-        }
-
-        if (!empty($changes['change']) && is_array($changes['change'])) {
-            foreach ($changes['change'] as $field_name => $field) {
-                if ($query) {
-                    $query.= ', ';
-                }
-                if (isset($rename[$field_name])) {
-                    $old_field_name = $rename[$field_name];
-                    unset($rename[$field_name]);
-                } else {
-                    $old_field_name = $field_name;
-                }
-                $old_field_name = $db->quoteIdentifier($old_field_name, true);
-                $query.= "CHANGE $old_field_name " . $db->getDeclaration($field['definition']['type'], $field_name, $field['definition']);
-            }
-        }
-
-        if (!empty($rename) && is_array($rename)) {
-            foreach ($rename as $rename_name => $renamed_field) {
-                if ($query) {
-                    $query.= ', ';
-                }
-                $field = $changes['rename'][$renamed_field];
-                $renamed_field = $db->quoteIdentifier($renamed_field, true);
-                $query.= 'CHANGE ' . $renamed_field . ' ' . $db->getDeclaration($field['definition']['type'], $field['name'], $field['definition']);
-            }
-        }
-
-        if (!$query) {
-            return MDB2_OK;
-        }
-
-        $name = $db->quoteIdentifier($name, true);
-        return $db->exec("ALTER TABLE $name $query");
-    }
-
-    // }}}
-    // {{{ listDatabases()
-
-    /**
-     * list all databases
-     *
-     * @return mixed array of database names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listDatabases()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $result = $db->queryCol('SHOW DATABASES');
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ listUsers()
-
-    /**
-     * list all users
-     *
-     * @return mixed array of user names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listUsers()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->queryCol('SELECT DISTINCT USER FROM mysql.USER');
-    }
-
-    // }}}
-    // {{{ listFunctions()
-
-    /**
-     * list all functions in the current database
-     *
-     * @return mixed array of function names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listFunctions()
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = "SELECT name FROM mysql.proc";
-        /*
-        SELECT ROUTINE_NAME
-          FROM INFORMATION_SCHEMA.ROUTINES
-         WHERE ROUTINE_TYPE = 'FUNCTION'
-        */
-        $result = $db->queryCol($query);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ listTableTriggers()
-
-    /**
-     * list all triggers in the database that reference a given table
-     *
-     * @param string table for which all referenced triggers should be found
-     * @return mixed array of trigger names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableTriggers($table = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = 'SHOW TRIGGERS';
-        if (!is_null($table)) {
-            $table = $db->quote($table, 'text');
-            $query .= " LIKE $table";
-        }
-        $result = $db->queryCol($query);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ listTables()
-
-    /**
-     * list all tables in the current database
-     *
-     * @param string database, the current is default
-     * @return mixed array of table names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTables($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = "SHOW /*!50002 FULL*/ TABLES";
-        if (!is_null($database)) {
-            $query .= " FROM $database";
-        }
-        $query.= "/*!50002  WHERE Table_type = 'BASE TABLE'*/";
-
-        $table_names = $db->queryAll($query, null, MDB2_FETCHMODE_ORDERED);
-        if (PEAR::isError($table_names)) {
-            return $table_names;
-        }
-
-        $result = array();
-        foreach ($table_names as $table) {
-            if (!$this->_fixSequenceName($table[0], true)) {
-                $result[] = $table[0];
-            }
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ listViews()
-
-    /**
-     * list all views in the current database
-     *
-     * @param string database, the current is default
-     * @return mixed array of view names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listViews($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = 'SHOW FULL TABLES';
-        if (!is_null($database)) {
-            $query.= " FROM $database";
-        }
-        $query.= " WHERE Table_type = 'VIEW'";
-
-        $result = $db->queryCol($query);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ listTableFields()
-
-    /**
-     * list all fields in a table in the current database
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of field names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableFields($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $result = $db->queryCol("SHOW COLUMNS FROM $table");
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ createIndex()
-
-    /**
-     * Get the stucture of a field into an array
-     *
-     * @author Leoncx
-     * @param string    $table         name of the table on which the index is to be created
-     * @param string    $name         name of the index to be created
-     * @param array     $definition        associative array that defines properties of the index to be created.
-     *                                 Currently, only one property named FIELDS is supported. This property
-     *                                 is also an associative with the names of the index fields as array
-     *                                 indexes. Each entry of this array is set to another type of associative
-     *                                 array that specifies properties of the index that are specific to
-     *                                 each field.
-     *
-     *                                Currently, only the sorting property is supported. It should be used
-     *                                 to define the sorting direction of the index. It may be set to either
-     *                                 ascending or descending.
-     *
-     *                                Not all DBMS support index sorting direction configuration. The DBMS
-     *                                 drivers of those that do not support it ignore this property. Use the
-     *                                 function supports() to determine whether the DBMS driver can manage indexes.
-     *
-     *                                 Example
-     *                                    array(
-     *                                        'fields' => array(
-     *                                            'user_name' => array(
-     *                                                'sorting' => 'ascending'
-     *                                                'length' => 10
-     *                                            ),
-     *                                            'last_login' => array()
-     *                                        )
-     *                                    )
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createIndex($table, $name, $definition)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        $query = "CREATE INDEX $name ON $table";
-        $fields = array();
-        foreach ($definition['fields'] as $field => $fieldinfo) {
-            if (!empty($fieldinfo['length'])) {
-                $fields[] = $db->quoteIdentifier($field, true) . '(' . $fieldinfo['length'] . ')';
-            } else {
-                $fields[] = $db->quoteIdentifier($field, true);
-            }
-        }
-        $query .= ' ('. implode(', ', $fields) . ')';
-        return $db->exec($query);
-    }
-
-    // }}}
-    // {{{ dropIndex()
-
-    /**
-     * drop existing index
-     *
-     * @param string    $table         name of table that should be used in method
-     * @param string    $name         name of the index to be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropIndex($table, $name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        return $db->exec("DROP INDEX $name ON $table");
-    }
-
-    // }}}
-    // {{{ listTableIndexes()
-
-    /**
-     * list all indexes in a table
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of index names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableIndexes($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $key_name = 'Key_name';
-        $non_unique = 'Non_unique';
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            if ($db->options['field_case'] == CASE_LOWER) {
-                $key_name = strtolower($key_name);
-                $non_unique = strtolower($non_unique);
-            } else {
-                $key_name = strtoupper($key_name);
-                $non_unique = strtoupper($non_unique);
-            }
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $query = "SHOW INDEX FROM $table";
-        $indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($indexes)) {
-            return $indexes;
-        }
-
-        $result = array();
-        foreach ($indexes as $index_data) {
-            if ($index_data[$non_unique] && ($index = $this->_fixIndexName($index_data[$key_name]))) {
-                $result[$index] = true;
-            }
-        }
-
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_change_key_case($result, $db->options['field_case']);
-        }
-        return array_keys($result);
-    }
-
-    // }}}
-    // {{{ createConstraint()
-
-    /**
-     * create a constraint on a table
-     *
-     * @param string    $table         name of the table on which the constraint is to be created
-     * @param string    $name         name of the constraint to be created
-     * @param array     $definition        associative array that defines properties of the constraint to be created.
-     *                                 Currently, only one property named FIELDS is supported. This property
-     *                                 is also an associative with the names of the constraint fields as array
-     *                                 constraints. Each entry of this array is set to another type of associative
-     *                                 array that specifies properties of the constraint that are specific to
-     *                                 each field.
-     *
-     *                                 Example
-     *                                    array(
-     *                                        'fields' => array(
-     *                                            'user_name' => array(),
-     *                                            'last_login' => array()
-     *                                        )
-     *                                    )
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createConstraint($table, $name, $definition)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $type = '';
-        $idx_name = $db->quoteIdentifier($db->getIndexName($name), true);
-        if (!empty($definition['primary'])) {
-            $type = 'PRIMARY';
-            $idx_name = 'KEY';
-        } elseif (!empty($definition['unique'])) {
-            $type = 'UNIQUE';
-        } elseif (!empty($definition['foreign'])) {
-            $type = 'CONSTRAINT';
-        }
-        if (empty($type)) {
-            return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                'invalid definition, could not create constraint', __FUNCTION__);
-        }
-
-        $table_quoted = $db->quoteIdentifier($table, true);
-        $query = "ALTER TABLE $table_quoted ADD $type $idx_name";
-        if (!empty($definition['foreign'])) {
-            $query .= ' FOREIGN KEY';
-        }
-        $fields = array();
-        foreach ($definition['fields'] as $field => $fieldinfo) {
-            $quoted = $db->quoteIdentifier($field, true);
-            if (!empty($fieldinfo['length'])) {
-                $quoted .= '(' . $fieldinfo['length'] . ')';
-            }
-            $fields[] = $quoted;
-        }
-        $query .= ' ('. implode(', ', $fields) . ')';
-        if (!empty($definition['foreign'])) {
-            $query.= ' REFERENCES ' . $db->quoteIdentifier($definition['references']['table'], true);
-            $referenced_fields = array();
-            foreach (array_keys($definition['references']['fields']) as $field) {
-                $referenced_fields[] = $db->quoteIdentifier($field, true);
-            }
-            $query .= ' ('. implode(', ', $referenced_fields) . ')';
-            $query .= $this->_getAdvancedFKOptions($definition);
-
-            // add index on FK column(s) or we can't add a FK constraint
-            // @see http://forums.mysql.com/read.php?22,19755,226009
-            $result = $this->createIndex($table, $name.'_fkidx', $definition);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-        }
-        $res = $db->exec($query);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-        if (!empty($definition['foreign'])) {
-            return $this->_createFKTriggers($table, array($name => $definition));
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ dropConstraint()
-
-    /**
-     * drop existing constraint
-     *
-     * @param string    $table        name of table that should be used in method
-     * @param string    $name         name of the constraint to be dropped
-     * @param string    $primary      hint if the constraint is primary
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropConstraint($table, $name, $primary = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        
-        if ($primary || strtolower($name) == 'primary') {
-            $query = 'ALTER TABLE '. $db->quoteIdentifier($table, true) .' DROP PRIMARY KEY';
-            return $db->exec($query);
-        }
-        
-        //is it a FK constraint? If so, also delete the associated triggers
-        $db->loadModule('Reverse', null, true);
-        $definition = $db->reverse->getTableConstraintDefinition($table, $name);
-        if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
-            //first drop the FK enforcing triggers
-            $result = $this->_dropFKTriggers($table, $name, $definition['references']['table']);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            //then drop the constraint itself
-            $table = $db->quoteIdentifier($table, true);
-            $name = $db->quoteIdentifier($db->getIndexName($name), true);
-            $query = "ALTER TABLE $table DROP FOREIGN KEY $name";
-            return $db->exec($query);
-        }
-
-        $table = $db->quoteIdentifier($table, true);
-        $name = $db->quoteIdentifier($db->getIndexName($name), true);
-        $query = "ALTER TABLE $table DROP INDEX $name";
-        return $db->exec($query);
-    }
-
-    // }}}
-    // {{{ _createFKTriggers()
-
-    /**
-     * Create triggers to enforce the FOREIGN KEY constraint on the table
-     *
-     * NB: since there's no RAISE_APPLICATION_ERROR facility in mysql,
-     * we call a non-existent procedure to raise the FK violation message.
-     * @see http://forums.mysql.com/read.php?99,55108,71877#msg-71877
-     *
-     * @param string $table        table name
-     * @param array  $foreign_keys FOREIGN KEY definitions
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access private
-     */
-    function _createFKTriggers($table, $foreign_keys)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        // create triggers to enforce FOREIGN KEY constraints
-        if ($db->supports('triggers') && !empty($foreign_keys)) {
-            $table_quoted = $db->quoteIdentifier($table, true);
-            foreach ($foreign_keys as $fkname => $fkdef) {
-                if (empty($fkdef)) {
-                    continue;
-                }
-                //set actions to default if not set
-                $fkdef['onupdate'] = empty($fkdef['onupdate']) ? $db->options['default_fk_action_onupdate'] : strtoupper($fkdef['onupdate']);
-                $fkdef['ondelete'] = empty($fkdef['ondelete']) ? $db->options['default_fk_action_ondelete'] : strtoupper($fkdef['ondelete']);
-
-                $trigger_names = array(
-                    'insert'    => $fkname.'_insert_trg',
-                    'update'    => $fkname.'_update_trg',
-                    'pk_update' => $fkname.'_pk_update_trg',
-                    'pk_delete' => $fkname.'_pk_delete_trg',
-                );
-                $table_fields = array_keys($fkdef['fields']);
-                $referenced_fields = array_keys($fkdef['references']['fields']);
-
-                //create the ON [UPDATE|DELETE] triggers on the primary table
-                $restrict_action = ' IF (SELECT ';
-                $aliased_fields = array();
-                foreach ($table_fields as $field) {
-                    $aliased_fields[] = $table_quoted .'.'.$field .' AS '.$field;
-                }
-                $restrict_action .= implode(',', $aliased_fields)
-                       .' FROM '.$table_quoted
-                       .' WHERE ';
-                $conditions  = array();
-                $new_values  = array();
-                $null_values = array();
-                for ($i=0; $i<count($table_fields); $i++) {
-                    $conditions[]  = $table_fields[$i] .' = OLD.'.$referenced_fields[$i];
-                    $new_values[]  = $table_fields[$i] .' = NEW.'.$referenced_fields[$i];
-                    $null_values[] = $table_fields[$i] .' = NULL';
-                }
-                $conditions2 = array();
-                for ($i=0; $i<count($referenced_fields); $i++) {
-                    $conditions2[]  = 'NEW.'.$referenced_fields[$i] .' <> OLD.'.$referenced_fields[$i];
-                }
-                $restrict_action .= implode(' AND ', $conditions).') IS NOT NULL'
-                                .' AND (' .implode(' OR ', $conditions2) .')'
-                                .' THEN CALL %s_ON_TABLE_'.$table.'_VIOLATES_FOREIGN_KEY_CONSTRAINT();'
-                                .' END IF;';
-
-                $cascade_action_update = 'UPDATE '.$table_quoted.' SET '.implode(', ', $new_values) .' WHERE '.implode(' AND ', $conditions). ';';
-                $cascade_action_delete = 'DELETE FROM '.$table_quoted.' WHERE '.implode(' AND ', $conditions). ';';
-                $setnull_action        = 'UPDATE '.$table_quoted.' SET '.implode(', ', $null_values).' WHERE '.implode(' AND ', $conditions). ';';
-
-                if ('SET DEFAULT' == $fkdef['onupdate'] || 'SET DEFAULT' == $fkdef['ondelete']) {
-                    $db->loadModule('Reverse', null, true);
-                    $default_values = array();
-                    foreach ($table_fields as $table_field) {
-                        $field_definition = $db->reverse->getTableFieldDefinition($table, $field);
-                        if (PEAR::isError($field_definition)) {
-                            return $field_definition;
-                        }
-                        $default_values[] = $table_field .' = '. $field_definition[0]['default'];
-                    }
-                    $setdefault_action = 'UPDATE '.$table_quoted.' SET '.implode(', ', $default_values).' WHERE '.implode(' AND ', $conditions). ';';
-                }
-
-                $query = 'CREATE TRIGGER %s'
-                        .' %s ON '.$fkdef['references']['table']
-                        .' FOR EACH ROW BEGIN '
-                        .' SET FOREIGN_KEY_CHECKS = 0; ';  //only really needed for ON UPDATE CASCADE
-
-                if ('CASCADE' == $fkdef['onupdate']) {
-                    $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE',  'update') . $cascade_action_update;
-                } elseif ('SET NULL' == $fkdef['onupdate']) {
-                    $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setnull_action;
-                } elseif ('SET DEFAULT' == $fkdef['onupdate']) {
-                    $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setdefault_action;
-                } elseif ('NO ACTION' == $fkdef['onupdate']) {
-                    $sql_update = sprintf($query.$restrict_action, $trigger_names['pk_update'], 'AFTER UPDATE', 'update');
-                } elseif ('RESTRICT' == $fkdef['onupdate']) {
-                    $sql_update = sprintf($query.$restrict_action, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update');
-                }
-                if ('CASCADE' == $fkdef['ondelete']) {
-                    $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE',  'delete') . $cascade_action_delete;
-                } elseif ('SET NULL' == $fkdef['ondelete']) {
-                    $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setnull_action;
-                } elseif ('SET DEFAULT' == $fkdef['ondelete']) {
-                    $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setdefault_action;
-                } elseif ('NO ACTION' == $fkdef['ondelete']) {
-                    $sql_delete = sprintf($query.$restrict_action, $trigger_names['pk_delete'], 'AFTER DELETE', 'delete');
-                } elseif ('RESTRICT' == $fkdef['ondelete']) {
-                    $sql_delete = sprintf($query.$restrict_action, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete');
-                }
-                $sql_update .= ' SET FOREIGN_KEY_CHECKS = 1; END;';
-                $sql_delete .= ' SET FOREIGN_KEY_CHECKS = 1; END;';
-
-                $db->pushErrorHandling(PEAR_ERROR_RETURN);
-                $db->expectError(MDB2_ERROR_CANNOT_CREATE); 
-                $result = $db->exec($sql_delete);
-                $expected_errmsg = 'This MySQL version doesn\'t support multiple triggers with the same action time and event for one table';
-                $db->popExpect();
-                $db->popErrorHandling();
-                if (PEAR::isError($result)) {
-                    if ($result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
-                        return $result;
-                    }
-                    $db->warnings[] = $expected_errmsg;
-                }
-                $db->pushErrorHandling(PEAR_ERROR_RETURN);
-                $db->expectError(MDB2_ERROR_CANNOT_CREATE);
-                $result = $db->exec($sql_update);
-                $db->popExpect();
-                $db->popErrorHandling();
-                if (PEAR::isError($result) && $result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
-                    if ($result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
-                        return $result;
-                    }
-                    $db->warnings[] = $expected_errmsg;
-                }
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ _dropFKTriggers()
-
-    /**
-     * Drop the triggers created to enforce the FOREIGN KEY constraint on the table
-     *
-     * @param string $table            table name
-     * @param string $fkname           FOREIGN KEY constraint name
-     * @param string $referenced_table referenced table name
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access private
-     */
-    function _dropFKTriggers($table, $fkname, $referenced_table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $triggers  = $this->listTableTriggers($table);
-        $triggers2 = $this->listTableTriggers($referenced_table);
-        if (!PEAR::isError($triggers2) && !PEAR::isError($triggers)) {
-            $triggers = array_merge($triggers, $triggers2);
-            $pattern = '/^'.$fkname.'(_pk)?_(insert|update|delete)_trg$/i';
-            foreach ($triggers as $trigger) {
-                if (preg_match($pattern, $trigger)) {
-                    $result = $db->exec('DROP TRIGGER '.$trigger);
-                    if (PEAR::isError($result)) {
-                        return $result;
-                    }
-                }
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ listTableConstraints()
-
-    /**
-     * list all constraints in a table
-     *
-     * @param string $table name of table that should be used in method
-     * @return mixed array of constraint names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listTableConstraints($table)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $key_name = 'Key_name';
-        $non_unique = 'Non_unique';
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            if ($db->options['field_case'] == CASE_LOWER) {
-                $key_name = strtolower($key_name);
-                $non_unique = strtolower($non_unique);
-            } else {
-                $key_name = strtoupper($key_name);
-                $non_unique = strtoupper($non_unique);
-            }
-        }
-
-        $query = 'SHOW INDEX FROM ' . $db->quoteIdentifier($table, true);
-        $indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($indexes)) {
-            return $indexes;
-        }
-
-        $result = array();
-        foreach ($indexes as $index_data) {
-            if (!$index_data[$non_unique]) {
-                if ($index_data[$key_name] !== 'PRIMARY') {
-                    $index = $this->_fixIndexName($index_data[$key_name]);
-                } else {
-                    $index = 'PRIMARY';
-                }
-                if (!empty($index)) {
-                    $result[$index] = true;
-                }
-            }
-        }
-
-        //list FOREIGN KEY constraints...
-        $query = 'SHOW CREATE TABLE '. $db->escape($table);
-        $definition = $db->queryOne($query, 'text', 1);
-        if (!PEAR::isError($definition) && !empty($definition)) {
-            $pattern = '/\bCONSTRAINT\b\s+([^\s]+)\s+\bFOREIGN KEY\b/Uims';
-            if (preg_match_all($pattern, str_replace('`', '', $definition), $matches) > 0) {
-                foreach ($matches[1] as $constraint) {
-                    $result[$constraint] = true;
-                }
-            }
-        }
-
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_change_key_case($result, $db->options['field_case']);
-        }
-        return array_keys($result);
-    }
-
-    // }}}
-    // {{{ createSequence()
-
-    /**
-     * create sequence
-     *
-     * @param string    $seq_name name of the sequence to be created
-     * @param string    $start    start value of the sequence; default is 1
-     * @param array     $options  An associative array of table options:
-     *                          array(
-     *                              'comment' => 'Foo',
-     *                              'charset' => 'utf8',
-     *                              'collate' => 'utf8_unicode_ci',
-     *                              'type'    => 'innodb',
-     *                          );
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function createSequence($seq_name, $start = 1, $options = array())
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
-        $seqcol_name = $db->quoteIdentifier($db->options['seqcol_name'], true);
-        
-        $options_strings = array();
-
-        if (!empty($options['comment'])) {
-            $options_strings['comment'] = 'COMMENT = '.$db->quote($options['comment'], 'text');
-        }
-
-        if (!empty($options['charset'])) {
-            $options_strings['charset'] = 'DEFAULT CHARACTER SET '.$options['charset'];
-            if (!empty($options['collate'])) {
-                $options_strings['charset'].= ' COLLATE '.$options['collate'];
-            }
-        }
-
-        $type = false;
-        if (!empty($options['type'])) {
-            $type = $options['type'];
-        } elseif ($db->options['default_table_type']) {
-            $type = $db->options['default_table_type'];
-        }
-        if ($type) {
-            $options_strings[] = "ENGINE = $type";
-        }
-
-        $query = "CREATE TABLE $sequence_name ($seqcol_name INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ($seqcol_name))";
-        if (!empty($options_strings)) {
-            $query .= ' '.implode(' ', $options_strings);
-        }
-        $res = $db->exec($query);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-
-        if ($start == 1) {
-            return MDB2_OK;
-        }
-
-        $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (".($start-1).')';
-        $res = $db->exec($query);
-        if (!PEAR::isError($res)) {
-            return MDB2_OK;
-        }
-
-        // Handle error
-        $result = $db->exec("DROP TABLE $sequence_name");
-        if (PEAR::isError($result)) {
-            return $db->raiseError($result, null, null,
-                'could not drop inconsistent sequence table', __FUNCTION__);
-        }
-
-        return $db->raiseError($res, null, null,
-            'could not create sequence table', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ dropSequence()
-
-    /**
-     * drop existing sequence
-     *
-     * @param string    $seq_name     name of the sequence to be dropped
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function dropSequence($seq_name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
-        return $db->exec("DROP TABLE $sequence_name");
-    }
-
-    // }}}
-    // {{{ listSequences()
-
-    /**
-     * list all sequences in the current database
-     *
-     * @param string database, the current is default
-     * @return mixed array of sequence names on success, a MDB2 error on failure
-     * @access public
-     */
-    function listSequences($database = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = "SHOW TABLES";
-        if (!is_null($database)) {
-            $query .= " FROM $database";
-        }
-        $table_names = $db->queryCol($query);
-        if (PEAR::isError($table_names)) {
-            return $table_names;
-        }
-
-        $result = array();
-        foreach ($table_names as $table_name) {
-            if ($sqn = $this->_fixSequenceName($table_name, true)) {
-                $result[] = $sqn;
-            }
-        }
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
-        }
-        return $result;
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Native/Common.php b/lib/php/MDB2/Driver/Native/Common.php
deleted file mode 100644
index c01caa35b716fce134664134956f8c635e3adc7a..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Native/Common.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Common.php,v 1.2 2007/09/09 13:47:36 quipo Exp $
-//
-
-/**
- * Base class for the natuve modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Native');
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Native_Common extends MDB2_Module_Common
-{
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Native/mysqli.php b/lib/php/MDB2/Driver/Native/mysqli.php
deleted file mode 100644
index 326c1d87ed2b548f101bc5e29aacde516506ea4c..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Native/mysqli.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.8 2006/06/18 21:59:05 lsmith Exp $
-//
-
-require_once 'MDB2/Driver/Native/Common.php';
-
-/**
- * MDB2 MySQLi driver for the native module
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Native_mysqli extends MDB2_Driver_Native_Common
-{
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Reverse/Common.php b/lib/php/MDB2/Driver/Reverse/Common.php
deleted file mode 100644
index 7ce9c744262f9b8266526ba2f8dc3a28b2850ce6..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Reverse/Common.php
+++ /dev/null
@@ -1,517 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Common.php,v 1.43 2009/01/14 15:01:21 quipo Exp $
-//
-
-/**
- * @package MDB2
- * @category Database
- */
-
-/**
- * These are constants for the tableInfo-function
- * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust MDB2_TABLEINFO_FULL accordingly
- */
-
-define('MDB2_TABLEINFO_ORDER',      1);
-define('MDB2_TABLEINFO_ORDERTABLE', 2);
-define('MDB2_TABLEINFO_FULL',       3);
-
-/**
- * Base class for the schema reverse engineering module that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Reverse');
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
-{
-    // {{{ splitTableSchema()
-
-    /**
-     * Split the "[owner|schema].table" notation into an array
-     *
-     * @param string $table [schema and] table name
-     *
-     * @return array array(schema, table)
-     * @access private
-     */
-    function splitTableSchema($table)
-    {
-        $ret = array();
-        if (strpos($table, '.') !== false) {
-            return explode('.', $table);
-        }
-        return array(null, $table);
-    }
-
-    // }}}
-    // {{{ getTableFieldDefinition()
-
-    /**
-     * Get the structure of a field into an array
-     *
-     * @param string    $table     name of table that should be used in method
-     * @param string    $field     name of field that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure.
-     *          The returned array contains an array for each field definition,
-     *          with all or some of these indices, depending on the field data type:
-     *          [notnull] [nativetype] [length] [fixed] [default] [type] [mdb2type]
-     * @access public
-     */
-    function getTableFieldDefinition($table, $field)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ getTableIndexDefinition()
-
-    /**
-     * Get the structure of an index into an array
-     *
-     * @param string    $table      name of table that should be used in method
-     * @param string    $index      name of index that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     *          The returned array has this structure:
-     *          </pre>
-     *          array (
-     *              [fields] => array (
-     *                  [field1name] => array() // one entry per each field covered
-     *                  [field2name] => array() // by the index
-     *                  [field3name] => array(
-     *                      [sorting] => ascending
-     *                  )
-     *              )
-     *          );
-     *          </pre>
-     * @access public
-     */
-    function getTableIndexDefinition($table, $index)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ getTableConstraintDefinition()
-
-    /**
-     * Get the structure of an constraints into an array
-     *
-     * @param string    $table      name of table that should be used in method
-     * @param string    $index      name of index that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     *          The returned array has this structure:
-     *          <pre>
-     *          array (
-     *              [primary] => 0
-     *              [unique]  => 0
-     *              [foreign] => 1
-     *              [check]   => 0
-     *              [fields] => array (
-     *                  [field1name] => array() // one entry per each field covered
-     *                  [field2name] => array() // by the index
-     *                  [field3name] => array(
-     *                      [sorting]  => ascending
-     *                      [position] => 3
-     *                  )
-     *              )
-     *              [references] => array(
-     *                  [table] => name
-     *                  [fields] => array(
-     *                      [field1name] => array(  //one entry per each referenced field
-     *                           [position] => 1
-     *                      )
-     *                  )
-     *              )
-     *              [deferrable] => 0
-     *              [initiallydeferred] => 0
-     *              [onupdate] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
-     *              [ondelete] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
-     *              [match] => SIMPLE|PARTIAL|FULL
-     *          );
-     *          </pre>
-     * @access public
-     */
-    function getTableConstraintDefinition($table, $index)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ getSequenceDefinition()
-
-    /**
-     * Get the structure of a sequence into an array
-     *
-     * @param string    $sequence   name of sequence that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     *          The returned array has this structure:
-     *          <pre>
-     *          array (
-     *              [start] => n
-     *          );
-     *          </pre>
-     * @access public
-     */
-    function getSequenceDefinition($sequence)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $start = $db->currId($sequence);
-        if (PEAR::isError($start)) {
-            return $start;
-        }
-        if ($db->supports('current_id')) {
-            $start++;
-        } else {
-            $db->warnings[] = 'database does not support getting current
-                sequence value, the sequence value was incremented';
-        }
-        $definition = array();
-        if ($start != 1) {
-            $definition = array('start' => $start);
-        }
-        return $definition;
-    }
-
-    // }}}
-    // {{{ getTriggerDefinition()
-
-    /**
-     * Get the structure of a trigger into an array
-     *
-     * EXPERIMENTAL
-     *
-     * WARNING: this function is experimental and may change the returned value 
-     * at any time until labelled as non-experimental
-     *
-     * @param string    $trigger    name of trigger that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     *          The returned array has this structure:
-     *          <pre>
-     *          array (
-     *              [trigger_name]    => 'trigger name',
-     *              [table_name]      => 'table name',
-     *              [trigger_body]    => 'trigger body definition',
-     *              [trigger_type]    => 'BEFORE' | 'AFTER',
-     *              [trigger_event]   => 'INSERT' | 'UPDATE' | 'DELETE'
-     *                  //or comma separated list of multiple events, when supported
-     *              [trigger_enabled] => true|false
-     *              [trigger_comment] => 'trigger comment',
-     *          );
-     *          </pre>
-     *          The oci8 driver also returns a [when_clause] index.
-     * @access public
-     */
-    function getTriggerDefinition($trigger)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'method not implemented', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * The format of the resulting array depends on which <var>$mode</var>
-     * you select.  The sample output below is based on this query:
-     * <pre>
-     *    SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
-     *    FROM tblFoo
-     *    JOIN tblBar ON tblFoo.fldId = tblBar.fldId
-     * </pre>
-     *
-     * <ul>
-     * <li>
-     *
-     * <kbd>null</kbd> (default)
-     *   <pre>
-     *   [0] => Array (
-     *       [table] => tblFoo
-     *       [name] => fldId
-     *       [type] => int
-     *       [len] => 11
-     *       [flags] => primary_key not_null
-     *   )
-     *   [1] => Array (
-     *       [table] => tblFoo
-     *       [name] => fldPhone
-     *       [type] => string
-     *       [len] => 20
-     *       [flags] =>
-     *   )
-     *   [2] => Array (
-     *       [table] => tblBar
-     *       [name] => fldId
-     *       [type] => int
-     *       [len] => 11
-     *       [flags] => primary_key not_null
-     *   )
-     *   </pre>
-     *
-     * </li><li>
-     *
-     * <kbd>MDB2_TABLEINFO_ORDER</kbd>
-     *
-     *   <p>In addition to the information found in the default output,
-     *   a notation of the number of columns is provided by the
-     *   <samp>num_fields</samp> element while the <samp>order</samp>
-     *   element provides an array with the column names as the keys and
-     *   their location index number (corresponding to the keys in the
-     *   the default output) as the values.</p>
-     *
-     *   <p>If a result set has identical field names, the last one is
-     *   used.</p>
-     *
-     *   <pre>
-     *   [num_fields] => 3
-     *   [order] => Array (
-     *       [fldId] => 2
-     *       [fldTrans] => 1
-     *   )
-     *   </pre>
-     *
-     * </li><li>
-     *
-     * <kbd>MDB2_TABLEINFO_ORDERTABLE</kbd>
-     *
-     *   <p>Similar to <kbd>MDB2_TABLEINFO_ORDER</kbd> but adds more
-     *   dimensions to the array in which the table names are keys and
-     *   the field names are sub-keys.  This is helpful for queries that
-     *   join tables which have identical field names.</p>
-     *
-     *   <pre>
-     *   [num_fields] => 3
-     *   [ordertable] => Array (
-     *       [tblFoo] => Array (
-     *           [fldId] => 0
-     *           [fldPhone] => 1
-     *       )
-     *       [tblBar] => Array (
-     *           [fldId] => 2
-     *       )
-     *   )
-     *   </pre>
-     *
-     * </li>
-     * </ul>
-     *
-     * The <samp>flags</samp> element contains a space separated list
-     * of extra information about the field.  This data is inconsistent
-     * between DBMS's due to the way each DBMS works.
-     *   + <samp>primary_key</samp>
-     *   + <samp>unique_key</samp>
-     *   + <samp>multiple_key</samp>
-     *   + <samp>not_null</samp>
-     *
-     * Most DBMS's only provide the <samp>table</samp> and <samp>flags</samp>
-     * elements if <var>$result</var> is a table name.  The following DBMS's
-     * provide full information from queries:
-     *   + fbsql
-     *   + mysql
-     *
-     * If the 'portability' option has <samp>MDB2_PORTABILITY_FIX_CASE</samp>
-     * turned on, the names of tables and fields will be lower or upper cased.
-     *
-     * @param object|string  $result  MDB2_result object from a query or a
-     *                                string containing the name of a table.
-     *                                While this also accepts a query result
-     *                                resource identifier, this behavior is
-     *                                deprecated.
-     * @param int  $mode   either unused or one of the tableInfo modes:
-     *                     <kbd>MDB2_TABLEINFO_ORDERTABLE</kbd>,
-     *                     <kbd>MDB2_TABLEINFO_ORDER</kbd> or
-     *                     <kbd>MDB2_TABLEINFO_FULL</kbd> (which does both).
-     *                     These are bitwise, so the first two can be
-     *                     combined using <kbd>|</kbd>.
-     *
-     * @return array  an associative array with the information requested.
-     *                 A MDB2_Error object on failure.
-     *
-     * @see MDB2_Driver_Common::setOption()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if (!is_string($result)) {
-            return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'method not implemented', __FUNCTION__);
-        }
-
-        $db->loadModule('Manager', null, true);
-        $fields = $db->manager->listTableFields($result);
-        if (PEAR::isError($fields)) {
-            return $fields;
-        }
-
-        $flags = array();
-
-        $idxname_format = $db->getOption('idxname_format');
-        $db->setOption('idxname_format', '%s');
-
-        $indexes = $db->manager->listTableIndexes($result);
-        if (PEAR::isError($indexes)) {
-            $db->setOption('idxname_format', $idxname_format);
-            return $indexes;
-        }
-
-        foreach ($indexes as $index) {
-            $definition = $this->getTableIndexDefinition($result, $index);
-            if (PEAR::isError($definition)) {
-                $db->setOption('idxname_format', $idxname_format);
-                return $definition;
-            }
-            if (count($definition['fields']) > 1) {
-                foreach ($definition['fields'] as $field => $sort) {
-                    $flags[$field] = 'multiple_key';
-                }
-            }
-        }
-
-        $constraints = $db->manager->listTableConstraints($result);
-        if (PEAR::isError($constraints)) {
-            return $constraints;
-        }
-
-        foreach ($constraints as $constraint) {
-            $definition = $this->getTableConstraintDefinition($result, $constraint);
-            if (PEAR::isError($definition)) {
-                $db->setOption('idxname_format', $idxname_format);
-                return $definition;
-            }
-            $flag = !empty($definition['primary'])
-                ? 'primary_key' : (!empty($definition['unique'])
-                    ? 'unique_key' : false);
-            if ($flag) {
-                foreach ($definition['fields'] as $field => $sort) {
-                    if (empty($flags[$field]) || $flags[$field] != 'primary_key') {
-                        $flags[$field] = $flag;
-                    }
-                }
-            }
-        }
-
-        $res = array();
-
-        if ($mode) {
-            $res['num_fields'] = count($fields);
-        }
-
-        foreach ($fields as $i => $field) {
-            $definition = $this->getTableFieldDefinition($result, $field);
-            if (PEAR::isError($definition)) {
-                $db->setOption('idxname_format', $idxname_format);
-                return $definition;
-            }
-            $res[$i] = $definition[0];
-            $res[$i]['name'] = $field;
-            $res[$i]['table'] = $result;
-            $res[$i]['type'] = preg_replace('/^([a-z]+).*$/i', '\\1', trim($definition[0]['nativetype']));
-            // 'primary_key', 'unique_key', 'multiple_key'
-            $res[$i]['flags'] = empty($flags[$field]) ? '' : $flags[$field];
-            // not_null', 'unsigned', 'auto_increment', 'default_[rawencodedvalue]'
-            if (!empty($res[$i]['notnull'])) {
-                $res[$i]['flags'].= ' not_null';
-            }
-            if (!empty($res[$i]['unsigned'])) {
-                $res[$i]['flags'].= ' unsigned';
-            }
-            if (!empty($res[$i]['auto_increment'])) {
-                $res[$i]['flags'].= ' autoincrement';
-            }
-            if (!empty($res[$i]['default'])) {
-                $res[$i]['flags'].= ' default_'.rawurlencode($res[$i]['default']);
-            }
-
-            if ($mode & MDB2_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        $db->setOption('idxname_format', $idxname_format);
-        return $res;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/Reverse/mysqli.php b/lib/php/MDB2/Driver/Reverse/mysqli.php
deleted file mode 100644
index 3668f7b80c7fe29edf6350749409c35efc083b3d..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/Reverse/mysqli.php
+++ /dev/null
@@ -1,600 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.70 2008/03/26 21:15:37 quipo Exp $
-//
-
-require_once 'MDB2/Driver/Reverse/Common.php';
-
-/**
- * MDB2 MySQLi driver for the schema reverse engineering module
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- * @author  Lorenzo Alberton <l.alberton@quipo.it>
- */
-class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
-{
-    /**
-     * Array for converting MYSQLI_*_FLAG constants to text values
-     * @var    array
-     * @access public
-     */
-    var $flags = array(
-        MYSQLI_NOT_NULL_FLAG        => 'not_null',
-        MYSQLI_PRI_KEY_FLAG         => 'primary_key',
-        MYSQLI_UNIQUE_KEY_FLAG      => 'unique_key',
-        MYSQLI_MULTIPLE_KEY_FLAG    => 'multiple_key',
-        MYSQLI_BLOB_FLAG            => 'blob',
-        MYSQLI_UNSIGNED_FLAG        => 'unsigned',
-        MYSQLI_ZEROFILL_FLAG        => 'zerofill',
-        MYSQLI_AUTO_INCREMENT_FLAG  => 'auto_increment',
-        MYSQLI_TIMESTAMP_FLAG       => 'timestamp',
-        MYSQLI_SET_FLAG             => 'set',
-        // MYSQLI_NUM_FLAG             => 'numeric',  // unnecessary
-        // MYSQLI_PART_KEY_FLAG        => 'multiple_key',  // duplicatvie
-        MYSQLI_GROUP_FLAG           => 'group_by'
-    );
-
-    /**
-     * Array for converting MYSQLI_TYPE_* constants to text values
-     * @var    array
-     * @access public
-     */
-    var $types = array(
-        MYSQLI_TYPE_DECIMAL     => 'decimal',
-        246                     => 'decimal',
-        MYSQLI_TYPE_TINY        => 'tinyint',
-        MYSQLI_TYPE_SHORT       => 'int',
-        MYSQLI_TYPE_LONG        => 'int',
-        MYSQLI_TYPE_FLOAT       => 'float',
-        MYSQLI_TYPE_DOUBLE      => 'double',
-        // MYSQLI_TYPE_NULL        => 'DEFAULT NULL',  // let flags handle it
-        MYSQLI_TYPE_TIMESTAMP   => 'timestamp',
-        MYSQLI_TYPE_LONGLONG    => 'bigint',
-        MYSQLI_TYPE_INT24       => 'mediumint',
-        MYSQLI_TYPE_DATE        => 'date',
-        MYSQLI_TYPE_TIME        => 'time',
-        MYSQLI_TYPE_DATETIME    => 'datetime',
-        MYSQLI_TYPE_YEAR        => 'year',
-        MYSQLI_TYPE_NEWDATE     => 'date',
-        MYSQLI_TYPE_ENUM        => 'enum',
-        MYSQLI_TYPE_SET         => 'set',
-        MYSQLI_TYPE_TINY_BLOB   => 'tinyblob',
-        MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
-        MYSQLI_TYPE_LONG_BLOB   => 'longblob',
-        MYSQLI_TYPE_BLOB        => 'blob',
-        MYSQLI_TYPE_VAR_STRING  => 'varchar',
-        MYSQLI_TYPE_STRING      => 'char',
-        MYSQLI_TYPE_GEOMETRY    => 'geometry',
-    );
-
-    // {{{ getTableFieldDefinition()
-
-    /**
-     * Get the structure of a field into an array
-     *
-     * @param string $table_name name of table that should be used in method
-     * @param string $field_name name of field that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     * @access public
-     */
-    function getTableFieldDefinition($table_name, $field_name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $result = $db->loadModule('Datatype', null, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        list($schema, $table) = $this->splitTableSchema($table_name);
-
-        $table = $db->quoteIdentifier($table, true);
-        $query = "SHOW FULL COLUMNS FROM $table LIKE ".$db->quote($field_name);
-        $columns = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($columns)) {
-            return $columns;
-        }
-        foreach ($columns as $column) {
-            $column = array_change_key_case($column, CASE_LOWER);
-            $column['name'] = $column['field'];
-            unset($column['field']);
-            if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                if ($db->options['field_case'] == CASE_LOWER) {
-                    $column['name'] = strtolower($column['name']);
-                } else {
-                    $column['name'] = strtoupper($column['name']);
-                }
-            } else {
-                $column = array_change_key_case($column, $db->options['field_case']);
-            }
-            if ($field_name == $column['name']) {
-                $mapped_datatype = $db->datatype->mapNativeDatatype($column);
-                if (PEAR::isError($mapped_datatype)) {
-                    return $mapped_datatype;
-                }
-                list($types, $length, $unsigned, $fixed) = $mapped_datatype;
-                $notnull = false;
-                if (empty($column['null']) || $column['null'] !== 'YES') {
-                    $notnull = true;
-                }
-                $default = false;
-                if (array_key_exists('default', $column)) {
-                    $default = $column['default'];
-                    if (is_null($default) && $notnull) {
-                        $default = '';
-                    }
-                }
-                $autoincrement = false;
-                if (!empty($column['extra']) && $column['extra'] == 'auto_increment') {
-                    $autoincrement = true;
-                }
-                $collate = null;
-                if (!empty($column['collation'])) {
-                    $collate = $column['collation'];
-                    $charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate);
-                }
-
-                $definition[0] = array(
-                    'notnull' => $notnull,
-                    'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
-                );
-                if (!is_null($length)) {
-                    $definition[0]['length'] = $length;
-                }
-                if (!is_null($unsigned)) {
-                    $definition[0]['unsigned'] = $unsigned;
-                }
-                if (!is_null($fixed)) {
-                    $definition[0]['fixed'] = $fixed;
-                }
-                if ($default !== false) {
-                    $definition[0]['default'] = $default;
-                }
-                if ($autoincrement !== false) {
-                    $definition[0]['autoincrement'] = $autoincrement;
-                }
-                if (!is_null($collate)) {
-                    $definition[0]['collate'] = $collate;
-                    $definition[0]['charset'] = $charset;
-                }
-                foreach ($types as $key => $type) {
-                    $definition[$key] = $definition[0];
-                    if ($type == 'clob' || $type == 'blob') {
-                        unset($definition[$key]['default']);
-                    } elseif ($type == 'timestamp' && $notnull && empty($definition[$key]['default'])) {
-                        $definition[$key]['default'] = '0000-00-00 00:00:00';
-                    }
-                    $definition[$key]['type'] = $type;
-                    $definition[$key]['mdb2type'] = $type;
-                }
-                return $definition;
-            }
-        }
-
-        return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-            'it was not specified an existing table column', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ getTableIndexDefinition()
-
-    /**
-     * Get the structure of an index into an array
-     *
-     * @param string $table_name name of table that should be used in method
-     * @param string $index_name name of index that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     * @access public
-     */
-    function getTableIndexDefinition($table_name, $index_name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        list($schema, $table) = $this->splitTableSchema($table_name);
-
-        $table = $db->quoteIdentifier($table, true);
-        $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
-        $index_name_mdb2 = $db->getIndexName($index_name);
-        $result = $db->queryRow(sprintf($query, $db->quote($index_name_mdb2)));
-        if (!PEAR::isError($result) && !is_null($result)) {
-            // apply 'idxname_format' only if the query succeeded, otherwise
-            // fallback to the given $index_name, without transformation
-            $index_name = $index_name_mdb2;
-        }
-        $result = $db->query(sprintf($query, $db->quote($index_name)));
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        $colpos = 1;
-        $definition = array();
-        while (is_array($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
-            $row = array_change_key_case($row, CASE_LOWER);
-            $key_name = $row['key_name'];
-            if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                if ($db->options['field_case'] == CASE_LOWER) {
-                    $key_name = strtolower($key_name);
-                } else {
-                    $key_name = strtoupper($key_name);
-                }
-            }
-            if ($index_name == $key_name) {
-                if (!$row['non_unique']) {
-                    return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                        $index_name . ' is not an existing table index', __FUNCTION__);
-                }
-                $column_name = $row['column_name'];
-                if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                    if ($db->options['field_case'] == CASE_LOWER) {
-                        $column_name = strtolower($column_name);
-                    } else {
-                        $column_name = strtoupper($column_name);
-                    }
-                }
-                $definition['fields'][$column_name] = array(
-                    'position' => $colpos++
-                );
-                if (!empty($row['collation'])) {
-                    $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A'
-                        ? 'ascending' : 'descending');
-                }
-            }
-        }
-        $result->free();
-        if (empty($definition['fields'])) {
-            return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                $index_name . ' is not an existing table index', __FUNCTION__);
-        }
-        return $definition;
-    }
-
-    // }}}
-    // {{{ getTableConstraintDefinition()
-
-    /**
-     * Get the structure of a constraint into an array
-     *
-     * @param string $table_name      name of table that should be used in method
-     * @param string $constraint_name name of constraint that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     * @access public
-     */
-    function getTableConstraintDefinition($table_name, $constraint_name)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        list($schema, $table) = $this->splitTableSchema($table_name);
-        $constraint_name_original = $constraint_name;
-
-        $table = $db->quoteIdentifier($table, true);
-        $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
-        if (strtolower($constraint_name) != 'primary') {
-            $constraint_name_mdb2 = $db->getIndexName($constraint_name);
-            $result = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2)));
-            if (!PEAR::isError($result) && !is_null($result)) {
-                // apply 'idxname_format' only if the query succeeded, otherwise
-                // fallback to the given $index_name, without transformation
-                $constraint_name = $constraint_name_mdb2;
-            }
-        }
-        $result = $db->query(sprintf($query, $db->quote($constraint_name)));
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        $colpos = 1;
-        //default values, eventually overridden
-        $definition = array(
-            'primary' => false,
-            'unique'  => false,
-            'foreign' => false,
-            'check'   => false,
-            'fields'  => array(),
-            'references' => array(
-                'table'  => '',
-                'fields' => array(),
-            ),
-            'onupdate'  => '',
-            'ondelete'  => '',
-            'match'     => '',
-            'deferrable'        => false,
-            'initiallydeferred' => false,
-        );
-        while (is_array($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
-            $row = array_change_key_case($row, CASE_LOWER);
-            $key_name = $row['key_name'];
-            if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                if ($db->options['field_case'] == CASE_LOWER) {
-                    $key_name = strtolower($key_name);
-                } else {
-                    $key_name = strtoupper($key_name);
-                }
-            }
-            if ($constraint_name == $key_name) {
-                if ($row['non_unique']) {
-                    //FOREIGN KEY?
-                    return $this->_getTableFKConstraintDefinition($table, $constraint_name_original, $definition);
-                }
-                if ($row['key_name'] == 'PRIMARY') {
-                    $definition['primary'] = true;
-                } elseif (!$row['non_unique']) {
-                    $definition['unique'] = true;
-                }
-                $column_name = $row['column_name'];
-                if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                    if ($db->options['field_case'] == CASE_LOWER) {
-                        $column_name = strtolower($column_name);
-                    } else {
-                        $column_name = strtoupper($column_name);
-                    }
-                }
-                $definition['fields'][$column_name] = array(
-                    'position' => $colpos++
-                );
-                if (!empty($row['collation'])) {
-                    $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A'
-                        ? 'ascending' : 'descending');
-                }
-            }
-        }
-        $result->free();
-        if (empty($definition['fields'])) {
-            return $this->_getTableFKConstraintDefinition($table, $constraint_name_original, $definition);
-        }
-        return $definition;
-    }
-
-    // }}}
-    // {{{ _getTableFKConstraintDefinition()
-
-    /**
-     * Get the FK definition from the CREATE TABLE statement
-     *
-     * @param string $table           table name
-     * @param string $constraint_name constraint name
-     * @param array  $definition      default values for constraint definition
-     *
-     * @return array|PEAR_Error
-     * @access private
-     */
-    function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        $query = 'SHOW CREATE TABLE '. $db->escape($table);
-        $constraint = $db->queryOne($query, 'text', 1);
-        if (!PEAR::isError($constraint) && !empty($constraint)) {
-            if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-                if ($db->options['field_case'] == CASE_LOWER) {
-                    $constraint = strtolower($constraint);
-                } else {
-                    $constraint = strtoupper($constraint);
-                }
-            }
-            $constraint_name_original = $constraint_name;
-            $constraint_name = $db->getIndexName($constraint_name);
-            $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
-            if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
-                //fallback to original constraint name
-                $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
-            }
-            if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
-                $definition['foreign'] = true;
-                $column_names = explode(',', $matches[1]);
-                $referenced_cols = explode(',', $matches[3]);
-                $definition['references'] = array(
-                    'table'  => $matches[2],
-                    'fields' => array(),
-                );
-                $colpos = 1;
-                foreach ($column_names as $column_name) {
-                    $definition['fields'][trim($column_name)] = array(
-                        'position' => $colpos++
-                    );
-                }
-                $colpos = 1;
-                foreach ($referenced_cols as $column_name) {
-                    $definition['references']['fields'][trim($column_name)] = array(
-                        'position' => $colpos++
-                    );
-                }
-                $definition['onupdate'] = 'NO ACTION';
-                $definition['ondelete'] = 'NO ACTION';
-                $definition['match']    = 'SIMPLE';
-                return $definition;
-            }
-        }
-        return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                $constraint_name . ' is not an existing table constraint', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ getTriggerDefinition()
-
-    /**
-     * Get the structure of a trigger into an array
-     *
-     * EXPERIMENTAL
-     *
-     * WARNING: this function is experimental and may change the returned value
-     * at any time until labelled as non-experimental
-     *
-     * @param string    $trigger    name of trigger that should be used in method
-     * @return mixed data array on success, a MDB2 error on failure
-     * @access public
-     */
-    function getTriggerDefinition($trigger)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $query = 'SELECT trigger_name,
-                         event_object_table AS table_name,
-                         action_statement AS trigger_body,
-                         action_timing AS trigger_type,
-                         event_manipulation AS trigger_event
-                    FROM information_schema.triggers
-                   WHERE trigger_name = '. $db->quote($trigger, 'text');
-        $types = array(
-            'trigger_name'    => 'text',
-            'table_name'      => 'text',
-            'trigger_body'    => 'text',
-            'trigger_type'    => 'text',
-            'trigger_event'   => 'text',
-        );
-        $def = $db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($def)) {
-            return $def;
-        }
-        $def['trigger_comment'] = '';
-        $def['trigger_enabled'] = true;
-        return $def;
-    }
-
-    // }}}
-    // {{{ tableInfo()
-
-    /**
-     * Returns information about a table or a result set
-     *
-     * @param object|string  $result  MDB2_result object from a query or a
-     *                                 string containing the name of a table.
-     *                                 While this also accepts a query result
-     *                                 resource identifier, this behavior is
-     *                                 deprecated.
-     * @param int            $mode    a valid tableInfo mode
-     *
-     * @return array  an associative array with the information requested.
-     *                 A MDB2_Error object on failure.
-     *
-     * @see MDB2_Driver_Common::setOption()
-     */
-    function tableInfo($result, $mode = null)
-    {
-        if (is_string($result)) {
-           return parent::tableInfo($result, $mode);
-        }
-
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $resource = MDB2::isResultCommon($result) ? $result->getResource() : $result;
-        if (!is_object($resource)) {
-            return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                'Could not generate result resource', __FUNCTION__);
-        }
-
-        if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            if ($db->options['field_case'] == CASE_LOWER) {
-                $case_func = 'strtolower';
-            } else {
-                $case_func = 'strtoupper';
-            }
-        } else {
-            $case_func = 'strval';
-        }
-
-        $count = @mysqli_num_fields($resource);
-        $res = array();
-        if ($mode) {
-            $res['num_fields'] = $count;
-        }
-
-        $db->loadModule('Datatype', null, true);
-        for ($i = 0; $i < $count; $i++) {
-            $tmp = @mysqli_fetch_field($resource);
-
-            $flags = '';
-            foreach ($this->flags as $const => $means) {
-                if ($tmp->flags & $const) {
-                    $flags.= $means . ' ';
-                }
-            }
-            if ($tmp->def) {
-                $flags.= 'default_' . rawurlencode($tmp->def);
-            }
-            $flags = trim($flags);
-
-            $res[$i] = array(
-                'table'  => $case_func($tmp->table),
-                'name'   => $case_func($tmp->name),
-                'type'   => isset($this->types[$tmp->type])
-                    ? $this->types[$tmp->type] : 'unknown',
-                // http://bugs.php.net/?id=36579
-                'length' => $tmp->length,
-                'flags'  => $flags,
-            );
-            $mdb2type_info = $db->datatype->mapNativeDatatype($res[$i]);
-            if (PEAR::isError($mdb2type_info)) {
-               return $mdb2type_info;
-            }
-            $res[$i]['mdb2type'] = $mdb2type_info[0][0];
-            if ($mode & MDB2_TABLEINFO_ORDER) {
-                $res['order'][$res[$i]['name']] = $i;
-            }
-            if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
-                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
-            }
-        }
-
-        return $res;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Driver/mysqli.php b/lib/php/MDB2/Driver/mysqli.php
deleted file mode 100644
index 964fb74eeb4ece9ccc2c860dc180e8cce6f0cc49..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Driver/mysqli.php
+++ /dev/null
@@ -1,1849 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: mysqli.php,v 1.192 2008/11/16 21:45:08 quipo Exp $
-//
-
-/**
- * MDB2 MySQLi driver
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_mysqli extends MDB2_Driver_Common
-{
-    // {{{ properties
-
-    var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => '\\', 'escape_pattern' => '\\');
-
-    var $identifier_quoting = array('start' => '`', 'end' => '`', 'escape' => '`');
-
-    var $sql_comments = array(
-        array('start' => '-- ', 'end' => "\n", 'escape' => false),
-        array('start' => '#', 'end' => "\n", 'escape' => false),
-        array('start' => '/*', 'end' => '*/', 'escape' => false),
-    );
-
-    var $server_capabilities_checked = false;
-
-    var $start_transaction = false;
-
-    var $varchar_max_length = 255;
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * Constructor
-     */
-    function __construct()
-    {
-        parent::__construct();
-
-        $this->phptype = 'mysqli';
-        $this->dbsyntax = 'mysql';
-
-        $this->supported['sequences'] = 'emulated';
-        $this->supported['indexes'] = true;
-        $this->supported['affected_rows'] = true;
-        $this->supported['transactions'] = false;
-        $this->supported['savepoints'] = false;
-        $this->supported['summary_functions'] = true;
-        $this->supported['order_by_text'] = true;
-        $this->supported['current_id'] = 'emulated';
-        $this->supported['limit_queries'] = true;
-        $this->supported['LOBs'] = true;
-        $this->supported['replace'] = true;
-        $this->supported['sub_selects'] = 'emulated';
-        $this->supported['triggers'] = false;
-        $this->supported['auto_increment'] = true;
-        $this->supported['primary_key'] = true;
-        $this->supported['result_introspection'] = true;
-        $this->supported['prepared_statements'] = 'emulated';
-        $this->supported['identifier_quoting'] = true;
-        $this->supported['pattern_escaping'] = true;
-        $this->supported['new_link'] = true;
-
-        $this->options['DBA_username'] = false;
-        $this->options['DBA_password'] = false;
-        $this->options['default_table_type'] = '';
-        $this->options['multi_query'] = false;
-        $this->options['max_identifiers_length'] = 64;
-
-        $this->_reCheckSupportedOptions();
-    }
-
-    // }}}
-    // {{{ _reCheckSupportedOptions()
-
-    /**
-     * If the user changes certain options, other capabilities may depend
-     * on the new settings, so we need to check them (again).
-     *
-     * @access private
-     */
-    function _reCheckSupportedOptions()
-    {
-        $this->supported['transactions'] = $this->options['use_transactions'];
-        $this->supported['savepoints']   = $this->options['use_transactions'];
-        if ($this->options['default_table_type']) {
-            switch (strtoupper($this->options['default_table_type'])) {
-            case 'BLACKHOLE':
-            case 'MEMORY':
-            case 'ARCHIVE':
-            case 'CSV':
-            case 'HEAP':
-            case 'ISAM':
-            case 'MERGE':
-            case 'MRG_ISAM':
-            case 'ISAM':
-            case 'MRG_MYISAM':
-            case 'MYISAM':
-                $this->supported['savepoints']   = false;
-                $this->supported['transactions'] = false;
-                $this->warnings[] = $this->options['default_table_type'] .
-                    ' is not a supported default table type';
-                break;
-            }
-        }
-    }
-
-    // }}}
-    // {{{ function setOption($option, $value)
-
-    /**
-     * set the option for the db class
-     *
-     * @param   string  option name
-     * @param   mixed   value for the option
-     *
-     * @return  mixed   MDB2_OK or MDB2 Error Object
-     *
-     * @access  public
-     */
-    function setOption($option, $value)
-    {
-        $res = parent::setOption($option, $value);
-        $this->_reCheckSupportedOptions();
-    }
-
-    // }}}
-    // {{{ errorInfo()
-
-    /**
-     * This method is used to collect information about an error
-     *
-     * @param integer $error
-     * @return array
-     * @access public
-     */
-    function errorInfo($error = null)
-    {
-        if ($this->connection) {
-            $native_code = @mysqli_errno($this->connection);
-            $native_msg  = @mysqli_error($this->connection);
-        } else {
-            $native_code = @mysqli_connect_errno();
-            $native_msg  = @mysqli_connect_error();
-        }
-        if (is_null($error)) {
-            static $ecode_map;
-            if (empty($ecode_map)) {
-                $ecode_map = array(
-                    1000 => MDB2_ERROR_INVALID, //hashchk
-                    1001 => MDB2_ERROR_INVALID, //isamchk
-                    1004 => MDB2_ERROR_CANNOT_CREATE,
-                    1005 => MDB2_ERROR_CANNOT_CREATE,
-                    1006 => MDB2_ERROR_CANNOT_CREATE,
-                    1007 => MDB2_ERROR_ALREADY_EXISTS,
-                    1008 => MDB2_ERROR_CANNOT_DROP,
-                    1009 => MDB2_ERROR_CANNOT_DROP,
-                    1010 => MDB2_ERROR_CANNOT_DROP,
-                    1011 => MDB2_ERROR_CANNOT_DELETE,
-                    1022 => MDB2_ERROR_ALREADY_EXISTS,
-                    1029 => MDB2_ERROR_NOT_FOUND,
-                    1032 => MDB2_ERROR_NOT_FOUND,
-                    1044 => MDB2_ERROR_ACCESS_VIOLATION,
-                    1045 => MDB2_ERROR_ACCESS_VIOLATION,
-                    1046 => MDB2_ERROR_NODBSELECTED,
-                    1048 => MDB2_ERROR_CONSTRAINT,
-                    1049 => MDB2_ERROR_NOSUCHDB,
-                    1050 => MDB2_ERROR_ALREADY_EXISTS,
-                    1051 => MDB2_ERROR_NOSUCHTABLE,
-                    1054 => MDB2_ERROR_NOSUCHFIELD,
-                    1060 => MDB2_ERROR_ALREADY_EXISTS,
-                    1061 => MDB2_ERROR_ALREADY_EXISTS,
-                    1062 => MDB2_ERROR_ALREADY_EXISTS,
-                    1064 => MDB2_ERROR_SYNTAX,
-                    1067 => MDB2_ERROR_INVALID,
-                    1072 => MDB2_ERROR_NOT_FOUND,
-                    1086 => MDB2_ERROR_ALREADY_EXISTS,
-                    1091 => MDB2_ERROR_NOT_FOUND,
-                    1100 => MDB2_ERROR_NOT_LOCKED,
-                    1109 => MDB2_ERROR_NOT_FOUND,
-                    1125 => MDB2_ERROR_ALREADY_EXISTS,
-                    1136 => MDB2_ERROR_VALUE_COUNT_ON_ROW,
-                    1138 => MDB2_ERROR_INVALID,
-                    1142 => MDB2_ERROR_ACCESS_VIOLATION,
-                    1143 => MDB2_ERROR_ACCESS_VIOLATION,
-                    1146 => MDB2_ERROR_NOSUCHTABLE,
-                    1149 => MDB2_ERROR_SYNTAX,
-                    1169 => MDB2_ERROR_CONSTRAINT,
-                    1176 => MDB2_ERROR_NOT_FOUND,
-                    1177 => MDB2_ERROR_NOSUCHTABLE,
-                    1213 => MDB2_ERROR_DEADLOCK,
-                    1216 => MDB2_ERROR_CONSTRAINT,
-                    1217 => MDB2_ERROR_CONSTRAINT,
-                    1227 => MDB2_ERROR_ACCESS_VIOLATION,
-                    1235 => MDB2_ERROR_CANNOT_CREATE,
-                    1299 => MDB2_ERROR_INVALID_DATE,
-                    1300 => MDB2_ERROR_INVALID,
-                    1304 => MDB2_ERROR_ALREADY_EXISTS,
-                    1305 => MDB2_ERROR_NOT_FOUND,
-                    1306 => MDB2_ERROR_CANNOT_DROP,
-                    1307 => MDB2_ERROR_CANNOT_CREATE,
-                    1334 => MDB2_ERROR_CANNOT_ALTER,
-                    1339 => MDB2_ERROR_NOT_FOUND,
-                    1356 => MDB2_ERROR_INVALID,
-                    1359 => MDB2_ERROR_ALREADY_EXISTS,
-                    1360 => MDB2_ERROR_NOT_FOUND,
-                    1363 => MDB2_ERROR_NOT_FOUND,
-                    1365 => MDB2_ERROR_DIVZERO,
-                    1451 => MDB2_ERROR_CONSTRAINT,
-                    1452 => MDB2_ERROR_CONSTRAINT,
-                    1542 => MDB2_ERROR_CANNOT_DROP,
-                    1546 => MDB2_ERROR_CONSTRAINT,
-                    1582 => MDB2_ERROR_CONSTRAINT,
-                    2003 => MDB2_ERROR_CONNECT_FAILED,
-                    2019 => MDB2_ERROR_INVALID,
-                );
-            }
-            if ($this->options['portability'] & MDB2_PORTABILITY_ERRORS) {
-                $ecode_map[1022] = MDB2_ERROR_CONSTRAINT;
-                $ecode_map[1048] = MDB2_ERROR_CONSTRAINT_NOT_NULL;
-                $ecode_map[1062] = MDB2_ERROR_CONSTRAINT;
-            } else {
-                // Doing this in case mode changes during runtime.
-                $ecode_map[1022] = MDB2_ERROR_ALREADY_EXISTS;
-                $ecode_map[1048] = MDB2_ERROR_CONSTRAINT;
-                $ecode_map[1062] = MDB2_ERROR_ALREADY_EXISTS;
-            }
-            if (isset($ecode_map[$native_code])) {
-                $error = $ecode_map[$native_code];
-            }
-        }
-        return array($error, $native_code, $native_msg);
-    }
-
-    // }}}
-    // {{{ escape()
-
-    /**
-     * Quotes a string so it can be safely used in a query. It will quote
-     * the text so it can safely be used within a query.
-     *
-     * @param   string  the input string to quote
-     * @param   bool    escape wildcards
-     *
-     * @return  string  quoted string
-     *
-     * @access  public
-     */
-    function escape($text, $escape_wildcards = false)
-    {
-        if ($escape_wildcards) {
-            $text = $this->escapePattern($text);
-        }
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-        $text = @mysqli_real_escape_string($connection, $text);
-        return $text;
-    }
-
-    // }}}
-    // {{{ beginTransaction()
-
-    /**
-     * Start a transaction or set a savepoint.
-     *
-     * @param   string  name of a savepoint to set
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function beginTransaction($savepoint = null)
-    {
-        $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        $this->_getServerCapabilities();
-        if (!is_null($savepoint)) {
-            if (!$this->supports('savepoints')) {
-                return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                    'savepoints are not supported', __FUNCTION__);
-            }
-            if (!$this->in_transaction) {
-                return $this->raiseError(MDB2_ERROR_INVALID, null, null,
-                    'savepoint cannot be released when changes are auto committed', __FUNCTION__);
-            }
-            $query = 'SAVEPOINT '.$savepoint;
-            return $this->_doQuery($query, true);
-        } elseif ($this->in_transaction) {
-            return MDB2_OK;  //nothing to do
-        }
-        $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0';
-        $result =& $this->_doQuery($query, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        $this->in_transaction = true;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ commit()
-
-    /**
-     * Commit the database changes done during a transaction that is in
-     * progress or release a savepoint. This function may only be called when
-     * auto-committing is disabled, otherwise it will fail. Therefore, a new
-     * transaction is implicitly started after committing the pending changes.
-     *
-     * @param   string  name of a savepoint to release
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function commit($savepoint = null)
-    {
-        $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        if (!$this->in_transaction) {
-            return $this->raiseError(MDB2_ERROR_INVALID, null, null,
-                'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
-        }
-        if (!is_null($savepoint)) {
-            if (!$this->supports('savepoints')) {
-                return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                    'savepoints are not supported', __FUNCTION__);
-            }
-            $server_info = $this->getServerVersion();
-            if (version_compare($server_info['major'].'.'.$server_info['minor'].'.'.$server_info['patch'], '5.0.3', '<')) {
-                return MDB2_OK;
-            }
-            $query = 'RELEASE SAVEPOINT '.$savepoint;
-            return $this->_doQuery($query, true);
-        }
-
-        if (!$this->supports('transactions')) {
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'transactions are not supported', __FUNCTION__);
-        }
-
-        $result =& $this->_doQuery('COMMIT', true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if (!$this->start_transaction) {
-            $query = 'SET AUTOCOMMIT = 1';
-            $result =& $this->_doQuery($query, true);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-        }
-        $this->in_transaction = false;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ rollback()
-
-    /**
-     * Cancel any database changes done during a transaction or since a specific
-     * savepoint that is in progress. This function may only be called when
-     * auto-committing is disabled, otherwise it will fail. Therefore, a new
-     * transaction is implicitly started after canceling the pending changes.
-     *
-     * @param   string  name of a savepoint to rollback to
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     */
-    function rollback($savepoint = null)
-    {
-        $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
-        if (!$this->in_transaction) {
-            return $this->raiseError(MDB2_ERROR_INVALID, null, null,
-                'rollback cannot be done changes are auto committed', __FUNCTION__);
-        }
-        if (!is_null($savepoint)) {
-            if (!$this->supports('savepoints')) {
-                return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                    'savepoints are not supported', __FUNCTION__);
-            }
-            $query = 'ROLLBACK TO SAVEPOINT '.$savepoint;
-            return $this->_doQuery($query, true);
-        }
-
-        $query = 'ROLLBACK';
-        $result =& $this->_doQuery($query, true);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if (!$this->start_transaction) {
-            $query = 'SET AUTOCOMMIT = 1';
-            $result =& $this->_doQuery($query, true);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-        }
-        $this->in_transaction = false;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ function setTransactionIsolation()
-
-    /**
-     * Set the transacton isolation level.
-     *
-     * @param   string  standard isolation level
-     *                  READ UNCOMMITTED (allows dirty reads)
-     *                  READ COMMITTED (prevents dirty reads)
-     *                  REPEATABLE READ (prevents nonrepeatable reads)
-     *                  SERIALIZABLE (prevents phantom reads)
-     * @return  mixed   MDB2_OK on success, a MDB2 error on failure
-     *
-     * @access  public
-     * @since   2.1.1
-     */
-    function setTransactionIsolation($isolation)
-    {
-        $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
-        if (!$this->supports('transactions')) {
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'transactions are not supported', __FUNCTION__);
-        }
-        switch ($isolation) {
-        case 'READ UNCOMMITTED':
-        case 'READ COMMITTED':
-        case 'REPEATABLE READ':
-        case 'SERIALIZABLE':
-            break;
-        default:
-            return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-                'isolation level is not supported: '.$isolation, __FUNCTION__);
-        }
-
-        $query = "SET SESSION TRANSACTION ISOLATION LEVEL $isolation";
-        return $this->_doQuery($query, true);
-    }
-
-    // }}}
-    // {{{ _doConnect()
-
-    /**
-     * do the grunt work of the connect
-     *
-     * @return connection on success or MDB2 Error Object on failure
-     * @access protected
-     */
-    function _doConnect($username, $password, $persistent = false)
-    {
-        if (!PEAR::loadExtension($this->phptype)) {
-            return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
-        }
-
-        $connection = @mysqli_init();
-        if (!empty($this->dsn['charset']) && defined('MYSQLI_SET_CHARSET_NAME')) {
-            @mysqli_options($connection, MYSQLI_SET_CHARSET_NAME, $this->dsn['charset']);
-        }
-
-        if ($this->options['ssl']) {
-            @mysqli_ssl_set(
-                $connection,
-                empty($this->dsn['key'])    ? null : $this->dsn['key'],
-                empty($this->dsn['cert'])   ? null : $this->dsn['cert'],
-                empty($this->dsn['ca'])     ? null : $this->dsn['ca'],
-                empty($this->dsn['capath']) ? null : $this->dsn['capath'],
-                empty($this->dsn['cipher']) ? null : $this->dsn['cipher']
-            );
-        }
-
-        if (!@mysqli_real_connect(
-            $connection,
-            $this->dsn['hostspec'],
-            $username,
-            $password,
-            $this->database_name,
-            $this->dsn['port'],
-            $this->dsn['socket']
-        )) {
-            if (($err = @mysqli_connect_error()) != '') {
-                return $this->raiseError(null,
-                    null, null, $err, __FUNCTION__);
-            } else {
-                return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
-                    'unable to establish a connection', __FUNCTION__);
-            }
-        }
-
-        if (!empty($this->dsn['charset']) && !defined('MYSQLI_SET_CHARSET_NAME')) {
-            $result = $this->setCharset($this->dsn['charset'], $connection);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-        }
-
-        return $connection;
-    }
-
-    // }}}
-    // {{{ connect()
-
-    /**
-     * Connect to the database
-     *
-     * @return true on success, MDB2 Error Object on failure
-     */
-    function connect()
-    {
-        if (is_object($this->connection)) {
-            //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0) {
-            if (MDB2::areEquals($this->connected_dsn, $this->dsn)) {
-                return MDB2_OK;
-            }
-            $this->connection = 0;
-        }
-
-        $connection = $this->_doConnect(
-            $this->dsn['username'],
-            $this->dsn['password']
-        );
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $this->connection = $connection;
-        $this->connected_dsn = $this->dsn;
-        $this->connected_database_name = $this->database_name;
-        $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
-
-        $this->_getServerCapabilities();
-
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ setCharset()
-
-    /**
-     * Set the charset on the current connection
-     *
-     * @param string    charset (or array(charset, collation))
-     * @param resource  connection handle
-     *
-     * @return true on success, MDB2 Error Object on failure
-     */
-    function setCharset($charset, $connection = null)
-    {
-        if (is_null($connection)) {
-            $connection = $this->getConnection();
-            if (PEAR::isError($connection)) {
-                return $connection;
-            }
-        }
-        $collation = null;
-        if (is_array($charset) && 2 == count($charset)) {
-            $collation = array_pop($charset);
-            $charset   = array_pop($charset);
-        }
-        $client_info = mysqli_get_client_version();
-        if (OS_WINDOWS && ((40111 > $client_info) ||
-            ((50000 <= $client_info) && (50006 > $client_info)))
-        ) {
-            $query = "SET NAMES '".mysqli_real_escape_string($connection, $charset)."'";
-            if (!is_null($collation)) {
-                $query .= " COLLATE '".mysqli_real_escape_string($connection, $collation)."'";
-            }
-            return $this->_doQuery($query, true, $connection);
-        }
-        if (!$result = mysqli_set_charset($connection, $charset)) {
-            $err =& $this->raiseError(null, null, null,
-                'Could not set client character set', __FUNCTION__);
-            return $err;
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ databaseExists()
-
-    /**
-     * check if given database name is exists?
-     *
-     * @param string $name    name of the database that should be checked
-     *
-     * @return mixed true/false on success, a MDB2 error on failure
-     * @access public
-     */
-    function databaseExists($name)
-    {
-        $connection = $this->_doConnect($this->dsn['username'],
-                                        $this->dsn['password']);
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $result = @mysqli_select_db($connection, $name);
-        @mysqli_close($connection);
-
-        return $result;
-    }
-
-    // }}}
-    // {{{ disconnect()
-
-    /**
-     * Log out and disconnect from the database.
-     *
-     * @param  boolean $force if the disconnect should be forced even if the
-     *                        connection is opened persistently
-     * @return mixed true on success, false if not connected and error
-     *                object on error
-     * @access public
-     */
-    function disconnect($force = true)
-    {
-        if (is_object($this->connection)) {
-            if ($this->in_transaction) {
-                $dsn = $this->dsn;
-                $database_name = $this->database_name;
-                $persistent = $this->options['persistent'];
-                $this->dsn = $this->connected_dsn;
-                $this->database_name = $this->connected_database_name;
-                $this->options['persistent'] = $this->opened_persistent;
-                $this->rollback();
-                $this->dsn = $dsn;
-                $this->database_name = $database_name;
-                $this->options['persistent'] = $persistent;
-            }
-
-            if ($force) {
-                $ok = @mysqli_close($this->connection);
-                if (!$ok) {
-                    return $this->raiseError(MDB2_ERROR_DISCONNECT_FAILED,
-                           null, null, null, __FUNCTION__);
-                }
-            }
-        } else {
-            return false;
-        }
-        return parent::disconnect($force);
-    }
-
-    // }}}
-    // {{{ standaloneQuery()
-
-   /**
-     * execute a query as DBA
-     *
-     * @param string $query the SQL query
-     * @param mixed   $types  array that contains the types of the columns in
-     *                        the result set
-     * @param boolean $is_manip  if the query is a manipulation query
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function &standaloneQuery($query, $types = null, $is_manip = false)
-    {
-        $user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
-        $pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
-        $connection = $this->_doConnect($user, $pass);
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-        
-        $result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
-        if (!PEAR::isError($result)) {
-            $result = $this->_affectedRows($connection, $result);
-        }
-
-        @mysqli_close($connection);
-        return $result;
-    }
-
-    // }}}
-    // {{{ _doQuery()
-
-    /**
-     * Execute a query
-     * @param string $query  query
-     * @param boolean $is_manip  if the query is a manipulation query
-     * @param resource $connection
-     * @param string $database_name
-     * @return result or error object
-     * @access protected
-     */
-    function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
-    {
-        $this->last_query = $query;
-        $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
-        if ($result) {
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            $query = $result;
-        }
-        if ($this->options['disable_query']) {
-            $result = $is_manip ? 0 : null;
-            return $result;
-        }
-
-        if (is_null($connection)) {
-            $connection = $this->getConnection();
-            if (PEAR::isError($connection)) {
-                return $connection;
-            }
-        }
-        if (is_null($database_name)) {
-            $database_name = $this->database_name;
-        }
-
-        if ($database_name) {
-            if ($database_name != $this->connected_database_name) {
-                if (!@mysqli_select_db($connection, $database_name)) {
-                    $err = $this->raiseError(null, null, null,
-                        'Could not select the database: '.$database_name, __FUNCTION__);
-                    return $err;
-                }
-                $this->connected_database_name = $database_name;
-            }
-        }
-
-        if ($this->options['multi_query']) {
-            $result = mysqli_multi_query($connection, $query);
-        } else {
-            $resultmode = $this->options['result_buffering'] ? MYSQLI_USE_RESULT : MYSQLI_USE_RESULT;
-            $result = mysqli_query($connection, $query);
-        }
-
-        if (!$result) {
-            $err =& $this->raiseError(null, null, null,
-                'Could not execute statement', __FUNCTION__);
-            return $err;
-        }
-
-        if ($this->options['multi_query']) {
-            if ($this->options['result_buffering']) {
-                if (!($result = @mysqli_store_result($connection))) {
-                    $err =& $this->raiseError(null, null, null,
-                        'Could not get the first result from a multi query', __FUNCTION__);
-                    return $err;
-                }
-            } elseif (!($result = @mysqli_use_result($connection))) {
-                $err =& $this->raiseError(null, null, null,
-                        'Could not get the first result from a multi query', __FUNCTION__);
-                return $err;
-            }
-        }
-
-        $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
-        return $result;
-    }
-
-    // }}}
-    // {{{ _affectedRows()
-
-    /**
-     * Returns the number of rows affected
-     *
-     * @param resource $result
-     * @param resource $connection
-     * @return mixed MDB2 Error Object or the number of rows affected
-     * @access private
-     */
-    function _affectedRows($connection, $result = null)
-    {
-        if (is_null($connection)) {
-            $connection = $this->getConnection();
-            if (PEAR::isError($connection)) {
-                return $connection;
-            }
-        }
-        return @mysqli_affected_rows($connection);
-    }
-
-    // }}}
-    // {{{ _modifyQuery()
-
-    /**
-     * Changes a query string for various DBMS specific reasons
-     *
-     * @param string $query  query to modify
-     * @param boolean $is_manip  if it is a DML query
-     * @param integer $limit  limit the number of rows
-     * @param integer $offset  start reading from given offset
-     * @return string modified query
-     * @access protected
-     */
-    function _modifyQuery($query, $is_manip, $limit, $offset)
-    {
-        if ($this->options['portability'] & MDB2_PORTABILITY_DELETE_COUNT) {
-            // "DELETE FROM table" gives 0 affected rows in MySQL.
-            // This little hack lets you know how many rows were deleted.
-            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
-                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
-                                      'DELETE FROM \1 WHERE 1=1', $query);
-            }
-        }
-        if ($limit > 0
-            && !preg_match('/LIMIT\s*\d(?:\s*(?:,|OFFSET)\s*\d+)?(?:[^\)]*)?$/i', $query)
-        ) {
-            $query = rtrim($query);
-            if (substr($query, -1) == ';') {
-                $query = substr($query, 0, -1);
-            }
-
-            // LIMIT doesn't always come last in the query
-            // @see http://dev.mysql.com/doc/refman/5.0/en/select.html
-            $after = '';
-            if (preg_match('/(\s+INTO\s+(?:OUT|DUMP)FILE\s.*)$/ims', $query, $matches)) {
-                $after = $matches[0];
-                $query = preg_replace('/(\s+INTO\s+(?:OUT|DUMP)FILE\s.*)$/ims', '', $query);
-            } elseif (preg_match('/(\s+FOR\s+UPDATE\s*)$/i', $query, $matches)) {
-               $after = $matches[0];
-               $query = preg_replace('/(\s+FOR\s+UPDATE\s*)$/im', '', $query);
-            } elseif (preg_match('/(\s+LOCK\s+IN\s+SHARE\s+MODE\s*)$/im', $query, $matches)) {
-               $after = $matches[0];
-               $query = preg_replace('/(\s+LOCK\s+IN\s+SHARE\s+MODE\s*)$/im', '', $query);
-            }
-
-            if ($is_manip) {
-                return $query . " LIMIT $limit" . $after;
-            } else {
-                return $query . " LIMIT $offset, $limit" . $after;
-            }
-        }
-        return $query;
-    }
-
-    // }}}
-    // {{{ getServerVersion()
-
-    /**
-     * return version information about the server
-     *
-     * @param bool   $native  determines if the raw version string should be returned
-     * @return mixed array/string with version information or MDB2 error object
-     * @access public
-     */
-    function getServerVersion($native = false)
-    {
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-        if ($this->connected_server_info) {
-            $server_info = $this->connected_server_info;
-        } else {
-            $server_info = @mysqli_get_server_info($connection);
-        }
-        if (!$server_info) {
-            return $this->raiseError(null, null, null,
-                'Could not get server information', __FUNCTION__);
-        }
-        // cache server_info
-        $this->connected_server_info = $server_info;
-        if (!$native) {
-            $tmp = explode('.', $server_info, 3);
-            if (isset($tmp[2]) && strpos($tmp[2], '-')) {
-                $tmp2 = explode('-', @$tmp[2], 2);
-            } else {
-                $tmp2[0] = isset($tmp[2]) ? $tmp[2] : null;
-                $tmp2[1] = null;
-            }
-            $server_info = array(
-                'major' => isset($tmp[0]) ? $tmp[0] : null,
-                'minor' => isset($tmp[1]) ? $tmp[1] : null,
-                'patch' => $tmp2[0],
-                'extra' => $tmp2[1],
-                'native' => $server_info,
-            );
-        }
-        return $server_info;
-    }
-
-    // }}}
-    // {{{ _getServerCapabilities()
-
-    /**
-     * Fetch some information about the server capabilities
-     * (transactions, subselects, prepared statements, etc).
-     *
-     * @access private
-     */
-    function _getServerCapabilities()
-    {
-        if (!$this->server_capabilities_checked) {
-            $this->server_capabilities_checked = true;
-
-            //set defaults
-            $this->supported['sub_selects'] = 'emulated';
-            $this->supported['prepared_statements'] = 'emulated';
-            $this->supported['triggers'] = false;
-            $this->start_transaction = false;
-            $this->varchar_max_length = 255;
-
-            $server_info = $this->getServerVersion();
-            if (is_array($server_info)) {
-                $server_version = $server_info['major'].'.'.$server_info['minor'].'.'.$server_info['patch'];
-            
-                if (!version_compare($server_version, '4.1.0', '<')) {
-                    $this->supported['sub_selects'] = true;
-                    $this->supported['prepared_statements'] = true;
-                }
-
-                // SAVEPOINTs were introduced in MySQL 4.0.14 and 4.1.1 (InnoDB)
-                if (version_compare($server_version, '4.1.0', '>=')) {
-                    if (version_compare($server_version, '4.1.1', '<')) {
-                        $this->supported['savepoints'] = false;
-                    }
-                } elseif (version_compare($server_version, '4.0.14', '<')) {
-                    $this->supported['savepoints'] = false;
-                }
-
-                if (!version_compare($server_version, '4.0.11', '<')) {
-                    $this->start_transaction = true;
-                }
-
-                if (!version_compare($server_version, '5.0.3', '<')) {
-                    $this->varchar_max_length = 65532;
-                }
-
-                if (!version_compare($server_version, '5.0.2', '<')) {
-                    $this->supported['triggers'] = true;
-                }
-            }
-        }
-    }
-
-    // }}}
-    // {{{ function _skipUserDefinedVariable($query, $position)
-
-    /**
-     * Utility method, used by prepare() to avoid misinterpreting MySQL user
-     * defined variables (SELECT @x:=5) for placeholders.
-     * Check if the placeholder is a false positive, i.e. if it is an user defined
-     * variable instead. If so, skip it and advance the position, otherwise
-     * return the current position, which is valid
-     *
-     * @param string $query
-     * @param integer $position current string cursor position
-     * @return integer $new_position
-     * @access protected
-     */
-    function _skipUserDefinedVariable($query, $position)
-    {
-        $found = strpos(strrev(substr($query, 0, $position)), '@');
-        if ($found === false) {
-            return $position;
-        }
-        $pos = strlen($query) - strlen(substr($query, $position)) - $found - 1;
-        $substring = substr($query, $pos, $position - $pos + 2);
-        if (preg_match('/^@\w+\s*:=$/', $substring)) {
-            return $position + 1; //found an user defined variable: skip it
-        }
-        return $position;
-    }
-
-    // }}}
-    // {{{ prepare()
-
-    /**
-     * Prepares a query for multiple execution with execute().
-     * With some database backends, this is emulated.
-     * prepare() requires a generic query as string like
-     * 'INSERT INTO numbers VALUES(?,?)' or
-     * 'INSERT INTO numbers VALUES(:foo,:bar)'.
-     * The ? and :name and are placeholders which can be set using
-     * bindParam() and the query can be sent off using the execute() method.
-     * The allowed format for :name can be set with the 'bindname_format' option.
-     *
-     * @param string $query the query to prepare
-     * @param mixed   $types  array that contains the types of the placeholders
-     * @param mixed   $result_types  array that contains the types of the columns in
-     *                        the result set or MDB2_PREPARE_RESULT, if set to
-     *                        MDB2_PREPARE_MANIP the query is handled as a manipulation query
-     * @param mixed   $lobs   key (field) value (parameter) pair for all lob placeholders
-     * @return mixed resource handle for the prepared query on success, a MDB2
-     *        error on failure
-     * @access public
-     * @see bindParam, execute
-     */
-    function &prepare($query, $types = null, $result_types = null, $lobs = array())
-    {
-        if ($this->options['emulate_prepared']
-            || $this->supported['prepared_statements'] !== true
-        ) {
-            $obj =& parent::prepare($query, $types, $result_types, $lobs);
-            return $obj;
-        }
-        $is_manip = ($result_types === MDB2_PREPARE_MANIP);
-        $offset = $this->offset;
-        $limit = $this->limit;
-        $this->offset = $this->limit = 0;
-        $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-        $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
-        if ($result) {
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-            $query = $result;
-        }
-        $placeholder_type_guess = $placeholder_type = null;
-        $question = '?';
-        $colon = ':';
-        $positions = array();
-        $position = 0;
-        while ($position < strlen($query)) {
-            $q_position = strpos($query, $question, $position);
-            $c_position = strpos($query, $colon, $position);
-            if ($q_position && $c_position) {
-                $p_position = min($q_position, $c_position);
-            } elseif ($q_position) {
-                $p_position = $q_position;
-            } elseif ($c_position) {
-                $p_position = $c_position;
-            } else {
-                break;
-            }
-            if (is_null($placeholder_type)) {
-                $placeholder_type_guess = $query[$p_position];
-            }
-            
-            $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
-            if (PEAR::isError($new_pos)) {
-                return $new_pos;
-            }
-            if ($new_pos != $position) {
-                $position = $new_pos;
-                continue; //evaluate again starting from the new position
-            }
-            
-            //make sure this is not part of an user defined variable
-            $new_pos = $this->_skipUserDefinedVariable($query, $position);
-            if ($new_pos != $position) {
-                $position = $new_pos;
-                continue; //evaluate again starting from the new position
-            }
-
-            if ($query[$position] == $placeholder_type_guess) {
-                if (is_null($placeholder_type)) {
-                    $placeholder_type = $query[$p_position];
-                    $question = $colon = $placeholder_type;
-                }
-                if ($placeholder_type == ':') {
-                    $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
-                    $parameter = preg_replace($regexp, '\\1', $query);
-                    if ($parameter === '') {
-                        $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                            'named parameter name must match "bindname_format" option', __FUNCTION__);
-                        return $err;
-                    }
-                    $positions[$p_position] = $parameter;
-                    $query = substr_replace($query, '?', $position, strlen($parameter)+1);
-                } else {
-                    $positions[$p_position] = count($positions);
-                }
-                $position = $p_position + 1;
-            } else {
-                $position = $p_position;
-            }
-        }
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        if (!$is_manip) {
-            static $prep_statement_counter = 1;
-            $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));
-            $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']);
-            $query = "PREPARE $statement_name FROM ".$this->quote($query, 'text');
-
-            $statement =& $this->_doQuery($query, true, $connection);
-            if (PEAR::isError($statement)) {
-                return $statement;
-            }
-            $statement = $statement_name;
-        } else {
-            $statement = @mysqli_prepare($connection, $query);
-            if (!$statement) {
-                $err =& $this->raiseError(null, null, null,
-                    'Unable to create prepared statement handle', __FUNCTION__);
-                return $err;
-            }
-        }
-
-        $class_name = 'MDB2_Statement_'.$this->phptype;
-        $obj = new $class_name($this, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
-        $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
-        return $obj;
-    }
-
-    // }}}
-    // {{{ replace()
-
-    /**
-     * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
-     * query, except that if there is already a row in the table with the same
-     * key field values, the old row is deleted before the new row is inserted.
-     *
-     * The REPLACE type of query does not make part of the SQL standards. Since
-     * practically only MySQL implements it natively, this type of query is
-     * emulated through this method for other DBMS using standard types of
-     * queries inside a transaction to assure the atomicity of the operation.
-     *
-     * @access public
-     *
-     * @param string $table name of the table on which the REPLACE query will
-     *  be executed.
-     * @param array $fields associative array that describes the fields and the
-     *  values that will be inserted or updated in the specified table. The
-     *  indexes of the array are the names of all the fields of the table. The
-     *  values of the array are also associative arrays that describe the
-     *  values and other properties of the table fields.
-     *
-     *  Here follows a list of field properties that need to be specified:
-     *
-     *    value:
-     *          Value to be assigned to the specified field. This value may be
-     *          of specified in database independent type format as this
-     *          function can perform the necessary datatype conversions.
-     *
-     *    Default:
-     *          this property is required unless the Null property
-     *          is set to 1.
-     *
-     *    type
-     *          Name of the type of the field. Currently, all types Metabase
-     *          are supported except for clob and blob.
-     *
-     *    Default: no type conversion
-     *
-     *    null
-     *          Boolean property that indicates that the value for this field
-     *          should be set to null.
-     *
-     *          The default value for fields missing in INSERT queries may be
-     *          specified the definition of a table. Often, the default value
-     *          is already null, but since the REPLACE may be emulated using
-     *          an UPDATE query, make sure that all fields of the table are
-     *          listed in this function argument array.
-     *
-     *    Default: 0
-     *
-     *    key
-     *          Boolean property that indicates that this field should be
-     *          handled as a primary key or at least as part of the compound
-     *          unique index of the table that will determine the row that will
-     *          updated if it exists or inserted a new row otherwise.
-     *
-     *          This function will fail if no key field is specified or if the
-     *          value of a key field is set to null because fields that are
-     *          part of unique index they may not be null.
-     *
-     *    Default: 0
-     *
-     * @see http://dev.mysql.com/doc/refman/5.0/en/replace.html
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     */
-    function replace($table, $fields)
-    {
-        $count = count($fields);
-        $query = $values = '';
-        $keys = $colnum = 0;
-        for (reset($fields); $colnum < $count; next($fields), $colnum++) {
-            $name = key($fields);
-            if ($colnum > 0) {
-                $query .= ',';
-                $values.= ',';
-            }
-            $query.= $this->quoteIdentifier($name, true);
-            if (isset($fields[$name]['null']) && $fields[$name]['null']) {
-                $value = 'NULL';
-            } else {
-                $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
-                $value = $this->quote($fields[$name]['value'], $type);
-                if (PEAR::isError($value)) {
-                    return $value;
-                }
-            }
-            $values.= $value;
-            if (isset($fields[$name]['key']) && $fields[$name]['key']) {
-                if ($value === 'NULL') {
-                    return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
-                        'key value '.$name.' may not be NULL', __FUNCTION__);
-                }
-                $keys++;
-            }
-        }
-        if ($keys == 0) {
-            return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
-                'not specified which fields are keys', __FUNCTION__);
-        }
-
-        $connection = $this->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        $table = $this->quoteIdentifier($table, true);
-        $query = "REPLACE INTO $table ($query) VALUES ($values)";
-        $result =& $this->_doQuery($query, true, $connection);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        return $this->_affectedRows($connection, $result);
-    }
-
-    // }}}
-    // {{{ nextID()
-
-    /**
-     * Returns the next free id of a sequence
-     *
-     * @param string $seq_name name of the sequence
-     * @param boolean $ondemand when true the sequence is
-     *                          automatic created, if it
-     *                          not exists
-     *
-     * @return mixed MDB2 Error Object or id
-     * @access public
-     */
-    function nextID($seq_name, $ondemand = true)
-    {
-        $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
-        $seqcol_name = $this->quoteIdentifier($this->options['seqcol_name'], true);
-        $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
-        $this->pushErrorHandling(PEAR_ERROR_RETURN);
-        $this->expectError(MDB2_ERROR_NOSUCHTABLE);
-        $result =& $this->_doQuery($query, true);
-        $this->popExpect();
-        $this->popErrorHandling();
-        if (PEAR::isError($result)) {
-            if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
-                $this->loadModule('Manager', null, true);
-                $result = $this->manager->createSequence($seq_name);
-                if (PEAR::isError($result)) {
-                    return $this->raiseError($result, null, null,
-                        'on demand sequence '.$seq_name.' could not be created', __FUNCTION__);
-                } else {
-                    return $this->nextID($seq_name, false);
-                }
-            }
-            return $result;
-        }
-        $value = $this->lastInsertID();
-        if (is_numeric($value)) {
-            $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
-            $result =& $this->_doQuery($query, true);
-            if (PEAR::isError($result)) {
-                $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
-            }
-        }
-        return $value;
-    }
-
-    // }}}
-    // {{{ lastInsertID()
-
-    /**
-     * Returns the autoincrement ID if supported or $id or fetches the current
-     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
-     *
-     * @param string $table name of the table into which a new row was inserted
-     * @param string $field name of the field into which a new row was inserted
-     * @return mixed MDB2 Error Object or id
-     * @access public
-     */
-    function lastInsertID($table = null, $field = null)
-    {
-        // not using mysql_insert_id() due to http://pear.php.net/bugs/bug.php?id=8051
-        return $this->queryOne('SELECT LAST_INSERT_ID()', 'integer');
-    }
-
-    // }}}
-    // {{{ currID()
-
-    /**
-     * Returns the current id of a sequence
-     *
-     * @param string $seq_name name of the sequence
-     * @return mixed MDB2 Error Object or id
-     * @access public
-     */
-    function currID($seq_name)
-    {
-        $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
-        $seqcol_name = $this->quoteIdentifier($this->options['seqcol_name'], true);
-        $query = "SELECT MAX($seqcol_name) FROM $sequence_name";
-        return $this->queryOne($query, 'integer');
-    }
-}
-
-/**
- * MDB2 MySQLi result driver
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_mysqli extends MDB2_Result_Common
-{
-    // }}}
-    // {{{ fetchRow()
-
-    /**
-     * Fetch a row and insert the data into an existing array.
-     *
-     * @param int       $fetchmode  how the array data should be indexed
-     * @param int    $rownum    number of the row where the data can be found
-     * @return int data array on success, a MDB2 error on failure
-     * @access public
-     */
-    function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
-    {
-        if (!is_null($rownum)) {
-            $seek = $this->seek($rownum);
-            if (PEAR::isError($seek)) {
-                return $seek;
-            }
-        }
-        if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
-            $fetchmode = $this->db->fetchmode;
-        }
-        if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
-            $row = @mysqli_fetch_assoc($this->result);
-            if (is_array($row)
-                && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
-            ) {
-                $row = array_change_key_case($row, $this->db->options['field_case']);
-            }
-        } else {
-           $row = @mysqli_fetch_row($this->result);
-        }
-
-        if (!$row) {
-            if ($this->result === false) {
-                $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                    'resultset has already been freed', __FUNCTION__);
-                return $err;
-            }
-            $null = null;
-            return $null;
-        }
-        $mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
-        $rtrim = false;
-        if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
-            if (empty($this->types)) {
-                $mode += MDB2_PORTABILITY_RTRIM;
-            } else {
-                $rtrim = true;
-            }
-        }
-        if ($mode) {
-            $this->db->_fixResultArrayValues($row, $mode);
-        }
-        if (!empty($this->types)) {
-            $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
-        }
-        if (!empty($this->values)) {
-            $this->_assignBindColumns($row);
-        }
-        if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
-            $object_class = $this->db->options['fetch_class'];
-            if ($object_class == 'stdClass') {
-                $row = (object) $row;
-            } else {
-                $row = &new $object_class($row);
-            }
-        }
-        ++$this->rownum;
-        return $row;
-    }
-
-    // }}}
-    // {{{ _getColumnNames()
-
-    /**
-     * Retrieve the names of columns returned by the DBMS in a query result.
-     *
-     * @return  mixed   Array variable that holds the names of columns as keys
-     *                  or an MDB2 error on failure.
-     *                  Some DBMS may not return any columns when the result set
-     *                  does not contain any rows.
-     * @access private
-     */
-    function _getColumnNames()
-    {
-        $columns = array();
-        $numcols = $this->numCols();
-        if (PEAR::isError($numcols)) {
-            return $numcols;
-        }
-        for ($column = 0; $column < $numcols; $column++) {
-            $column_info = @mysqli_fetch_field_direct($this->result, $column);
-            $columns[$column_info->name] = $column;
-        }
-        if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
-            $columns = array_change_key_case($columns, $this->db->options['field_case']);
-        }
-        return $columns;
-    }
-
-    // }}}
-    // {{{ numCols()
-
-    /**
-     * Count the number of columns returned by the DBMS in a query result.
-     *
-     * @return mixed integer value with the number of columns, a MDB2 error
-     *                       on failure
-     * @access public
-     */
-    function numCols()
-    {
-        $cols = @mysqli_num_fields($this->result);
-        if (is_null($cols)) {
-            if ($this->result === false) {
-                return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                    'resultset has already been freed', __FUNCTION__);
-            } elseif (is_null($this->result)) {
-                return count($this->types);
-            }
-            return $this->db->raiseError(null, null, null,
-                'Could not get column count', __FUNCTION__);
-        }
-        return $cols;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal result pointer to the next available result
-     *
-     * @return true on success, false if there is no more result set or an error object on failure
-     * @access public
-     */
-    function nextResult()
-    {
-        $connection = $this->db->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        if (!@mysqli_more_results($connection)) {
-            return false;
-        }
-        if (!@mysqli_next_result($connection)) {
-            return false;
-        }
-        if (!($this->result = @mysqli_use_result($connection))) {
-            return false;
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ free()
-
-    /**
-     * Free the internal resources associated with result.
-     *
-     * @return boolean true on success, false if result is invalid
-     * @access public
-     */
-    function free()
-    {
-        if (is_object($this->result) && $this->db->connection) {
-            $free = @mysqli_free_result($this->result);
-            if ($free === false) {
-                return $this->db->raiseError(null, null, null,
-                    'Could not free result', __FUNCTION__);
-            }
-        }
-        $this->result = false;
-        return MDB2_OK;
-    }
-}
-
-/**
- * MDB2 MySQLi buffered result driver
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedResult_mysqli extends MDB2_Result_mysqli
-{
-    // }}}
-    // {{{ seek()
-
-    /**
-     * Seek to a specific row in a result set
-     *
-     * @param int    $rownum    number of the row where the data can be found
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function seek($rownum = 0)
-    {
-        if ($this->rownum != ($rownum - 1) && !@mysqli_data_seek($this->result, $rownum)) {
-            if ($this->result === false) {
-                return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                    'resultset has already been freed', __FUNCTION__);
-            } elseif (is_null($this->result)) {
-                return MDB2_OK;
-            }
-            return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
-                'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
-        }
-        $this->rownum = $rownum - 1;
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ valid()
-
-    /**
-     * Check if the end of the result set has been reached
-     *
-     * @return mixed true or false on sucess, a MDB2 error on failure
-     * @access public
-     */
-    function valid()
-    {
-        $numrows = $this->numRows();
-        if (PEAR::isError($numrows)) {
-            return $numrows;
-        }
-        return $this->rownum < ($numrows - 1);
-    }
-
-    // }}}
-    // {{{ numRows()
-
-    /**
-     * Returns the number of rows in a result object
-     *
-     * @return mixed MDB2 Error Object or the number of rows
-     * @access public
-     */
-    function numRows()
-    {
-        $rows = @mysqli_num_rows($this->result);
-        if (is_null($rows)) {
-            if ($this->result === false) {
-                return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                    'resultset has already been freed', __FUNCTION__);
-            } elseif (is_null($this->result)) {
-                return 0;
-            }
-            return $this->db->raiseError(null, null, null,
-                'Could not get row count', __FUNCTION__);
-        }
-        return $rows;
-    }
-
-    // }}}
-    // {{{ nextResult()
-
-    /**
-     * Move the internal result pointer to the next available result
-     *
-     * @param a valid result resource
-     * @return true on success, false if there is no more result set or an error object on failure
-     * @access public
-     */
-    function nextResult()
-    {
-        $connection = $this->db->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        if (!@mysqli_more_results($connection)) {
-            return false;
-        }
-        if (!@mysqli_next_result($connection)) {
-            return false;
-        }
-        if (!($this->result = @mysqli_store_result($connection))) {
-            return false;
-        }
-        return MDB2_OK;
-    }
-}
-
-/**
- * MDB2 MySQLi statement driver
- *
- * @package MDB2
- * @category Database
- * @author  Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_mysqli extends MDB2_Statement_Common
-{
-    // {{{ _execute()
-
-    /**
-     * Execute a prepared query statement helper method.
-     *
-     * @param mixed $result_class string which specifies which result class to use
-     * @param mixed $result_wrap_class string which specifies which class to wrap results in
-     *
-     * @return mixed MDB2_Result or integer (affected rows) on success,
-     *               a MDB2 error on failure
-     * @access private
-     */
-    function &_execute($result_class = true, $result_wrap_class = false)
-    {
-        if (is_null($this->statement)) {
-            $result =& parent::_execute($result_class, $result_wrap_class);
-            return $result;
-        }
-        $this->db->last_query = $this->query;
-        $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
-        if ($this->db->getOption('disable_query')) {
-            $result = $this->is_manip ? 0 : null;
-            return $result;
-        }
-
-        $connection = $this->db->getConnection();
-        if (PEAR::isError($connection)) {
-            return $connection;
-        }
-
-        if (!is_object($this->statement)) {
-            $query = 'EXECUTE '.$this->statement;
-        }
-        if (!empty($this->positions)) {
-            $parameters = array(0 => $this->statement, 1 => '');
-            $lobs = array();
-            $i = 0;
-            foreach ($this->positions as $parameter) {
-                if (!array_key_exists($parameter, $this->values)) {
-                    return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
-                        'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
-                }
-                $value = $this->values[$parameter];
-                $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
-                if (!is_object($this->statement)) {
-                    if (is_resource($value) || $type == 'clob' || $type == 'blob' && $this->db->options['lob_allow_url_include']) {
-                        if (!is_resource($value) && preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
-                            if ($match[1] == 'file://') {
-                                $value = $match[2];
-                            }
-                            $value = @fopen($value, 'r');
-                            $close = true;
-                        }
-                        if (is_resource($value)) {
-                            $data = '';
-                            while (!@feof($value)) {
-                                $data.= @fread($value, $this->db->options['lob_buffer_length']);
-                            }
-                            if ($close) {
-                                @fclose($value);
-                            }
-                            $value = $data;
-                        }
-                    }
-                    $quoted = $this->db->quote($value, $type);
-                    if (PEAR::isError($quoted)) {
-                        return $quoted;
-                    }
-                    $param_query = 'SET @'.$parameter.' = '.$quoted;
-                    $result = $this->db->_doQuery($param_query, true, $connection);
-                    if (PEAR::isError($result)) {
-                        return $result;
-                    }
-                } else {
-                    if (is_resource($value) || $type == 'clob' || $type == 'blob') {
-                        $parameters[] = null;
-                        $parameters[1].= 'b';
-                        $lobs[$i] = $parameter;
-                    } else {
-                        $quoted = $this->db->quote($value, $type, false);
-                        if (PEAR::isError($quoted)) {
-                            return $quoted;
-                        }
-                        $parameters[] = $quoted;
-                        $parameters[1].= $this->db->datatype->mapPrepareDatatype($type);
-                    }
-                    ++$i;
-                }
-            }
-
-            if (!is_object($this->statement)) {
-                $query.= ' USING @'.implode(', @', array_values($this->positions));
-            } else {
-                $result = @call_user_func_array('mysqli_stmt_bind_param', $parameters);
-                if ($result === false) {
-                    $err =& $this->db->raiseError(null, null, null,
-                        'Unable to bind parameters', __FUNCTION__);
-                    return $err;
-                }
-
-                foreach ($lobs as $i => $parameter) {
-                    $value = $this->values[$parameter];
-                    $close = false;
-                    if (!is_resource($value)) {
-                        $close = true;
-                        if (preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
-                            if ($match[1] == 'file://') {
-                                $value = $match[2];
-                            }
-                            $value = @fopen($value, 'r');
-                        } else {
-                            $fp = @tmpfile();
-                            @fwrite($fp, $value);
-                            @rewind($fp);
-                            $value = $fp;
-                        }
-                    }
-                    while (!@feof($value)) {
-                        $data = @fread($value, $this->db->options['lob_buffer_length']);
-                        @mysqli_stmt_send_long_data($this->statement, $i, $data);
-                    }
-                    if ($close) {
-                        @fclose($value);
-                    }
-                }
-            }
-        }
-
-        if (!is_object($this->statement)) {
-            $result = $this->db->_doQuery($query, $this->is_manip, $connection);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-
-            if ($this->is_manip) {
-                $affected_rows = $this->db->_affectedRows($connection, $result);
-                return $affected_rows;
-            }
-
-            $result =& $this->db->_wrapResult($result, $this->result_types,
-                $result_class, $result_wrap_class, $this->limit, $this->offset);
-        } else {
-            if (!@mysqli_stmt_execute($this->statement)) {
-                $err =& $this->db->raiseError(null, null, null,
-                    'Unable to execute statement', __FUNCTION__);
-                return $err;
-            }
-
-            if ($this->is_manip) {
-                $affected_rows = @mysqli_stmt_affected_rows($this->statement);
-                return $affected_rows;
-            }
-
-            if ($this->db->options['result_buffering']) {
-                @mysqli_stmt_store_result($this->statement);
-            }
-
-            $result =& $this->db->_wrapResult($this->statement, $this->result_types,
-                $result_class, $result_wrap_class, $this->limit, $this->offset);
-        }
-
-        $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
-        return $result;
-    }
-
-    // }}}
-    // {{{ free()
-
-    /**
-     * Release resources allocated for the specified prepared query.
-     *
-     * @return mixed MDB2_OK on success, a MDB2 error on failure
-     * @access public
-     */
-    function free()
-    {
-        if (is_null($this->positions)) {
-            return $this->db->raiseError(MDB2_ERROR, null, null,
-                'Prepared statement has already been freed', __FUNCTION__);
-        }
-        $result = MDB2_OK;
-
-        if (is_object($this->statement)) {
-            if (!@mysqli_stmt_close($this->statement)) {
-                $result = $this->db->raiseError(null, null, null,
-                    'Could not free statement', __FUNCTION__);
-            }
-        } elseif (!is_null($this->statement)) {
-            $connection = $this->db->getConnection();
-            if (PEAR::isError($connection)) {
-                return $connection;
-            }
-
-            $query = 'DEALLOCATE PREPARE '.$this->statement;
-            $result = $this->db->_doQuery($query, true, $connection);
-        }
-
-        parent::free();
-        return $result;
-   }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Extended.php b/lib/php/MDB2/Extended.php
deleted file mode 100644
index 864ab9235432bd0e839d6093269b627062d27f8d..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Extended.php
+++ /dev/null
@@ -1,721 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Extended.php,v 1.60 2007/11/28 19:49:34 quipo Exp $
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Used by autoPrepare()
- */
-define('MDB2_AUTOQUERY_INSERT', 1);
-define('MDB2_AUTOQUERY_UPDATE', 2);
-define('MDB2_AUTOQUERY_DELETE', 3);
-define('MDB2_AUTOQUERY_SELECT', 4);
-
-/**
- * MDB2_Extended: class which adds several high level methods to MDB2
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Extended extends MDB2_Module_Common
-{
-    // {{{ autoPrepare()
-
-    /**
-     * Generate an insert, update or delete query and call prepare() on it
-     *
-     * @param string table
-     * @param array the fields names
-     * @param int type of query to build
-     *                          MDB2_AUTOQUERY_INSERT
-     *                          MDB2_AUTOQUERY_UPDATE
-     *                          MDB2_AUTOQUERY_DELETE
-     *                          MDB2_AUTOQUERY_SELECT
-     * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
-     * @param array that contains the types of the placeholders
-     * @param mixed array that contains the types of the columns in
-     *                        the result set or MDB2_PREPARE_RESULT, if set to
-     *                        MDB2_PREPARE_MANIP the query is handled as a manipulation query
-     *
-     * @return resource handle for the query
-     * @see buildManipSQL
-     * @access public
-     */
-    function autoPrepare($table, $table_fields, $mode = MDB2_AUTOQUERY_INSERT,
-        $where = false, $types = null, $result_types = MDB2_PREPARE_MANIP)
-    {
-        $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
-        if (PEAR::isError($query)) {
-            return $query;
-        }
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-        $lobs = array();
-        foreach ((array)$types as $param => $type) {
-            if (($type == 'clob') || ($type == 'blob')) {
-                $lobs[$param] = $table_fields[$param];
-            }
-        }
-        return $db->prepare($query, $types, $result_types, $lobs);
-    }
-
-    // }}}
-    // {{{ autoExecute()
-
-    /**
-     * Generate an insert, update or delete query and call prepare() and execute() on it
-     *
-     * @param string name of the table
-     * @param array assoc ($key=>$value) where $key is a field name and $value its value
-     * @param int type of query to build
-     *                          MDB2_AUTOQUERY_INSERT
-     *                          MDB2_AUTOQUERY_UPDATE
-     *                          MDB2_AUTOQUERY_DELETE
-     *                          MDB2_AUTOQUERY_SELECT
-     * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
-     * @param array that contains the types of the placeholders
-     * @param string which specifies which result class to use
-     * @param mixed  array that contains the types of the columns in
-     *                        the result set or MDB2_PREPARE_RESULT, if set to
-     *                        MDB2_PREPARE_MANIP the query is handled as a manipulation query
-     *
-     * @return bool|MDB2_Error true on success, a MDB2 error on failure
-     * @see buildManipSQL
-     * @see autoPrepare
-     * @access public
-    */
-    function &autoExecute($table, $fields_values, $mode = MDB2_AUTOQUERY_INSERT,
-        $where = false, $types = null, $result_class = true, $result_types = MDB2_PREPARE_MANIP)
-    {
-        $fields_values = (array)$fields_values;
-        if ($mode == MDB2_AUTOQUERY_SELECT) {
-            if (is_array($result_types)) {
-                $keys = array_keys($result_types);
-            } elseif (!empty($fields_values)) {
-                $keys = $fields_values;
-            } else {
-                $keys = array();
-            }
-        } else {
-            $keys = array_keys($fields_values);
-        }
-        $params = array_values($fields_values);
-        if (empty($params)) {
-            $query = $this->buildManipSQL($table, $keys, $mode, $where);
-
-            $db =& $this->getDBInstance();
-            if (PEAR::isError($db)) {
-                return $db;
-            }
-            if ($mode == MDB2_AUTOQUERY_SELECT) {
-                $result =& $db->query($query, $result_types, $result_class);
-            } else {
-                $result = $db->exec($query);
-            }
-        } else {
-            $stmt = $this->autoPrepare($table, $keys, $mode, $where, $types, $result_types);
-            if (PEAR::isError($stmt)) {
-                return $stmt;
-            }
-            $result =& $stmt->execute($params, $result_class);
-            $stmt->free();
-        }
-        return $result;
-    }
-
-    // }}}
-    // {{{ buildManipSQL()
-
-    /**
-     * Make automaticaly an sql query for prepare()
-     *
-     * Example : buildManipSQL('table_sql', array('field1', 'field2', 'field3'), MDB2_AUTOQUERY_INSERT)
-     *           will return the string : INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
-     * NB : - This belongs more to a SQL Builder class, but this is a simple facility
-     *      - Be carefull ! If you don't give a $where param with an UPDATE/DELETE query, all
-     *        the records of the table will be updated/deleted !
-     *
-     * @param string name of the table
-     * @param ordered array containing the fields names
-     * @param int type of query to build
-     *                          MDB2_AUTOQUERY_INSERT
-     *                          MDB2_AUTOQUERY_UPDATE
-     *                          MDB2_AUTOQUERY_DELETE
-     *                          MDB2_AUTOQUERY_SELECT
-     * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
-     *
-     * @return string sql query for prepare()
-     * @access public
-     */
-    function buildManipSQL($table, $table_fields, $mode, $where = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if ($db->options['quote_identifier']) {
-            $table = $db->quoteIdentifier($table);
-        }
-
-        if (!empty($table_fields) && $db->options['quote_identifier']) {
-            foreach ($table_fields as $key => $field) {
-                $table_fields[$key] = $db->quoteIdentifier($field);
-            }
-        }
-
-        if ($where !== false && !is_null($where)) {
-            if (is_array($where)) {
-                $where = implode(' AND ', $where);
-            }
-            $where = ' WHERE '.$where;
-        }
-
-        switch ($mode) {
-        case MDB2_AUTOQUERY_INSERT:
-            if (empty($table_fields)) {
-                return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                'Insert requires table fields', __FUNCTION__);
-            }
-            $cols = implode(', ', $table_fields);
-            $values = '?'.str_repeat(', ?', (count($table_fields) - 1));
-            return 'INSERT INTO '.$table.' ('.$cols.') VALUES ('.$values.')';
-            break;
-        case MDB2_AUTOQUERY_UPDATE:
-            if (empty($table_fields)) {
-                return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
-                'Update requires table fields', __FUNCTION__);
-            }
-            $set = implode(' = ?, ', $table_fields).' = ?';
-            $sql = 'UPDATE '.$table.' SET '.$set.$where;
-            return $sql;
-            break;
-        case MDB2_AUTOQUERY_DELETE:
-            $sql = 'DELETE FROM '.$table.$where;
-            return $sql;
-            break;
-        case MDB2_AUTOQUERY_SELECT:
-            $cols = !empty($table_fields) ? implode(', ', $table_fields) : '*';
-            $sql = 'SELECT '.$cols.' FROM '.$table.$where;
-            return $sql;
-            break;
-        }
-        return $db->raiseError(MDB2_ERROR_SYNTAX, null, null,
-                'Non existant mode', __FUNCTION__);
-    }
-
-    // }}}
-    // {{{ limitQuery()
-
-    /**
-     * Generates a limited query
-     *
-     * @param string query
-     * @param array that contains the types of the columns in the result set
-     * @param integer the numbers of rows to fetch
-     * @param integer the row to start to fetching
-     * @param string which specifies which result class to use
-     * @param mixed   string which specifies which class to wrap results in
-     *
-     * @return MDB2_Result|MDB2_Error result set on success, a MDB2 error on failure
-     * @access public
-     */
-    function &limitQuery($query, $types, $limit, $offset = 0, $result_class = true,
-        $result_wrap_class = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        $result = $db->setLimit($limit, $offset);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        $result =& $db->query($query, $types, $result_class, $result_wrap_class);
-        return $result;
-    }
-
-    // }}}
-    // {{{ execParam()
-
-    /**
-     * Execute a parameterized DML statement.
-     *
-     * @param string the SQL query
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     *
-     * @return int|MDB2_Error affected rows on success, a MDB2 error on failure
-     * @access public
-     */
-    function execParam($query, $params = array(), $param_types = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        if (empty($params)) {
-            return $db->exec($query);
-        }
-
-        $stmt = $db->prepare($query, $param_types, MDB2_PREPARE_MANIP);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-
-        $stmt->free();
-        return $result;
-    }
-
-    // }}}
-    // {{{ getOne()
-
-    /**
-     * Fetch the first column of the first row of data returned from a query.
-     * Takes care of doing the query and freeing the results when finished.
-     *
-     * @param string the SQL query
-     * @param string that contains the type of the column in the result set
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     * @param int|string which column to return
-     *
-     * @return scalar|MDB2_Error data on success, a MDB2 error on failure
-     * @access public
-     */
-    function getOne($query, $type = null, $params = array(),
-        $param_types = null, $colnum = 0)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        settype($type, 'array');
-        if (empty($params)) {
-            return $db->queryOne($query, $type, $colnum);
-        }
-
-        $stmt = $db->prepare($query, $param_types, $type);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $one = $result->fetchOne($colnum);
-        $stmt->free();
-        $result->free();
-        return $one;
-    }
-
-    // }}}
-    // {{{ getRow()
-
-    /**
-     * Fetch the first row of data returned from a query.  Takes care
-     * of doing the query and freeing the results when finished.
-     *
-     * @param string the SQL query
-     * @param array that contains the types of the columns in the result set
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     * @param int the fetch mode to use
-     *
-     * @return array|MDB2_Error data on success, a MDB2 error on failure
-     * @access public
-     */
-    function getRow($query, $types = null, $params = array(),
-        $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        if (empty($params)) {
-            return $db->queryRow($query, $types, $fetchmode);
-        }
-
-        $stmt = $db->prepare($query, $param_types, $types);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $row = $result->fetchRow($fetchmode);
-        $stmt->free();
-        $result->free();
-        return $row;
-    }
-
-    // }}}
-    // {{{ getCol()
-
-    /**
-     * Fetch a single column from a result set and return it as an
-     * indexed array.
-     *
-     * @param string the SQL query
-     * @param string that contains the type of the column in the result set
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     * @param int|string which column to return
-     *
-     * @return array|MDB2_Error data on success, a MDB2 error on failure
-     * @access public
-     */
-    function getCol($query, $type = null, $params = array(),
-        $param_types = null, $colnum = 0)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        settype($type, 'array');
-        if (empty($params)) {
-            return $db->queryCol($query, $type, $colnum);
-        }
-
-        $stmt = $db->prepare($query, $param_types, $type);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $col = $result->fetchCol($colnum);
-        $stmt->free();
-        $result->free();
-        return $col;
-    }
-
-    // }}}
-    // {{{ getAll()
-
-    /**
-     * Fetch all the rows returned from a query.
-     *
-     * @param string the SQL query
-     * @param array that contains the types of the columns in the result set
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     * @param int the fetch mode to use
-     * @param bool if set to true, the $all will have the first
-     *       column as its first dimension
-     * @param bool $force_array used only when the query returns exactly
-     *       two columns. If true, the values of the returned array will be
-     *       one-element arrays instead of scalars.
-     * @param bool $group if true, the values of the returned array is
-     *       wrapped in another array.  If the same key value (in the first
-     *       column) repeats itself, the values will be appended to this array
-     *       instead of overwriting the existing values.
-     *
-     * @return array|MDB2_Error data on success, a MDB2 error on failure
-     * @access public
-     */
-    function getAll($query, $types = null, $params = array(),
-        $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT,
-        $rekey = false, $force_array = false, $group = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        if (empty($params)) {
-            return $db->queryAll($query, $types, $fetchmode, $rekey, $force_array, $group);
-        }
-
-        $stmt = $db->prepare($query, $param_types, $types);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $all = $result->fetchAll($fetchmode, $rekey, $force_array, $group);
-        $stmt->free();
-        $result->free();
-        return $all;
-    }
-
-    // }}}
-    // {{{ getAssoc()
-
-    /**
-     * Fetch the entire result set of a query and return it as an
-     * associative array using the first column as the key.
-     *
-     * If the result set contains more than two columns, the value
-     * will be an array of the values from column 2-n.  If the result
-     * set contains only two columns, the returned value will be a
-     * scalar with the value of the second column (unless forced to an
-     * array with the $force_array parameter).  A MDB2 error code is
-     * returned on errors.  If the result set contains fewer than two
-     * columns, a MDB2_ERROR_TRUNCATED error is returned.
-     *
-     * For example, if the table 'mytable' contains:
-     * <pre>
-     *   ID      TEXT       DATE
-     * --------------------------------
-     *   1       'one'      944679408
-     *   2       'two'      944679408
-     *   3       'three'    944679408
-     * </pre>
-     * Then the call getAssoc('SELECT id,text FROM mytable') returns:
-     * <pre>
-     *    array(
-     *      '1' => 'one',
-     *      '2' => 'two',
-     *      '3' => 'three',
-     *    )
-     * </pre>
-     * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
-     * <pre>
-     *    array(
-     *      '1' => array('one', '944679408'),
-     *      '2' => array('two', '944679408'),
-     *      '3' => array('three', '944679408')
-     *    )
-     * </pre>
-     *
-     * If the more than one row occurs with the same value in the
-     * first column, the last row overwrites all previous ones by
-     * default.  Use the $group parameter if you don't want to
-     * overwrite like this.  Example:
-     * <pre>
-     * getAssoc('SELECT category,id,name FROM mytable', null, null
-     *           MDB2_FETCHMODE_ASSOC, false, true) returns:
-     *    array(
-     *      '1' => array(array('id' => '4', 'name' => 'number four'),
-     *                   array('id' => '6', 'name' => 'number six')
-     *             ),
-     *      '9' => array(array('id' => '4', 'name' => 'number four'),
-     *                   array('id' => '6', 'name' => 'number six')
-     *             )
-     *    )
-     * </pre>
-     *
-     * Keep in mind that database functions in PHP usually return string
-     * values for results regardless of the database's internal type.
-     *
-     * @param string the SQL query
-     * @param array that contains the types of the columns in the result set
-     * @param array if supplied, prepare/execute will be used
-     *       with this array as execute parameters
-     * @param array that contains the types of the values defined in $params
-     * @param bool $force_array used only when the query returns
-     * exactly two columns.  If TRUE, the values of the returned array
-     * will be one-element arrays instead of scalars.
-     * @param bool $group if TRUE, the values of the returned array
-     *       is wrapped in another array.  If the same key value (in the first
-     *       column) repeats itself, the values will be appended to this array
-     *       instead of overwriting the existing values.
-     *
-     * @return array|MDB2_Error data on success, a MDB2 error on failure
-     * @access public
-     */
-    function getAssoc($query, $types = null, $params = array(), $param_types = null,
-        $fetchmode = MDB2_FETCHMODE_DEFAULT, $force_array = false, $group = false)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        settype($params, 'array');
-        if (empty($params)) {
-            return $db->queryAll($query, $types, $fetchmode, true, $force_array, $group);
-        }
-
-        $stmt = $db->prepare($query, $param_types, $types);
-        if (PEAR::isError($stmt)) {
-            return $stmt;
-        }
-
-        $result = $stmt->execute($params);
-        if (!MDB2::isResultCommon($result)) {
-            return $result;
-        }
-
-        $all = $result->fetchAll($fetchmode, true, $force_array, $group);
-        $stmt->free();
-        $result->free();
-        return $all;
-    }
-
-    // }}}
-    // {{{ executeMultiple()
-
-    /**
-     * This function does several execute() calls on the same statement handle.
-     * $params must be an array indexed numerically from 0, one execute call is
-     * done for every 'row' in the array.
-     *
-     * If an error occurs during execute(), executeMultiple() does not execute
-     * the unfinished rows, but rather returns that error.
-     *
-     * @param resource query handle from prepare()
-     * @param array numeric array containing the data to insert into the query
-     *
-     * @return bool|MDB2_Error true on success, a MDB2 error on failure
-     * @access public
-     * @see prepare(), execute()
-     */
-    function executeMultiple(&$stmt, $params = null)
-    {
-        for ($i = 0, $j = count($params); $i < $j; $i++) {
-            $result = $stmt->execute($params[$i]);
-            if (PEAR::isError($result)) {
-                return $result;
-            }
-        }
-        return MDB2_OK;
-    }
-
-    // }}}
-    // {{{ getBeforeID()
-
-    /**
-     * Returns the next free id of a sequence if the RDBMS
-     * does not support auto increment
-     *
-     * @param string name of the table into which a new row was inserted
-     * @param string name of the field into which a new row was inserted
-     * @param bool when true the sequence is automatic created, if it not exists
-     * @param bool if the returned value should be quoted
-     *
-     * @return int|MDB2_Error id on success, a MDB2 error on failure
-     * @access public
-     */
-    function getBeforeID($table, $field = null, $ondemand = true, $quote = true)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if ($db->supports('auto_increment') !== true) {
-            $seq = $table.(empty($field) ? '' : '_'.$field);
-            $id = $db->nextID($seq, $ondemand);
-            if (!$quote || PEAR::isError($id)) {
-                return $id;
-            }
-            return $db->quote($id, 'integer');
-        } elseif (!$quote) {
-            return null;
-        }
-        return 'NULL';
-    }
-
-    // }}}
-    // {{{ getAfterID()
-
-    /**
-     * Returns the autoincrement ID if supported or $id
-     *
-     * @param mixed value as returned by getBeforeId()
-     * @param string name of the table into which a new row was inserted
-     * @param string name of the field into which a new row was inserted
-     *
-     * @return int|MDB2_Error id on success, a MDB2 error on failure
-     * @access public
-     */
-    function getAfterID($id, $table, $field = null)
-    {
-        $db =& $this->getDBInstance();
-        if (PEAR::isError($db)) {
-            return $db;
-        }
-
-        if ($db->supports('auto_increment') !== true) {
-            return $id;
-        }
-        return $db->lastInsertID($table, $field);
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/Iterator.php b/lib/php/MDB2/Iterator.php
deleted file mode 100644
index ca5e7b69c27df7091c4b01483ada57d2435f2440..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/Iterator.php
+++ /dev/null
@@ -1,259 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP version 5                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: Iterator.php,v 1.22 2006/05/06 14:03:41 lsmith Exp $
-
-/**
- * PHP5 Iterator
- *
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Iterator implements Iterator
-{
-    protected $fetchmode;
-    protected $result;
-    protected $row;
-
-    // {{{ constructor
-
-    /**
-     * Constructor
-     */
-    public function __construct($result, $fetchmode = MDB2_FETCHMODE_DEFAULT)
-    {
-        $this->result = $result;
-        $this->fetchmode = $fetchmode;
-    }
-    // }}}
-
-    // {{{ seek()
-
-    /**
-     * Seek forward to a specific row in a result set
-     *
-     * @param int number of the row where the data can be found
-     *
-     * @return void
-     * @access public
-     */
-    public function seek($rownum)
-    {
-        $this->row = null;
-        if ($this->result) {
-            $this->result->seek($rownum);
-        }
-    }
-    // }}}
-
-    // {{{ next()
-
-    /**
-     * Fetch next row of data
-     *
-     * @return void
-     * @access public
-     */
-    public function next()
-    {
-        $this->row = null;
-    }
-    // }}}
-
-    // {{{ current()
-
-    /**
-     * return a row of data
-     *
-     * @return void
-     * @access public
-     */
-    public function current()
-    {
-        if (is_null($this->row)) {
-            $row = $this->result->fetchRow($this->fetchmode);
-            if (PEAR::isError($row)) {
-                $row = false;
-            }
-            $this->row = $row;
-        }
-        return $this->row;
-    }
-    // }}}
-
-    // {{{ valid()
-
-    /**
-     * Check if the end of the result set has been reached
-     *
-     * @return bool true/false, false is also returned on failure
-     * @access public
-     */
-    public function valid()
-    {
-        return (bool)$this->current();
-    }
-    // }}}
-
-    // {{{ free()
-
-    /**
-     * Free the internal resources associated with result.
-     *
-     * @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
-     * @access public
-     */
-    public function free()
-    {
-        if ($this->result) {
-            return $this->result->free();
-        }
-        $this->result = false;
-        $this->row = null;
-        return false;
-    }
-    // }}}
-
-    // {{{ key()
-
-    /**
-     * Returns the row number
-     *
-     * @return int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
-     * @access public
-     */
-    public function key()
-    {
-        if ($this->result) {
-            return $this->result->rowCount();
-        }
-        return false;
-    }
-    // }}}
-
-    // {{{ rewind()
-
-    /**
-     * Seek to the first row in a result set
-     *
-     * @return void
-     * @access public
-     */
-    public function rewind()
-    {
-    }
-    // }}}
-
-    // {{{ destructor
-
-    /**
-     * Destructor
-     */
-    public function __destruct()
-    {
-        $this->free();
-    }
-    // }}}
-}
-
-/**
- * PHP5 buffered Iterator
- *
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedIterator extends MDB2_Iterator implements SeekableIterator
-{
-    // {{{ valid()
-
-    /**
-     * Check if the end of the result set has been reached
-     *
-     * @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
-     * @access public
-     */
-    public function valid()
-    {
-        if ($this->result) {
-            return $this->result->valid();
-        }
-        return false;
-    }
-    // }}}
-
-    // {{{count()
-
-    /**
-     * Returns the number of rows in a result object
-     *
-     * @return int|MDB2_Error number of rows, false|MDB2_Error if result is invalid
-     * @access public
-     */
-    public function count()
-    {
-        if ($this->result) {
-            return $this->result->numRows();
-        }
-        return false;
-    }
-    // }}}
-
-    // {{{ rewind()
-
-    /**
-     * Seek to the first row in a result set
-     *
-     * @return void
-     * @access public
-     */
-    public function rewind()
-    {
-        $this->seek(0);
-    }
-    // }}}
-}
-
-?>
\ No newline at end of file
diff --git a/lib/php/MDB2/LOB.php b/lib/php/MDB2/LOB.php
deleted file mode 100644
index 69db267d69e63cc503f753a03f1a1ab5d739949c..0000000000000000000000000000000000000000
--- a/lib/php/MDB2/LOB.php
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP version 5                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox,                 |
-// | Stig. S. Bakken, Lukas Smith                                         |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: LOB.php,v 1.34 2006/10/25 11:52:21 lsmith Exp $
-
-/**
- * @package  MDB2
- * @category Database
- * @author   Lukas Smith <smith@pooteeweet.org>
- */
-
-require_once 'MDB2.php';
-
-/**
- * MDB2_LOB: user land stream wrapper implementation for LOB support
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_LOB
-{
-    /**
-     * contains the key to the global MDB2 instance array of the associated
-     * MDB2 instance
-     *
-     * @var integer
-     * @access protected
-     */
-    var $db_index;
-
-    /**
-     * contains the key to the global MDB2_LOB instance array of the associated
-     * MDB2_LOB instance
-     *
-     * @var integer
-     * @access protected
-     */
-    var $lob_index;
-
-    // {{{ stream_open()
-
-    /**
-     * open stream
-     *
-     * @param string specifies the URL that was passed to fopen()
-     * @param string the mode used to open the file
-     * @param int holds additional flags set by the streams API
-     * @param string not used
-     *
-     * @return bool
-     * @access public
-     */
-    function stream_open($path, $mode, $options, &$opened_path)
-    {
-        if (!preg_match('/^rb?\+?$/', $mode)) {
-            return false;
-        }
-        $url = parse_url($path);
-        if (empty($url['host'])) {
-            return false;
-        }
-        $this->db_index = (int)$url['host'];
-        if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            return false;
-        }
-        $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-        $this->lob_index = (int)$url['user'];
-        if (!isset($db->datatype->lobs[$this->lob_index])) {
-            return false;
-        }
-        return true;
-    }
-    // }}}
-
-    // {{{ stream_read()
-
-    /**
-     * read stream
-     *
-     * @param int number of bytes to read
-     *
-     * @return string
-     * @access public
-     */
-    function stream_read($count)
-    {
-        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-            $db->datatype->_retrieveLOB($db->datatype->lobs[$this->lob_index]);
-
-            $data = $db->datatype->_readLOB($db->datatype->lobs[$this->lob_index], $count);
-            $length = strlen($data);
-            if ($length == 0) {
-                $db->datatype->lobs[$this->lob_index]['endOfLOB'] = true;
-            }
-            $db->datatype->lobs[$this->lob_index]['position'] += $length;
-            return $data;
-        }
-    }
-    // }}}
-
-    // {{{ stream_write()
-
-    /**
-     * write stream, note implemented
-     *
-     * @param string data
-     *
-     * @return int
-     * @access public
-     */
-    function stream_write($data)
-    {
-        return 0;
-    }
-    // }}}
-
-    // {{{ stream_tell()
-
-    /**
-     * return the current position
-     *
-     * @return int current position
-     * @access public
-     */
-    function stream_tell()
-    {
-        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-            return $db->datatype->lobs[$this->lob_index]['position'];
-        }
-    }
-    // }}}
-
-    // {{{ stream_eof()
-
-    /**
-     * Check if stream reaches EOF
-     *
-     * @return bool
-     * @access public
-     */
-    function stream_eof()
-    {
-        if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            return true;
-        }
-
-        $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-        $result = $db->datatype->_endOfLOB($db->datatype->lobs[$this->lob_index]);
-        if (version_compare(phpversion(), "5.0", ">=")
-            && version_compare(phpversion(), "5.1", "<")
-        ) {
-            return !$result;
-        }
-        return $result;
-    }
-    // }}}
-
-    // {{{ stream_seek()
-
-    /**
-     * Seek stream, not implemented
-     *
-     * @param int offset
-     * @param int whence
-     *
-     * @return bool
-     * @access public
-     */
-    function stream_seek($offset, $whence)
-    {
-        return false;
-    }
-    // }}}
-
-    // {{{ stream_stat()
-
-    /**
-     * return information about stream
-     *
-     * @access public
-     */
-    function stream_stat()
-    {
-        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-            return array(
-              'db_index' => $this->db_index,
-              'lob_index' => $this->lob_index,
-            );
-        }
-    }
-    // }}}
-
-    // {{{ stream_close()
-
-    /**
-     * close stream
-     *
-     * @access public
-     */
-    function stream_close()
-    {
-        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
-            $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
-            if (isset($db->datatype->lobs[$this->lob_index])) {
-                $db->datatype->_destroyLOB($db->datatype->lobs[$this->lob_index]);
-                unset($db->datatype->lobs[$this->lob_index]);
-            }
-        }
-    }
-    // }}}
-}
-
-// register streams wrapper
-if (!stream_wrapper_register("MDB2LOB", "MDB2_LOB")) {
-    MDB2::raiseError();
-    return false;
-}
-
-?>
diff --git a/lib/php/OS/Guess.php b/lib/php/OS/Guess.php
deleted file mode 100644
index 98948e3f1d449ca1aa02e116e8800541c91fd7c1..0000000000000000000000000000000000000000
--- a/lib/php/OS/Guess.php
+++ /dev/null
@@ -1,338 +0,0 @@
-<?php
-/**
- * The OS_Guess class
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Gregory Beaver <cellog@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Guess.php 278521 2009-04-09 22:24:12Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since PEAR 0.1
- */
-
-// {{{ uname examples
-
-// php_uname() without args returns the same as 'uname -a', or a PHP-custom
-// string for Windows.
-// PHP versions prior to 4.3 return the uname of the host where PHP was built,
-// as of 4.3 it returns the uname of the host running the PHP code.
-//
-// PC RedHat Linux 7.1:
-// Linux host.example.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
-//
-// PC Debian Potato:
-// Linux host 2.4.17 #2 SMP Tue Feb 12 15:10:04 CET 2002 i686 unknown
-//
-// PC FreeBSD 3.3:
-// FreeBSD host.example.com 3.3-STABLE FreeBSD 3.3-STABLE #0: Mon Feb 21 00:42:31 CET 2000     root@example.com:/usr/src/sys/compile/CONFIG  i386
-//
-// PC FreeBSD 4.3:
-// FreeBSD host.example.com 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Mon Jun 25 11:19:43 EDT 2001     root@example.com:/usr/src/sys/compile/CONFIG  i386
-//
-// PC FreeBSD 4.5:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb  6 23:59:23 CET 2002     root@example.com:/usr/src/sys/compile/CONFIG  i386
-//
-// PC FreeBSD 4.5 w/uname from GNU shellutils:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb  i386 unknown
-//
-// HP 9000/712 HP-UX 10:
-// HP-UX iq B.10.10 A 9000/712 2008429113 two-user license
-//
-// HP 9000/712 HP-UX 10 w/uname from GNU shellutils:
-// HP-UX host B.10.10 A 9000/712 unknown
-//
-// IBM RS6000/550 AIX 4.3:
-// AIX host 3 4 000003531C00
-//
-// AIX 4.3 w/uname from GNU shellutils:
-// AIX host 3 4 000003531C00 unknown
-//
-// SGI Onyx IRIX 6.5 w/uname from GNU shellutils:
-// IRIX64 host 6.5 01091820 IP19 mips
-//
-// SGI Onyx IRIX 6.5:
-// IRIX64 host 6.5 01091820 IP19
-//
-// SparcStation 20 Solaris 8 w/uname from GNU shellutils:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc
-//
-// SparcStation 20 Solaris 8:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20
-//
-// Mac OS X (Darwin)
-// Darwin home-eden.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug  5 19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC  Power Macintosh
-//
-// Mac OS X early versions
-//
-
-// }}}
-
-/* TODO:
- * - define endianness, to allow matchSignature("bigend") etc.
- */
-
-/**
- * Retrieves information about the current operating system
- *
- * This class uses php_uname() to grok information about the current OS
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Gregory Beaver <cellog@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class OS_Guess
-{
-    var $sysname;
-    var $nodename;
-    var $cpu;
-    var $release;
-    var $extra;
-
-    function OS_Guess($uname = null)
-    {
-        list($this->sysname,
-             $this->release,
-             $this->cpu,
-             $this->extra,
-             $this->nodename) = $this->parseSignature($uname);
-    }
-
-    function parseSignature($uname = null)
-    {
-        static $sysmap = array(
-            'HP-UX' => 'hpux',
-            'IRIX64' => 'irix',
-        );
-        static $cpumap = array(
-            'i586' => 'i386',
-            'i686' => 'i386',
-            'ppc' => 'powerpc',
-        );
-        if ($uname === null) {
-            $uname = php_uname();
-        }
-        $parts = preg_split('/\s+/', trim($uname));
-        $n = count($parts);
-
-        $release  = $machine = $cpu = '';
-        $sysname  = $parts[0];
-        $nodename = $parts[1];
-        $cpu      = $parts[$n-1];
-        $extra = '';
-        if ($cpu == 'unknown') {
-            $cpu = $parts[$n - 2];
-        }
-
-        switch ($sysname) {
-            case 'AIX' :
-                $release = "$parts[3].$parts[2]";
-                break;
-            case 'Windows' :
-                switch ($parts[1]) {
-                    case '95/98':
-                        $release = '9x';
-                        break;
-                    default:
-                        $release = $parts[1];
-                        break;
-                }
-                $cpu = 'i386';
-                break;
-            case 'Linux' :
-                $extra = $this->_detectGlibcVersion();
-                // use only the first two digits from the kernel version
-                $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]);
-                break;
-            case 'Mac' :
-                $sysname = 'darwin';
-                $nodename = $parts[2];
-                $release = $parts[3];
-                if ($cpu == 'Macintosh') {
-                    if ($parts[$n - 2] == 'Power') {
-                        $cpu = 'powerpc';
-                    }
-                }
-                break;
-            case 'Darwin' :
-                if ($cpu == 'Macintosh') {
-                    if ($parts[$n - 2] == 'Power') {
-                        $cpu = 'powerpc';
-                    }
-                }
-                $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]);
-                break;
-            default:
-                $release = preg_replace('/-.*/', '', $parts[2]);
-                break;
-        }
-
-        if (isset($sysmap[$sysname])) {
-            $sysname = $sysmap[$sysname];
-        } else {
-            $sysname = strtolower($sysname);
-        }
-        if (isset($cpumap[$cpu])) {
-            $cpu = $cpumap[$cpu];
-        }
-        return array($sysname, $release, $cpu, $extra, $nodename);
-    }
-
-    function _detectGlibcVersion()
-    {
-        static $glibc = false;
-        if ($glibc !== false) {
-            return $glibc; // no need to run this multiple times
-        }
-        $major = $minor = 0;
-        include_once "System.php";
-        // Use glibc's <features.h> header file to
-        // get major and minor version number:
-        if (@file_exists('/usr/include/features.h') &&
-              @is_readable('/usr/include/features.h')) {
-            if (!@file_exists('/usr/bin/cpp') || !@is_executable('/usr/bin/cpp')) {
-                $features_file = fopen('/usr/include/features.h', 'rb');
-                while (!feof($features_file)) {
-                    $line = fgets($features_file, 8192);
-                    if (!$line || (strpos($line, '#define') === false)) {
-                        continue;
-                    }
-                    if (strpos($line, '__GLIBC__')) {
-                        // major version number #define __GLIBC__ version
-                        $line = preg_split('/\s+/', $line);
-                        $glibc_major = trim($line[2]);
-                        if (isset($glibc_minor)) {
-                            break;
-                        }
-                        continue;
-                    }
-
-                    if (strpos($line, '__GLIBC_MINOR__'))  {
-                        // got the minor version number
-                        // #define __GLIBC_MINOR__ version
-                        $line = preg_split('/\s+/', $line);
-                        $glibc_minor = trim($line[2]);
-                        if (isset($glibc_major)) {
-                            break;
-                        }
-                        continue;
-                    }
-                }
-                fclose($features_file);
-                if (!isset($glibc_major) || !isset($glibc_minor)) {
-                    return $glibc = '';
-                }
-                return $glibc = 'glibc' . trim($glibc_major) . "." . trim($glibc_minor) ;
-            } // no cpp
-
-            $tmpfile = System::mktemp("glibctest");
-            $fp = fopen($tmpfile, "w");
-            fwrite($fp, "#include <features.h>\n__GLIBC__ __GLIBC_MINOR__\n");
-            fclose($fp);
-            $cpp = popen("/usr/bin/cpp $tmpfile", "r");
-            while ($line = fgets($cpp, 1024)) {
-                if ($line{0} == '#' || trim($line) == '') {
-                    continue;
-                }
-
-                if (list($major, $minor) = explode(' ', trim($line))) {
-                    break;
-                }
-            }
-            pclose($cpp);
-            unlink($tmpfile);
-        } // features.h
-
-        if (!($major && $minor) && @is_link('/lib/libc.so.6')) {
-            // Let's try reading the libc.so.6 symlink
-            if (preg_match('/^libc-(.*)\.so$/', basename(readlink('/lib/libc.so.6')), $matches)) {
-                list($major, $minor) = explode('.', $matches[1]);
-            }
-        }
-
-        if (!($major && $minor)) {
-            return $glibc = '';
-        }
-
-        return $glibc = "glibc{$major}.{$minor}";
-    }
-
-    function getSignature()
-    {
-        if (empty($this->extra)) {
-            return "{$this->sysname}-{$this->release}-{$this->cpu}";
-        }
-        return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}";
-    }
-
-    function getSysname()
-    {
-        return $this->sysname;
-    }
-
-    function getNodename()
-    {
-        return $this->nodename;
-    }
-
-    function getCpu()
-    {
-        return $this->cpu;
-    }
-
-    function getRelease()
-    {
-        return $this->release;
-    }
-
-    function getExtra()
-    {
-        return $this->extra;
-    }
-
-    function matchSignature($match)
-    {
-        $fragments = is_array($match) ? $match : explode('-', $match);
-        $n = count($fragments);
-        $matches = 0;
-        if ($n > 0) {
-            $matches += $this->_matchFragment($fragments[0], $this->sysname);
-        }
-        if ($n > 1) {
-            $matches += $this->_matchFragment($fragments[1], $this->release);
-        }
-        if ($n > 2) {
-            $matches += $this->_matchFragment($fragments[2], $this->cpu);
-        }
-        if ($n > 3) {
-            $matches += $this->_matchFragment($fragments[3], $this->extra);
-        }
-        return ($matches == $n);
-    }
-
-    function _matchFragment($fragment, $value)
-    {
-        if (strcspn($fragment, '*?') < strlen($fragment)) {
-            $reg = '/^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '\\z/';
-            return preg_match($reg, $value);
-        }
-        return ($fragment == '*' || !strcasecmp($fragment, $value));
-    }
-
-}
-/*
- * Local Variables:
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * End:
- */
\ No newline at end of file
diff --git a/lib/php/PEAR.php b/lib/php/PEAR.php
deleted file mode 100644
index d48ee828256ed9a1f37321df7d45b70809b5693b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR.php
+++ /dev/null
@@ -1,1137 +0,0 @@
-<?php
-/**
- * PEAR, the PHP Extension and Application Repository
- *
- * PEAR class and PEAR_Error class
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Sterling Hughes <sterling@php.net>
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @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: PEAR.php 286670 2009-08-02 14:16:06Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**#@+
- * ERROR constants
- */
-define('PEAR_ERROR_RETURN',     1);
-define('PEAR_ERROR_PRINT',      2);
-define('PEAR_ERROR_TRIGGER',    4);
-define('PEAR_ERROR_DIE',        8);
-define('PEAR_ERROR_CALLBACK',  16);
-/**
- * WARNING: obsolete
- * @deprecated
- */
-define('PEAR_ERROR_EXCEPTION', 32);
-/**#@-*/
-define('PEAR_ZE2', (function_exists('version_compare') &&
-                    version_compare(zend_version(), "2-dev", "ge")));
-
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    define('OS_WINDOWS', true);
-    define('OS_UNIX',    false);
-    define('PEAR_OS',    'Windows');
-} else {
-    define('OS_WINDOWS', false);
-    define('OS_UNIX',    true);
-    define('PEAR_OS',    'Unix'); // blatant assumption
-}
-
-$GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options']  = E_USER_NOTICE;
-$GLOBALS['_PEAR_destructor_object_list'] = array();
-$GLOBALS['_PEAR_shutdown_funcs']         = array();
-$GLOBALS['_PEAR_error_handler_stack']    = array();
-
-@ini_set('track_errors', true);
-
-/**
- * Base class for other PEAR classes.  Provides rudimentary
- * emulation of destructors.
- *
- * If you want a destructor in your class, inherit PEAR and make a
- * destructor method called _yourclassname (same name as the
- * constructor, but with a "_" prefix).  Also, in your constructor you
- * have to call the PEAR constructor: $this->PEAR();.
- * The destructor method will be called without parameters.  Note that
- * at in some SAPI implementations (such as Apache), any output during
- * the request shutdown (in which destructors are called) seems to be
- * discarded.  If you need to get any debug information from your
- * destructor, use error_log(), syslog() or something similar.
- *
- * IMPORTANT! To use the emulated destructors you need to create the
- * objects by reference: $obj =& new PEAR_child;
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @see        PEAR_Error
- * @since      Class available since PHP 4.0.2
- * @link        http://pear.php.net/manual/en/core.pear.php#core.pear.pear
- */
-class PEAR
-{
-    // {{{ properties
-
-    /**
-     * Whether to enable internal debug messages.
-     *
-     * @var     bool
-     * @access  private
-     */
-    var $_debug = false;
-
-    /**
-     * Default error mode for this object.
-     *
-     * @var     int
-     * @access  private
-     */
-    var $_default_error_mode = null;
-
-    /**
-     * Default error options used for this object when error mode
-     * is PEAR_ERROR_TRIGGER.
-     *
-     * @var     int
-     * @access  private
-     */
-    var $_default_error_options = null;
-
-    /**
-     * Default error handler (callback) for this object, if error mode is
-     * PEAR_ERROR_CALLBACK.
-     *
-     * @var     string
-     * @access  private
-     */
-    var $_default_error_handler = '';
-
-    /**
-     * Which class to use for error objects.
-     *
-     * @var     string
-     * @access  private
-     */
-    var $_error_class = 'PEAR_Error';
-
-    /**
-     * An array of expected errors.
-     *
-     * @var     array
-     * @access  private
-     */
-    var $_expected_errors = array();
-
-    // }}}
-
-    // {{{ constructor
-
-    /**
-     * Constructor.  Registers this object in
-     * $_PEAR_destructor_object_list for destructor emulation if a
-     * destructor object exists.
-     *
-     * @param string $error_class  (optional) which class to use for
-     *        error objects, defaults to PEAR_Error.
-     * @access public
-     * @return void
-     */
-    function PEAR($error_class = null)
-    {
-        $classname = strtolower(get_class($this));
-        if ($this->_debug) {
-            print "PEAR constructor called, class=$classname\n";
-        }
-        if ($error_class !== null) {
-            $this->_error_class = $error_class;
-        }
-        while ($classname && strcasecmp($classname, "pear")) {
-            $destructor = "_$classname";
-            if (method_exists($this, $destructor)) {
-                global $_PEAR_destructor_object_list;
-                $_PEAR_destructor_object_list[] = &$this;
-                if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
-                    register_shutdown_function("_PEAR_call_destructors");
-                    $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
-                }
-                break;
-            } else {
-                $classname = get_parent_class($classname);
-            }
-        }
-    }
-
-    // }}}
-    // {{{ destructor
-
-    /**
-     * Destructor (the emulated type of...).  Does nothing right now,
-     * but is included for forward compatibility, so subclass
-     * destructors should always call it.
-     *
-     * See the note in the class desciption about output from
-     * destructors.
-     *
-     * @access public
-     * @return void
-     */
-    function _PEAR() {
-        if ($this->_debug) {
-            printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
-        }
-    }
-
-    // }}}
-    // {{{ getStaticProperty()
-
-    /**
-    * If you have a class that's mostly/entirely static, and you need static
-    * properties, you can use this method to simulate them. Eg. in your method(s)
-    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
-    * You MUST use a reference, or they will not persist!
-    *
-    * @access public
-    * @param  string $class  The calling classname, to prevent clashes
-    * @param  string $var    The variable to retrieve.
-    * @return mixed   A reference to the variable. If not set it will be
-    *                 auto initialised to NULL.
-    */
-    function &getStaticProperty($class, $var)
-    {
-        static $properties;
-        if (!isset($properties[$class])) {
-            $properties[$class] = array();
-        }
-
-        if (!array_key_exists($var, $properties[$class])) {
-            $properties[$class][$var] = null;
-        }
-
-        return $properties[$class][$var];
-    }
-
-    // }}}
-    // {{{ registerShutdownFunc()
-
-    /**
-    * Use this function to register a shutdown method for static
-    * classes.
-    *
-    * @access public
-    * @param  mixed $func  The function name (or array of class/method) to call
-    * @param  mixed $args  The arguments to pass to the function
-    * @return void
-    */
-    function registerShutdownFunc($func, $args = array())
-    {
-        // if we are called statically, there is a potential
-        // that no shutdown func is registered.  Bug #6445
-        if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
-            register_shutdown_function("_PEAR_call_destructors");
-            $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
-        }
-        $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
-    }
-
-    // }}}
-    // {{{ isError()
-
-    /**
-     * Tell whether a value is a PEAR error.
-     *
-     * @param   mixed $data   the value to test
-     * @param   int   $code   if $data is an error object, return true
-     *                        only if $code is a string and
-     *                        $obj->getMessage() == $code or
-     *                        $code is an integer and $obj->getCode() == $code
-     * @access  public
-     * @return  bool    true if parameter is an error
-     */
-    function isError($data, $code = null)
-    {
-        if (!is_a($data, 'PEAR_Error')) {
-            return false;
-        }
-
-        if (is_null($code)) {
-            return true;
-        } elseif (is_string($code)) {
-            return $data->getMessage() == $code;
-        }
-
-        return $data->getCode() == $code;
-    }
-
-    // }}}
-    // {{{ setErrorHandling()
-
-    /**
-     * Sets how errors generated by this object should be handled.
-     * Can be invoked both in objects and statically.  If called
-     * statically, setErrorHandling sets the default behaviour for all
-     * PEAR objects.  If called in an object, setErrorHandling sets
-     * the default behaviour for that object.
-     *
-     * @param int $mode
-     *        One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
-     *        PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
-     *        PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
-     *
-     * @param mixed $options
-     *        When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
-     *        of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
-     *
-     *        When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
-     *        to be the callback function or method.  A callback
-     *        function is a string with the name of the function, a
-     *        callback method is an array of two elements: the element
-     *        at index 0 is the object, and the element at index 1 is
-     *        the name of the method to call in the object.
-     *
-     *        When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
-     *        a printf format string used when printing the error
-     *        message.
-     *
-     * @access public
-     * @return void
-     * @see PEAR_ERROR_RETURN
-     * @see PEAR_ERROR_PRINT
-     * @see PEAR_ERROR_TRIGGER
-     * @see PEAR_ERROR_DIE
-     * @see PEAR_ERROR_CALLBACK
-     * @see PEAR_ERROR_EXCEPTION
-     *
-     * @since PHP 4.0.5
-     */
-
-    function setErrorHandling($mode = null, $options = null)
-    {
-        if (isset($this) && is_a($this, 'PEAR')) {
-            $setmode     = &$this->_default_error_mode;
-            $setoptions  = &$this->_default_error_options;
-        } else {
-            $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
-            $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
-        }
-
-        switch ($mode) {
-            case PEAR_ERROR_EXCEPTION:
-            case PEAR_ERROR_RETURN:
-            case PEAR_ERROR_PRINT:
-            case PEAR_ERROR_TRIGGER:
-            case PEAR_ERROR_DIE:
-            case null:
-                $setmode = $mode;
-                $setoptions = $options;
-                break;
-
-            case PEAR_ERROR_CALLBACK:
-                $setmode = $mode;
-                // class/object method callback
-                if (is_callable($options)) {
-                    $setoptions = $options;
-                } else {
-                    trigger_error("invalid error callback", E_USER_WARNING);
-                }
-                break;
-
-            default:
-                trigger_error("invalid error mode", E_USER_WARNING);
-                break;
-        }
-    }
-
-    // }}}
-    // {{{ expectError()
-
-    /**
-     * This method is used to tell which errors you expect to get.
-     * Expected errors are always returned with error mode
-     * PEAR_ERROR_RETURN.  Expected error codes are stored in a stack,
-     * and this method pushes a new element onto it.  The list of
-     * expected errors are in effect until they are popped off the
-     * stack with the popExpect() method.
-     *
-     * Note that this method can not be called statically
-     *
-     * @param mixed $code a single error code or an array of error codes to expect
-     *
-     * @return int     the new depth of the "expected errors" stack
-     * @access public
-     */
-    function expectError($code = '*')
-    {
-        if (is_array($code)) {
-            array_push($this->_expected_errors, $code);
-        } else {
-            array_push($this->_expected_errors, array($code));
-        }
-        return sizeof($this->_expected_errors);
-    }
-
-    // }}}
-    // {{{ popExpect()
-
-    /**
-     * This method pops one element off the expected error codes
-     * stack.
-     *
-     * @return array   the list of error codes that were popped
-     */
-    function popExpect()
-    {
-        return array_pop($this->_expected_errors);
-    }
-
-    // }}}
-    // {{{ _checkDelExpect()
-
-    /**
-     * This method checks unsets an error code if available
-     *
-     * @param mixed error code
-     * @return bool true if the error code was unset, false otherwise
-     * @access private
-     * @since PHP 4.3.0
-     */
-    function _checkDelExpect($error_code)
-    {
-        $deleted = false;
-
-        foreach ($this->_expected_errors AS $key => $error_array) {
-            if (in_array($error_code, $error_array)) {
-                unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
-                $deleted = true;
-            }
-
-            // clean up empty arrays
-            if (0 == count($this->_expected_errors[$key])) {
-                unset($this->_expected_errors[$key]);
-            }
-        }
-        return $deleted;
-    }
-
-    // }}}
-    // {{{ delExpect()
-
-    /**
-     * This method deletes all occurences of the specified element from
-     * the expected error codes stack.
-     *
-     * @param  mixed $error_code error code that should be deleted
-     * @return mixed list of error codes that were deleted or error
-     * @access public
-     * @since PHP 4.3.0
-     */
-    function delExpect($error_code)
-    {
-        $deleted = false;
-        if ((is_array($error_code) && (0 != count($error_code)))) {
-            // $error_code is a non-empty array here;
-            // we walk through it trying to unset all
-            // values
-            foreach($error_code as $key => $error) {
-                if ($this->_checkDelExpect($error)) {
-                    $deleted =  true;
-                } else {
-                    $deleted = false;
-                }
-            }
-            return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
-        } elseif (!empty($error_code)) {
-            // $error_code comes alone, trying to unset it
-            if ($this->_checkDelExpect($error_code)) {
-                return true;
-            } else {
-                return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
-            }
-        }
-
-        // $error_code is empty
-        return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
-    }
-
-    // }}}
-    // {{{ raiseError()
-
-    /**
-     * This method is a wrapper that returns an instance of the
-     * configured error class with this object's default error
-     * handling applied.  If the $mode and $options parameters are not
-     * specified, the object's defaults are used.
-     *
-     * @param mixed $message a text error message or a PEAR error object
-     *
-     * @param int $code      a numeric error code (it is up to your class
-     *                  to define these if you want to use codes)
-     *
-     * @param int $mode      One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
-     *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
-     *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
-     *
-     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
-     *                  specifies the PHP-internal error level (one of
-     *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
-     *                  If $mode is PEAR_ERROR_CALLBACK, this
-     *                  parameter specifies the callback function or
-     *                  method.  In other error modes this parameter
-     *                  is ignored.
-     *
-     * @param string $userinfo If you need to pass along for example debug
-     *                  information, this parameter is meant for that.
-     *
-     * @param string $error_class The returned error object will be
-     *                  instantiated from this class, if specified.
-     *
-     * @param bool $skipmsg If true, raiseError will only pass error codes,
-     *                  the error message parameter will be dropped.
-     *
-     * @access public
-     * @return object   a PEAR error object
-     * @see PEAR::setErrorHandling
-     * @since PHP 4.0.5
-     */
-    function &raiseError($message = null,
-                         $code = null,
-                         $mode = null,
-                         $options = null,
-                         $userinfo = null,
-                         $error_class = null,
-                         $skipmsg = false)
-    {
-        // The error is yet a PEAR error object
-        if (is_object($message)) {
-            $code        = $message->getCode();
-            $userinfo    = $message->getUserInfo();
-            $error_class = $message->getType();
-            $message->error_message_prefix = '';
-            $message     = $message->getMessage();
-        }
-
-        if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
-            if ($exp[0] == "*" ||
-                (is_int(reset($exp)) && in_array($code, $exp)) ||
-                (is_string(reset($exp)) && in_array($message, $exp))) {
-                $mode = PEAR_ERROR_RETURN;
-            }
-        }
-
-        // No mode given, try global ones
-        if ($mode === null) {
-            // Class error handler
-            if (isset($this) && isset($this->_default_error_mode)) {
-                $mode    = $this->_default_error_mode;
-                $options = $this->_default_error_options;
-            // Global error handler
-            } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
-                $mode    = $GLOBALS['_PEAR_default_error_mode'];
-                $options = $GLOBALS['_PEAR_default_error_options'];
-            }
-        }
-
-        if ($error_class !== null) {
-            $ec = $error_class;
-        } elseif (isset($this) && isset($this->_error_class)) {
-            $ec = $this->_error_class;
-        } else {
-            $ec = 'PEAR_Error';
-        }
-
-        if (intval(PHP_VERSION) < 5) {
-            // little non-eval hack to fix bug #12147
-            include 'PEAR/FixPHP5PEARWarnings.php';
-            return $a;
-        }
-
-        if ($skipmsg) {
-            $a = new $ec($code, $mode, $options, $userinfo);
-        } else {
-            $a = new $ec($message, $code, $mode, $options, $userinfo);
-        }
-
-        return $a;
-    }
-
-    // }}}
-    // {{{ throwError()
-
-    /**
-     * Simpler form of raiseError with fewer options.  In most cases
-     * message, code and userinfo are enough.
-     *
-     * @param string $message
-     *
-     */
-    function &throwError($message = null,
-                         $code = null,
-                         $userinfo = null)
-    {
-        if (isset($this) && is_a($this, 'PEAR')) {
-            $a = &$this->raiseError($message, $code, null, null, $userinfo);
-            return $a;
-        }
-
-        $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
-        return $a;
-    }
-
-    // }}}
-    function staticPushErrorHandling($mode, $options = null)
-    {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
-        $def_options = &$GLOBALS['_PEAR_default_error_options'];
-        $stack[] = array($def_mode, $def_options);
-        switch ($mode) {
-            case PEAR_ERROR_EXCEPTION:
-            case PEAR_ERROR_RETURN:
-            case PEAR_ERROR_PRINT:
-            case PEAR_ERROR_TRIGGER:
-            case PEAR_ERROR_DIE:
-            case null:
-                $def_mode = $mode;
-                $def_options = $options;
-                break;
-
-            case PEAR_ERROR_CALLBACK:
-                $def_mode = $mode;
-                // class/object method callback
-                if (is_callable($options)) {
-                    $def_options = $options;
-                } else {
-                    trigger_error("invalid error callback", E_USER_WARNING);
-                }
-                break;
-
-            default:
-                trigger_error("invalid error mode", E_USER_WARNING);
-                break;
-        }
-        $stack[] = array($mode, $options);
-        return true;
-    }
-
-    function staticPopErrorHandling()
-    {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
-        $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
-        array_pop($stack);
-        list($mode, $options) = $stack[sizeof($stack) - 1];
-        array_pop($stack);
-        switch ($mode) {
-            case PEAR_ERROR_EXCEPTION:
-            case PEAR_ERROR_RETURN:
-            case PEAR_ERROR_PRINT:
-            case PEAR_ERROR_TRIGGER:
-            case PEAR_ERROR_DIE:
-            case null:
-                $setmode = $mode;
-                $setoptions = $options;
-                break;
-
-            case PEAR_ERROR_CALLBACK:
-                $setmode = $mode;
-                // class/object method callback
-                if (is_callable($options)) {
-                    $setoptions = $options;
-                } else {
-                    trigger_error("invalid error callback", E_USER_WARNING);
-                }
-                break;
-
-            default:
-                trigger_error("invalid error mode", E_USER_WARNING);
-                break;
-        }
-        return true;
-    }
-
-    // {{{ pushErrorHandling()
-
-    /**
-     * Push a new error handler on top of the error handler options stack. With this
-     * you can easily override the actual error handler for some code and restore
-     * it later with popErrorHandling.
-     *
-     * @param mixed $mode (same as setErrorHandling)
-     * @param mixed $options (same as setErrorHandling)
-     *
-     * @return bool Always true
-     *
-     * @see PEAR::setErrorHandling
-     */
-    function pushErrorHandling($mode, $options = null)
-    {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        if (isset($this) && is_a($this, 'PEAR')) {
-            $def_mode    = &$this->_default_error_mode;
-            $def_options = &$this->_default_error_options;
-        } else {
-            $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
-            $def_options = &$GLOBALS['_PEAR_default_error_options'];
-        }
-        $stack[] = array($def_mode, $def_options);
-
-        if (isset($this) && is_a($this, 'PEAR')) {
-            $this->setErrorHandling($mode, $options);
-        } else {
-            PEAR::setErrorHandling($mode, $options);
-        }
-        $stack[] = array($mode, $options);
-        return true;
-    }
-
-    // }}}
-    // {{{ popErrorHandling()
-
-    /**
-    * Pop the last error handler used
-    *
-    * @return bool Always true
-    *
-    * @see PEAR::pushErrorHandling
-    */
-    function popErrorHandling()
-    {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        array_pop($stack);
-        list($mode, $options) = $stack[sizeof($stack) - 1];
-        array_pop($stack);
-        if (isset($this) && is_a($this, 'PEAR')) {
-            $this->setErrorHandling($mode, $options);
-        } else {
-            PEAR::setErrorHandling($mode, $options);
-        }
-        return true;
-    }
-
-    // }}}
-    // {{{ loadExtension()
-
-    /**
-    * OS independant PHP extension load. Remember to take care
-    * on the correct extension name for case sensitive OSes.
-    *
-    * @param string $ext The extension name
-    * @return bool Success or not on the dl() call
-    */
-    function loadExtension($ext)
-    {
-        if (!extension_loaded($ext)) {
-            // if either returns true dl() will produce a FATAL error, stop that
-            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
-                return false;
-            }
-
-            if (OS_WINDOWS) {
-                $suffix = '.dll';
-            } elseif (PHP_OS == 'HP-UX') {
-                $suffix = '.sl';
-            } elseif (PHP_OS == 'AIX') {
-                $suffix = '.a';
-            } elseif (PHP_OS == 'OSX') {
-                $suffix = '.bundle';
-            } else {
-                $suffix = '.so';
-            }
-
-            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
-        }
-
-        return true;
-    }
-
-    // }}}
-}
-
-if (PEAR_ZE2) {
-    include_once 'PEAR5.php';
-}
-
-// {{{ _PEAR_call_destructors()
-
-function _PEAR_call_destructors()
-{
-    global $_PEAR_destructor_object_list;
-    if (is_array($_PEAR_destructor_object_list) &&
-        sizeof($_PEAR_destructor_object_list))
-    {
-        reset($_PEAR_destructor_object_list);
-        if (PEAR_ZE2) {
-            $destructLifoExists = PEAR5::getStaticProperty('PEAR', 'destructlifo');
-        } else {
-            $destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
-        }
-
-        if ($destructLifoExists) {
-            $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
-        }
-
-        while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
-            $classname = get_class($objref);
-            while ($classname) {
-                $destructor = "_$classname";
-                if (method_exists($objref, $destructor)) {
-                    $objref->$destructor();
-                    break;
-                } else {
-                    $classname = get_parent_class($classname);
-                }
-            }
-        }
-        // Empty the object list to ensure that destructors are
-        // not called more than once.
-        $_PEAR_destructor_object_list = array();
-    }
-
-    // Now call the shutdown functions
-    if (isset($GLOBALS['_PEAR_shutdown_funcs']) AND is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
-        foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
-            call_user_func_array($value[0], $value[1]);
-        }
-    }
-}
-
-// }}}
-/**
- * Standard PEAR error class for PHP 4
- *
- * This class is supserseded by {@link PEAR_Exception} in PHP 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Gregory Beaver <cellog@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/manual/en/core.pear.pear-error.php
- * @see        PEAR::raiseError(), PEAR::throwError()
- * @since      Class available since PHP 4.0.2
- */
-class PEAR_Error
-{
-    // {{{ properties
-
-    var $error_message_prefix = '';
-    var $mode                 = PEAR_ERROR_RETURN;
-    var $level                = E_USER_NOTICE;
-    var $code                 = -1;
-    var $message              = '';
-    var $userinfo             = '';
-    var $backtrace            = null;
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * PEAR_Error constructor
-     *
-     * @param string $message  message
-     *
-     * @param int $code     (optional) error code
-     *
-     * @param int $mode     (optional) error mode, one of: PEAR_ERROR_RETURN,
-     * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
-     * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
-     *
-     * @param mixed $options   (optional) error level, _OR_ in the case of
-     * PEAR_ERROR_CALLBACK, the callback function or object/method
-     * tuple.
-     *
-     * @param string $userinfo (optional) additional user/debug info
-     *
-     * @access public
-     *
-     */
-    function PEAR_Error($message = 'unknown error', $code = null,
-                        $mode = null, $options = null, $userinfo = null)
-    {
-        if ($mode === null) {
-            $mode = PEAR_ERROR_RETURN;
-        }
-        $this->message   = $message;
-        $this->code      = $code;
-        $this->mode      = $mode;
-        $this->userinfo  = $userinfo;
-
-        if (PEAR_ZE2) {
-            $skiptrace = PEAR5::getStaticProperty('PEAR_Error', 'skiptrace');
-        } else {
-            $skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
-        }
-
-        if (!$skiptrace) {
-            $this->backtrace = debug_backtrace();
-            if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) {
-                unset($this->backtrace[0]['object']);
-            }
-        }
-
-        if ($mode & PEAR_ERROR_CALLBACK) {
-            $this->level = E_USER_NOTICE;
-            $this->callback = $options;
-        } else {
-            if ($options === null) {
-                $options = E_USER_NOTICE;
-            }
-
-            $this->level = $options;
-            $this->callback = null;
-        }
-
-        if ($this->mode & PEAR_ERROR_PRINT) {
-            if (is_null($options) || is_int($options)) {
-                $format = "%s";
-            } else {
-                $format = $options;
-            }
-
-            printf($format, $this->getMessage());
-        }
-
-        if ($this->mode & PEAR_ERROR_TRIGGER) {
-            trigger_error($this->getMessage(), $this->level);
-        }
-
-        if ($this->mode & PEAR_ERROR_DIE) {
-            $msg = $this->getMessage();
-            if (is_null($options) || is_int($options)) {
-                $format = "%s";
-                if (substr($msg, -1) != "\n") {
-                    $msg .= "\n";
-                }
-            } else {
-                $format = $options;
-            }
-            die(sprintf($format, $msg));
-        }
-
-        if ($this->mode & PEAR_ERROR_CALLBACK) {
-            if (is_callable($this->callback)) {
-                call_user_func($this->callback, $this);
-            }
-        }
-
-        if ($this->mode & PEAR_ERROR_EXCEPTION) {
-            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
-            eval('$e = new Exception($this->message, $this->code);throw($e);');
-        }
-    }
-
-    // }}}
-    // {{{ getMode()
-
-    /**
-     * Get the error mode from an error object.
-     *
-     * @return int error mode
-     * @access public
-     */
-    function getMode() {
-        return $this->mode;
-    }
-
-    // }}}
-    // {{{ getCallback()
-
-    /**
-     * Get the callback function/method from an error object.
-     *
-     * @return mixed callback function or object/method array
-     * @access public
-     */
-    function getCallback() {
-        return $this->callback;
-    }
-
-    // }}}
-    // {{{ getMessage()
-
-
-    /**
-     * Get the error message from an error object.
-     *
-     * @return  string  full error message
-     * @access public
-     */
-    function getMessage()
-    {
-        return ($this->error_message_prefix . $this->message);
-    }
-
-
-    // }}}
-    // {{{ getCode()
-
-    /**
-     * Get error code from an error object
-     *
-     * @return int error code
-     * @access public
-     */
-     function getCode()
-     {
-        return $this->code;
-     }
-
-    // }}}
-    // {{{ getType()
-
-    /**
-     * Get the name of this error/exception.
-     *
-     * @return string error/exception name (type)
-     * @access public
-     */
-    function getType()
-    {
-        return get_class($this);
-    }
-
-    // }}}
-    // {{{ getUserInfo()
-
-    /**
-     * Get additional user-supplied information.
-     *
-     * @return string user-supplied information
-     * @access public
-     */
-    function getUserInfo()
-    {
-        return $this->userinfo;
-    }
-
-    // }}}
-    // {{{ getDebugInfo()
-
-    /**
-     * Get additional debug information supplied by the application.
-     *
-     * @return string debug information
-     * @access public
-     */
-    function getDebugInfo()
-    {
-        return $this->getUserInfo();
-    }
-
-    // }}}
-    // {{{ getBacktrace()
-
-    /**
-     * Get the call backtrace from where the error was generated.
-     * Supported with PHP 4.3.0 or newer.
-     *
-     * @param int $frame (optional) what frame to fetch
-     * @return array Backtrace, or NULL if not available.
-     * @access public
-     */
-    function getBacktrace($frame = null)
-    {
-        if (defined('PEAR_IGNORE_BACKTRACE')) {
-            return null;
-        }
-        if ($frame === null) {
-            return $this->backtrace;
-        }
-        return $this->backtrace[$frame];
-    }
-
-    // }}}
-    // {{{ addUserInfo()
-
-    function addUserInfo($info)
-    {
-        if (empty($this->userinfo)) {
-            $this->userinfo = $info;
-        } else {
-            $this->userinfo .= " ** $info";
-        }
-    }
-
-    // }}}
-    // {{{ toString()
-    function __toString()
-    {
-        return $this->getMessage();
-    }
-    // }}}
-    // {{{ toString()
-
-    /**
-     * Make a string representation of this object.
-     *
-     * @return string a string with an object summary
-     * @access public
-     */
-    function toString() {
-        $modes = array();
-        $levels = array(E_USER_NOTICE  => 'notice',
-                        E_USER_WARNING => 'warning',
-                        E_USER_ERROR   => 'error');
-        if ($this->mode & PEAR_ERROR_CALLBACK) {
-            if (is_array($this->callback)) {
-                $callback = (is_object($this->callback[0]) ?
-                    strtolower(get_class($this->callback[0])) :
-                    $this->callback[0]) . '::' .
-                    $this->callback[1];
-            } else {
-                $callback = $this->callback;
-            }
-            return sprintf('[%s: message="%s" code=%d mode=callback '.
-                           'callback=%s prefix="%s" info="%s"]',
-                           strtolower(get_class($this)), $this->message, $this->code,
-                           $callback, $this->error_message_prefix,
-                           $this->userinfo);
-        }
-        if ($this->mode & PEAR_ERROR_PRINT) {
-            $modes[] = 'print';
-        }
-        if ($this->mode & PEAR_ERROR_TRIGGER) {
-            $modes[] = 'trigger';
-        }
-        if ($this->mode & PEAR_ERROR_DIE) {
-            $modes[] = 'die';
-        }
-        if ($this->mode & PEAR_ERROR_RETURN) {
-            $modes[] = 'return';
-        }
-        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
-                       'prefix="%s" info="%s"]',
-                       strtolower(get_class($this)), $this->message, $this->code,
-                       implode("|", $modes), $levels[$this->level],
-                       $this->error_message_prefix,
-                       $this->userinfo);
-    }
-
-    // }}}
-}
-
-/*
- * Local Variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/lib/php/PEAR/Autoloader.php b/lib/php/PEAR/Autoloader.php
deleted file mode 100644
index 69d933a0632ac5659ab3f7cd2ce694b3a839d298..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Autoloader.php
+++ /dev/null
@@ -1,218 +0,0 @@
-<?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.0
- * @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");
-
-?>
diff --git a/lib/php/PEAR/Builder.php b/lib/php/PEAR/Builder.php
deleted file mode 100644
index 49352cba96265e7f8c28d0eb2aa5d15a4b8c98ed..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Builder.php
+++ /dev/null
@@ -1,474 +0,0 @@
-<?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.0
- * @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.0');
-        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
diff --git a/lib/php/PEAR/ChannelFile.php b/lib/php/PEAR/ChannelFile.php
deleted file mode 100644
index 6c864d1a398474af1b8484f0e08afccf0e8cc5ed..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/ChannelFile.php
+++ /dev/null
@@ -1,1559 +0,0 @@
-<?php
-/**
- * PEAR_ChannelFile, the channel handling class
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: ChannelFile.php 286951 2009-08-09 14:41:22Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR/ErrorStack.php';
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/Common.php';
-
-/**
- * Error code if the channel.xml <channel> tag does not contain a valid version
- */
-define('PEAR_CHANNELFILE_ERROR_NO_VERSION', 1);
-/**
- * Error code if the channel.xml <channel> tag version is not supported (version 1.0 is the only supported version,
- * currently
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_VERSION', 2);
-
-/**
- * Error code if parsing is attempted with no xml extension
- */
-define('PEAR_CHANNELFILE_ERROR_NO_XML_EXT', 3);
-
-/**
- * Error code if creating the xml parser resource fails
- */
-define('PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER', 4);
-
-/**
- * Error code used for all sax xml parsing errors
- */
-define('PEAR_CHANNELFILE_ERROR_PARSER_ERROR', 5);
-
-/**#@+
- * Validation errors
- */
-/**
- * Error code when channel name is missing
- */
-define('PEAR_CHANNELFILE_ERROR_NO_NAME', 6);
-/**
- * Error code when channel name is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_NAME', 7);
-/**
- * Error code when channel summary is missing
- */
-define('PEAR_CHANNELFILE_ERROR_NO_SUMMARY', 8);
-/**
- * Error code when channel summary is multi-line
- */
-define('PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY', 9);
-/**
- * Error code when channel server is missing for protocol
- */
-define('PEAR_CHANNELFILE_ERROR_NO_HOST', 10);
-/**
- * Error code when channel server is invalid for protocol
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_HOST', 11);
-/**
- * Error code when a mirror name is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_MIRROR', 21);
-/**
- * Error code when a mirror type is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE', 22);
-/**
- * Error code when an attempt is made to generate xml, but the parsed content is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID', 23);
-/**
- * Error code when an empty package name validate regex is passed in
- */
-define('PEAR_CHANNELFILE_ERROR_EMPTY_REGEX', 24);
-/**
- * Error code when a <function> tag has no version
- */
-define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION', 25);
-/**
- * Error code when a <function> tag has no name
- */
-define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME', 26);
-/**
- * Error code when a <validatepackage> tag has no name
- */
-define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME', 27);
-/**
- * Error code when a <validatepackage> tag has no version attribute
- */
-define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION', 28);
-/**
- * Error code when a mirror does not exist but is called for in one of the set*
- * methods.
- */
-define('PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND', 32);
-/**
- * Error code when a server port is not numeric
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_PORT', 33);
-/**
- * Error code when <static> contains no version attribute
- */
-define('PEAR_CHANNELFILE_ERROR_NO_STATICVERSION', 34);
-/**
- * Error code when <baseurl> contains no type attribute in a <rest> protocol definition
- */
-define('PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE', 35);
-/**
- * Error code when a mirror is defined and the channel.xml represents the __uri pseudo-channel
- */
-define('PEAR_CHANNELFILE_URI_CANT_MIRROR', 36);
-/**
- * Error code when ssl attribute is present and is not "yes"
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_SSL', 37);
-/**#@-*/
-
-/**
- * Mirror types allowed.  Currently only internet servers are recognized.
- */
-$GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] =  array('server');
-
-
-/**
- * The Channel handling class
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_ChannelFile
-{
-    /**
-     * @access private
-     * @var PEAR_ErrorStack
-     * @access private
-     */
-    var $_stack;
-
-    /**
-     * Supported channel.xml versions, for parsing
-     * @var array
-     * @access private
-     */
-    var $_supportedVersions = array('1.0');
-
-    /**
-     * Parsed channel information
-     * @var array
-     * @access private
-     */
-    var $_channelInfo;
-
-    /**
-     * index into the subchannels array, used for parsing xml
-     * @var int
-     * @access private
-     */
-    var $_subchannelIndex;
-
-    /**
-     * index into the mirrors array, used for parsing xml
-     * @var int
-     * @access private
-     */
-    var $_mirrorIndex;
-
-    /**
-     * Flag used to determine the validity of parsed content
-     * @var boolean
-     * @access private
-     */
-    var $_isValid = false;
-
-    function PEAR_ChannelFile()
-    {
-        $this->_stack = &new PEAR_ErrorStack('PEAR_ChannelFile');
-        $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
-        $this->_isValid = false;
-    }
-
-    /**
-     * @return array
-     * @access protected
-     */
-    function _getErrorMessage()
-    {
-        return
-            array(
-                PEAR_CHANNELFILE_ERROR_INVALID_VERSION =>
-                    'While parsing channel.xml, an invalid version number "%version% was passed in, expecting one of %versions%',
-                PEAR_CHANNELFILE_ERROR_NO_VERSION =>
-                    'No version number found in <channel> tag',
-                PEAR_CHANNELFILE_ERROR_NO_XML_EXT =>
-                    '%error%',
-                PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER =>
-                    'Unable to create XML parser',
-                PEAR_CHANNELFILE_ERROR_PARSER_ERROR =>
-                    '%error%',
-                PEAR_CHANNELFILE_ERROR_NO_NAME =>
-                    'Missing channel name',
-                PEAR_CHANNELFILE_ERROR_INVALID_NAME =>
-                    'Invalid channel %tag% "%name%"',
-                PEAR_CHANNELFILE_ERROR_NO_SUMMARY =>
-                    'Missing channel summary',
-                PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY =>
-                    'Channel summary should be on one line, but is multi-line',
-                PEAR_CHANNELFILE_ERROR_NO_HOST =>
-                    'Missing channel server for %type% server',
-                PEAR_CHANNELFILE_ERROR_INVALID_HOST =>
-                    'Server name "%server%" is invalid for %type% server',
-                PEAR_CHANNELFILE_ERROR_INVALID_MIRROR =>
-                    'Invalid mirror name "%name%", mirror type %type%',
-                PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE =>
-                    'Invalid mirror type "%type%"',
-                PEAR_CHANNELFILE_ERROR_INVALID =>
-                    'Cannot generate xml, contents are invalid',
-                PEAR_CHANNELFILE_ERROR_EMPTY_REGEX =>
-                    'packagenameregex cannot be empty',
-                PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION =>
-                    '%parent% %protocol% function has no version',
-                PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME =>
-                    '%parent% %protocol% function has no name',
-                PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE =>
-                    '%parent% rest baseurl has no type',
-                PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME =>
-                    'Validation package has no name in <validatepackage> tag',
-                PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION =>
-                    'Validation package "%package%" has no version',
-                PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND =>
-                    'Mirror "%mirror%" does not exist',
-                PEAR_CHANNELFILE_ERROR_INVALID_PORT =>
-                    'Port "%port%" must be numeric',
-                PEAR_CHANNELFILE_ERROR_NO_STATICVERSION =>
-                    '<static> tag must contain version attribute',
-                PEAR_CHANNELFILE_URI_CANT_MIRROR =>
-                    'The __uri pseudo-channel cannot have mirrors',
-                PEAR_CHANNELFILE_ERROR_INVALID_SSL =>
-                    '%server% has invalid ssl attribute "%ssl%" can only be yes or not present',
-            );
-    }
-
-    /**
-     * @param string contents of package.xml file
-     * @return bool success of parsing
-     */
-    function fromXmlString($data)
-    {
-        if (preg_match('/<channel\s+version="([0-9]+\.[0-9]+)"/', $data, $channelversion)) {
-            if (!in_array($channelversion[1], $this->_supportedVersions)) {
-                $this->_stack->push(PEAR_CHANNELFILE_ERROR_INVALID_VERSION, 'error',
-                    array('version' => $channelversion[1]));
-                return false;
-            }
-            $parser = new PEAR_XMLParser;
-            $result = $parser->parse($data);
-            if ($result !== true) {
-                if ($result->getCode() == 1) {
-                    $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_XML_EXT, 'error',
-                        array('error' => $result->getMessage()));
-                } else {
-                    $this->_stack->push(PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER, 'error');
-                }
-                return false;
-            }
-            $this->_channelInfo = $parser->getData();
-            return true;
-        } else {
-            $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_VERSION, 'error', array('xml' => $data));
-            return false;
-        }
-    }
-
-    /**
-     * @return array
-     */
-    function toArray()
-    {
-        if (!$this->_isValid && !$this->validate()) {
-            return false;
-        }
-        return $this->_channelInfo;
-    }
-
-    /**
-     * @param array
-     * @static
-     * @return PEAR_ChannelFile|false false if invalid
-     */
-    function &fromArray($data, $compatibility = false, $stackClass = 'PEAR_ErrorStack')
-    {
-        $a = new PEAR_ChannelFile($compatibility, $stackClass);
-        $a->_fromArray($data);
-        if (!$a->validate()) {
-            $a = false;
-            return $a;
-        }
-        return $a;
-    }
-
-    /**
-     * Unlike {@link fromArray()} this does not do any validation
-     * @param array
-     * @static
-     * @return PEAR_ChannelFile
-     */
-    function &fromArrayWithErrors($data, $compatibility = false,
-                                  $stackClass = 'PEAR_ErrorStack')
-    {
-        $a = new PEAR_ChannelFile($compatibility, $stackClass);
-        $a->_fromArray($data);
-        return $a;
-    }
-
-    /**
-     * @param array
-     * @access private
-     */
-    function _fromArray($data)
-    {
-        $this->_channelInfo = $data;
-    }
-
-    /**
-     * Wrapper to {@link PEAR_ErrorStack::getErrors()}
-     * @param boolean determines whether to purge the error stack after retrieving
-     * @return array
-     */
-    function getErrors($purge = false)
-    {
-        return $this->_stack->getErrors($purge);
-    }
-
-    /**
-     * Unindent given string (?)
-     *
-     * @param string $str The string that has to be unindented.
-     * @return string
-     * @access private
-     */
-    function _unIndent($str)
-    {
-        // remove leading newlines
-        $str = preg_replace('/^[\r\n]+/', '', $str);
-        // find whitespace at the beginning of the first line
-        $indent_len = strspn($str, " \t");
-        $indent = substr($str, 0, $indent_len);
-        $data = '';
-        // remove the same amount of whitespace from following lines
-        foreach (explode("\n", $str) as $line) {
-            if (substr($line, 0, $indent_len) == $indent) {
-                $data .= substr($line, $indent_len) . "\n";
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * Parse a channel.xml file.  Expects the name of
-     * a channel xml file as input.
-     *
-     * @param string  $descfile  name of channel xml file
-     * @return bool success of parsing
-     */
-    function fromXmlFile($descfile)
-    {
-        if (!file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) ||
-             (!$fp = fopen($descfile, 'r'))) {
-            require_once 'PEAR.php';
-            return PEAR::raiseError("Unable to open $descfile");
-        }
-
-        // read the whole thing so we only get one cdata callback
-        // for each block of cdata
-        fclose($fp);
-        $data = file_get_contents($descfile);
-        return $this->fromXmlString($data);
-    }
-
-    /**
-     * Parse channel information from different sources
-     *
-     * This method is able to extract information about a channel
-     * from an .xml file or a string
-     *
-     * @access public
-     * @param  string Filename of the source or the source itself
-     * @return bool
-     */
-    function fromAny($info)
-    {
-        if (is_string($info) && file_exists($info) && strlen($info) < 255) {
-            $tmp = substr($info, -4);
-            if ($tmp == '.xml') {
-                $info = $this->fromXmlFile($info);
-            } else {
-                $fp = fopen($info, "r");
-                $test = fread($fp, 5);
-                fclose($fp);
-                if ($test == "<?xml") {
-                    $info = $this->fromXmlFile($info);
-                }
-            }
-            if (PEAR::isError($info)) {
-                require_once 'PEAR.php';
-                return PEAR::raiseError($info);
-            }
-        }
-        if (is_string($info)) {
-            $info = $this->fromXmlString($info);
-        }
-        return $info;
-    }
-
-    /**
-     * Return an XML document based on previous parsing and modifications
-     *
-     * @return string XML data
-     *
-     * @access public
-     */
-    function toXml()
-    {
-        if (!$this->_isValid && !$this->validate()) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID);
-            return false;
-        }
-        if (!isset($this->_channelInfo['attribs']['version'])) {
-            $this->_channelInfo['attribs']['version'] = '1.0';
-        }
-        $channelInfo = $this->_channelInfo;
-        $ret = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
-        $ret .= "<channel version=\"" .
-            $channelInfo['attribs']['version'] . "\" xmlns=\"http://pear.php.net/channel-1.0\"
-  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
-  xsi:schemaLocation=\"http://pear.php.net/dtd/channel-"
-            . $channelInfo['attribs']['version'] . " http://pear.php.net/dtd/channel-" .
-            $channelInfo['attribs']['version'] . ".xsd\">
- <name>$channelInfo[name]</name>
- <summary>" . htmlspecialchars($channelInfo['summary'])."</summary>
-";
-        if (isset($channelInfo['suggestedalias'])) {
-            $ret .= ' <suggestedalias>' . $channelInfo['suggestedalias'] . "</suggestedalias>\n";
-        }
-        if (isset($channelInfo['validatepackage'])) {
-            $ret .= ' <validatepackage version="' .
-                $channelInfo['validatepackage']['attribs']['version']. '">' .
-                htmlspecialchars($channelInfo['validatepackage']['_content']) .
-                "</validatepackage>\n";
-        }
-        $ret .= " <servers>\n";
-        $ret .= '  <primary';
-        if (isset($channelInfo['servers']['primary']['attribs']['ssl'])) {
-            $ret .= ' ssl="' . $channelInfo['servers']['primary']['attribs']['ssl'] . '"';
-        }
-        if (isset($channelInfo['servers']['primary']['attribs']['port'])) {
-            $ret .= ' port="' . $channelInfo['servers']['primary']['attribs']['port'] . '"';
-        }
-        $ret .= ">\n";
-        if (isset($channelInfo['servers']['primary']['rest'])) {
-            $ret .= $this->_makeRestXml($channelInfo['servers']['primary']['rest'], '   ');
-        }
-        $ret .= "  </primary>\n";
-        if (isset($channelInfo['servers']['mirror'])) {
-            $ret .= $this->_makeMirrorsXml($channelInfo);
-        }
-        $ret .= " </servers>\n";
-        $ret .= "</channel>";
-        return str_replace("\r", "\n", str_replace("\r\n", "\n", $ret));
-    }
-
-    /**
-     * Generate the <rest> tag
-     * @access private
-     */
-    function _makeRestXml($info, $indent)
-    {
-        $ret = $indent . "<rest>\n";
-        if (isset($info['baseurl']) && !isset($info['baseurl'][0])) {
-            $info['baseurl'] = array($info['baseurl']);
-        }
-
-        if (isset($info['baseurl'])) {
-            foreach ($info['baseurl'] as $url) {
-                $ret .= "$indent <baseurl type=\"" . $url['attribs']['type'] . "\"";
-                $ret .= ">" . $url['_content'] . "</baseurl>\n";
-            }
-        }
-        $ret .= $indent . "</rest>\n";
-        return $ret;
-    }
-
-    /**
-     * Generate the <mirrors> tag
-     * @access private
-     */
-    function _makeMirrorsXml($channelInfo)
-    {
-        $ret = "";
-        if (!isset($channelInfo['servers']['mirror'][0])) {
-            $channelInfo['servers']['mirror'] = array($channelInfo['servers']['mirror']);
-        }
-        foreach ($channelInfo['servers']['mirror'] as $mirror) {
-            $ret .= '  <mirror host="' . $mirror['attribs']['host'] . '"';
-            if (isset($mirror['attribs']['port'])) {
-                $ret .= ' port="' . $mirror['attribs']['port'] . '"';
-            }
-            if (isset($mirror['attribs']['ssl'])) {
-                $ret .= ' ssl="' . $mirror['attribs']['ssl'] . '"';
-            }
-            $ret .= ">\n";
-            if (isset($mirror['rest'])) {
-                if (isset($mirror['rest'])) {
-                    $ret .= $this->_makeRestXml($mirror['rest'], '   ');
-                }
-                $ret .= "  </mirror>\n";
-            } else {
-                $ret .= "/>\n";
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Generate the <functions> tag
-     * @access private
-     */
-    function _makeFunctionsXml($functions, $indent, $rest = false)
-    {
-        $ret = '';
-        if (!isset($functions[0])) {
-            $functions = array($functions);
-        }
-        foreach ($functions as $function) {
-            $ret .= "$indent<function version=\"" . $function['attribs']['version'] . "\"";
-            if ($rest) {
-                $ret .= ' uri="' . $function['attribs']['uri'] . '"';
-            }
-            $ret .= ">" . $function['_content'] . "</function>\n";
-        }
-        return $ret;
-    }
-
-    /**
-     * Validation error.  Also marks the object contents as invalid
-     * @param error code
-     * @param array error information
-     * @access private
-     */
-    function _validateError($code, $params = array())
-    {
-        $this->_stack->push($code, 'error', $params);
-        $this->_isValid = false;
-    }
-
-    /**
-     * Validation warning.  Does not mark the object contents invalid.
-     * @param error code
-     * @param array error information
-     * @access private
-     */
-    function _validateWarning($code, $params = array())
-    {
-        $this->_stack->push($code, 'warning', $params);
-    }
-
-    /**
-     * Validate parsed file.
-     *
-     * @access public
-     * @return boolean
-     */
-    function validate()
-    {
-        $this->_isValid = true;
-        $info = $this->_channelInfo;
-        if (empty($info['name'])) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_NAME);
-        } elseif (!$this->validChannelServer($info['name'])) {
-            if ($info['name'] != '__uri') {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'name',
-                    'name' => $info['name']));
-            }
-        }
-        if (empty($info['summary'])) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY);
-        } elseif (strpos(trim($info['summary']), "\n") !== false) {
-            $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY,
-                array('summary' => $info['summary']));
-        }
-        if (isset($info['suggestedalias'])) {
-            if (!$this->validChannelServer($info['suggestedalias'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
-                    array('tag' => 'suggestedalias', 'name' =>$info['suggestedalias']));
-            }
-        }
-        if (isset($info['localalias'])) {
-            if (!$this->validChannelServer($info['localalias'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
-                    array('tag' => 'localalias', 'name' =>$info['localalias']));
-            }
-        }
-        if (isset($info['validatepackage'])) {
-            if (!isset($info['validatepackage']['_content'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME);
-            }
-            if (!isset($info['validatepackage']['attribs']['version'])) {
-                $content = isset($info['validatepackage']['_content']) ?
-                    $info['validatepackage']['_content'] :
-                    null;
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION,
-                    array('package' => $content));
-            }
-        }
-
-        if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['port']) &&
-              !is_numeric($info['servers']['primary']['attribs']['port'])) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_PORT,
-                array('port' => $info['servers']['primary']['attribs']['port']));
-        }
-
-        if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['ssl']) &&
-              $info['servers']['primary']['attribs']['ssl'] != 'yes') {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL,
-                array('ssl' => $info['servers']['primary']['attribs']['ssl'],
-                    'server' => $info['name']));
-        }
-
-        if (isset($info['servers']['primary']['rest']) &&
-              isset($info['servers']['primary']['rest']['baseurl'])) {
-            $this->_validateFunctions('rest', $info['servers']['primary']['rest']['baseurl']);
-        }
-        if (isset($info['servers']['mirror'])) {
-            if ($this->_channelInfo['name'] == '__uri') {
-                $this->_validateError(PEAR_CHANNELFILE_URI_CANT_MIRROR);
-            }
-            if (!isset($info['servers']['mirror'][0])) {
-                $info['servers']['mirror'] = array($info['servers']['mirror']);
-            }
-            foreach ($info['servers']['mirror'] as $mirror) {
-                if (!isset($mirror['attribs']['host'])) {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_HOST,
-                      array('type' => 'mirror'));
-                } elseif (!$this->validChannelServer($mirror['attribs']['host'])) {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_HOST,
-                        array('server' => $mirror['attribs']['host'], 'type' => 'mirror'));
-                }
-                if (isset($mirror['attribs']['ssl']) && $mirror['attribs']['ssl'] != 'yes') {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL,
-                        array('ssl' => $info['ssl'], 'server' => $mirror['attribs']['host']));
-                }
-                if (isset($mirror['rest'])) {
-                    $this->_validateFunctions('rest', $mirror['rest']['baseurl'],
-                        $mirror['attribs']['host']);
-                }
-            }
-        }
-        return $this->_isValid;
-    }
-
-    /**
-     * @param string  rest - protocol name this function applies to
-     * @param array the functions
-     * @param string the name of the parent element (mirror name, for instance)
-     */
-    function _validateFunctions($protocol, $functions, $parent = '')
-    {
-        if (!isset($functions[0])) {
-            $functions = array($functions);
-        }
-
-        foreach ($functions as $function) {
-            if (!isset($function['_content']) || empty($function['_content'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME,
-                    array('parent' => $parent, 'protocol' => $protocol));
-            }
-
-            if ($protocol == 'rest') {
-                if (!isset($function['attribs']['type']) ||
-                      empty($function['attribs']['type'])) {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE,
-                        array('parent' => $parent, 'protocol' => $protocol));
-                }
-            } else {
-                if (!isset($function['attribs']['version']) ||
-                      empty($function['attribs']['version'])) {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION,
-                        array('parent' => $parent, 'protocol' => $protocol));
-                }
-            }
-        }
-    }
-
-    /**
-     * Test whether a string contains a valid channel server.
-     * @param string $ver the package version to test
-     * @return bool
-     */
-    function validChannelServer($server)
-    {
-        if ($server == '__uri') {
-            return true;
-        }
-        return (bool) preg_match(PEAR_CHANNELS_SERVER_PREG, $server);
-    }
-
-    /**
-     * @return string|false
-     */
-    function getName()
-    {
-        if (isset($this->_channelInfo['name'])) {
-            return $this->_channelInfo['name'];
-        }
-
-        return false;
-    }
-
-    /**
-     * @return string|false
-     */
-    function getServer()
-    {
-        if (isset($this->_channelInfo['name'])) {
-            return $this->_channelInfo['name'];
-        }
-
-        return false;
-    }
-
-    /**
-     * @return int|80 port number to connect to
-     */
-    function getPort($mirror = false)
-    {
-        if ($mirror) {
-            if ($mir = $this->getMirror($mirror)) {
-                if (isset($mir['attribs']['port'])) {
-                    return $mir['attribs']['port'];
-                }
-
-                if ($this->getSSL($mirror)) {
-                    return 443;
-                }
-
-                return 80;
-            }
-
-            return false;
-        }
-
-        if (isset($this->_channelInfo['servers']['primary']['attribs']['port'])) {
-            return $this->_channelInfo['servers']['primary']['attribs']['port'];
-        }
-
-        if ($this->getSSL()) {
-            return 443;
-        }
-
-        return 80;
-    }
-
-    /**
-     * @return bool Determines whether secure sockets layer (SSL) is used to connect to this channel
-     */
-    function getSSL($mirror = false)
-    {
-        if ($mirror) {
-            if ($mir = $this->getMirror($mirror)) {
-                if (isset($mir['attribs']['ssl'])) {
-                    return true;
-                }
-
-                return false;
-            }
-
-            return false;
-        }
-
-        if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * @return string|false
-     */
-    function getSummary()
-    {
-        if (isset($this->_channelInfo['summary'])) {
-            return $this->_channelInfo['summary'];
-        }
-
-        return false;
-    }
-
-    /**
-     * @param string protocol type
-     * @param string Mirror name
-     * @return array|false
-     */
-    function getFunctions($protocol, $mirror = false)
-    {
-        if ($this->getName() == '__uri') {
-            return false;
-        }
-
-        $function = $protocol == 'rest' ? 'baseurl' : 'function';
-        if ($mirror) {
-            if ($mir = $this->getMirror($mirror)) {
-                if (isset($mir[$protocol][$function])) {
-                    return $mir[$protocol][$function];
-                }
-            }
-
-            return false;
-        }
-
-        if (isset($this->_channelInfo['servers']['primary'][$protocol][$function])) {
-            return $this->_channelInfo['servers']['primary'][$protocol][$function];
-        }
-
-        return false;
-    }
-
-    /**
-     * @param string Protocol type
-     * @param string Function name (null to return the
-     *               first protocol of the type requested)
-     * @param string Mirror name, if any
-     * @return array
-     */
-     function getFunction($type, $name = null, $mirror = false)
-     {
-        $protocols = $this->getFunctions($type, $mirror);
-        if (!$protocols) {
-            return false;
-        }
-
-        foreach ($protocols as $protocol) {
-            if ($name === null) {
-                return $protocol;
-            }
-
-            if ($protocol['_content'] != $name) {
-                continue;
-            }
-
-            return $protocol;
-        }
-
-        return false;
-     }
-
-    /**
-     * @param string protocol type
-     * @param string protocol name
-     * @param string version
-     * @param string mirror name
-     * @return boolean
-     */
-    function supports($type, $name = null, $mirror = false, $version = '1.0')
-    {
-        $protocols = $this->getFunctions($type, $mirror);
-        if (!$protocols) {
-            return false;
-        }
-
-        foreach ($protocols as $protocol) {
-            if ($protocol['attribs']['version'] != $version) {
-                continue;
-            }
-
-            if ($name === null) {
-                return true;
-            }
-
-            if ($protocol['_content'] != $name) {
-                continue;
-            }
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Determines whether a channel supports Representational State Transfer (REST) protocols
-     * for retrieving channel information
-     * @param string
-     * @return bool
-     */
-    function supportsREST($mirror = false)
-    {
-        if ($mirror == $this->_channelInfo['name']) {
-            $mirror = false;
-        }
-
-        if ($mirror) {
-            if ($mir = $this->getMirror($mirror)) {
-                return isset($mir['rest']);
-            }
-
-            return false;
-        }
-
-        return isset($this->_channelInfo['servers']['primary']['rest']);
-    }
-
-    /**
-     * Get the URL to access a base resource.
-     *
-     * Hyperlinks in the returned xml will be used to retrieve the proper information
-     * needed.  This allows extreme extensibility and flexibility in implementation
-     * @param string Resource Type to retrieve
-     */
-    function getBaseURL($resourceType, $mirror = false)
-    {
-        if ($mirror == $this->_channelInfo['name']) {
-            $mirror = false;
-        }
-
-        if ($mirror) {
-            $mir = $this->getMirror($mirror);
-            if (!$mir) {
-                return false;
-            }
-
-            $rest = $mir['rest'];
-        } else {
-            $rest = $this->_channelInfo['servers']['primary']['rest'];
-        }
-
-        if (!isset($rest['baseurl'][0])) {
-            $rest['baseurl'] = array($rest['baseurl']);
-        }
-
-        foreach ($rest['baseurl'] as $baseurl) {
-            if (strtolower($baseurl['attribs']['type']) == strtolower($resourceType)) {
-                return $baseurl['_content'];
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Since REST does not implement RPC, provide this as a logical wrapper around
-     * resetFunctions for REST
-     * @param string|false mirror name, if any
-     */
-    function resetREST($mirror = false)
-    {
-        return $this->resetFunctions('rest', $mirror);
-    }
-
-    /**
-     * Empty all protocol definitions
-     * @param string protocol type
-     * @param string|false mirror name, if any
-     */
-    function resetFunctions($type, $mirror = false)
-    {
-        if ($mirror) {
-            if (isset($this->_channelInfo['servers']['mirror'])) {
-                $mirrors = $this->_channelInfo['servers']['mirror'];
-                if (!isset($mirrors[0])) {
-                    $mirrors = array($mirrors);
-                }
-
-                foreach ($mirrors as $i => $mir) {
-                    if ($mir['attribs']['host'] == $mirror) {
-                        if (isset($this->_channelInfo['servers']['mirror'][$i][$type])) {
-                            unset($this->_channelInfo['servers']['mirror'][$i][$type]);
-                        }
-
-                        return true;
-                    }
-                }
-
-                return false;
-            }
-
-            return false;
-        }
-
-        if (isset($this->_channelInfo['servers']['primary'][$type])) {
-            unset($this->_channelInfo['servers']['primary'][$type]);
-        }
-
-        return true;
-    }
-
-    /**
-     * Set a channel's protocols to the protocols supported by pearweb
-     */
-    function setDefaultPEARProtocols($version = '1.0', $mirror = false)
-    {
-        switch ($version) {
-            case '1.0' :
-                $this->resetREST($mirror);
-
-                if (!isset($this->_channelInfo['servers'])) {
-                    $this->_channelInfo['servers'] = array('primary' =>
-                        array('rest' => array()));
-                } elseif (!isset($this->_channelInfo['servers']['primary'])) {
-                    $this->_channelInfo['servers']['primary'] = array('rest' => array());
-                }
-
-                return true;
-            break;
-            default :
-                return false;
-            break;
-        }
-    }
-
-    /**
-     * @return array
-     */
-    function getMirrors()
-    {
-        if (isset($this->_channelInfo['servers']['mirror'])) {
-            $mirrors = $this->_channelInfo['servers']['mirror'];
-            if (!isset($mirrors[0])) {
-                $mirrors = array($mirrors);
-            }
-
-            return $mirrors;
-        }
-
-        return array();
-    }
-
-    /**
-     * Get the unserialized XML representing a mirror
-     * @return array|false
-     */
-    function getMirror($server)
-    {
-        foreach ($this->getMirrors() as $mirror) {
-            if ($mirror['attribs']['host'] == $server) {
-                return $mirror;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * @param string
-     * @return string|false
-     * @error PEAR_CHANNELFILE_ERROR_NO_NAME
-     * @error PEAR_CHANNELFILE_ERROR_INVALID_NAME
-     */
-    function setName($name)
-    {
-        return $this->setServer($name);
-    }
-
-    /**
-     * Set the socket number (port) that is used to connect to this channel
-     * @param integer
-     * @param string|false name of the mirror server, or false for the primary
-     */
-    function setPort($port, $mirror = false)
-    {
-        if ($mirror) {
-            if (!isset($this->_channelInfo['servers']['mirror'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                    array('mirror' => $mirror));
-                return false;
-            }
-
-            if (isset($this->_channelInfo['servers']['mirror'][0])) {
-                foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
-                    if ($mirror == $mir['attribs']['host']) {
-                        $this->_channelInfo['servers']['mirror'][$i]['attribs']['port'] = $port;
-                        return true;
-                    }
-                }
-
-                return false;
-            } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
-                $this->_channelInfo['servers']['mirror']['attribs']['port'] = $port;
-                $this->_isValid = false;
-                return true;
-            }
-        }
-
-        $this->_channelInfo['servers']['primary']['attribs']['port'] = $port;
-        $this->_isValid = false;
-        return true;
-    }
-
-    /**
-     * Set the socket number (port) that is used to connect to this channel
-     * @param bool Determines whether to turn on SSL support or turn it off
-     * @param string|false name of the mirror server, or false for the primary
-     */
-    function setSSL($ssl = true, $mirror = false)
-    {
-        if ($mirror) {
-            if (!isset($this->_channelInfo['servers']['mirror'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                    array('mirror' => $mirror));
-                return false;
-            }
-
-            if (isset($this->_channelInfo['servers']['mirror'][0])) {
-                foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
-                    if ($mirror == $mir['attribs']['host']) {
-                        if (!$ssl) {
-                            if (isset($this->_channelInfo['servers']['mirror'][$i]
-                                  ['attribs']['ssl'])) {
-                                unset($this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl']);
-                            }
-                        } else {
-                            $this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl'] = 'yes';
-                        }
-
-                        return true;
-                    }
-                }
-
-                return false;
-            } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
-                if (!$ssl) {
-                    if (isset($this->_channelInfo['servers']['mirror']['attribs']['ssl'])) {
-                        unset($this->_channelInfo['servers']['mirror']['attribs']['ssl']);
-                    }
-                } else {
-                    $this->_channelInfo['servers']['mirror']['attribs']['ssl'] = 'yes';
-                }
-
-                $this->_isValid = false;
-                return true;
-            }
-        }
-
-        if ($ssl) {
-            $this->_channelInfo['servers']['primary']['attribs']['ssl'] = 'yes';
-        } else {
-            if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) {
-                unset($this->_channelInfo['servers']['primary']['attribs']['ssl']);
-            }
-        }
-
-        $this->_isValid = false;
-        return true;
-    }
-
-    /**
-     * @param string
-     * @return string|false
-     * @error PEAR_CHANNELFILE_ERROR_NO_SERVER
-     * @error PEAR_CHANNELFILE_ERROR_INVALID_SERVER
-     */
-    function setServer($server, $mirror = false)
-    {
-        if (empty($server)) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SERVER);
-            return false;
-        } elseif (!$this->validChannelServer($server)) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
-                array('tag' => 'name', 'name' => $server));
-            return false;
-        }
-
-        if ($mirror) {
-            $found = false;
-            foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
-                if ($mirror == $mir['attribs']['host']) {
-                    $found = true;
-                    break;
-                }
-            }
-
-            if (!$found) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                    array('mirror' => $mirror));
-                return false;
-            }
-
-            $this->_channelInfo['mirror'][$i]['attribs']['host'] = $server;
-            return true;
-        }
-
-        $this->_channelInfo['name'] = $server;
-        return true;
-    }
-
-    /**
-     * @param string
-     * @return boolean success
-     * @error PEAR_CHANNELFILE_ERROR_NO_SUMMARY
-     * @warning PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY
-     */
-    function setSummary($summary)
-    {
-        if (empty($summary)) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY);
-            return false;
-        } elseif (strpos(trim($summary), "\n") !== false) {
-            $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY,
-                array('summary' => $summary));
-        }
-
-        $this->_channelInfo['summary'] = $summary;
-        return true;
-    }
-
-    /**
-     * @param string
-     * @param boolean determines whether the alias is in channel.xml or local
-     * @return boolean success
-     */
-    function setAlias($alias, $local = false)
-    {
-        if (!$this->validChannelServer($alias)) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
-                array('tag' => 'suggestedalias', 'name' => $alias));
-            return false;
-        }
-
-        if ($local) {
-            $this->_channelInfo['localalias'] = $alias;
-        } else {
-            $this->_channelInfo['suggestedalias'] = $alias;
-        }
-
-        return true;
-    }
-
-    /**
-     * @return string
-     */
-    function getAlias()
-    {
-        if (isset($this->_channelInfo['localalias'])) {
-            return $this->_channelInfo['localalias'];
-        }
-        if (isset($this->_channelInfo['suggestedalias'])) {
-            return $this->_channelInfo['suggestedalias'];
-        }
-        if (isset($this->_channelInfo['name'])) {
-            return $this->_channelInfo['name'];
-        }
-        return '';
-    }
-
-    /**
-     * Set the package validation object if it differs from PEAR's default
-     * The class must be includeable via changing _ in the classname to path separator,
-     * but no checking of this is made.
-     * @param string|false pass in false to reset to the default packagename regex
-     * @return boolean success
-     */
-    function setValidationPackage($validateclass, $version)
-    {
-        if (empty($validateclass)) {
-            unset($this->_channelInfo['validatepackage']);
-        }
-        $this->_channelInfo['validatepackage'] = array('_content' => $validateclass);
-        $this->_channelInfo['validatepackage']['attribs'] = array('version' => $version);
-    }
-
-    /**
-     * Add a protocol to the provides section
-     * @param string protocol type
-     * @param string protocol version
-     * @param string protocol name, if any
-     * @param string mirror name, if this is a mirror's protocol
-     * @return bool
-     */
-    function addFunction($type, $version, $name = '', $mirror = false)
-    {
-        if ($mirror) {
-            return $this->addMirrorFunction($mirror, $type, $version, $name);
-        }
-
-        $set = array('attribs' => array('version' => $version), '_content' => $name);
-        if (!isset($this->_channelInfo['servers']['primary'][$type]['function'])) {
-            if (!isset($this->_channelInfo['servers'])) {
-                $this->_channelInfo['servers'] = array('primary' =>
-                    array($type => array()));
-            } elseif (!isset($this->_channelInfo['servers']['primary'])) {
-                $this->_channelInfo['servers']['primary'] = array($type => array());
-            }
-
-            $this->_channelInfo['servers']['primary'][$type]['function'] = $set;
-            $this->_isValid = false;
-            return true;
-        } elseif (!isset($this->_channelInfo['servers']['primary'][$type]['function'][0])) {
-            $this->_channelInfo['servers']['primary'][$type]['function'] = array(
-                $this->_channelInfo['servers']['primary'][$type]['function']);
-        }
-
-        $this->_channelInfo['servers']['primary'][$type]['function'][] = $set;
-        return true;
-    }
-    /**
-     * Add a protocol to a mirror's provides section
-     * @param string mirror name (server)
-     * @param string protocol type
-     * @param string protocol version
-     * @param string protocol name, if any
-     */
-    function addMirrorFunction($mirror, $type, $version, $name = '')
-    {
-        if (!isset($this->_channelInfo['servers']['mirror'])) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                array('mirror' => $mirror));
-            return false;
-        }
-
-        $setmirror = false;
-        if (isset($this->_channelInfo['servers']['mirror'][0])) {
-            foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
-                if ($mirror == $mir['attribs']['host']) {
-                    $setmirror = &$this->_channelInfo['servers']['mirror'][$i];
-                    break;
-                }
-            }
-        } else {
-            if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
-                $setmirror = &$this->_channelInfo['servers']['mirror'];
-            }
-        }
-
-        if (!$setmirror) {
-            $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                array('mirror' => $mirror));
-            return false;
-        }
-
-        $set = array('attribs' => array('version' => $version), '_content' => $name);
-        if (!isset($setmirror[$type]['function'])) {
-            $setmirror[$type]['function'] = $set;
-            $this->_isValid = false;
-            return true;
-        } elseif (!isset($setmirror[$type]['function'][0])) {
-            $setmirror[$type]['function'] = array($setmirror[$type]['function']);
-        }
-
-        $setmirror[$type]['function'][] = $set;
-        $this->_isValid = false;
-        return true;
-    }
-
-    /**
-     * @param string Resource Type this url links to
-     * @param string URL
-     * @param string|false mirror name, if this is not a primary server REST base URL
-     */
-    function setBaseURL($resourceType, $url, $mirror = false)
-    {
-        if ($mirror) {
-            if (!isset($this->_channelInfo['servers']['mirror'])) {
-                $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
-                    array('mirror' => $mirror));
-                return false;
-            }
-
-            $setmirror = false;
-            if (isset($this->_channelInfo['servers']['mirror'][0])) {
-                foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
-                    if ($mirror == $mir['attribs']['host']) {
-                        $setmirror = &$this->_channelInfo['servers']['mirror'][$i];
-                        break;
-                    }
-                }
-            } else {
-                if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
-                    $setmirror = &$this->_channelInfo['servers']['mirror'];
-                }
-            }
-        } else {
-            $setmirror = &$this->_channelInfo['servers']['primary'];
-        }
-
-        $set = array('attribs' => array('type' => $resourceType), '_content' => $url);
-        if (!isset($setmirror['rest'])) {
-            $setmirror['rest'] = array();
-        }
-
-        if (!isset($setmirror['rest']['baseurl'])) {
-            $setmirror['rest']['baseurl'] = $set;
-            $this->_isValid = false;
-            return true;
-        } elseif (!isset($setmirror['rest']['baseurl'][0])) {
-            $setmirror['rest']['baseurl'] = array($setmirror['rest']['baseurl']);
-        }
-
-        foreach ($setmirror['rest']['baseurl'] as $i => $url) {
-            if ($url['attribs']['type'] == $resourceType) {
-                $this->_isValid = false;
-                $setmirror['rest']['baseurl'][$i] = $set;
-                return true;
-            }
-        }
-
-        $setmirror['rest']['baseurl'][] = $set;
-        $this->_isValid = false;
-        return true;
-    }
-
-    /**
-     * @param string mirror server
-     * @param int mirror http port
-     * @return boolean
-     */
-    function addMirror($server, $port = null)
-    {
-        if ($this->_channelInfo['name'] == '__uri') {
-            return false; // the __uri channel cannot have mirrors by definition
-        }
-
-        $set = array('attribs' => array('host' => $server));
-        if (is_numeric($port)) {
-            $set['attribs']['port'] = $port;
-        }
-
-        if (!isset($this->_channelInfo['servers']['mirror'])) {
-            $this->_channelInfo['servers']['mirror'] = $set;
-            return true;
-        }
-
-        if (!isset($this->_channelInfo['servers']['mirror'][0])) {
-            $this->_channelInfo['servers']['mirror'] =
-                array($this->_channelInfo['servers']['mirror']);
-        }
-
-        $this->_channelInfo['servers']['mirror'][] = $set;
-        return true;
-    }
-
-    /**
-     * Retrieve the name of the validation package for this channel
-     * @return string|false
-     */
-    function getValidationPackage()
-    {
-        if (!$this->_isValid && !$this->validate()) {
-            return false;
-        }
-
-        if (!isset($this->_channelInfo['validatepackage'])) {
-            return array('attribs' => array('version' => 'default'),
-                '_content' => 'PEAR_Validate');
-        }
-
-        return $this->_channelInfo['validatepackage'];
-    }
-
-    /**
-     * Retrieve the object that can be used for custom validation
-     * @param string|false the name of the package to validate.  If the package is
-     *                     the channel validation package, PEAR_Validate is returned
-     * @return PEAR_Validate|false false is returned if the validation package
-     *         cannot be located
-     */
-    function &getValidationObject($package = false)
-    {
-        if (!class_exists('PEAR_Validate')) {
-            require_once 'PEAR/Validate.php';
-        }
-
-        if (!$this->_isValid) {
-            if (!$this->validate()) {
-                $a = false;
-                return $a;
-            }
-        }
-
-        if (isset($this->_channelInfo['validatepackage'])) {
-            if ($package == $this->_channelInfo['validatepackage']) {
-                // channel validation packages are always validated by PEAR_Validate
-                $val = &new PEAR_Validate;
-                return $val;
-            }
-
-            if (!class_exists(str_replace('.', '_',
-                  $this->_channelInfo['validatepackage']['_content']))) {
-                if ($this->isIncludeable(str_replace('_', '/',
-                      $this->_channelInfo['validatepackage']['_content']) . '.php')) {
-                    include_once str_replace('_', '/',
-                        $this->_channelInfo['validatepackage']['_content']) . '.php';
-                    $vclass = str_replace('.', '_',
-                        $this->_channelInfo['validatepackage']['_content']);
-                    $val = &new $vclass;
-                } else {
-                    $a = false;
-                    return $a;
-                }
-            } else {
-                $vclass = str_replace('.', '_',
-                    $this->_channelInfo['validatepackage']['_content']);
-                $val = &new $vclass;
-            }
-        } else {
-            $val = &new PEAR_Validate;
-        }
-
-        return $val;
-    }
-
-    function isIncludeable($path)
-    {
-        $possibilities = explode(PATH_SEPARATOR, ini_get('include_path'));
-        foreach ($possibilities as $dir) {
-            if (file_exists($dir . DIRECTORY_SEPARATOR . $path)
-                  && is_readable($dir . DIRECTORY_SEPARATOR . $path)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * This function is used by the channel updater and retrieves a value set by
-     * the registry, or the current time if it has not been set
-     * @return string
-     */
-    function lastModified()
-    {
-        if (isset($this->_channelInfo['_lastmodified'])) {
-            return $this->_channelInfo['_lastmodified'];
-        }
-
-        return time();
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/ChannelFile/Parser.php b/lib/php/PEAR/ChannelFile/Parser.php
deleted file mode 100644
index a97493d41ac4384c4ae8764e58e194b420aff51a..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/ChannelFile/Parser.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * PEAR_ChannelFile_Parser for parsing channel.xml
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Parser.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * base xml parser class
- */
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/ChannelFile.php';
-/**
- * Parser for channel.xml
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_ChannelFile_Parser extends PEAR_XMLParser
-{
-    var $_config;
-    var $_logger;
-    var $_registry;
-
-    function setConfig(&$c)
-    {
-        $this->_config = &$c;
-        $this->_registry = &$c->getRegistry();
-    }
-
-    function setLogger(&$l)
-    {
-        $this->_logger = &$l;
-    }
-
-    function parse($data, $file)
-    {
-        if (PEAR::isError($err = parent::parse($data, $file))) {
-            return $err;
-        }
-
-        $ret = new PEAR_ChannelFile;
-        $ret->setConfig($this->_config);
-        if (isset($this->_logger)) {
-            $ret->setLogger($this->_logger);
-        }
-
-        $ret->fromArray($this->_unserializedData);
-        // make sure the filelist is in the easy to read format needed
-        $ret->flattenFilelist();
-        $ret->setPackagefile($file, $archive);
-        return $ret;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command.php b/lib/php/PEAR/Command.php
deleted file mode 100644
index 2bd6cb6f1df5cc04cbb87b9b3ddb531d0cf299da..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command.php
+++ /dev/null
@@ -1,414 +0,0 @@
-<?php
-/**
- * PEAR_Command, command pattern class
- *
- * 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: Command.php 286494 2009-07-29 06:57:11Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Frontend.php';
-require_once 'PEAR/XMLParser.php';
-
-/**
- * List of commands and what classes they are implemented in.
- * @var array command => implementing class
- */
-$GLOBALS['_PEAR_Command_commandlist'] = array();
-
-/**
- * List of commands and their descriptions
- * @var array command => description
- */
-$GLOBALS['_PEAR_Command_commanddesc'] = array();
-
-/**
- * List of shortcuts to common commands.
- * @var array shortcut => command
- */
-$GLOBALS['_PEAR_Command_shortcuts'] = array();
-
-/**
- * Array of command objects
- * @var array class => object
- */
-$GLOBALS['_PEAR_Command_objects'] = array();
-
-/**
- * PEAR command class, a simple factory class for administrative
- * commands.
- *
- * How to implement command classes:
- *
- * - The class must be called PEAR_Command_Nnn, installed in the
- *   "PEAR/Common" subdir, with a method called getCommands() that
- *   returns an array of the commands implemented by the class (see
- *   PEAR/Command/Install.php for an example).
- *
- * - The class must implement a run() function that is called with three
- *   params:
- *
- *    (string) command name
- *    (array)  assoc array with options, freely defined by each
- *             command, for example:
- *             array('force' => true)
- *    (array)  list of the other parameters
- *
- *   The run() function returns a PEAR_CommandResponse object.  Use
- *   these methods to get information:
- *
- *    int getStatus()   Returns PEAR_COMMAND_(SUCCESS|FAILURE|PARTIAL)
- *                      *_PARTIAL means that you need to issue at least
- *                      one more command to complete the operation
- *                      (used for example for validation steps).
- *
- *    string getMessage()  Returns a message for the user.  Remember,
- *                         no HTML or other interface-specific markup.
- *
- *   If something unexpected happens, run() returns a PEAR error.
- *
- * - DON'T OUTPUT ANYTHING! Return text for output instead.
- *
- * - DON'T USE HTML! The text you return will be used from both Gtk,
- *   web and command-line interfaces, so for now, keep everything to
- *   plain text.
- *
- * - DON'T USE EXIT OR DIE! Always use pear errors.  From static
- *   classes do PEAR::raiseError(), from other classes do
- *   $this->raiseError().
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command
-{
-    // {{{ factory()
-
-    /**
-     * Get the right object for executing a command.
-     *
-     * @param string $command The name of the command
-     * @param object $config  Instance of PEAR_Config object
-     *
-     * @return object the command object or a PEAR error
-     *
-     * @access public
-     * @static
-     */
-    function &factory($command, &$config)
-    {
-        if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
-            PEAR_Command::registerCommands();
-        }
-        if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
-            $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
-        }
-        if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
-            $a = PEAR::raiseError("unknown command `$command'");
-            return $a;
-        }
-        $class = $GLOBALS['_PEAR_Command_commandlist'][$command];
-        if (!class_exists($class)) {
-            require_once $GLOBALS['_PEAR_Command_objects'][$class];
-        }
-        if (!class_exists($class)) {
-            $a = PEAR::raiseError("unknown command `$command'");
-            return $a;
-        }
-        $ui =& PEAR_Command::getFrontendObject();
-        $obj = &new $class($ui, $config);
-        return $obj;
-    }
-
-    // }}}
-    // {{{ & getObject()
-    function &getObject($command)
-    {
-        $class = $GLOBALS['_PEAR_Command_commandlist'][$command];
-        if (!class_exists($class)) {
-            require_once $GLOBALS['_PEAR_Command_objects'][$class];
-        }
-        if (!class_exists($class)) {
-            return PEAR::raiseError("unknown command `$command'");
-        }
-        $ui =& PEAR_Command::getFrontendObject();
-        $config = &PEAR_Config::singleton();
-        $obj = &new $class($ui, $config);
-        return $obj;
-    }
-
-    // }}}
-    // {{{ & getFrontendObject()
-
-    /**
-     * Get instance of frontend object.
-     *
-     * @return object|PEAR_Error
-     * @static
-     */
-    function &getFrontendObject()
-    {
-        $a = &PEAR_Frontend::singleton();
-        return $a;
-    }
-
-    // }}}
-    // {{{ & setFrontendClass()
-
-    /**
-     * Load current frontend class.
-     *
-     * @param string $uiclass Name of class implementing the frontend
-     *
-     * @return object the frontend object, or a PEAR error
-     * @static
-     */
-    function &setFrontendClass($uiclass)
-    {
-        $a = &PEAR_Frontend::setFrontendClass($uiclass);
-        return $a;
-    }
-
-    // }}}
-    // {{{ setFrontendType()
-
-    /**
-     * Set current frontend.
-     *
-     * @param string $uitype Name of the frontend type (for example "CLI")
-     *
-     * @return object the frontend object, or a PEAR error
-     * @static
-     */
-    function setFrontendType($uitype)
-    {
-        $uiclass = 'PEAR_Frontend_' . $uitype;
-        return PEAR_Command::setFrontendClass($uiclass);
-    }
-
-    // }}}
-    // {{{ registerCommands()
-
-    /**
-     * Scan through the Command directory looking for classes
-     * and see what commands they implement.
-     *
-     * @param bool   (optional) if FALSE (default), the new list of
-     *               commands should replace the current one.  If TRUE,
-     *               new entries will be merged with old.
-     *
-     * @param string (optional) where (what directory) to look for
-     *               classes, defaults to the Command subdirectory of
-     *               the directory from where this file (__FILE__) is
-     *               included.
-     *
-     * @return bool TRUE on success, a PEAR error on failure
-     *
-     * @access public
-     * @static
-     */
-    function registerCommands($merge = false, $dir = null)
-    {
-        $parser = new PEAR_XMLParser;
-        if ($dir === null) {
-            $dir = dirname(__FILE__) . '/Command';
-        }
-        if (!is_dir($dir)) {
-            return PEAR::raiseError("registerCommands: opendir($dir) '$dir' does not exist or is not a directory");
-        }
-        $dp = @opendir($dir);
-        if (empty($dp)) {
-            return PEAR::raiseError("registerCommands: opendir($dir) failed");
-        }
-        if (!$merge) {
-            $GLOBALS['_PEAR_Command_commandlist'] = array();
-        }
-
-        while ($file = readdir($dp)) {
-            if ($file{0} == '.' || substr($file, -4) != '.xml') {
-                continue;
-            }
-
-            $f = substr($file, 0, -4);
-            $class = "PEAR_Command_" . $f;
-            // List of commands
-            if (empty($GLOBALS['_PEAR_Command_objects'][$class])) {
-                $GLOBALS['_PEAR_Command_objects'][$class] = "$dir/" . $f . '.php';
-            }
-
-            $parser->parse(file_get_contents("$dir/$file"));
-            $implements = $parser->getData();
-            foreach ($implements as $command => $desc) {
-                if ($command == 'attribs') {
-                    continue;
-                }
-
-                if (isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
-                    return PEAR::raiseError('Command "' . $command . '" already registered in ' .
-                        'class "' . $GLOBALS['_PEAR_Command_commandlist'][$command] . '"');
-                }
-
-                $GLOBALS['_PEAR_Command_commandlist'][$command] = $class;
-                $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc['summary'];
-                if (isset($desc['shortcut'])) {
-                    $shortcut = $desc['shortcut'];
-                    if (isset($GLOBALS['_PEAR_Command_shortcuts'][$shortcut])) {
-                        return PEAR::raiseError('Command shortcut "' . $shortcut . '" already ' .
-                            'registered to command "' . $command . '" in class "' .
-                            $GLOBALS['_PEAR_Command_commandlist'][$command] . '"');
-                    }
-                    $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command;
-                }
-
-                if (isset($desc['options']) && $desc['options']) {
-                    foreach ($desc['options'] as $oname => $option) {
-                        if (isset($option['shortopt']) && strlen($option['shortopt']) > 1) {
-                            return PEAR::raiseError('Option "' . $oname . '" short option "' .
-                                $option['shortopt'] . '" must be ' .
-                                'only 1 character in Command "' . $command . '" in class "' .
-                                $class . '"');
-                        }
-                    }
-                }
-            }
-        }
-
-        ksort($GLOBALS['_PEAR_Command_shortcuts']);
-        ksort($GLOBALS['_PEAR_Command_commandlist']);
-        @closedir($dp);
-        return true;
-    }
-
-    // }}}
-    // {{{ getCommands()
-
-    /**
-     * Get the list of currently supported commands, and what
-     * classes implement them.
-     *
-     * @return array command => implementing class
-     *
-     * @access public
-     * @static
-     */
-    function getCommands()
-    {
-        if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
-            PEAR_Command::registerCommands();
-        }
-        return $GLOBALS['_PEAR_Command_commandlist'];
-    }
-
-    // }}}
-    // {{{ getShortcuts()
-
-    /**
-     * Get the list of command shortcuts.
-     *
-     * @return array shortcut => command
-     *
-     * @access public
-     * @static
-     */
-    function getShortcuts()
-    {
-        if (empty($GLOBALS['_PEAR_Command_shortcuts'])) {
-            PEAR_Command::registerCommands();
-        }
-        return $GLOBALS['_PEAR_Command_shortcuts'];
-    }
-
-    // }}}
-    // {{{ getGetoptArgs()
-
-    /**
-     * Compiles arguments for getopt.
-     *
-     * @param string $command     command to get optstring for
-     * @param string $short_args  (reference) short getopt format
-     * @param array  $long_args   (reference) long getopt format
-     *
-     * @return void
-     *
-     * @access public
-     * @static
-     */
-    function getGetoptArgs($command, &$short_args, &$long_args)
-    {
-        if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
-            PEAR_Command::registerCommands();
-        }
-        if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
-            $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
-        }
-        if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
-            return null;
-        }
-        $obj = &PEAR_Command::getObject($command);
-        return $obj->getGetoptArgs($command, $short_args, $long_args);
-    }
-
-    // }}}
-    // {{{ getDescription()
-
-    /**
-     * Get description for a command.
-     *
-     * @param  string $command Name of the command
-     *
-     * @return string command description
-     *
-     * @access public
-     * @static
-     */
-    function getDescription($command)
-    {
-        if (!isset($GLOBALS['_PEAR_Command_commanddesc'][$command])) {
-            return null;
-        }
-        return $GLOBALS['_PEAR_Command_commanddesc'][$command];
-    }
-
-    // }}}
-    // {{{ getHelp()
-
-    /**
-     * Get help for command.
-     *
-     * @param string $command Name of the command to return help for
-     *
-     * @access public
-     * @static
-     */
-    function getHelp($command)
-    {
-        $cmds = PEAR_Command::getCommands();
-        if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
-            $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
-        }
-        if (isset($cmds[$command])) {
-            $obj = &PEAR_Command::getObject($command);
-            return $obj->getHelp($command);
-        }
-        return false;
-    }
-    // }}}
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Auth.php b/lib/php/PEAR/Command/Auth.php
deleted file mode 100644
index 9eaeeab578ab6be37d03063fac8f625053c85972..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Auth.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * PEAR_Command_Auth (login, logout commands)
- *
- * 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: Auth.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- * @deprecated since 1.8.0alpha1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Channels.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- * @deprecated since 1.8.0alpha1
- */
-class PEAR_Command_Auth extends PEAR_Command_Channels
-{
-    var $commands = array(
-        'login' => array(
-            'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]',
-            'shortcut' => 'li',
-            'function' => 'doLogin',
-            'options' => array(),
-            'doc' => '<channel name>
-WARNING: This function is deprecated in favor of using channel-login
-
-Log in to a remote channel server.  If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.',
-            ),
-        'logout' => array(
-            'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]',
-            'shortcut' => 'lo',
-            'function' => 'doLogout',
-            'options' => array(),
-            'doc' => '
-WARNING: This function is deprecated in favor of using channel-logout
-
-Logs out from the remote server.  This command does not actually
-connect to the remote server, it only deletes the stored username and
-password from your user configuration.',
-            )
-
-        );
-
-    /**
-     * PEAR_Command_Auth constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Auth(&$ui, &$config)
-    {
-        parent::PEAR_Command_Channels($ui, $config);
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Auth.xml b/lib/php/PEAR/Command/Auth.xml
deleted file mode 100644
index 590193d142a989432488be51eb5f32f01285b5a8..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Auth.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<commands version="1.0">
- <login>
-  <summary>Connects and authenticates to remote server [Deprecated in favor of channel-login]</summary>
-  <function>doLogin</function>
-  <shortcut>li</shortcut>
-  <options />
-  <doc>&lt;channel name&gt;
-WARNING: This function is deprecated in favor of using channel-login
-
-Log in to a remote channel server.  If &lt;channel name&gt; is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.</doc>
- </login>
- <logout>
-  <summary>Logs out from the remote server [Deprecated in favor of channel-logout]</summary>
-  <function>doLogout</function>
-  <shortcut>lo</shortcut>
-  <options />
-  <doc>
-WARNING: This function is deprecated in favor of using channel-logout
-
-Logs out from the remote server.  This command does not actually
-connect to the remote server, it only deletes the stored username and
-password from your user configuration.</doc>
- </logout>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Build.php b/lib/php/PEAR/Command/Build.php
deleted file mode 100644
index e4821eee7cf0580d5c0023ed767c21032bc28a24..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Build.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * PEAR_Command_Auth (build command)
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @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: Build.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for building extensions.
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Build extends PEAR_Command_Common
-{
-    var $commands = array(
-        'build' => array(
-            'summary' => 'Build an Extension From C Source',
-            'function' => 'doBuild',
-            'shortcut' => 'b',
-            'options' => array(),
-            'doc' => '[package.xml]
-Builds one or more extensions contained in a package.'
-            ),
-        );
-
-    /**
-     * PEAR_Command_Build constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Build(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function doBuild($command, $options, $params)
-    {
-        require_once 'PEAR/Builder.php';
-        if (sizeof($params) < 1) {
-            $params[0] = 'package.xml';
-        }
-
-        $builder = &new PEAR_Builder($this->ui);
-        $this->debug = $this->config->get('verbose');
-        $err = $builder->build($params[0], array(&$this, 'buildCallback'));
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-
-        return true;
-    }
-
-    function buildCallback($what, $data)
-    {
-        if (($what == 'cmdoutput' && $this->debug > 1) ||
-            ($what == 'output' && $this->debug > 0)) {
-            $this->ui->outputData(rtrim($data), 'build');
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Build.xml b/lib/php/PEAR/Command/Build.xml
deleted file mode 100644
index ec4e6f554ca148bf583c77642aa087620a4a46cd..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Build.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<commands version="1.0">
- <build>
-  <summary>Build an Extension From C Source</summary>
-  <function>doBuild</function>
-  <shortcut>b</shortcut>
-  <options />
-  <doc>[package.xml]
-Builds one or more extensions contained in a package.</doc>
- </build>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Channels.php b/lib/php/PEAR/Command/Channels.php
deleted file mode 100644
index f267d18364b3b0c1535ba8e0fee0ae1e7432ad86..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Channels.php
+++ /dev/null
@@ -1,883 +0,0 @@
-<?php
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-/**
- * PEAR_Command_Channels (list-channels, update-channels, channel-delete, channel-add,
- * channel-update, channel-info, channel-alias, channel-discover commands)
- *
- * 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: Channels.php 287561 2009-08-21 22:42:58Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500);
-
-/**
- * PEAR commands for managing channels.
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Command_Channels extends PEAR_Command_Common
-{
-    var $commands = array(
-        'list-channels' => array(
-            'summary' => 'List Available Channels',
-            'function' => 'doList',
-            'shortcut' => 'lc',
-            'options' => array(),
-            'doc' => '
-List all available channels for installation.
-',
-            ),
-        'update-channels' => array(
-            'summary' => 'Update the Channel List',
-            'function' => 'doUpdateAll',
-            'shortcut' => 'uc',
-            'options' => array(),
-            'doc' => '
-List all installed packages in all channels.
-'
-            ),
-        'channel-delete' => array(
-            'summary' => 'Remove a Channel From the List',
-            'function' => 'doDelete',
-            'shortcut' => 'cde',
-            'options' => array(),
-            'doc' => '<channel name>
-Delete a channel from the registry.  You may not
-remove any channel that has installed packages.
-'
-            ),
-        'channel-add' => array(
-            'summary' => 'Add a Channel',
-            'function' => 'doAdd',
-            'shortcut' => 'ca',
-            'options' => array(),
-            'doc' => '<channel.xml>
-Add a private channel to the channel list.  Note that all
-public channels should be synced using "update-channels".
-Parameter may be either a local file or remote URL to a
-channel.xml.
-'
-            ),
-        'channel-update' => array(
-            'summary' => 'Update an Existing Channel',
-            'function' => 'doUpdate',
-            'shortcut' => 'cu',
-            'options' => array(
-                'force' => array(
-                    'shortopt' => 'f',
-                    'doc' => 'will force download of new channel.xml if an existing channel name is used',
-                    ),
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'arg' => 'CHANNEL',
-                    'doc' => 'will force download of new channel.xml if an existing channel name is used',
-                    ),
-),
-            'doc' => '[<channel.xml>|<channel name>]
-Update a channel in the channel list directly.  Note that all
-public channels can be synced using "update-channels".
-Parameter may be a local or remote channel.xml, or the name of
-an existing channel.
-'
-            ),
-        'channel-info' => array(
-            'summary' => 'Retrieve Information on a Channel',
-            'function' => 'doInfo',
-            'shortcut' => 'ci',
-            'options' => array(),
-            'doc' => '<package>
-List the files in an installed package.
-'
-            ),
-        'channel-alias' => array(
-            'summary' => 'Specify an alias to a channel name',
-            'function' => 'doAlias',
-            'shortcut' => 'cha',
-            'options' => array(),
-            'doc' => '<channel> <alias>
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-'
-            ),
-        'channel-discover' => array(
-            'summary' => 'Initialize a Channel from its server',
-            'function' => 'doDiscover',
-            'shortcut' => 'di',
-            'options' => array(),
-            'doc' => '[<channel.xml>|<channel name>]
-Initialize a channel from its server and create a local channel.xml.
-If <channel name> is in the format "<username>:<password>@<channel>" then
-<username> and <password> will be set as the login username/password for
-<channel>. Use caution when passing the username/password in this way, as
-it may allow other users on your computer to briefly view your username/
-password via the system\'s process list.
-'
-            ),
-        'channel-login' => array(
-            'summary' => 'Connects and authenticates to remote channel server',
-            'shortcut' => 'cli',
-            'function' => 'doLogin',
-            'options' => array(),
-            'doc' => '<channel name>
-Log in to a remote channel server.  If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.',
-            ),
-        'channel-logout' => array(
-            'summary' => 'Logs out from the remote channel server',
-            'shortcut' => 'clo',
-            'function' => 'doLogout',
-            'options' => array(),
-            'doc' => '<channel name>
-Logs out from a remote channel server.  If <channel name> is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.',
-            ),
-        );
-
-    /**
-     * PEAR_Command_Registry constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Channels(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function _sortChannels($a, $b)
-    {
-        return strnatcasecmp($a->getName(), $b->getName());
-    }
-
-    function doList($command, $options, $params)
-    {
-        $reg = &$this->config->getRegistry();
-        $registered = $reg->getChannels();
-        usort($registered, array(&$this, '_sortchannels'));
-        $i = $j = 0;
-        $data = array(
-            'caption' => 'Registered Channels:',
-            'border' => true,
-            'headline' => array('Channel', 'Alias', 'Summary')
-            );
-        foreach ($registered as $channel) {
-            $data['data'][] = array($channel->getName(),
-                                    $channel->getAlias(),
-                                    $channel->getSummary());
-        }
-
-        if (count($registered) === 0) {
-            $data = '(no registered channels)';
-        }
-        $this->ui->outputData($data, $command);
-        return true;
-    }
-
-    function doUpdateAll($command, $options, $params)
-    {
-        $reg = &$this->config->getRegistry();
-        $channels = $reg->getChannels();
-
-        $success = true;
-        foreach ($channels as $channel) {
-            if ($channel->getName() != '__uri') {
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $err = $this->doUpdate('channel-update',
-                                          $options,
-                                          array($channel->getName()));
-                if (PEAR::isError($err)) {
-                    $this->ui->outputData($err->getMessage(), $command);
-                    $success = false;
-                } else {
-                    $success &= $err;
-                }
-            }
-        }
-        return $success;
-    }
-
-    function doInfo($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError("No channel specified");
-        }
-
-        $reg     = &$this->config->getRegistry();
-        $channel = strtolower($params[0]);
-        if ($reg->channelExists($channel)) {
-            $chan = $reg->getChannel($channel);
-            if (PEAR::isError($chan)) {
-                return $this->raiseError($chan);
-            }
-        } else {
-            if (strpos($channel, '://')) {
-                $downloader = &$this->getDownloader();
-                $tmpdir = $this->config->get('temp_dir');
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $loc = $downloader->downloadHttp($channel, $this->ui, $tmpdir);
-                PEAR::staticPopErrorHandling();
-                if (PEAR::isError($loc)) {
-                    return $this->raiseError('Cannot open "' . $channel .
-                        '" (' . $loc->getMessage() . ')');
-                } else {
-                    $contents = implode('', file($loc));
-                }
-            } else {
-                if (!file_exists($params[0])) {
-                    return $this->raiseError('Unknown channel "' . $channel . '"');
-                }
-
-                $fp = fopen($params[0], 'r');
-                if (!$fp) {
-                    return $this->raiseError('Cannot open "' . $params[0] . '"');
-                }
-
-                $contents = '';
-                while (!feof($fp)) {
-                    $contents .= fread($fp, 1024);
-                }
-                fclose($fp);
-            }
-
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $chan = new PEAR_ChannelFile;
-            $chan->fromXmlString($contents);
-            $chan->validate();
-            if ($errs = $chan->getErrors(true)) {
-                foreach ($errs as $err) {
-                    $this->ui->outputData($err['level'] . ': ' . $err['message']);
-                }
-                return $this->raiseError('Channel file "' . $params[0] . '" is not valid');
-            }
-        }
-
-        if (!$chan) {
-            return $this->raiseError('Serious error: Channel "' . $params[0] .
-                '" has a corrupted registry entry');
-        }
-
-        $channel = $chan->getName();
-        $caption = 'Channel ' . $channel . ' Information:';
-        $data1 = array(
-            'caption' => $caption,
-            'border' => true);
-        $data1['data']['server'] = array('Name and Server', $chan->getName());
-        if ($chan->getAlias() != $chan->getName()) {
-            $data1['data']['alias'] = array('Alias', $chan->getAlias());
-        }
-
-        $data1['data']['summary'] = array('Summary', $chan->getSummary());
-        $validate = $chan->getValidationPackage();
-        $data1['data']['vpackage'] = array('Validation Package Name', $validate['_content']);
-        $data1['data']['vpackageversion'] =
-            array('Validation Package Version', $validate['attribs']['version']);
-        $d = array();
-        $d['main'] = $data1;
-
-        $data['data'] = array();
-        $data['caption'] = 'Server Capabilities';
-        $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base');
-        if ($chan->supportsREST()) {
-            if ($chan->supportsREST()) {
-                $funcs = $chan->getFunctions('rest');
-                if (!isset($funcs[0])) {
-                    $funcs = array($funcs);
-                }
-                foreach ($funcs as $protocol) {
-                    $data['data'][] = array('rest', $protocol['attribs']['type'],
-                        $protocol['_content']);
-                }
-            }
-        } else {
-            $data['data'][] = array('No supported protocols');
-        }
-
-        $d['protocols'] = $data;
-        $data['data'] = array();
-        $mirrors = $chan->getMirrors();
-        if ($mirrors) {
-            $data['caption'] = 'Channel ' . $channel . ' Mirrors:';
-            unset($data['headline']);
-            foreach ($mirrors as $mirror) {
-                $data['data'][] = array($mirror['attribs']['host']);
-                $d['mirrors'] = $data;
-            }
-
-            foreach ($mirrors as $i => $mirror) {
-                $data['data'] = array();
-                $data['caption'] = 'Mirror ' . $mirror['attribs']['host'] . ' Capabilities';
-                $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base');
-                if ($chan->supportsREST($mirror['attribs']['host'])) {
-                    if ($chan->supportsREST($mirror['attribs']['host'])) {
-                        $funcs = $chan->getFunctions('rest', $mirror['attribs']['host']);
-                        if (!isset($funcs[0])) {
-                            $funcs = array($funcs);
-                        }
-
-                        foreach ($funcs as $protocol) {
-                            $data['data'][] = array('rest', $protocol['attribs']['type'],
-                                $protocol['_content']);
-                        }
-                    }
-                } else {
-                    $data['data'][] = array('No supported protocols');
-                }
-                $d['mirrorprotocols' . $i] = $data;
-            }
-        }
-        $this->ui->outputData($d, 'channel-info');
-    }
-
-    // }}}
-
-    function doDelete($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError('channel-delete: no channel specified');
-        }
-
-        $reg = &$this->config->getRegistry();
-        if (!$reg->channelExists($params[0])) {
-            return $this->raiseError('channel-delete: channel "' . $params[0] . '" does not exist');
-        }
-
-        $channel = $reg->channelName($params[0]);
-        if ($channel == 'pear.php.net') {
-            return $this->raiseError('Cannot delete the pear.php.net channel');
-        }
-
-        if ($channel == 'pecl.php.net') {
-            return $this->raiseError('Cannot delete the pecl.php.net channel');
-        }
-
-        if ($channel == 'doc.php.net') {
-            return $this->raiseError('Cannot delete the doc.php.net channel');
-        }
-
-        if ($channel == '__uri') {
-            return $this->raiseError('Cannot delete the __uri pseudo-channel');
-        }
-
-        if (PEAR::isError($err = $reg->listPackages($channel))) {
-            return $err;
-        }
-
-        if (count($err)) {
-            return $this->raiseError('Channel "' . $channel .
-                '" has installed packages, cannot delete');
-        }
-
-        if (!$reg->deleteChannel($channel)) {
-            return $this->raiseError('Channel "' . $channel . '" deletion failed');
-        } else {
-            $this->config->deleteChannel($channel);
-            $this->ui->outputData('Channel "' . $channel . '" deleted', $command);
-        }
-    }
-
-    function doAdd($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError('channel-add: no channel file specified');
-        }
-
-        if (strpos($params[0], '://')) {
-            $downloader = &$this->getDownloader();
-            $tmpdir = $this->config->get('temp_dir');
-            if (!file_exists($tmpdir)) {
-                require_once 'System.php';
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $err = System::mkdir(array('-p', $tmpdir));
-                PEAR::staticPopErrorHandling();
-                if (PEAR::isError($err)) {
-                    return $this->raiseError('channel-add: temp_dir does not exist: "' .
-                        $tmpdir .
-                        '" - You can change this location with "pear config-set temp_dir"');
-                }
-            }
-
-            if (!is_writable($tmpdir)) {
-                return $this->raiseError('channel-add: temp_dir is not writable: "' .
-                    $tmpdir .
-                    '" - You can change this location with "pear config-set temp_dir"');
-            }
-
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $loc = $downloader->downloadHttp($params[0], $this->ui, $tmpdir, null, false);
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($loc)) {
-                return $this->raiseError('channel-add: Cannot open "' . $params[0] .
-                    '" (' . $loc->getMessage() . ')');
-            }
-
-            list($loc, $lastmodified) = $loc;
-            $contents = implode('', file($loc));
-        } else {
-            $lastmodified = $fp = false;
-            if (file_exists($params[0])) {
-                $fp = fopen($params[0], 'r');
-            }
-
-            if (!$fp) {
-                return $this->raiseError('channel-add: cannot open "' . $params[0] . '"');
-            }
-
-            $contents = '';
-            while (!feof($fp)) {
-                $contents .= fread($fp, 1024);
-            }
-            fclose($fp);
-        }
-
-        if (!class_exists('PEAR_ChannelFile')) {
-            require_once 'PEAR/ChannelFile.php';
-        }
-
-        $channel = new PEAR_ChannelFile;
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $result = $channel->fromXmlString($contents);
-        PEAR::staticPopErrorHandling();
-        if (!$result) {
-            $exit = false;
-            if (count($errors = $channel->getErrors(true))) {
-                foreach ($errors as $error) {
-                    $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
-                    if (!$exit) {
-                        $exit = $error['level'] == 'error' ? true : false;
-                    }
-                }
-                if ($exit) {
-                    return $this->raiseError('channel-add: invalid channel.xml file');
-                }
-            }
-        }
-
-        $reg = &$this->config->getRegistry();
-        if ($reg->channelExists($channel->getName())) {
-            return $this->raiseError('channel-add: Channel "' . $channel->getName() .
-                '" exists, use channel-update to update entry', PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS);
-        }
-
-        $ret = $reg->addChannel($channel, $lastmodified);
-        if (PEAR::isError($ret)) {
-            return $ret;
-        }
-
-        if (!$ret) {
-            return $this->raiseError('channel-add: adding Channel "' . $channel->getName() .
-                '" to registry failed');
-        }
-
-        $this->config->setChannels($reg->listChannels());
-        $this->config->writeConfigFile();
-        $this->ui->outputData('Adding Channel "' . $channel->getName() . '" succeeded', $command);
-    }
-
-    function doUpdate($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError("No channel file specified");
-        }
-
-        $tmpdir = $this->config->get('temp_dir');
-        if (!file_exists($tmpdir)) {
-            require_once 'System.php';
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $err = System::mkdir(array('-p', $tmpdir));
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($err)) {
-                return $this->raiseError('channel-add: temp_dir does not exist: "' .
-                    $tmpdir .
-                    '" - You can change this location with "pear config-set temp_dir"');
-            }
-        }
-
-        if (!is_writable($tmpdir)) {
-            return $this->raiseError('channel-add: temp_dir is not writable: "' .
-                $tmpdir .
-                '" - You can change this location with "pear config-set temp_dir"');
-        }
-
-        $reg = &$this->config->getRegistry();
-        $lastmodified = false;
-        if ((!file_exists($params[0]) || is_dir($params[0]))
-              && $reg->channelExists(strtolower($params[0]))) {
-            $c = $reg->getChannel(strtolower($params[0]));
-            if (PEAR::isError($c)) {
-                return $this->raiseError($c);
-            }
-
-            $this->ui->outputData("Updating channel \"$params[0]\"", $command);
-            $dl = &$this->getDownloader(array());
-            // if force is specified, use a timestamp of "1" to force retrieval
-            $lastmodified = isset($options['force']) ? false : $c->lastModified();
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml',
-                $this->ui, $tmpdir, null, $lastmodified);
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($contents)) {
-                // Attempt to fall back to https
-                $this->ui->outputData("Channel \"$params[0]\" is not responding over http://, failed with message: " . $contents->getMessage());
-                $this->ui->outputData("Trying channel \"$params[0]\" over https:// instead");
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $contents = $dl->downloadHttp('https://' . $c->getName() . '/channel.xml',
-                    $this->ui, $tmpdir, null, $lastmodified);
-                PEAR::staticPopErrorHandling();
-                if (PEAR::isError($contents)) {
-                    return $this->raiseError('Cannot retrieve channel.xml for channel "' .
-                        $c->getName() . '" (' . $contents->getMessage() . ')');
-                }
-            }
-
-            list($contents, $lastmodified) = $contents;
-            if (!$contents) {
-                $this->ui->outputData("Channel \"$params[0]\" is up to date");
-                return;
-            }
-
-            $contents = implode('', file($contents));
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $channel = new PEAR_ChannelFile;
-            $channel->fromXmlString($contents);
-            if (!$channel->getErrors()) {
-                // security check: is the downloaded file for the channel we got it from?
-                if (strtolower($channel->getName()) != strtolower($c->getName())) {
-                    if (!isset($options['force'])) {
-                        return $this->raiseError('ERROR: downloaded channel definition file' .
-                            ' for channel "' . $channel->getName() . '" from channel "' .
-                            strtolower($c->getName()) . '"');
-                    }
-
-                    $this->ui->log(0, 'WARNING: downloaded channel definition file' .
-                        ' for channel "' . $channel->getName() . '" from channel "' .
-                        strtolower($c->getName()) . '"');
-                }
-            }
-        } else {
-            if (strpos($params[0], '://')) {
-                $dl = &$this->getDownloader();
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $loc = $dl->downloadHttp($params[0],
-                    $this->ui, $tmpdir, null, $lastmodified);
-                PEAR::staticPopErrorHandling();
-                if (PEAR::isError($loc)) {
-                    return $this->raiseError("Cannot open " . $params[0] .
-                         ' (' . $loc->getMessage() . ')');
-                }
-
-                list($loc, $lastmodified) = $loc;
-                $contents = implode('', file($loc));
-            } else {
-                $fp = false;
-                if (file_exists($params[0])) {
-                    $fp = fopen($params[0], 'r');
-                }
-
-                if (!$fp) {
-                    return $this->raiseError("Cannot open " . $params[0]);
-                }
-
-                $contents = '';
-                while (!feof($fp)) {
-                    $contents .= fread($fp, 1024);
-                }
-                fclose($fp);
-            }
-
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $channel = new PEAR_ChannelFile;
-            $channel->fromXmlString($contents);
-        }
-
-        $exit = false;
-        if (count($errors = $channel->getErrors(true))) {
-            foreach ($errors as $error) {
-                $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
-                if (!$exit) {
-                    $exit = $error['level'] == 'error' ? true : false;
-                }
-            }
-            if ($exit) {
-                return $this->raiseError('Invalid channel.xml file');
-            }
-        }
-
-        if (!$reg->channelExists($channel->getName())) {
-            return $this->raiseError('Error: Channel "' . $channel->getName() .
-                '" does not exist, use channel-add to add an entry');
-        }
-
-        $ret = $reg->updateChannel($channel, $lastmodified);
-        if (PEAR::isError($ret)) {
-            return $ret;
-        }
-
-        if (!$ret) {
-            return $this->raiseError('Updating Channel "' . $channel->getName() .
-                '" in registry failed');
-        }
-
-        $this->config->setChannels($reg->listChannels());
-        $this->config->writeConfigFile();
-        $this->ui->outputData('Update of Channel "' . $channel->getName() . '" succeeded');
-    }
-
-    function &getDownloader()
-    {
-        if (!class_exists('PEAR_Downloader')) {
-            require_once 'PEAR/Downloader.php';
-        }
-        $a = new PEAR_Downloader($this->ui, array(), $this->config);
-        return $a;
-    }
-
-    function doAlias($command, $options, $params)
-    {
-        if (count($params) === 1) {
-            return $this->raiseError('No channel alias specified');
-        }
-
-        if (count($params) !== 2 || (!empty($params[1]) && $params[1]{0} == '-')) {
-            return $this->raiseError(
-                'Invalid format, correct is: channel-alias channel alias');
-        }
-
-        $reg = &$this->config->getRegistry();
-        if (!$reg->channelExists($params[0], true)) {
-            $extra = '';
-            if ($reg->isAlias($params[0])) {
-                $extra = ' (use "channel-alias ' . $reg->channelName($params[0]) . ' ' .
-                    strtolower($params[1]) . '")';
-            }
-
-            return $this->raiseError('"' . $params[0] . '" is not a valid channel' . $extra);
-        }
-
-        if ($reg->isAlias($params[1])) {
-            return $this->raiseError('Channel "' . $reg->channelName($params[1]) . '" is ' .
-                'already aliased to "' . strtolower($params[1]) . '", cannot re-alias');
-        }
-
-        $chan = &$reg->getChannel($params[0]);
-        if (PEAR::isError($chan)) {
-            return $this->raiseError('Corrupt registry?  Error retrieving channel "' . $params[0] .
-                '" information (' . $chan->getMessage() . ')');
-        }
-
-        // make it a local alias
-        if (!$chan->setAlias(strtolower($params[1]), true)) {
-            return $this->raiseError('Alias "' . strtolower($params[1]) .
-                '" is not a valid channel alias');
-        }
-
-        $reg->updateChannel($chan);
-        $this->ui->outputData('Channel "' . $chan->getName() . '" aliased successfully to "' .
-            strtolower($params[1]) . '"');
-    }
-
-    /**
-     * The channel-discover command
-     *
-     * @param string $command command name
-     * @param array  $options option_name => value
-     * @param array  $params  list of additional parameters.
-     *               $params[0] should contain a string with either:
-     *               - <channel name> or
-     *               - <username>:<password>@<channel name>
-     * @return null|PEAR_Error
-     */
-    function doDiscover($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError("No channel server specified");
-        }
-
-        // Look for the possible input format "<username>:<password>@<channel>"
-        if (preg_match('/^(.+):(.+)@(.+)\\z/', $params[0], $matches)) {
-            $username = $matches[1];
-            $password = $matches[2];
-            $channel  = $matches[3];
-        } else {
-            $channel = $params[0];
-        }
-
-        $reg = &$this->config->getRegistry();
-        if ($reg->channelExists($channel)) {
-            if (!$reg->isAlias($channel)) {
-                return $this->raiseError("Channel \"$channel\" is already initialized", PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS);
-            }
-
-            return $this->raiseError("A channel alias named \"$channel\" " .
-                'already exists, aliasing channel "' . $reg->channelName($channel)
-                . '"');
-        }
-
-        $this->pushErrorHandling(PEAR_ERROR_RETURN);
-        $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml'));
-        $this->popErrorHandling();
-        if (PEAR::isError($err)) {
-            if ($err->getCode() === PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS) {
-                return $this->raiseError("Discovery of channel \"$channel\" failed (" .
-                    $err->getMessage() . ')');
-            }
-            // Attempt fetch via https
-            $this->ui->outputData("Discovering channel $channel over http:// failed with message: " . $err->getMessage());
-            $this->ui->outputData("Trying to discover channel $channel over https:// instead");
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $err = $this->doAdd($command, $options, array('https://' . $channel . '/channel.xml'));
-            $this->popErrorHandling();
-            if (PEAR::isError($err)) {
-                return $this->raiseError("Discovery of channel \"$channel\" failed (" .
-                    $err->getMessage() . ')');
-            }
-        }
-
-        // Store username/password if they were given
-        // Arguably we should do a logintest on the channel here, but since
-        // that's awkward on a REST-based channel (even "pear login" doesn't
-        // do it for those), and XML-RPC is deprecated, it's fairly pointless.
-        if (isset($username)) {
-            $this->config->set('username', $username, 'user', $channel);
-            $this->config->set('password', $password, 'user', $channel);
-            $this->config->store();
-            $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command);
-        }
-
-        $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command);
-    }
-
-    /**
-     * Execute the 'login' command.
-     *
-     * @param string $command command name
-     * @param array $options option_name => value
-     * @param array $params list of additional parameters
-     *
-     * @return bool TRUE on success or
-     * a PEAR error on failure
-     *
-     * @access public
-     */
-    function doLogin($command, $options, $params)
-    {
-        $reg = &$this->config->getRegistry();
-
-        // If a parameter is supplied, use that as the channel to log in to
-        $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel');
-
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($chan)) {
-            return $this->raiseError($chan);
-        }
-
-        $server   = $this->config->get('preferred_mirror', null, $channel);
-        $username = $this->config->get('username',         null, $channel);
-        if (empty($username)) {
-            $username = isset($_ENV['USER']) ? $_ENV['USER'] : null;
-        }
-        $this->ui->outputData("Logging in to $server.", $command);
-
-        list($username, $password) = $this->ui->userDialog(
-            $command,
-            array('Username', 'Password'),
-            array('text',     'password'),
-            array($username,  '')
-            );
-        $username = trim($username);
-        $password = trim($password);
-
-        $ourfile = $this->config->getConfFile('user');
-        if (!$ourfile) {
-            $ourfile = $this->config->getConfFile('system');
-        }
-
-        $this->config->set('username', $username, 'user', $channel);
-        $this->config->set('password', $password, 'user', $channel);
-
-        if ($chan->supportsREST()) {
-            $ok = true;
-        }
-
-        if ($ok !== true) {
-            return $this->raiseError('Login failed!');
-        }
-
-        $this->ui->outputData("Logged in.", $command);
-        // avoid changing any temporary settings changed with -d
-        $ourconfig = new PEAR_Config($ourfile, $ourfile);
-        $ourconfig->set('username', $username, 'user', $channel);
-        $ourconfig->set('password', $password, 'user', $channel);
-        $ourconfig->store();
-
-        return true;
-    }
-
-    /**
-     * Execute the 'logout' command.
-     *
-     * @param string $command command name
-     * @param array $options option_name => value
-     * @param array $params list of additional parameters
-     *
-     * @return bool TRUE on success or
-     * a PEAR error on failure
-     *
-     * @access public
-     */
-    function doLogout($command, $options, $params)
-    {
-        $reg     = &$this->config->getRegistry();
-
-        // If a parameter is supplied, use that as the channel to log in to
-        $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel');
-
-        $chan    = $reg->getChannel($channel);
-        if (PEAR::isError($chan)) {
-            return $this->raiseError($chan);
-        }
-
-        $server = $this->config->get('preferred_mirror', null, $channel);
-        $this->ui->outputData("Logging out from $server.", $command);
-        $this->config->remove('username', 'user', $channel);
-        $this->config->remove('password', 'user', $channel);
-        $this->config->store();
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Channels.xml b/lib/php/PEAR/Command/Channels.xml
deleted file mode 100644
index 47b72066abf928c1d1550772f721dd3bb95cfd40..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Channels.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<commands version="1.0">
- <list-channels>
-  <summary>List Available Channels</summary>
-  <function>doList</function>
-  <shortcut>lc</shortcut>
-  <options />
-  <doc>
-List all available channels for installation.
-</doc>
- </list-channels>
- <update-channels>
-  <summary>Update the Channel List</summary>
-  <function>doUpdateAll</function>
-  <shortcut>uc</shortcut>
-  <options />
-  <doc>
-List all installed packages in all channels.
-</doc>
- </update-channels>
- <channel-delete>
-  <summary>Remove a Channel From the List</summary>
-  <function>doDelete</function>
-  <shortcut>cde</shortcut>
-  <options />
-  <doc>&lt;channel name&gt;
-Delete a channel from the registry.  You may not
-remove any channel that has installed packages.
-</doc>
- </channel-delete>
- <channel-add>
-  <summary>Add a Channel</summary>
-  <function>doAdd</function>
-  <shortcut>ca</shortcut>
-  <options />
-  <doc>&lt;channel.xml&gt;
-Add a private channel to the channel list.  Note that all
-public channels should be synced using &quot;update-channels&quot;.
-Parameter may be either a local file or remote URL to a
-channel.xml.
-</doc>
- </channel-add>
- <channel-update>
-  <summary>Update an Existing Channel</summary>
-  <function>doUpdate</function>
-  <shortcut>cu</shortcut>
-  <options>
-   <force>
-    <shortopt>f</shortopt>
-    <doc>will force download of new channel.xml if an existing channel name is used</doc>
-   </force>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>will force download of new channel.xml if an existing channel name is used</doc>
-    <arg>CHANNEL</arg>
-   </channel>
-  </options>
-  <doc>[&lt;channel.xml&gt;|&lt;channel name&gt;]
-Update a channel in the channel list directly.  Note that all
-public channels can be synced using &quot;update-channels&quot;.
-Parameter may be a local or remote channel.xml, or the name of
-an existing channel.
-</doc>
- </channel-update>
- <channel-info>
-  <summary>Retrieve Information on a Channel</summary>
-  <function>doInfo</function>
-  <shortcut>ci</shortcut>
-  <options />
-  <doc>&lt;package&gt;
-List the files in an installed package.
-</doc>
- </channel-info>
- <channel-alias>
-  <summary>Specify an alias to a channel name</summary>
-  <function>doAlias</function>
-  <shortcut>cha</shortcut>
-  <options />
-  <doc>&lt;channel&gt; &lt;alias&gt;
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-</doc>
- </channel-alias>
- <channel-discover>
-  <summary>Initialize a Channel from its server</summary>
-  <function>doDiscover</function>
-  <shortcut>di</shortcut>
-  <options />
-  <doc>[&lt;channel.xml&gt;|&lt;channel name&gt;]
-Initialize a channel from its server and create a local channel.xml.
-If &lt;channel name&gt; is in the format &quot;&lt;username&gt;:&lt;password&gt;@&lt;channel&gt;&quot; then
-&lt;username&gt; and &lt;password&gt; will be set as the login username/password for
-&lt;channel&gt;. Use caution when passing the username/password in this way, as
-it may allow other users on your computer to briefly view your username/
-password via the system&#039;s process list.
-</doc>
- </channel-discover>
- <channel-login>
-  <summary>Connects and authenticates to remote channel server</summary>
-  <function>doLogin</function>
-  <shortcut>cli</shortcut>
-  <options />
-  <doc>&lt;channel name&gt;
-Log in to a remote channel server.  If &lt;channel name&gt; is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.</doc>
- </channel-login>
- <channel-logout>
-  <summary>Logs out from the remote channel server</summary>
-  <function>doLogout</function>
-  <shortcut>clo</shortcut>
-  <options />
-  <doc>&lt;channel name&gt;
-Logs out from a remote channel server.  If &lt;channel name&gt; is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.</doc>
- </channel-logout>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Common.php b/lib/php/PEAR/Command/Common.php
deleted file mode 100644
index 9427bccc35787852b6b5b0bcf79727356eb55393..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Common.php
+++ /dev/null
@@ -1,273 +0,0 @@
-<?php
-/**
- * PEAR_Command_Common base class
- *
- * 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: Common.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR.php';
-
-/**
- * PEAR commands base class
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Common extends PEAR
-{
-    /**
-     * PEAR_Config object used to pass user system and configuration
-     * on when executing commands
-     *
-     * @var PEAR_Config
-     */
-    var $config;
-    /**
-     * @var PEAR_Registry
-     * @access protected
-     */
-    var $_registry;
-
-    /**
-     * User Interface object, for all interaction with the user.
-     * @var object
-     */
-    var $ui;
-
-    var $_deps_rel_trans = array(
-                                 'lt' => '<',
-                                 'le' => '<=',
-                                 'eq' => '=',
-                                 'ne' => '!=',
-                                 'gt' => '>',
-                                 'ge' => '>=',
-                                 'has' => '=='
-                                 );
-
-    var $_deps_type_trans = array(
-                                  'pkg' => 'package',
-                                  'ext' => 'extension',
-                                  'php' => 'PHP',
-                                  'prog' => 'external program',
-                                  'ldlib' => 'external library for linking',
-                                  'rtlib' => 'external runtime library',
-                                  'os' => 'operating system',
-                                  'websrv' => 'web server',
-                                  'sapi' => 'SAPI backend'
-                                  );
-
-    /**
-     * PEAR_Command_Common constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Common(&$ui, &$config)
-    {
-        parent::PEAR();
-        $this->config = &$config;
-        $this->ui = &$ui;
-    }
-
-    /**
-     * Return a list of all the commands defined by this class.
-     * @return array list of commands
-     * @access public
-     */
-    function getCommands()
-    {
-        $ret = array();
-        foreach (array_keys($this->commands) as $command) {
-            $ret[$command] = $this->commands[$command]['summary'];
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Return a list of all the command shortcuts defined by this class.
-     * @return array shortcut => command
-     * @access public
-     */
-    function getShortcuts()
-    {
-        $ret = array();
-        foreach (array_keys($this->commands) as $command) {
-            if (isset($this->commands[$command]['shortcut'])) {
-                $ret[$this->commands[$command]['shortcut']] = $command;
-            }
-        }
-
-        return $ret;
-    }
-
-    function getOptions($command)
-    {
-        $shortcuts = $this->getShortcuts();
-        if (isset($shortcuts[$command])) {
-            $command = $shortcuts[$command];
-        }
-
-        if (isset($this->commands[$command]) &&
-              isset($this->commands[$command]['options'])) {
-            return $this->commands[$command]['options'];
-        }
-
-        return null;
-    }
-
-    function getGetoptArgs($command, &$short_args, &$long_args)
-    {
-        $short_args = '';
-        $long_args = array();
-        if (empty($this->commands[$command]) || empty($this->commands[$command]['options'])) {
-            return;
-        }
-
-        reset($this->commands[$command]['options']);
-        while (list($option, $info) = each($this->commands[$command]['options'])) {
-            $larg = $sarg = '';
-            if (isset($info['arg'])) {
-                if ($info['arg']{0} == '(') {
-                    $larg = '==';
-                    $sarg = '::';
-                    $arg = substr($info['arg'], 1, -1);
-                } else {
-                    $larg = '=';
-                    $sarg = ':';
-                    $arg = $info['arg'];
-                }
-            }
-
-            if (isset($info['shortopt'])) {
-                $short_args .= $info['shortopt'] . $sarg;
-            }
-
-            $long_args[] = $option . $larg;
-        }
-    }
-
-    /**
-    * Returns the help message for the given command
-    *
-    * @param string $command The command
-    * @return mixed A fail string if the command does not have help or
-    *               a two elements array containing [0]=>help string,
-    *               [1]=> help string for the accepted cmd args
-    */
-    function getHelp($command)
-    {
-        $config = &PEAR_Config::singleton();
-        if (!isset($this->commands[$command])) {
-            return "No such command \"$command\"";
-        }
-
-        $help = null;
-        if (isset($this->commands[$command]['doc'])) {
-            $help = $this->commands[$command]['doc'];
-        }
-
-        if (empty($help)) {
-            // XXX (cox) Fallback to summary if there is no doc (show both?)
-            if (!isset($this->commands[$command]['summary'])) {
-                return "No help for command \"$command\"";
-            }
-            $help = $this->commands[$command]['summary'];
-        }
-
-        if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) {
-            foreach($matches[0] as $k => $v) {
-                $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help);
-            }
-        }
-
-        return array($help, $this->getHelpArgs($command));
-    }
-
-    /**
-     * Returns the help for the accepted arguments of a command
-     *
-     * @param  string $command
-     * @return string The help string
-     */
-    function getHelpArgs($command)
-    {
-        if (isset($this->commands[$command]['options']) &&
-            count($this->commands[$command]['options']))
-        {
-            $help = "Options:\n";
-            foreach ($this->commands[$command]['options'] as $k => $v) {
-                if (isset($v['arg'])) {
-                    if ($v['arg'][0] == '(') {
-                        $arg = substr($v['arg'], 1, -1);
-                        $sapp = " [$arg]";
-                        $lapp = "[=$arg]";
-                    } else {
-                        $sapp = " $v[arg]";
-                        $lapp = "=$v[arg]";
-                    }
-                } else {
-                    $sapp = $lapp = "";
-                }
-
-                if (isset($v['shortopt'])) {
-                    $s = $v['shortopt'];
-                    $help .= "  -$s$sapp, --$k$lapp\n";
-                } else {
-                    $help .= "  --$k$lapp\n";
-                }
-
-                $p = "        ";
-                $doc = rtrim(str_replace("\n", "\n$p", $v['doc']));
-                $help .= "        $doc\n";
-            }
-
-            return $help;
-        }
-
-        return null;
-    }
-
-    function run($command, $options, $params)
-    {
-        if (empty($this->commands[$command]['function'])) {
-            // look for shortcuts
-            foreach (array_keys($this->commands) as $cmd) {
-                if (isset($this->commands[$cmd]['shortcut']) && $this->commands[$cmd]['shortcut'] == $command) {
-                    if (empty($this->commands[$cmd]['function'])) {
-                        return $this->raiseError("unknown command `$command'");
-                    } else {
-                        $func = $this->commands[$cmd]['function'];
-                    }
-                    $command = $cmd;
-
-                    //$command = $this->commands[$cmd]['function'];
-                    break;
-                }
-            }
-        } else {
-            $func = $this->commands[$command]['function'];
-        }
-
-        return $this->$func($command, $options, $params);
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Config.php b/lib/php/PEAR/Command/Config.php
deleted file mode 100644
index 7fd863b4b79fb299c07f2a654a65500e4424bffa..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Config.php
+++ /dev/null
@@ -1,413 +0,0 @@
-<?php
-/**
- * PEAR_Command_Config (config-show, config-get, config-set, config-help, config-create commands)
- *
- * 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: Config.php 287554 2009-08-21 21:16:25Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for managing configuration data.
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Config extends PEAR_Command_Common
-{
-    var $commands = array(
-        'config-show' => array(
-            'summary' => 'Show All Settings',
-            'function' => 'doConfigShow',
-            'shortcut' => 'csh',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'show configuration variables for another channel',
-                    'arg' => 'CHAN',
-                    ),
-),
-            'doc' => '[layer]
-Displays all configuration values.  An optional argument
-may be used to tell which configuration layer to display.  Valid
-configuration layers are "user", "system" and "default". To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-',
-            ),
-        'config-get' => array(
-            'summary' => 'Show One Setting',
-            'function' => 'doConfigGet',
-            'shortcut' => 'cg',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'show configuration variables for another channel',
-                    'arg' => 'CHAN',
-                    ),
-),
-            'doc' => '<parameter> [layer]
-Displays the value of one configuration parameter.  The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in.  Valid configuration
-layers are "user", "system" and "default".  If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified.  The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-',
-            ),
-        'config-set' => array(
-            'summary' => 'Change Setting',
-            'function' => 'doConfigSet',
-            'shortcut' => 'cs',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'show configuration variables for another channel',
-                    'arg' => 'CHAN',
-                    ),
-),
-            'doc' => '<parameter> <value> [layer]
-Sets the value of one configuration parameter.  The first argument is
-the name of the parameter, the second argument is the new value.  Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense.  An optional
-third argument may be used to specify in which layer to set the
-configuration parameter.  The default layer is "user".  The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-',
-            ),
-        'config-help' => array(
-            'summary' => 'Show Information About Setting',
-            'function' => 'doConfigHelp',
-            'shortcut' => 'ch',
-            'options' => array(),
-            'doc' => '[parameter]
-Displays help for a configuration parameter.  Without arguments it
-displays help for all configuration parameters.
-',
-           ),
-        'config-create' => array(
-            'summary' => 'Create a Default configuration file',
-            'function' => 'doConfigCreate',
-            'shortcut' => 'coc',
-            'options' => array(
-                'windows' => array(
-                    'shortopt' => 'w',
-                    'doc' => 'create a config file for a windows install',
-                    ),
-            ),
-            'doc' => '<root path> <filename>
-Create a default configuration file with all directory configuration
-variables set to subdirectories of <root path>, and save it as <filename>.
-This is useful especially for creating a configuration file for a remote
-PEAR installation (using the --remoteconfig option of install, upgrade,
-and uninstall).
-',
-            ),
-        );
-
-    /**
-     * PEAR_Command_Config constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Config(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function doConfigShow($command, $options, $params)
-    {
-        $layer = null;
-        if (is_array($params)) {
-            $layer = isset($params[0]) ? $params[0] : null;
-        }
-
-        // $params[0] -> the layer
-        if ($error = $this->_checkLayer($layer)) {
-            return $this->raiseError("config-show:$error");
-        }
-
-        $keys = $this->config->getKeys();
-        sort($keys);
-        $channel = isset($options['channel']) ? $options['channel'] :
-            $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        if (!$reg->channelExists($channel)) {
-            return $this->raiseError('Channel "' . $channel . '" does not exist');
-        }
-
-        $channel = $reg->channelName($channel);
-        $data = array('caption' => 'Configuration (channel ' . $channel . '):');
-        foreach ($keys as $key) {
-            $type = $this->config->getType($key);
-            $value = $this->config->get($key, $layer, $channel);
-            if ($type == 'password' && $value) {
-                $value = '********';
-            }
-
-            if ($value === false) {
-                $value = 'false';
-            } elseif ($value === true) {
-                $value = 'true';
-            }
-
-            $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value);
-        }
-
-        foreach ($this->config->getLayers() as $layer) {
-            $data['data']['Config Files'][] = array(ucfirst($layer) . ' Configuration File', 'Filename' , $this->config->getConfFile($layer));
-        }
-
-        $this->ui->outputData($data, $command);
-        return true;
-    }
-
-    function doConfigGet($command, $options, $params)
-    {
-        $args_cnt = is_array($params) ? count($params) : 0;
-        switch ($args_cnt) {
-            case 1:
-                $config_key = $params[0];
-                $layer = null;
-                break;
-            case 2:
-                $config_key = $params[0];
-                $layer = $params[1];
-                if ($error = $this->_checkLayer($layer)) {
-                    return $this->raiseError("config-get:$error");
-                }
-                break;
-            case 0:
-            default:
-                return $this->raiseError("config-get expects 1 or 2 parameters");
-        }
-
-        $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        if (!$reg->channelExists($channel)) {
-            return $this->raiseError('Channel "' . $channel . '" does not exist');
-        }
-
-        $this->ui->outputData($this->config->get($config_key, $layer, $channel), $command);
-        return true;
-    }
-
-    function doConfigSet($command, $options, $params)
-    {
-        // $param[0] -> a parameter to set
-        // $param[1] -> the value for the parameter
-        // $param[2] -> the layer
-        $failmsg = '';
-        if (count($params) < 2 || count($params) > 3) {
-            $failmsg .= "config-set expects 2 or 3 parameters";
-            return PEAR::raiseError($failmsg);
-        }
-
-        if (isset($params[2]) && ($error = $this->_checkLayer($params[2]))) {
-            $failmsg .= $error;
-            return PEAR::raiseError("config-set:$failmsg");
-        }
-
-        $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        if (!$reg->channelExists($channel)) {
-            return $this->raiseError('Channel "' . $channel . '" does not exist');
-        }
-
-        $channel = $reg->channelName($channel);
-        if ($params[0] == 'default_channel' && !$reg->channelExists($params[1])) {
-            return $this->raiseError('Channel "' . $params[1] . '" does not exist');
-        }
-
-        if ($params[0] == 'preferred_mirror'
-            && (
-                !$reg->mirrorExists($channel, $params[1]) &&
-                (!$reg->channelExists($params[1]) || $channel != $params[1])
-            )
-        ) {
-            $msg  = 'Channel Mirror "' . $params[1] . '" does not exist';
-            $msg .= ' in your registry for channel "' . $channel . '".';
-            $msg .= "\n" . 'Attempt to run "pear channel-update ' . $channel .'"';
-            $msg .= ' if you believe this mirror should exist as you may';
-            $msg .= ' have outdated channel information.';
-            return $this->raiseError($msg);
-        }
-
-        if (count($params) == 2) {
-            array_push($params, 'user');
-            $layer = 'user';
-        } else {
-            $layer = $params[2];
-        }
-
-        array_push($params, $channel);
-        if (!call_user_func_array(array(&$this->config, 'set'), $params)) {
-            array_pop($params);
-            $failmsg = "config-set (" . implode(", ", $params) . ") failed, channel $channel";
-        } else {
-            $this->config->store($layer);
-        }
-
-        if ($failmsg) {
-            return $this->raiseError($failmsg);
-        }
-
-        $this->ui->outputData('config-set succeeded', $command);
-        return true;
-    }
-
-    function doConfigHelp($command, $options, $params)
-    {
-        if (empty($params)) {
-            $params = $this->config->getKeys();
-        }
-
-        $data['caption']  = "Config help" . ((count($params) == 1) ? " for $params[0]" : '');
-        $data['headline'] = array('Name', 'Type', 'Description');
-        $data['border']   = true;
-        foreach ($params as $name) {
-            $type = $this->config->getType($name);
-            $docs = $this->config->getDocs($name);
-            if ($type == 'set') {
-                $docs = rtrim($docs) . "\nValid set: " .
-                    implode(' ', $this->config->getSetValues($name));
-            }
-
-            $data['data'][] = array($name, $type, $docs);
-        }
-
-        $this->ui->outputData($data, $command);
-    }
-
-    function doConfigCreate($command, $options, $params)
-    {
-        if (count($params) != 2) {
-            return PEAR::raiseError('config-create: must have 2 parameters, root path and ' .
-                'filename to save as');
-        }
-
-        $root = $params[0];
-        // Clean up the DIRECTORY_SEPARATOR mess
-        $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
-        $root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"),
-                             array('/', '/', '/'),
-                            $root);
-        if ($root{0} != '/') {
-            if (!isset($options['windows'])) {
-                return PEAR::raiseError('Root directory must be an absolute path beginning ' .
-                    'with "/", was: "' . $root . '"');
-            }
-
-            if (!preg_match('/^[A-Za-z]:/', $root)) {
-                return PEAR::raiseError('Root directory must be an absolute path beginning ' .
-                    'with "\\" or "C:\\", was: "' . $root . '"');
-            }
-        }
-
-        $windows = isset($options['windows']);
-        if ($windows) {
-            $root = str_replace('/', '\\', $root);
-        }
-
-        if (!file_exists($params[1]) && !@touch($params[1])) {
-            return PEAR::raiseError('Could not create "' . $params[1] . '"');
-        }
-
-        $params[1] = realpath($params[1]);
-        $config = &new PEAR_Config($params[1], '#no#system#config#', false, false);
-        if ($root{strlen($root) - 1} == '/') {
-            $root = substr($root, 0, strlen($root) - 1);
-        }
-
-        $config->noRegistry();
-        $config->set('php_dir', $windows ? "$root\\pear\\php" : "$root/pear/php", 'user');
-        $config->set('data_dir', $windows ? "$root\\pear\\data" : "$root/pear/data");
-        $config->set('www_dir', $windows ? "$root\\pear\\www" : "$root/pear/www");
-        $config->set('cfg_dir', $windows ? "$root\\pear\\cfg" : "$root/pear/cfg");
-        $config->set('ext_dir', $windows ? "$root\\pear\\ext" : "$root/pear/ext");
-        $config->set('doc_dir', $windows ? "$root\\pear\\docs" : "$root/pear/docs");
-        $config->set('test_dir', $windows ? "$root\\pear\\tests" : "$root/pear/tests");
-        $config->set('cache_dir', $windows ? "$root\\pear\\cache" : "$root/pear/cache");
-        $config->set('download_dir', $windows ? "$root\\pear\\download" : "$root/pear/download");
-        $config->set('temp_dir', $windows ? "$root\\pear\\temp" : "$root/pear/temp");
-        $config->set('bin_dir', $windows ? "$root\\pear" : "$root/pear");
-        $config->writeConfigFile();
-        $this->_showConfig($config);
-        $this->ui->outputData('Successfully created default configuration file "' . $params[1] . '"',
-            $command);
-    }
-
-    function _showConfig(&$config)
-    {
-        $params = array('user');
-        $keys = $config->getKeys();
-        sort($keys);
-        $channel = 'pear.php.net';
-        $data = array('caption' => 'Configuration (channel ' . $channel . '):');
-        foreach ($keys as $key) {
-            $type = $config->getType($key);
-            $value = $config->get($key, 'user', $channel);
-            if ($type == 'password' && $value) {
-                $value = '********';
-            }
-
-            if ($value === false) {
-                $value = 'false';
-            } elseif ($value === true) {
-                $value = 'true';
-            }
-            $data['data'][$config->getGroup($key)][] =
-                array($config->getPrompt($key) , $key, $value);
-        }
-
-        foreach ($config->getLayers() as $layer) {
-            $data['data']['Config Files'][] =
-                array(ucfirst($layer) . ' Configuration File', 'Filename' ,
-                    $config->getConfFile($layer));
-        }
-
-        $this->ui->outputData($data, 'config-show');
-        return true;
-    }
-
-    /**
-     * Checks if a layer is defined or not
-     *
-     * @param string $layer The layer to search for
-     * @return mixed False on no error or the error message
-     */
-    function _checkLayer($layer = null)
-    {
-        if (!empty($layer) && $layer != 'default') {
-            $layers = $this->config->getLayers();
-            if (!in_array($layer, $layers)) {
-                return " only the layers: \"" . implode('" or "', $layers) . "\" are supported";
-            }
-        }
-
-        return false;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Config.xml b/lib/php/PEAR/Command/Config.xml
deleted file mode 100644
index f64a925f52c38a43c428f471b7b8ac8e6249ea82..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Config.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<commands version="1.0">
- <config-show>
-  <summary>Show All Settings</summary>
-  <function>doConfigShow</function>
-  <shortcut>csh</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>show configuration variables for another channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-  </options>
-  <doc>[layer]
-Displays all configuration values.  An optional argument
-may be used to tell which configuration layer to display.  Valid
-configuration layers are &quot;user&quot;, &quot;system&quot; and &quot;default&quot;. To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-</doc>
- </config-show>
- <config-get>
-  <summary>Show One Setting</summary>
-  <function>doConfigGet</function>
-  <shortcut>cg</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>show configuration variables for another channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-  </options>
-  <doc>&lt;parameter&gt; [layer]
-Displays the value of one configuration parameter.  The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in.  Valid configuration
-layers are &quot;user&quot;, &quot;system&quot; and &quot;default&quot;.  If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified.  The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-</doc>
- </config-get>
- <config-set>
-  <summary>Change Setting</summary>
-  <function>doConfigSet</function>
-  <shortcut>cs</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>show configuration variables for another channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-  </options>
-  <doc>&lt;parameter&gt; &lt;value&gt; [layer]
-Sets the value of one configuration parameter.  The first argument is
-the name of the parameter, the second argument is the new value.  Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense.  An optional
-third argument may be used to specify in which layer to set the
-configuration parameter.  The default layer is &quot;user&quot;.  The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-</doc>
- </config-set>
- <config-help>
-  <summary>Show Information About Setting</summary>
-  <function>doConfigHelp</function>
-  <shortcut>ch</shortcut>
-  <options />
-  <doc>[parameter]
-Displays help for a configuration parameter.  Without arguments it
-displays help for all configuration parameters.
-</doc>
- </config-help>
- <config-create>
-  <summary>Create a Default configuration file</summary>
-  <function>doConfigCreate</function>
-  <shortcut>coc</shortcut>
-  <options>
-   <windows>
-    <shortopt>w</shortopt>
-    <doc>create a config file for a windows install</doc>
-   </windows>
-  </options>
-  <doc>&lt;root path&gt; &lt;filename&gt;
-Create a default configuration file with all directory configuration
-variables set to subdirectories of &lt;root path&gt;, and save it as &lt;filename&gt;.
-This is useful especially for creating a configuration file for a remote
-PEAR installation (using the --remoteconfig option of install, upgrade,
-and uninstall).
-</doc>
- </config-create>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Install.php b/lib/php/PEAR/Command/Install.php
deleted file mode 100644
index d5a8dd475b161f3ebe0949a92447e8715a798f46..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Install.php
+++ /dev/null
@@ -1,1266 +0,0 @@
-<?php
-/**
- * PEAR_Command_Install (install, upgrade, upgrade-all, uninstall, bundle, run-scripts commands)
- *
- * 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: Install.php 287477 2009-08-19 14:19:43Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for installation or deinstallation/upgrading of
- * packages.
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Install extends PEAR_Command_Common
-{
-    // {{{ properties
-
-    var $commands = array(
-        'install' => array(
-            'summary' => 'Install Package',
-            'function' => 'doInstall',
-            'shortcut' => 'i',
-            'options' => array(
-                'force' => array(
-                    'shortopt' => 'f',
-                    'doc' => 'will overwrite newer installed packages',
-                    ),
-                'loose' => array(
-                    'shortopt' => 'l',
-                    'doc' => 'do not check for recommended dependency version',
-                    ),
-                'nodeps' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'ignore dependencies, install anyway',
-                    ),
-                'register-only' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'do not install files, only register the package as installed',
-                    ),
-                'soft' => array(
-                    'shortopt' => 's',
-                    'doc' => 'soft install, fail silently, or upgrade if already installed',
-                    ),
-                'nobuild' => array(
-                    'shortopt' => 'B',
-                    'doc' => 'don\'t build C extensions',
-                    ),
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'request uncompressed files when downloading',
-                    ),
-                'installroot' => array(
-                    'shortopt' => 'R',
-                    'arg' => 'DIR',
-                    'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
-                    ),
-                'packagingroot' => array(
-                    'shortopt' => 'P',
-                    'arg' => 'DIR',
-                    'doc' => 'root directory used when packaging files, like RPM packaging',
-                    ),
-                'ignore-errors' => array(
-                    'doc' => 'force install even if there were errors',
-                    ),
-                'alldeps' => array(
-                    'shortopt' => 'a',
-                    'doc' => 'install all required and optional dependencies',
-                    ),
-                'onlyreqdeps' => array(
-                    'shortopt' => 'o',
-                    'doc' => 'install all required dependencies',
-                    ),
-                'offline' => array(
-                    'shortopt' => 'O',
-                    'doc' => 'do not attempt to download any urls or contact channels',
-                    ),
-                'pretend' => array(
-                    'shortopt' => 'p',
-                    'doc' => 'Only list the packages that would be downloaded',
-                    ),
-                ),
-            'doc' => '[channel/]<package> ...
-Installs one or more PEAR packages.  You can specify a package to
-install in four ways:
-
-"Package-1.0.tgz" : installs from a local file
-
-"http://example.com/Package-1.0.tgz" : installs from
-anywhere on the net.
-
-"package.xml" : installs the package described in
-package.xml.  Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-"Package[-version/state][.tar]" : queries your default channel\'s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use "Package-1.1," to retrieve
-Package state beta, use "Package-beta."  To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-"channel/Package"
-
-More than one package may be specified at once.  It is ok to mix these
-four ways of specifying packages.
-'),
-        'upgrade' => array(
-            'summary' => 'Upgrade Package',
-            'function' => 'doInstall',
-            'shortcut' => 'up',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'upgrade packages from a specific channel',
-                    'arg' => 'CHAN',
-                    ),
-                'force' => array(
-                    'shortopt' => 'f',
-                    'doc' => 'overwrite newer installed packages',
-                    ),
-                'loose' => array(
-                    'shortopt' => 'l',
-                    'doc' => 'do not check for recommended dependency version',
-                    ),
-                'nodeps' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'ignore dependencies, upgrade anyway',
-                    ),
-                'register-only' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'do not install files, only register the package as upgraded',
-                    ),
-                'nobuild' => array(
-                    'shortopt' => 'B',
-                    'doc' => 'don\'t build C extensions',
-                    ),
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'request uncompressed files when downloading',
-                    ),
-                'installroot' => array(
-                    'shortopt' => 'R',
-                    'arg' => 'DIR',
-                    'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
-                    ),
-                'ignore-errors' => array(
-                    'doc' => 'force install even if there were errors',
-                    ),
-                'alldeps' => array(
-                    'shortopt' => 'a',
-                    'doc' => 'install all required and optional dependencies',
-                    ),
-                'onlyreqdeps' => array(
-                    'shortopt' => 'o',
-                    'doc' => 'install all required dependencies',
-                    ),
-                'offline' => array(
-                    'shortopt' => 'O',
-                    'doc' => 'do not attempt to download any urls or contact channels',
-                    ),
-                'pretend' => array(
-                    'shortopt' => 'p',
-                    'doc' => 'Only list the packages that would be downloaded',
-                    ),
-                ),
-            'doc' => '<package> ...
-Upgrades one or more PEAR packages.  See documentation for the
-"install" command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-'),
-        'upgrade-all' => array(
-            'summary' => 'Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]',
-            'function' => 'doUpgradeAll',
-            'shortcut' => 'ua',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'upgrade packages from a specific channel',
-                    'arg' => 'CHAN',
-                    ),
-                'nodeps' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'ignore dependencies, upgrade anyway',
-                    ),
-                'register-only' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'do not install files, only register the package as upgraded',
-                    ),
-                'nobuild' => array(
-                    'shortopt' => 'B',
-                    'doc' => 'don\'t build C extensions',
-                    ),
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'request uncompressed files when downloading',
-                    ),
-                'installroot' => array(
-                    'shortopt' => 'R',
-                    'arg' => 'DIR',
-                    'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
-                    ),
-                'ignore-errors' => array(
-                    'doc' => 'force install even if there were errors',
-                    ),
-                'loose' => array(
-                    'doc' => 'do not check for recommended dependency version',
-                    ),
-                ),
-            'doc' => '
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available.  Upgrades are
-done only if there is a release available of the state specified in
-"preferred_state" (currently {config preferred_state}), or a state considered
-more stable.
-'),
-        'uninstall' => array(
-            'summary' => 'Un-install Package',
-            'function' => 'doUninstall',
-            'shortcut' => 'un',
-            'options' => array(
-                'nodeps' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'ignore dependencies, uninstall anyway',
-                    ),
-                'register-only' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'do not remove files, only register the packages as not installed',
-                    ),
-                'installroot' => array(
-                    'shortopt' => 'R',
-                    'arg' => 'DIR',
-                    'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
-                    ),
-                'ignore-errors' => array(
-                    'doc' => 'force install even if there were errors',
-                    ),
-                'offline' => array(
-                    'shortopt' => 'O',
-                    'doc' => 'do not attempt to uninstall remotely',
-                    ),
-                ),
-            'doc' => '[channel/]<package> ...
-Uninstalls one or more PEAR packages.  More than one package may be
-specified at once.  Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-'),
-        'bundle' => array(
-            'summary' => 'Unpacks a Pecl Package',
-            'function' => 'doBundle',
-            'shortcut' => 'bun',
-            'options' => array(
-                'destination' => array(
-                   'shortopt' => 'd',
-                    'arg' => 'DIR',
-                    'doc' => 'Optional destination directory for unpacking (defaults to current path or "ext" if exists)',
-                    ),
-                'force' => array(
-                    'shortopt' => 'f',
-                    'doc' => 'Force the unpacking even if there were errors in the package',
-                ),
-            ),
-            'doc' => '<package>
-Unpacks a Pecl Package into the selected location. It will download the
-package if needed.
-'),
-        'run-scripts' => array(
-            'summary' => 'Run Post-Install Scripts bundled with a package',
-            'function' => 'doRunScripts',
-            'shortcut' => 'rs',
-            'options' => array(
-            ),
-            'doc' => '<package>
-Run post-installation scripts in package <package>, if any exist.
-'),
-    );
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * PEAR_Command_Install constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Install(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    // }}}
-
-    /**
-     * For unit testing purposes
-     */
-    function &getDownloader(&$ui, $options, &$config)
-    {
-        if (!class_exists('PEAR_Downloader')) {
-            require_once 'PEAR/Downloader.php';
-        }
-        $a = &new PEAR_Downloader($ui, $options, $config);
-        return $a;
-    }
-
-    /**
-     * For unit testing purposes
-     */
-    function &getInstaller(&$ui)
-    {
-        if (!class_exists('PEAR_Installer')) {
-            require_once 'PEAR/Installer.php';
-        }
-        $a = &new PEAR_Installer($ui);
-        return $a;
-    }
-
-    function enableExtension($binaries, $type)
-    {
-        if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
-            return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
-        }
-        $ini = $this->_parseIni($phpini);
-        if (PEAR::isError($ini)) {
-            return $ini;
-        }
-        $line = 0;
-        if ($type == 'extsrc' || $type == 'extbin') {
-            $search = 'extensions';
-            $enable = 'extension';
-        } else {
-            $search = 'zend_extensions';
-            ob_start();
-            phpinfo(INFO_GENERAL);
-            $info = ob_get_contents();
-            ob_end_clean();
-            $debug = function_exists('leak') ? '_debug' : '';
-            $ts = preg_match('Thread Safety.+enabled', $info) ? '_ts' : '';
-            $enable = 'zend_extension' . $debug . $ts;
-        }
-        foreach ($ini[$search] as $line => $extension) {
-            if (in_array($extension, $binaries, true) || in_array(
-                  $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
-                // already enabled - assume if one is, all are
-                return true;
-            }
-        }
-        if ($line) {
-            $newini = array_slice($ini['all'], 0, $line);
-        } else {
-            $newini = array();
-        }
-        foreach ($binaries as $binary) {
-            if ($ini['extension_dir']) {
-                $binary = basename($binary);
-            }
-            $newini[] = $enable . '="' . $binary . '"' . (OS_UNIX ? "\n" : "\r\n");
-        }
-        $newini = array_merge($newini, array_slice($ini['all'], $line));
-        $fp = @fopen($phpini, 'wb');
-        if (!$fp) {
-            return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
-        }
-        foreach ($newini as $line) {
-            fwrite($fp, $line);
-        }
-        fclose($fp);
-        return true;
-    }
-
-    function disableExtension($binaries, $type)
-    {
-        if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
-            return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
-        }
-        $ini = $this->_parseIni($phpini);
-        if (PEAR::isError($ini)) {
-            return $ini;
-        }
-        $line = 0;
-        if ($type == 'extsrc' || $type == 'extbin') {
-            $search = 'extensions';
-            $enable = 'extension';
-        } else {
-            $search = 'zend_extensions';
-            ob_start();
-            phpinfo(INFO_GENERAL);
-            $info = ob_get_contents();
-            ob_end_clean();
-            $debug = function_exists('leak') ? '_debug' : '';
-            $ts = preg_match('Thread Safety.+enabled', $info) ? '_ts' : '';
-            $enable = 'zend_extension' . $debug . $ts;
-        }
-        $found = false;
-        foreach ($ini[$search] as $line => $extension) {
-            if (in_array($extension, $binaries, true) || in_array(
-                  $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
-                $found = true;
-                break;
-            }
-        }
-        if (!$found) {
-            // not enabled
-            return true;
-        }
-        $fp = @fopen($phpini, 'wb');
-        if (!$fp) {
-            return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
-        }
-        if ($line) {
-            $newini = array_slice($ini['all'], 0, $line);
-            // delete the enable line
-            $newini = array_merge($newini, array_slice($ini['all'], $line + 1));
-        } else {
-            $newini = array_slice($ini['all'], 1);
-        }
-        foreach ($newini as $line) {
-            fwrite($fp, $line);
-        }
-        fclose($fp);
-        return true;
-    }
-
-    function _parseIni($filename)
-    {
-        if (!file_exists($filename)) {
-            return PEAR::raiseError('php.ini "' . $filename . '" does not exist');
-        }
-
-        if (filesize($filename) > 300000) {
-            return PEAR::raiseError('php.ini "' . $filename . '" is too large, aborting');
-        }
-
-        ob_start();
-        phpinfo(INFO_GENERAL);
-        $info = ob_get_contents();
-        ob_end_clean();
-        $debug = function_exists('leak') ? '_debug' : '';
-        $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
-        $zend_extension_line = 'zend_extension' . $debug . $ts;
-        $all = @file($filename);
-        if (!$all) {
-            return PEAR::raiseError('php.ini "' . $filename .'" could not be read');
-        }
-        $zend_extensions = $extensions = array();
-        // assume this is right, but pull from the php.ini if it is found
-        $extension_dir = ini_get('extension_dir');
-        foreach ($all as $linenum => $line) {
-            $line = trim($line);
-            if (!$line) {
-                continue;
-            }
-            if ($line[0] == ';') {
-                continue;
-            }
-            if (strtolower(substr($line, 0, 13)) == 'extension_dir') {
-                $line = trim(substr($line, 13));
-                if ($line[0] == '=') {
-                    $x = trim(substr($line, 1));
-                    $x = explode(';', $x);
-                    $extension_dir = str_replace('"', '', array_shift($x));
-                    continue;
-                }
-            }
-            if (strtolower(substr($line, 0, 9)) == 'extension') {
-                $line = trim(substr($line, 9));
-                if ($line[0] == '=') {
-                    $x = trim(substr($line, 1));
-                    $x = explode(';', $x);
-                    $extensions[$linenum] = str_replace('"', '', array_shift($x));
-                    continue;
-                }
-            }
-            if (strtolower(substr($line, 0, strlen($zend_extension_line))) ==
-                  $zend_extension_line) {
-                $line = trim(substr($line, strlen($zend_extension_line)));
-                if ($line[0] == '=') {
-                    $x = trim(substr($line, 1));
-                    $x = explode(';', $x);
-                    $zend_extensions[$linenum] = str_replace('"', '', array_shift($x));
-                    continue;
-                }
-            }
-        }
-        return array(
-            'extensions' => $extensions,
-            'zend_extensions' => $zend_extensions,
-            'extension_dir' => $extension_dir,
-            'all' => $all,
-        );
-    }
-
-    // {{{ doInstall()
-
-    function doInstall($command, $options, $params)
-    {
-        if (!class_exists('PEAR_PackageFile')) {
-            require_once 'PEAR/PackageFile.php';
-        }
-
-        if (isset($options['installroot']) && isset($options['packagingroot'])) {
-            return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot');
-        }
-
-        $reg = &$this->config->getRegistry();
-        $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
-        if (!$reg->channelExists($channel)) {
-            return $this->raiseError('Channel "' . $channel . '" does not exist');
-        }
-
-        if (empty($this->installer)) {
-            $this->installer = &$this->getInstaller($this->ui);
-        }
-
-        if ($command == 'upgrade' || $command == 'upgrade-all') {
-            // If people run the upgrade command but pass nothing, emulate a upgrade-all
-            if ($command == 'upgrade' && empty($params)) {
-                return $this->doUpgradeAll($command, $options, $params);
-            }
-            $options['upgrade'] = true;
-        } else {
-            $packages = $params;
-        }
-
-        $instreg = &$reg; // instreg used to check if package is installed
-        if (isset($options['packagingroot']) && !isset($options['upgrade'])) {
-            $packrootphp_dir = $this->installer->_prependPath(
-                $this->config->get('php_dir', null, 'pear.php.net'),
-                $options['packagingroot']);
-            $instreg = new PEAR_Registry($packrootphp_dir); // other instreg!
-
-            if ($this->config->get('verbose') > 2) {
-                $this->ui->outputData('using package root: ' . $options['packagingroot']);
-            }
-        }
-
-        $abstractpackages = $otherpackages = array();
-        // parse params
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-
-        foreach ($params as $param) {
-            if (strpos($param, 'http://') === 0) {
-                $otherpackages[] = $param;
-                continue;
-            }
-
-            if (strpos($param, 'channel://') === false && @file_exists($param)) {
-                if (isset($options['force'])) {
-                    $otherpackages[] = $param;
-                    continue;
-                }
-
-                $pkg = new PEAR_PackageFile($this->config);
-                $pf  = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING);
-                if (PEAR::isError($pf)) {
-                    $otherpackages[] = $param;
-                    continue;
-                }
-
-                $exists   = $reg->packageExists($pf->getPackage(), $pf->getChannel());
-                $pversion = $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel());
-                $version_compare = version_compare($pf->getVersion(), $pversion, '<=');
-                if ($exists && $version_compare) {
-                    if ($this->config->get('verbose')) {
-                        $this->ui->outputData('Ignoring installed package ' .
-                            $reg->parsedPackageNameToString(
-                            array('package' => $pf->getPackage(),
-                                  'channel' => $pf->getChannel()), true));
-                    }
-                    continue;
-                }
-                $otherpackages[] = $param;
-                continue;
-            }
-
-            $e = $reg->parsePackageName($param, $channel);
-            if (PEAR::isError($e)) {
-                $otherpackages[] = $param;
-            } else {
-                $abstractpackages[] = $e;
-            }
-        }
-        PEAR::staticPopErrorHandling();
-
-        // if there are any local package .tgz or remote static url, we can't
-        // filter.  The filter only works for abstract packages
-        if (count($abstractpackages) && !isset($options['force'])) {
-            // when not being forced, only do necessary upgrades/installs
-            if (isset($options['upgrade'])) {
-                $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command);
-            } else {
-                $count = count($abstractpackages);
-                foreach ($abstractpackages as $i => $package) {
-                    if (isset($package['group'])) {
-                        // do not filter out install groups
-                        continue;
-                    }
-
-                    if ($instreg->packageExists($package['package'], $package['channel'])) {
-                        if ($count > 1) {
-                            if ($this->config->get('verbose')) {
-                                $this->ui->outputData('Ignoring installed package ' .
-                                    $reg->parsedPackageNameToString($package, true));
-                            }
-                            unset($abstractpackages[$i]);
-                        } elseif ($count === 1) {
-                            // Lets try to upgrade it since it's already installed
-                            $options['upgrade'] = true;
-                        }
-                    }
-                }
-            }
-            $abstractpackages =
-                array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
-        } elseif (count($abstractpackages)) {
-            $abstractpackages =
-                array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
-        }
-
-        $packages = array_merge($abstractpackages, $otherpackages);
-        if (!count($packages)) {
-            $c = '';
-            if (isset($options['channel'])){
-                $c .= ' in channel "' . $options['channel'] . '"';
-            }
-            $this->ui->outputData('Nothing to ' . $command . $c);
-            return true;
-        }
-
-        $this->downloader = &$this->getDownloader($this->ui, $options, $this->config);
-        $errors = $downloaded = $binaries = array();
-        $downloaded = &$this->downloader->download($packages);
-        if (PEAR::isError($downloaded)) {
-            return $this->raiseError($downloaded);
-        }
-
-        $errors = $this->downloader->getErrorMsgs();
-        if (count($errors)) {
-            $err = array();
-            $err['data'] = array();
-            foreach ($errors as $error) {
-                if ($error !== null) {
-                    $err['data'][] = array($error);
-                }
-            }
-
-            if (!empty($err['data'])) {
-                $err['headline'] = 'Install Errors';
-                $this->ui->outputData($err);
-            }
-
-            if (!count($downloaded)) {
-                return $this->raiseError("$command failed");
-            }
-        }
-
-        $data = array(
-            'headline' => 'Packages that would be Installed'
-        );
-
-        if (isset($options['pretend'])) {
-            foreach ($downloaded as $package) {
-                $data['data'][] = array($reg->parsedPackageNameToString($package->getParsedPackage()));
-            }
-            $this->ui->outputData($data, 'pretend');
-            return true;
-        }
-
-        $this->installer->setOptions($options);
-        $this->installer->sortPackagesForInstall($downloaded);
-        if (PEAR::isError($err = $this->installer->setDownloadedPackages($downloaded))) {
-            $this->raiseError($err->getMessage());
-            return true;
-        }
-
-        $binaries = $extrainfo = array();
-        foreach ($downloaded as $param) {
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $info = $this->installer->install($param, $options);
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($info)) {
-                $oldinfo = $info;
-                $pkg = &$param->getPackageFile();
-                if ($info->getCode() != PEAR_INSTALLER_NOBINARY) {
-                    if (!($info = $pkg->installBinary($this->installer))) {
-                        $this->ui->outputData('ERROR: ' .$oldinfo->getMessage());
-                        continue;
-                    }
-
-                    // we just installed a different package than requested,
-                    // let's change the param and info so that the rest of this works
-                    $param = $info[0];
-                    $info  = $info[1];
-                }
-            }
-
-            if (!is_array($info)) {
-                return $this->raiseError("$command failed");
-            }
-
-            if ($param->getPackageType() == 'extsrc' ||
-                  $param->getPackageType() == 'extbin' ||
-                  $param->getPackageType() == 'zendextsrc' ||
-                  $param->getPackageType() == 'zendextbin') {
-                $pkg = &$param->getPackageFile();
-                if ($instbin = $pkg->getInstalledBinary()) {
-                    $instpkg = &$instreg->getPackage($instbin, $pkg->getChannel());
-                } else {
-                    $instpkg = &$instreg->getPackage($pkg->getPackage(), $pkg->getChannel());
-                }
-
-                foreach ($instpkg->getFilelist() as $name => $atts) {
-                    $pinfo = pathinfo($atts['installed_as']);
-                    if (!isset($pinfo['extension']) ||
-                          in_array($pinfo['extension'], array('c', 'h'))) {
-                        continue; // make sure we don't match php_blah.h
-                    }
-
-                    if ((strpos($pinfo['basename'], 'php_') === 0 &&
-                          $pinfo['extension'] == 'dll') ||
-                          // most unices
-                          $pinfo['extension'] == 'so' ||
-                          // hp-ux
-                          $pinfo['extension'] == 'sl') {
-                        $binaries[] = array($atts['installed_as'], $pinfo);
-                        break;
-                    }
-                }
-
-                if (count($binaries)) {
-                    foreach ($binaries as $pinfo) {
-                        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                        $ret = $this->enableExtension(array($pinfo[0]), $param->getPackageType());
-                        PEAR::staticPopErrorHandling();
-                        if (PEAR::isError($ret)) {
-                            $extrainfo[] = $ret->getMessage();
-                            if ($param->getPackageType() == 'extsrc' ||
-                                  $param->getPackageType() == 'extbin') {
-                                $exttype = 'extension';
-                            } else {
-                                ob_start();
-                                phpinfo(INFO_GENERAL);
-                                $info = ob_get_contents();
-                                ob_end_clean();
-                                $debug = function_exists('leak') ? '_debug' : '';
-                                $ts = preg_match('Thread Safety.+enabled', $info) ? '_ts' : '';
-                                $exttype = 'zend_extension' . $debug . $ts;
-                            }
-                            $extrainfo[] = 'You should add "' . $exttype . '=' .
-                                $pinfo[1]['basename'] . '" to php.ini';
-                        } else {
-                            $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() .
-                                ' enabled in php.ini';
-                        }
-                    }
-                }
-            }
-
-            if ($this->config->get('verbose') > 0) {
-                $chan = $param->getChannel();
-                $label = $reg->parsedPackageNameToString(
-                    array(
-                        'channel' => $chan,
-                        'package' => $param->getPackage(),
-                        'version' => $param->getVersion(),
-                    ));
-                $out = array('data' => "$command ok: $label");
-                if (isset($info['release_warnings'])) {
-                    $out['release_warnings'] = $info['release_warnings'];
-                }
-                $this->ui->outputData($out, $command);
-
-                if (!isset($options['register-only']) && !isset($options['offline'])) {
-                    if ($this->config->isDefinedLayer('ftp')) {
-                        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                        $info = $this->installer->ftpInstall($param);
-                        PEAR::staticPopErrorHandling();
-                        if (PEAR::isError($info)) {
-                            $this->ui->outputData($info->getMessage());
-                            $this->ui->outputData("remote install failed: $label");
-                        } else {
-                            $this->ui->outputData("remote install ok: $label");
-                        }
-                    }
-                }
-            }
-
-            $deps = $param->getDeps();
-            if ($deps) {
-                if (isset($deps['group'])) {
-                    $groups = $deps['group'];
-                    if (!isset($groups[0])) {
-                        $groups = array($groups);
-                    }
-
-                    foreach ($groups as $group) {
-                        if ($group['attribs']['name'] == 'default') {
-                            // default group is always installed, unless the user
-                            // explicitly chooses to install another group
-                            continue;
-                        }
-                        $extrainfo[] = $param->getPackage() . ': Optional feature ' .
-                            $group['attribs']['name'] . ' available (' .
-                            $group['attribs']['hint'] . ')';
-                    }
-
-                    $extrainfo[] = $param->getPackage() .
-                        ': To install optional features use "pear install ' .
-                        $reg->parsedPackageNameToString(
-                            array('package' => $param->getPackage(),
-                                  'channel' => $param->getChannel()), true) .
-                              '#featurename"';
-                }
-            }
-
-            $pkg = &$instreg->getPackage($param->getPackage(), $param->getChannel());
-            // $pkg may be NULL if install is a 'fake' install via --packagingroot
-            if (is_object($pkg)) {
-                $pkg->setConfig($this->config);
-                if ($list = $pkg->listPostinstallScripts()) {
-                    $pn = $reg->parsedPackageNameToString(array('channel' =>
-                       $param->getChannel(), 'package' => $param->getPackage()), true);
-                    $extrainfo[] = $pn . ' has post-install scripts:';
-                    foreach ($list as $file) {
-                        $extrainfo[] = $file;
-                    }
-                    $extrainfo[] = $param->getPackage() .
-                        ': Use "pear run-scripts ' . $pn . '" to finish setup.';
-                    $extrainfo[] = 'DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES';
-                }
-            }
-        }
-
-        if (count($extrainfo)) {
-            foreach ($extrainfo as $info) {
-                $this->ui->outputData($info);
-            }
-        }
-
-        return true;
-    }
-
-    // }}}
-    // {{{ doUpgradeAll()
-
-    function doUpgradeAll($command, $options, $params)
-    {
-        $reg = &$this->config->getRegistry();
-        $upgrade = array();
-
-        if (isset($options['channel'])) {
-            $channels = array($options['channel']);
-        } else {
-            $channels = $reg->listChannels();
-        }
-
-        foreach ($channels as $channel) {
-            if ($channel == '__uri') {
-                continue;
-            }
-
-            // parse name with channel
-            foreach ($reg->listPackages($channel) as $name) {
-                $upgrade[] = $reg->parsedPackageNameToString(array(
-                        'channel' => $channel,
-                        'package' => $name
-                    ));
-            }
-        }
-
-        $err = $this->doInstall($command, $options, $upgrade);
-        if (PEAR::isError($err)) {
-            $this->ui->outputData($err->getMessage(), $command);
-        }
-   }
-
-    // }}}
-    // {{{ doUninstall()
-
-    function doUninstall($command, $options, $params)
-    {
-        if (count($params) < 1) {
-            return $this->raiseError("Please supply the package(s) you want to uninstall");
-        }
-
-        if (empty($this->installer)) {
-            $this->installer = &$this->getInstaller($this->ui);
-        }
-
-        if (isset($options['remoteconfig'])) {
-            $e = $this->config->readFTPConfigFile($options['remoteconfig']);
-            if (!PEAR::isError($e)) {
-                $this->installer->setConfig($this->config);
-            }
-        }
-
-        $reg = &$this->config->getRegistry();
-        $newparams = array();
-        $binaries = array();
-        $badparams = array();
-        foreach ($params as $pkg) {
-            $channel = $this->config->get('default_channel');
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $parsed = $reg->parsePackageName($pkg, $channel);
-            PEAR::staticPopErrorHandling();
-            if (!$parsed || PEAR::isError($parsed)) {
-                $badparams[] = $pkg;
-                continue;
-            }
-            $package = $parsed['package'];
-            $channel = $parsed['channel'];
-            $info = &$reg->getPackage($package, $channel);
-            if ($info === null &&
-                 ($channel == 'pear.php.net' || $channel == 'pecl.php.net')) {
-                // make sure this isn't a package that has flipped from pear to pecl but
-                // used a package.xml 1.0
-                $testc = ($channel == 'pear.php.net') ? 'pecl.php.net' : 'pear.php.net';
-                $info = &$reg->getPackage($package, $testc);
-                if ($info !== null) {
-                    $channel = $testc;
-                }
-            }
-            if ($info === null) {
-                $badparams[] = $pkg;
-            } else {
-                $newparams[] = &$info;
-                // check for binary packages (this is an alias for those packages if so)
-                if ($installedbinary = $info->getInstalledBinary()) {
-                    $this->ui->log('adding binary package ' .
-                        $reg->parsedPackageNameToString(array('channel' => $channel,
-                            'package' => $installedbinary), true));
-                    $newparams[] = &$reg->getPackage($installedbinary, $channel);
-                }
-                // add the contents of a dependency group to the list of installed packages
-                if (isset($parsed['group'])) {
-                    $group = $info->getDependencyGroup($parsed['group']);
-                    if ($group) {
-                        $installed = $reg->getInstalledGroup($group);
-                        if ($installed) {
-                            foreach ($installed as $i => $p) {
-                                $newparams[] = &$installed[$i];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        $err = $this->installer->sortPackagesForUninstall($newparams);
-        if (PEAR::isError($err)) {
-            $this->ui->outputData($err->getMessage(), $command);
-            return true;
-        }
-        $params = $newparams;
-        // twist this to use it to check on whether dependent packages are also being uninstalled
-        // for circular dependencies like subpackages
-        $this->installer->setUninstallPackages($newparams);
-        $params = array_merge($params, $badparams);
-        $binaries = array();
-        foreach ($params as $pkg) {
-            $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
-            if ($err = $this->installer->uninstall($pkg, $options)) {
-                $this->installer->popErrorHandling();
-                if (PEAR::isError($err)) {
-                    $this->ui->outputData($err->getMessage(), $command);
-                    continue;
-                }
-                if ($pkg->getPackageType() == 'extsrc' ||
-                      $pkg->getPackageType() == 'extbin' ||
-                      $pkg->getPackageType() == 'zendextsrc' ||
-                      $pkg->getPackageType() == 'zendextbin') {
-                    if ($instbin = $pkg->getInstalledBinary()) {
-                        continue; // this will be uninstalled later
-                    }
-
-                    foreach ($pkg->getFilelist() as $name => $atts) {
-                        $pinfo = pathinfo($atts['installed_as']);
-                        if (!isset($pinfo['extension']) ||
-                              in_array($pinfo['extension'], array('c', 'h'))) {
-                            continue; // make sure we don't match php_blah.h
-                        }
-                        if ((strpos($pinfo['basename'], 'php_') === 0 &&
-                              $pinfo['extension'] == 'dll') ||
-                              // most unices
-                              $pinfo['extension'] == 'so' ||
-                              // hp-ux
-                              $pinfo['extension'] == 'sl') {
-                            $binaries[] = array($atts['installed_as'], $pinfo);
-                            break;
-                        }
-                    }
-                    if (count($binaries)) {
-                        foreach ($binaries as $pinfo) {
-                            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                            $ret = $this->disableExtension(array($pinfo[0]), $pkg->getPackageType());
-                            PEAR::staticPopErrorHandling();
-                            if (PEAR::isError($ret)) {
-                                $extrainfo[] = $ret->getMessage();
-                                if ($pkg->getPackageType() == 'extsrc' ||
-                                      $pkg->getPackageType() == 'extbin') {
-                                    $exttype = 'extension';
-                                } else {
-                                    ob_start();
-                                    phpinfo(INFO_GENERAL);
-                                    $info = ob_get_contents();
-                                    ob_end_clean();
-                                    $debug = function_exists('leak') ? '_debug' : '';
-                                    $ts = preg_match('Thread Safety.+enabled', $info) ? '_ts' : '';
-                                    $exttype = 'zend_extension' . $debug . $ts;
-                                }
-                                $this->ui->outputData('Unable to remove "' . $exttype . '=' .
-                                    $pinfo[1]['basename'] . '" from php.ini', $command);
-                            } else {
-                                $this->ui->outputData('Extension ' . $pkg->getProvidesExtension() .
-                                    ' disabled in php.ini', $command);
-                            }
-                        }
-                    }
-                }
-                $savepkg = $pkg;
-                if ($this->config->get('verbose') > 0) {
-                    if (is_object($pkg)) {
-                        $pkg = $reg->parsedPackageNameToString($pkg);
-                    }
-                    $this->ui->outputData("uninstall ok: $pkg", $command);
-                }
-                if (!isset($options['offline']) && is_object($savepkg) &&
-                      defined('PEAR_REMOTEINSTALL_OK')) {
-                    if ($this->config->isDefinedLayer('ftp')) {
-                        $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
-                        $info = $this->installer->ftpUninstall($savepkg);
-                        $this->installer->popErrorHandling();
-                        if (PEAR::isError($info)) {
-                            $this->ui->outputData($info->getMessage());
-                            $this->ui->outputData("remote uninstall failed: $pkg");
-                        } else {
-                            $this->ui->outputData("remote uninstall ok: $pkg");
-                        }
-                    }
-                }
-            } else {
-                $this->installer->popErrorHandling();
-                if (!is_object($pkg)) {
-                    return $this->raiseError("uninstall failed: $pkg");
-                }
-                $pkg = $reg->parsedPackageNameToString($pkg);
-            }
-        }
-
-        return true;
-    }
-
-    // }}}
-
-
-    // }}}
-    // {{{ doBundle()
-    /*
-    (cox) It just downloads and untars the package, does not do
-            any check that the PEAR_Installer::_installFile() does.
-    */
-
-    function doBundle($command, $options, $params)
-    {
-        $opts = array(
-            'force'        => true,
-            'nodeps'       => true,
-            'soft'         => true,
-            'downloadonly' => true
-        );
-        $downloader = &$this->getDownloader($this->ui, $opts, $this->config);
-        $reg = &$this->config->getRegistry();
-        if (count($params) < 1) {
-            return $this->raiseError("Please supply the package you want to bundle");
-        }
-
-        if (isset($options['destination'])) {
-            if (!is_dir($options['destination'])) {
-                System::mkdir('-p ' . $options['destination']);
-            }
-            $dest = realpath($options['destination']);
-        } else {
-            $pwd  = getcwd();
-            $dir  = $pwd . DIRECTORY_SEPARATOR . 'ext';
-            $dest = is_dir($dir) ? $dir : $pwd;
-        }
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $err = $downloader->setDownloadDir($dest);
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($err)) {
-            return PEAR::raiseError('download directory "' . $dest .
-                '" is not writeable.');
-        }
-        $result = &$downloader->download(array($params[0]));
-        if (PEAR::isError($result)) {
-            return $result;
-        }
-        if (!isset($result[0])) {
-            return $this->raiseError('unable to unpack ' . $params[0]);
-        }
-        $pkgfile = &$result[0]->getPackageFile();
-        $pkgname = $pkgfile->getName();
-        $pkgversion = $pkgfile->getVersion();
-
-        // Unpacking -------------------------------------------------
-        $dest .= DIRECTORY_SEPARATOR . $pkgname;
-        $orig = $pkgname . '-' . $pkgversion;
-
-        $tar = &new Archive_Tar($pkgfile->getArchiveFile());
-        if (!$tar->extractModify($dest, $orig)) {
-            return $this->raiseError('unable to unpack ' . $pkgfile->getArchiveFile());
-        }
-        $this->ui->outputData("Package ready at '$dest'");
-    // }}}
-    }
-
-    // }}}
-
-    function doRunScripts($command, $options, $params)
-    {
-        if (!isset($params[0])) {
-            return $this->raiseError('run-scripts expects 1 parameter: a package name');
-        }
-
-        $reg = &$this->config->getRegistry();
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($parsed)) {
-            return $this->raiseError($parsed);
-        }
-
-        $package = &$reg->getPackage($parsed['package'], $parsed['channel']);
-        if (!is_object($package)) {
-            return $this->raiseError('Could not retrieve package "' . $params[0] . '" from registry');
-        }
-
-        $package->setConfig($this->config);
-        $package->runPostinstallScripts();
-        $this->ui->outputData('Install scripts complete', $command);
-        return true;
-    }
-
-    /**
-     * Given a list of packages, filter out those ones that are already up to date
-     *
-     * @param $packages: packages, in parsed array format !
-     * @return list of packages that can be upgraded
-     */
-    function _filterUptodatePackages($packages, $command)
-    {
-        $reg = &$this->config->getRegistry();
-        $latestReleases = array();
-
-        $ret = array();
-        foreach ($packages as $package) {
-            if (isset($package['group'])) {
-                $ret[] = $package;
-                continue;
-            }
-
-            $channel = $package['channel'];
-            $name    = $package['package'];
-            if (!$reg->packageExists($name, $channel)) {
-                $ret[] = $package;
-                continue;
-            }
-
-            if (!isset($latestReleases[$channel])) {
-                // fill in cache for this channel
-                $chan = &$reg->getChannel($channel);
-                if (PEAR::isError($chan)) {
-                    return $this->raiseError($chan);
-                }
-
-                $base2 = false;
-                $preferred_mirror = $this->config->get('preferred_mirror', null, $channel);
-                if ($chan->supportsREST($preferred_mirror) &&
-                    (
-                       //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) ||
-                       ($base  = $chan->getBaseURL('REST1.0', $preferred_mirror))
-                    )
-                ) {
-                    $dorest = true;
-                }
-
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                if (!isset($package['state'])) {
-                    $state = $this->config->get('preferred_state', null, $channel);
-                } else {
-                    $state = $package['state'];
-                }
-
-                if ($dorest) {
-                    if ($base2) {
-                        $rest = &$this->config->getREST('1.4', array());
-                        $base = $base2;
-                    } else {
-                        $rest = &$this->config->getREST('1.0', array());
-                    }
-
-                    $installed = array_flip($reg->listPackages($channel));
-                    $latest    = $rest->listLatestUpgrades($base, $state, $installed, $channel, $reg);
-                }
-
-                PEAR::staticPopErrorHandling();
-                if (PEAR::isError($latest)) {
-                    $this->ui->outputData('Error getting channel info from ' . $channel .
-                        ': ' . $latest->getMessage());
-                    continue;
-                }
-
-                $latestReleases[$channel] = array_change_key_case($latest);
-            }
-
-            // check package for latest release
-            $name_lower = strtolower($name);
-            if (isset($latestReleases[$channel][$name_lower])) {
-                // if not set, up to date
-                $inst_version    = $reg->packageInfo($name, 'version', $channel);
-                $channel_version = $latestReleases[$channel][$name_lower]['version'];
-                if (version_compare($channel_version, $inst_version, 'le')) {
-                    // installed version is up-to-date
-                    continue;
-                }
-
-                // maintain BC
-                if ($command == 'upgrade-all') {
-                    $this->ui->outputData(array('data' => 'Will upgrade ' .
-                        $reg->parsedPackageNameToString($package)), $command);
-                }
-                $ret[] = $package;
-            }
-        }
-
-        return $ret;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Install.xml b/lib/php/PEAR/Command/Install.xml
deleted file mode 100644
index 1b1e933c22da92225b6ed73a0e8f76f6df47bcdf..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Install.xml
+++ /dev/null
@@ -1,276 +0,0 @@
-<commands version="1.0">
- <install>
-  <summary>Install Package</summary>
-  <function>doInstall</function>
-  <shortcut>i</shortcut>
-  <options>
-   <force>
-    <shortopt>f</shortopt>
-    <doc>will overwrite newer installed packages</doc>
-   </force>
-   <loose>
-    <shortopt>l</shortopt>
-    <doc>do not check for recommended dependency version</doc>
-   </loose>
-   <nodeps>
-    <shortopt>n</shortopt>
-    <doc>ignore dependencies, install anyway</doc>
-   </nodeps>
-   <register-only>
-    <shortopt>r</shortopt>
-    <doc>do not install files, only register the package as installed</doc>
-   </register-only>
-   <soft>
-    <shortopt>s</shortopt>
-    <doc>soft install, fail silently, or upgrade if already installed</doc>
-   </soft>
-   <nobuild>
-    <shortopt>B</shortopt>
-    <doc>don&#039;t build C extensions</doc>
-   </nobuild>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>request uncompressed files when downloading</doc>
-   </nocompress>
-   <installroot>
-    <shortopt>R</shortopt>
-    <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT), use packagingroot for RPM</doc>
-    <arg>DIR</arg>
-   </installroot>
-   <packagingroot>
-    <shortopt>P</shortopt>
-    <doc>root directory used when packaging files, like RPM packaging</doc>
-    <arg>DIR</arg>
-   </packagingroot>
-   <ignore-errors>
-    <shortopt></shortopt>
-    <doc>force install even if there were errors</doc>
-   </ignore-errors>
-   <alldeps>
-    <shortopt>a</shortopt>
-    <doc>install all required and optional dependencies</doc>
-   </alldeps>
-   <onlyreqdeps>
-    <shortopt>o</shortopt>
-    <doc>install all required dependencies</doc>
-   </onlyreqdeps>
-   <offline>
-    <shortopt>O</shortopt>
-    <doc>do not attempt to download any urls or contact channels</doc>
-   </offline>
-   <pretend>
-    <shortopt>p</shortopt>
-    <doc>Only list the packages that would be downloaded</doc>
-   </pretend>
-  </options>
-  <doc>[channel/]&lt;package&gt; ...
-Installs one or more PEAR packages.  You can specify a package to
-install in four ways:
-
-&quot;Package-1.0.tgz&quot; : installs from a local file
-
-&quot;http://example.com/Package-1.0.tgz&quot; : installs from
-anywhere on the net.
-
-&quot;package.xml&quot; : installs the package described in
-package.xml.  Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-&quot;Package[-version/state][.tar]&quot; : queries your default channel&#039;s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use &quot;Package-1.1,&quot; to retrieve
-Package state beta, use &quot;Package-beta.&quot;  To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-&quot;channel/Package&quot;
-
-More than one package may be specified at once.  It is ok to mix these
-four ways of specifying packages.
-</doc>
- </install>
- <upgrade>
-  <summary>Upgrade Package</summary>
-  <function>doInstall</function>
-  <shortcut>up</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>upgrade packages from a specific channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-   <force>
-    <shortopt>f</shortopt>
-    <doc>overwrite newer installed packages</doc>
-   </force>
-   <loose>
-    <shortopt>l</shortopt>
-    <doc>do not check for recommended dependency version</doc>
-   </loose>
-   <nodeps>
-    <shortopt>n</shortopt>
-    <doc>ignore dependencies, upgrade anyway</doc>
-   </nodeps>
-   <register-only>
-    <shortopt>r</shortopt>
-    <doc>do not install files, only register the package as upgraded</doc>
-   </register-only>
-   <nobuild>
-    <shortopt>B</shortopt>
-    <doc>don&#039;t build C extensions</doc>
-   </nobuild>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>request uncompressed files when downloading</doc>
-   </nocompress>
-   <installroot>
-    <shortopt>R</shortopt>
-    <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT)</doc>
-    <arg>DIR</arg>
-   </installroot>
-   <ignore-errors>
-    <shortopt></shortopt>
-    <doc>force install even if there were errors</doc>
-   </ignore-errors>
-   <alldeps>
-    <shortopt>a</shortopt>
-    <doc>install all required and optional dependencies</doc>
-   </alldeps>
-   <onlyreqdeps>
-    <shortopt>o</shortopt>
-    <doc>install all required dependencies</doc>
-   </onlyreqdeps>
-   <offline>
-    <shortopt>O</shortopt>
-    <doc>do not attempt to download any urls or contact channels</doc>
-   </offline>
-   <pretend>
-    <shortopt>p</shortopt>
-    <doc>Only list the packages that would be downloaded</doc>
-   </pretend>
-  </options>
-  <doc>&lt;package&gt; ...
-Upgrades one or more PEAR packages.  See documentation for the
-&quot;install&quot; command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-</doc>
- </upgrade>
- <upgrade-all>
-  <summary>Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]</summary>
-  <function>doUpgradeAll</function>
-  <shortcut>ua</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>upgrade packages from a specific channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-   <nodeps>
-    <shortopt>n</shortopt>
-    <doc>ignore dependencies, upgrade anyway</doc>
-   </nodeps>
-   <register-only>
-    <shortopt>r</shortopt>
-    <doc>do not install files, only register the package as upgraded</doc>
-   </register-only>
-   <nobuild>
-    <shortopt>B</shortopt>
-    <doc>don&#039;t build C extensions</doc>
-   </nobuild>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>request uncompressed files when downloading</doc>
-   </nocompress>
-   <installroot>
-    <shortopt>R</shortopt>
-    <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT), use packagingroot for RPM</doc>
-    <arg>DIR</arg>
-   </installroot>
-   <ignore-errors>
-    <shortopt></shortopt>
-    <doc>force install even if there were errors</doc>
-   </ignore-errors>
-   <loose>
-    <shortopt></shortopt>
-    <doc>do not check for recommended dependency version</doc>
-   </loose>
-  </options>
-  <doc>
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available.  Upgrades are
-done only if there is a release available of the state specified in
-&quot;preferred_state&quot; (currently {config preferred_state}), or a state considered
-more stable.
-</doc>
- </upgrade-all>
- <uninstall>
-  <summary>Un-install Package</summary>
-  <function>doUninstall</function>
-  <shortcut>un</shortcut>
-  <options>
-   <nodeps>
-    <shortopt>n</shortopt>
-    <doc>ignore dependencies, uninstall anyway</doc>
-   </nodeps>
-   <register-only>
-    <shortopt>r</shortopt>
-    <doc>do not remove files, only register the packages as not installed</doc>
-   </register-only>
-   <installroot>
-    <shortopt>R</shortopt>
-    <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT)</doc>
-    <arg>DIR</arg>
-   </installroot>
-   <ignore-errors>
-    <shortopt></shortopt>
-    <doc>force install even if there were errors</doc>
-   </ignore-errors>
-   <offline>
-    <shortopt>O</shortopt>
-    <doc>do not attempt to uninstall remotely</doc>
-   </offline>
-  </options>
-  <doc>[channel/]&lt;package&gt; ...
-Uninstalls one or more PEAR packages.  More than one package may be
-specified at once.  Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-</doc>
- </uninstall>
- <bundle>
-  <summary>Unpacks a Pecl Package</summary>
-  <function>doBundle</function>
-  <shortcut>bun</shortcut>
-  <options>
-   <destination>
-    <shortopt>d</shortopt>
-    <doc>Optional destination directory for unpacking (defaults to current path or &quot;ext&quot; if exists)</doc>
-    <arg>DIR</arg>
-   </destination>
-   <force>
-    <shortopt>f</shortopt>
-    <doc>Force the unpacking even if there were errors in the package</doc>
-   </force>
-  </options>
-  <doc>&lt;package&gt;
-Unpacks a Pecl Package into the selected location. It will download the
-package if needed.
-</doc>
- </bundle>
- <run-scripts>
-  <summary>Run Post-Install Scripts bundled with a package</summary>
-  <function>doRunScripts</function>
-  <shortcut>rs</shortcut>
-  <options />
-  <doc>&lt;package&gt;
-Run post-installation scripts in package &lt;package&gt;, if any exist.
-</doc>
- </run-scripts>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Mirror.php b/lib/php/PEAR/Command/Mirror.php
deleted file mode 100644
index 10140b8852ebfe0866eebf0a8df308e80cb134ed..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Mirror.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * PEAR_Command_Mirror (download-all command)
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Alexander Merz <alexmerz@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Mirror.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.2.0
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for providing file mirrors
- *
- * @category   pear
- * @package    PEAR
- * @author     Alexander Merz <alexmerz@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.2.0
- */
-class PEAR_Command_Mirror extends PEAR_Command_Common
-{
-    var $commands = array(
-        'download-all' => array(
-            'summary' => 'Downloads each available package from the default channel',
-            'function' => 'doDownloadAll',
-            'shortcut' => 'da',
-            'options' => array(
-                'channel' =>
-                    array(
-                    'shortopt' => 'c',
-                    'doc' => 'specify a channel other than the default channel',
-                    'arg' => 'CHAN',
-                    ),
-                ),
-            'doc' => '
-Requests a list of available packages from the default channel ({config default_channel})
-and downloads them to current working directory.  Note: only
-packages within preferred_state ({config preferred_state}) will be downloaded'
-            ),
-        );
-
-    /**
-     * PEAR_Command_Mirror constructor.
-     *
-     * @access public
-     * @param object PEAR_Frontend a reference to an frontend
-     * @param object PEAR_Config a reference to the configuration data
-     */
-    function PEAR_Command_Mirror(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    /**
-     * For unit-testing
-     */
-    function &factory($a)
-    {
-        $a = &PEAR_Command::factory($a, $this->config);
-        return $a;
-    }
-
-    /**
-    * retrieves a list of avaible Packages from master server
-    * and downloads them
-    *
-    * @access public
-    * @param string $command the command
-    * @param array $options the command options before the command
-    * @param array $params the stuff after the command name
-    * @return bool true if succesful
-    * @throw PEAR_Error
-    */
-    function doDownloadAll($command, $options, $params)
-    {
-        $savechannel = $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        $channel = isset($options['channel']) ? $options['channel'] :
-            $this->config->get('default_channel');
-        if (!$reg->channelExists($channel)) {
-            $this->config->set('default_channel', $savechannel);
-            return $this->raiseError('Channel "' . $channel . '" does not exist');
-        }
-        $this->config->set('default_channel', $channel);
-
-        $this->ui->outputData('Using Channel ' . $this->config->get('default_channel'));
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($chan)) {
-            return $this->raiseError($chan);
-        }
-
-        if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
-            $rest = &$this->config->getREST('1.0', array());
-            $remoteInfo = array_flip($rest->listPackages($base, $channel));
-        }
-
-        if (PEAR::isError($remoteInfo)) {
-            return $remoteInfo;
-        }
-
-        $cmd = &$this->factory("download");
-        if (PEAR::isError($cmd)) {
-            return $cmd;
-        }
-
-        $this->ui->outputData('Using Preferred State of ' .
-            $this->config->get('preferred_state'));
-        $this->ui->outputData('Gathering release information, please wait...');
-
-        /**
-         * Error handling not necessary, because already done by
-         * the download command
-         */
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo));
-        PEAR::staticPopErrorHandling();
-        $this->config->set('default_channel', $savechannel);
-        if (PEAR::isError($err)) {
-            $this->ui->outputData($err->getMessage());
-        }
-
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Mirror.xml b/lib/php/PEAR/Command/Mirror.xml
deleted file mode 100644
index fe8be9d03bf94a11aae5fb1fbbe338932bd2c9c8..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Mirror.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<commands version="1.0">
- <download-all>
-  <summary>Downloads each available package from the default channel</summary>
-  <function>doDownloadAll</function>
-  <shortcut>da</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>specify a channel other than the default channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-  </options>
-  <doc>
-Requests a list of available packages from the default channel ({config default_channel})
-and downloads them to current working directory.  Note: only
-packages within preferred_state ({config preferred_state}) will be downloaded</doc>
- </download-all>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Package.php b/lib/php/PEAR/Command/Package.php
deleted file mode 100644
index 483decc29d781843394c1d58896563fd8dd31fd5..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Package.php
+++ /dev/null
@@ -1,1108 +0,0 @@
-<?php
-/**
- * PEAR_Command_Package (package, package-validate, cvsdiff, cvstag, package-dependencies,
- * sign, makerpm, convert commands)
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Martin Jansen <mj@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: Package.php 287559 2009-08-21 22:33:10Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Martin Jansen <mj@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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-
-class PEAR_Command_Package extends PEAR_Command_Common
-{
-    var $commands = array(
-        'package' => array(
-            'summary' => 'Build Package',
-            'function' => 'doPackage',
-            'shortcut' => 'p',
-            'options' => array(
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'Do not gzip the package file'
-                    ),
-                'showname' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'Print the name of the packaged file.',
-                    ),
-                ),
-            'doc' => '[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml).  If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0.  The
-package.xml version 1.0 will be saved as "package.xml" in the archive,
-and the other as "package2.xml" in the archive"
-'
-            ),
-        'package-validate' => array(
-            'summary' => 'Validate Package Consistency',
-            'function' => 'doPackageValidate',
-            'shortcut' => 'pv',
-            'options' => array(),
-            'doc' => '
-',
-            ),
-        'cvsdiff' => array(
-            'summary' => 'Run a "cvs diff" for all files in a package',
-            'function' => 'doCvsDiff',
-            'shortcut' => 'cd',
-            'options' => array(
-                'quiet' => array(
-                    'shortopt' => 'q',
-                    'doc' => 'Be quiet',
-                    ),
-                'reallyquiet' => array(
-                    'shortopt' => 'Q',
-                    'doc' => 'Be really quiet',
-                    ),
-                'date' => array(
-                    'shortopt' => 'D',
-                    'doc' => 'Diff against revision of DATE',
-                    'arg' => 'DATE',
-                    ),
-                'release' => array(
-                    'shortopt' => 'R',
-                    'doc' => 'Diff against tag for package release REL',
-                    'arg' => 'REL',
-                    ),
-                'revision' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'Diff against revision REV',
-                    'arg' => 'REV',
-                    ),
-                'context' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'Generate context diff',
-                    ),
-                'unified' => array(
-                    'shortopt' => 'u',
-                    'doc' => 'Generate unified diff',
-                    ),
-                'ignore-case' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'Ignore case, consider upper- and lower-case letters equivalent',
-                    ),
-                'ignore-whitespace' => array(
-                    'shortopt' => 'b',
-                    'doc' => 'Ignore changes in amount of white space',
-                    ),
-                'ignore-blank-lines' => array(
-                    'shortopt' => 'B',
-                    'doc' => 'Ignore changes that insert or delete blank lines',
-                    ),
-                'brief' => array(
-                    'doc' => 'Report only whether the files differ, no details',
-                    ),
-                'dry-run' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'Don\'t do anything, just pretend',
-                    ),
-                ),
-            'doc' => '<package.xml>
-Compares all the files in a package.  Without any options, this
-command will compare the current code with the last checked-in code.
-Using the -r or -R option you may compare the current code with that
-of a specific release.
-',
-            ),
-         'svntag' => array(
-             'summary' => 'Set SVN Release Tag',
-             'function' => 'doSvnTag',
-             'shortcut' => 'sv',
-             'options' => array(
-                 'quiet' => array(
-                     'shortopt' => 'q',
-                     'doc' => 'Be quiet',
-                     ),
-                 'slide' => array(
-                     'shortopt' => 'F',
-                     'doc' => 'Move (slide) tag if it exists',
-                     ),
-                 'delete' => array(
-                     'shortopt' => 'd',
-                     'doc' => 'Remove tag',
-                     ),
-                 'dry-run' => array(
-                     'shortopt' => 'n',
-                     'doc' => 'Don\'t do anything, just pretend',
-                     ),
-                 ),
-             'doc' => '<package.xml> [files...]
- Sets a SVN tag on all files in a package.  Use this command after you have
- packaged a distribution tarball with the "package" command to tag what
- revisions of what files were in that release.  If need to fix something
- after running cvstag once, but before the tarball is released to the public,
- use the "slide" option to move the release tag.
-
- to include files (such as a second package.xml, or tests not included in the
- release), pass them as additional parameters.
- ',
-             ),
-        'cvstag' => array(
-            'summary' => 'Set CVS Release Tag',
-            'function' => 'doCvsTag',
-            'shortcut' => 'ct',
-            'options' => array(
-                'quiet' => array(
-                    'shortopt' => 'q',
-                    'doc' => 'Be quiet',
-                    ),
-                'reallyquiet' => array(
-                    'shortopt' => 'Q',
-                    'doc' => 'Be really quiet',
-                    ),
-                'slide' => array(
-                    'shortopt' => 'F',
-                    'doc' => 'Move (slide) tag if it exists',
-                    ),
-                'delete' => array(
-                    'shortopt' => 'd',
-                    'doc' => 'Remove tag',
-                    ),
-                'dry-run' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'Don\'t do anything, just pretend',
-                    ),
-                ),
-            'doc' => '<package.xml> [files...]
-Sets a CVS tag on all files in a package.  Use this command after you have
-packaged a distribution tarball with the "package" command to tag what
-revisions of what files were in that release.  If need to fix something
-after running cvstag once, but before the tarball is released to the public,
-use the "slide" option to move the release tag.
-
-to include files (such as a second package.xml, or tests not included in the
-release), pass them as additional parameters.
-',
-            ),
-        'package-dependencies' => array(
-            'summary' => 'Show package dependencies',
-            'function' => 'doPackageDependencies',
-            'shortcut' => 'pd',
-            'options' => array(),
-            'doc' => '<package-file> or <package.xml> or <install-package-name>
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.'
-            ),
-        'sign' => array(
-            'summary' => 'Sign a package distribution file',
-            'function' => 'doSign',
-            'shortcut' => 'si',
-            'options' => array(
-                'verbose' => array(
-                    'shortopt' => 'v',
-                    'doc' => 'Display GnuPG output',
-                    ),
-            ),
-            'doc' => '<package-file>
-Signs a package distribution (.tar or .tgz) file with GnuPG.',
-            ),
-        'makerpm' => array(
-            'summary' => 'Builds an RPM spec file from a PEAR package',
-            'function' => 'doMakeRPM',
-            'shortcut' => 'rpm',
-            'options' => array(
-                'spec-template' => array(
-                    'shortopt' => 't',
-                    'arg' => 'FILE',
-                    'doc' => 'Use FILE as RPM spec file template'
-                    ),
-                'rpm-pkgname' => array(
-                    'shortopt' => 'p',
-                    'arg' => 'FORMAT',
-                    'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to "PEAR::%s".',
-                    ),
-                ),
-            'doc' => '<package-file>
-
-Creates an RPM .spec file for wrapping a PEAR package inside an RPM
-package.  Intended to be used from the SPECS directory, with the PEAR
-package tarball in the SOURCES directory:
-
-$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
-...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
-',
-            ),
-        'convert' => array(
-            'summary' => 'Convert a package.xml 1.0 to package.xml 2.0 format',
-            'function' => 'doConvert',
-            'shortcut' => 'c2',
-            'options' => array(
-                'flat' => array(
-                    'shortopt' => 'f',
-                    'doc' => 'do not beautify the filelist.',
-                    ),
-                ),
-            'doc' => '[descfile] [descfile2]
-Converts a package.xml in 1.0 format into a package.xml
-in 2.0 format.  The new file will be named package2.xml by default,
-and package.xml will be used as the old file by default.
-This is not the most intelligent conversion, and should only be
-used for automated conversion or learning the format.
-'
-            ),
-        );
-
-    var $output;
-
-    /**
-     * PEAR_Command_Package constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Package(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function _displayValidationResults($err, $warn, $strict = false)
-    {
-        foreach ($err as $e) {
-            $this->output .= "Error: $e\n";
-        }
-        foreach ($warn as $w) {
-            $this->output .= "Warning: $w\n";
-        }
-        $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n",
-                                       sizeof($err), sizeof($warn));
-        if ($strict && count($err) > 0) {
-            $this->output .= "Fix these errors and try again.";
-            return false;
-        }
-        return true;
-    }
-
-    function &getPackager()
-    {
-        if (!class_exists('PEAR_Packager')) {
-            require_once 'PEAR/Packager.php';
-        }
-        $a = &new PEAR_Packager;
-        return $a;
-    }
-
-    function &getPackageFile($config, $debug = false, $tmpdir = null)
-    {
-        if (!class_exists('PEAR_Common')) {
-            require_once 'PEAR/Common.php';
-        }
-        if (!class_exists('PEAR_PackageFile')) {
-            require_once 'PEAR/PackageFile.php';
-        }
-        $a = &new PEAR_PackageFile($config, $debug, $tmpdir);
-        $common = new PEAR_Common;
-        $common->ui = $this->ui;
-        $a->setLogger($common);
-        return $a;
-    }
-
-    function doPackage($command, $options, $params)
-    {
-        $this->output = '';
-        $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';
-        $pkg2 = isset($params[1]) ? $params[1] : null;
-        if (!$pkg2 && !isset($params[0]) && file_exists('package2.xml')) {
-            $pkg2 = 'package2.xml';
-        }
-
-        $packager = &$this->getPackager();
-        $compress = empty($options['nocompress']) ? true : false;
-        $result   = $packager->package($pkginfofile, $compress, $pkg2);
-        if (PEAR::isError($result)) {
-            return $this->raiseError($result);
-        }
-
-        // Don't want output, only the package file name just created
-        if (isset($options['showname'])) {
-            $this->output = $result;
-        }
-
-        if ($this->output) {
-            $this->ui->outputData($this->output, $command);
-        }
-
-        return true;
-    }
-
-    function doPackageValidate($command, $options, $params)
-    {
-        $this->output = '';
-        if (count($params) < 1) {
-            $params[0] = 'package.xml';
-        }
-
-        $obj = &$this->getPackageFile($this->config, $this->_debug);
-        $obj->rawReturn();
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);
-        if (PEAR::isError($info)) {
-            $info = $obj->fromPackageFile($params[0], PEAR_VALIDATE_NORMAL);
-        } else {
-            $archive = $info->getArchiveFile();
-            $tar = &new Archive_Tar($archive);
-            $tar->extract(dirname($info->getPackageFile()));
-            $info->setPackageFile(dirname($info->getPackageFile()) . DIRECTORY_SEPARATOR .
-                $info->getPackage() . '-' . $info->getVersion() . DIRECTORY_SEPARATOR .
-                basename($info->getPackageFile()));
-        }
-
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $valid = false;
-        if ($info->getPackagexmlVersion() == '2.0') {
-            if ($valid = $info->validate(PEAR_VALIDATE_NORMAL)) {
-                $info->flattenFileList();
-                $valid = $info->validate(PEAR_VALIDATE_PACKAGING);
-            }
-        } else {
-            $valid = $info->validate(PEAR_VALIDATE_PACKAGING);
-        }
-
-        $err = $warn = array();
-        if ($errors = $info->getValidationWarnings()) {
-            foreach ($errors as $error) {
-                if ($error['level'] == 'warning') {
-                    $warn[] = $error['message'];
-                } else {
-                    $err[] = $error['message'];
-                }
-            }
-        }
-
-        $this->_displayValidationResults($err, $warn);
-        $this->ui->outputData($this->output, $command);
-        return true;
-    }
-
-    function doSvnTag($command, $options, $params)
-    {
-        $this->output = '';
-        $_cmd = $command;
-        if (count($params) < 1) {
-            $help = $this->getHelp($command);
-            return $this->raiseError("$command: missing parameter: $help[0]");
-        }
-
-        $packageFile = realpath($params[0]);
-        $dir = dirname($packageFile);
-        $dir = substr($dir, strrpos($dir, '/') + 1);
-        $obj  = &$this->getPackageFile($this->config, $this->_debug);
-        $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL);
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $err = $warn = array();
-        if (!$info->validate()) {
-            foreach ($info->getValidationWarnings() as $error) {
-                if ($error['level'] == 'warning') {
-                    $warn[] = $error['message'];
-                } else {
-                    $err[] = $error['message'];
-                }
-            }
-        }
-
-        if (!$this->_displayValidationResults($err, $warn, true)) {
-            $this->ui->outputData($this->output, $command);
-            return $this->raiseError('SVN tag failed');
-        }
-
-        $version    = $info->getVersion();
-        $package    = $info->getName();
-        $svntag     = "$package-$version";
-
-        if (isset($options['delete'])) {
-            return $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options);
-        }
-
-        $path = $this->_svnFindPath($packageFile);
-
-        // Check if there are any modified files
-        $fp = popen('svn st --xml ' . dirname($packageFile), "r");
-        $out = '';
-        while ($line = fgets($fp, 1024)) {
-            $out .= rtrim($line)."\n";
-        }
-        pclose($fp);
-
-        if (!isset($options['quiet']) && strpos($out, 'item="modified"')) {
-            $params = array(array(
-                'name' => 'modified',
-                'type' => 'yesno',
-                'default' => 'no',
-                'prompt' => 'You have files in your SVN checkout (' . $path['from']  . ') that have been modified but not commited, do you still want to tag ' . $version . '?',
-            ));
-            $answers = $this->ui->confirmDialog($params);
-
-            if (!in_array($answers['modified'], array('y', 'yes', 'on', '1'))) {
-                return true;
-            }
-        }
-
-        if (isset($options['slide'])) {
-            $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options);
-        }
-
-        // Check if tag already exists
-        $releaseTag = $path['local']['base'] . 'tags/' . $svntag;
-        $existsCommand = 'svn ls ' . $path['base'] . 'tags/';
-
-        $fp = popen($existsCommand, "r");
-        $out = '';
-        while ($line = fgets($fp, 1024)) {
-            $out .= rtrim($line)."\n";
-        }
-        pclose($fp);
-
-        if (in_array($svntag . '/', explode("\n", $out))) {
-            $this->ui->outputData($this->output, $command);
-            return $this->raiseError('SVN tag ' . $svntag . ' for ' . $package . ' already exists.');
-        } else {
-            $makeCommand = 'svn mkdir ' . $releaseTag;
-            $this->output .= "+ $makeCommand\n";
-            if (empty($options['dry-run'])) {
-                // We need to create the tag dir.
-                $fp = popen($makeCommand, "r");
-                $out = '';
-                while ($line = fgets($fp, 1024)) {
-                    $out .= rtrim($line)."\n";
-                }
-                pclose($fp);
-                $this->output .= "$out\n";
-            }
-        }
-
-        $command = 'svn';
-        if (isset($options['quiet'])) {
-            $command .= ' -q';
-        }
-
-        $command .= ' copy --parents ';
-
-        $dir   = dirname($packageFile);
-        $dir   = substr($dir, strrpos($dir, '/') + 1);
-        $files = array_keys($info->getFilelist());
-        $commands = array();
-        foreach ($files as $file) {
-            if (!file_exists($file)) {
-                $file = $dir . DIRECTORY_SEPARATOR . $file;
-            }
-            $commands[] = $command . ' ' . escapeshellarg($file) . ' ' .
-                          escapeshellarg($releaseTag . DIRECTORY_SEPARATOR . $file);
-        }
-
-        $this->output .= implode("\n", $commands) . "\n";
-        if (empty($options['dry-run'])) {
-            foreach ($commands as $command) {
-                $fp = popen($command, "r");
-                while ($line = fgets($fp, 1024)) {
-                    $this->output .= rtrim($line)."\n";
-                }
-                pclose($fp);
-            }
-        }
-
-        $command = 'svn ci -m "Tagging the ' . $version  . ' release" ' . $releaseTag . "\n";
-        $this->output .= "+ $command\n";
-        if (empty($options['dry-run'])) {
-            $fp = popen($command, "r");
-            while ($line = fgets($fp, 1024)) {
-                $this->output .= rtrim($line)."\n";
-            }
-            pclose($fp);
-        }
-
-        $this->ui->outputData($this->output, $_cmd);
-        return true;
-    }
-
-    function _svnFindPath($file)
-    {
-        $xml = '';
-        $command = "svn info --xml $file";
-        $fp = popen($command, "r");
-        while ($line = fgets($fp, 1024)) {
-            $xml .= rtrim($line)."\n";
-        }
-        pclose($fp);
-        $url_tag = strpos($xml, '<url>');
-        $url = substr($xml, $url_tag + 5, strpos($xml, '</url>', $url_tag + 5) - ($url_tag + 5));
-
-        $path = array();
-        $path['from'] = substr($url, 0, strrpos($url, '/'));
-        $path['base'] = substr($path['from'], 0, strrpos($path['from'], '/') + 1);
-
-        // Figure out the local paths
-        $pos = strpos($file, '/trunk/');
-        if ($pos === false) {
-            $pos = strpos($file, '/branches/');
-        }
-        $path['local']['base'] = substr($file, 0, $pos + 1);
-
-        return $path;
-    }
-
-    function _svnRemoveTag($version, $package, $tag, $packageFile, $options)
-    {
-        $command = 'svn';
-
-        if (isset($options['quiet'])) {
-            $command .= ' -q';
-        }
-
-        $command .= ' remove';
-        $command .= ' -m "Removing tag for the ' . $version  . ' release."';
-
-        $path = $this->_svnFindPath($packageFile);
-        $command .= ' ' . $path['base'] . 'tags/' . $tag;
-
-
-        if ($this->config->get('verbose') > 1) {
-            $this->output .= "+ $command\n";
-        }
-
-        $this->output .= "+ $command\n";
-        if (empty($options['dry-run'])) {
-            $fp = popen($command, "r");
-            while ($line = fgets($fp, 1024)) {
-                $this->output .= rtrim($line)."\n";
-            }
-            pclose($fp);
-        }
-
-        $this->ui->outputData($this->output, $command);
-        return true;
-    }
-
-    function doCvsTag($command, $options, $params)
-    {
-        $this->output = '';
-        $_cmd = $command;
-        if (count($params) < 1) {
-            $help = $this->getHelp($command);
-            return $this->raiseError("$command: missing parameter: $help[0]");
-        }
-
-        $packageFile = realpath($params[0]);
-        $obj  = &$this->getPackageFile($this->config, $this->_debug);
-        $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL);
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $err = $warn = array();
-        if (!$info->validate()) {
-            foreach ($info->getValidationWarnings() as $error) {
-                if ($error['level'] == 'warning') {
-                    $warn[] = $error['message'];
-                } else {
-                    $err[] = $error['message'];
-                }
-            }
-        }
-
-        if (!$this->_displayValidationResults($err, $warn, true)) {
-            $this->ui->outputData($this->output, $command);
-            return $this->raiseError('CVS tag failed');
-        }
-
-        $version    = $info->getVersion();
-        $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);
-        $cvstag     = "RELEASE_$cvsversion";
-        $files      = array_keys($info->getFilelist());
-        $command = 'cvs';
-        if (isset($options['quiet'])) {
-            $command .= ' -q';
-        }
-
-        if (isset($options['reallyquiet'])) {
-            $command .= ' -Q';
-        }
-
-        $command .= ' tag';
-        if (isset($options['slide'])) {
-            $command .= ' -F';
-        }
-
-        if (isset($options['delete'])) {
-            $command .= ' -d';
-        }
-
-        $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]);
-        array_shift($params);
-        if (count($params)) {
-            // add in additional files to be tagged
-            $files = array_merge($files, $params);
-        }
-
-        $dir = dirname($packageFile);
-        $dir = substr($dir, strrpos($dir, '/') + 1);
-        foreach ($files as $file) {
-            if (!file_exists($file)) {
-                $file = $dir . DIRECTORY_SEPARATOR . $file;
-            }
-            $command .= ' ' . escapeshellarg($file);
-        }
-
-        if ($this->config->get('verbose') > 1) {
-            $this->output .= "+ $command\n";
-        }
-
-        $this->output .= "+ $command\n";
-        if (empty($options['dry-run'])) {
-            $fp = popen($command, "r");
-            while ($line = fgets($fp, 1024)) {
-                $this->output .= rtrim($line)."\n";
-            }
-            pclose($fp);
-        }
-
-        $this->ui->outputData($this->output, $_cmd);
-        return true;
-    }
-
-    function doCvsDiff($command, $options, $params)
-    {
-        $this->output = '';
-        if (sizeof($params) < 1) {
-            $help = $this->getHelp($command);
-            return $this->raiseError("$command: missing parameter: $help[0]");
-        }
-
-        $file = realpath($params[0]);
-        $obj  = &$this->getPackageFile($this->config, $this->_debug);
-        $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL);
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $err = $warn = array();
-        if (!$info->validate()) {
-            foreach ($info->getValidationWarnings() as $error) {
-                if ($error['level'] == 'warning') {
-                    $warn[] = $error['message'];
-                } else {
-                    $err[] = $error['message'];
-                }
-            }
-        }
-
-        if (!$this->_displayValidationResults($err, $warn, true)) {
-            $this->ui->outputData($this->output, $command);
-            return $this->raiseError('CVS diff failed');
-        }
-
-        $info1 = $info->getFilelist();
-        $files = $info1;
-        $cmd = "cvs";
-        if (isset($options['quiet'])) {
-            $cmd .= ' -q';
-            unset($options['quiet']);
-        }
-
-        if (isset($options['reallyquiet'])) {
-            $cmd .= ' -Q';
-            unset($options['reallyquiet']);
-        }
-
-        if (isset($options['release'])) {
-            $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']);
-            $cvstag = "RELEASE_$cvsversion";
-            $options['revision'] = $cvstag;
-            unset($options['release']);
-        }
-
-        $execute = true;
-        if (isset($options['dry-run'])) {
-            $execute = false;
-            unset($options['dry-run']);
-        }
-
-        $cmd .= ' diff';
-        // the rest of the options are passed right on to "cvs diff"
-        foreach ($options as $option => $optarg) {
-            $arg = $short = false;
-            if (isset($this->commands[$command]['options'][$option])) {
-                $arg = $this->commands[$command]['options'][$option]['arg'];
-                $short = $this->commands[$command]['options'][$option]['shortopt'];
-            }
-            $cmd .= $short ? " -$short" : " --$option";
-            if ($arg && $optarg) {
-                $cmd .= ($short ? '' : '=') . escapeshellarg($optarg);
-            }
-        }
-
-        foreach ($files as $file) {
-            $cmd .= ' ' . escapeshellarg($file['name']);
-        }
-
-        if ($this->config->get('verbose') > 1) {
-            $this->output .= "+ $cmd\n";
-        }
-
-        if ($execute) {
-            $fp = popen($cmd, "r");
-            while ($line = fgets($fp, 1024)) {
-                $this->output .= rtrim($line)."\n";
-            }
-            pclose($fp);
-        }
-
-        $this->ui->outputData($this->output, $command);
-        return true;
-    }
-
-    function doPackageDependencies($command, $options, $params)
-    {
-        // $params[0] -> the PEAR package to list its information
-        if (count($params) !== 1) {
-            return $this->raiseError("bad parameter(s), try \"help $command\"");
-        }
-
-        $obj = &$this->getPackageFile($this->config, $this->_debug);
-        if (is_file($params[0]) || strpos($params[0], '.xml') > 0) {
-           $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
-        } else {
-            $reg  = $this->config->getRegistry();
-            $info = $obj->fromArray($reg->packageInfo($params[0]));
-        }
-
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $deps = $info->getDeps();
-        if (is_array($deps)) {
-            if ($info->getPackagexmlVersion() == '1.0') {
-                $data = array(
-                    'caption' => 'Dependencies for pear/' . $info->getPackage(),
-                    'border' => true,
-                    'headline' => array("Required?", "Type", "Name", "Relation", "Version"),
-                    );
-
-                foreach ($deps as $d) {
-                    if (isset($d['optional'])) {
-                        if ($d['optional'] == 'yes') {
-                            $req = 'No';
-                        } else {
-                            $req = 'Yes';
-                        }
-                    } else {
-                        $req = 'Yes';
-                    }
-
-                    if (isset($this->_deps_rel_trans[$d['rel']])) {
-                        $rel = $this->_deps_rel_trans[$d['rel']];
-                    } else {
-                        $rel = $d['rel'];
-                    }
-
-                    if (isset($this->_deps_type_trans[$d['type']])) {
-                        $type = ucfirst($this->_deps_type_trans[$d['type']]);
-                    } else {
-                        $type = $d['type'];
-                    }
-
-                    if (isset($d['name'])) {
-                        $name = $d['name'];
-                    } else {
-                        $name = '';
-                    }
-
-                    if (isset($d['version'])) {
-                        $version = $d['version'];
-                    } else {
-                        $version = '';
-                    }
-
-                    $data['data'][] = array($req, $type, $name, $rel, $version);
-                }
-            } else { // package.xml 2.0 dependencies display
-                require_once 'PEAR/Dependency2.php';
-                $deps = $info->getDependencies();
-                $reg = &$this->config->getRegistry();
-                if (is_array($deps)) {
-                    $d = new PEAR_Dependency2($this->config, array(), '');
-                    $data = array(
-                        'caption' => 'Dependencies for ' . $info->getPackage(),
-                        'border' => true,
-                        'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'),
-                        );
-                    foreach ($deps as $type => $subd) {
-                        $req = ($type == 'required') ? 'Yes' : 'No';
-                        if ($type == 'group') {
-                            $group = $subd['attribs']['name'];
-                        } else {
-                            $group = '';
-                        }
-
-                        if (!isset($subd[0])) {
-                            $subd = array($subd);
-                        }
-
-                        foreach ($subd as $groupa) {
-                            foreach ($groupa as $deptype => $depinfo) {
-                                if ($deptype == 'attribs') {
-                                    continue;
-                                }
-
-                                if ($deptype == 'pearinstaller') {
-                                    $deptype = 'pear Installer';
-                                }
-
-                                if (!isset($depinfo[0])) {
-                                    $depinfo = array($depinfo);
-                                }
-
-                                foreach ($depinfo as $inf) {
-                                    $name = '';
-                                    if (isset($inf['channel'])) {
-                                        $alias = $reg->channelAlias($inf['channel']);
-                                        if (!$alias) {
-                                            $alias = '(channel?) ' .$inf['channel'];
-                                        }
-                                        $name = $alias . '/';
-
-                                    }
-                                    if (isset($inf['name'])) {
-                                        $name .= $inf['name'];
-                                    } elseif (isset($inf['pattern'])) {
-                                        $name .= $inf['pattern'];
-                                    } else {
-                                        $name .= '';
-                                    }
-
-                                    if (isset($inf['uri'])) {
-                                        $name .= ' [' . $inf['uri'] .  ']';
-                                    }
-
-                                    if (isset($inf['conflicts'])) {
-                                        $ver = 'conflicts';
-                                    } else {
-                                        $ver = $d->_getExtraString($inf);
-                                    }
-
-                                    $data['data'][] = array($req, ucfirst($deptype), $name,
-                                        $ver, $group);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-
-            $this->ui->outputData($data, $command);
-            return true;
-        }
-
-        // Fallback
-        $this->ui->outputData("This package does not have any dependencies.", $command);
-    }
-
-    function doSign($command, $options, $params)
-    {
-        // should move most of this code into PEAR_Packager
-        // so it'll be easy to implement "pear package --sign"
-        if (count($params) !== 1) {
-            return $this->raiseError("bad parameter(s), try \"help $command\"");
-        }
-
-        require_once 'System.php';
-        require_once 'Archive/Tar.php';
-
-        if (!file_exists($params[0])) {
-            return $this->raiseError("file does not exist: $params[0]");
-        }
-
-        $obj = $this->getPackageFile($this->config, $this->_debug);
-        $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        $tar = new Archive_Tar($params[0]);
-        $tmpdir = System::mktemp('-d pearsign');
-        if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) {
-            return $this->raiseError("failed to extract tar file");
-        }
-
-        if (file_exists("$tmpdir/package.sig")) {
-            return $this->raiseError("package already signed");
-        }
-
-        $packagexml = 'package.xml';
-        if (file_exists("$tmpdir/package2.xml")) {
-            $packagexml = 'package2.xml';
-        }
-
-        if (file_exists("$tmpdir/package.sig")) {
-            unlink("$tmpdir/package.sig");
-        }
-
-        if (!file_exists("$tmpdir/$packagexml")) {
-            return $this->raiseError("Extracted file $tmpdir/$packagexml not found.");
-        }
-
-        $input = $this->ui->userDialog($command,
-                                       array('GnuPG Passphrase'),
-                                       array('password'));
-        if (!isset($input[0])) {
-            //use empty passphrase
-            $input[0] = '';
-        }
-
-        $devnull = (isset($options['verbose'])) ? '' : ' 2>/dev/null';
-        $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml" . $devnull, "w");
-        if (!$gpg) {
-            return $this->raiseError("gpg command failed");
-        }
-
-        fwrite($gpg, "$input[0]\n");
-        if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {
-            return $this->raiseError("gpg sign failed");
-        }
-
-        if (!$tar->addModify("$tmpdir/package.sig", '', $tmpdir)) {
-            return $this->raiseError('failed adding signature to file');
-        }
-
-        $this->ui->outputData("Package signed.", $command);
-        return true;
-    }
-
-    /**
-     * For unit testing purposes
-     */
-    function &getInstaller(&$ui)
-    {
-        if (!class_exists('PEAR_Installer')) {
-            require_once 'PEAR/Installer.php';
-        }
-        $a = &new PEAR_Installer($ui);
-        return $a;
-    }
-
-    /**
-     * For unit testing purposes
-     */
-    function &getCommandPackaging(&$ui, &$config)
-    {
-        if (!class_exists('PEAR_Command_Packaging')) {
-            if ($fp = @fopen('PEAR/Command/Packaging.php', 'r', true)) {
-                fclose($fp);
-                include_once 'PEAR/Command/Packaging.php';
-            }
-        }
-
-        if (class_exists('PEAR_Command_Packaging')) {
-            $a = &new PEAR_Command_Packaging($ui, $config);
-        } else {
-            $a = null;
-        }
-
-        return $a;
-    }
-
-    function doMakeRPM($command, $options, $params)
-    {
-
-        // Check to see if PEAR_Command_Packaging is installed, and
-        // transparently switch to use the "make-rpm-spec" command from it
-        // instead, if it does. Otherwise, continue to use the old version
-        // of "makerpm" supplied with this package (PEAR).
-        $packaging_cmd = $this->getCommandPackaging($this->ui, $this->config);
-        if ($packaging_cmd !== null) {
-            $this->ui->outputData('PEAR_Command_Packaging is installed; using '.
-                'newer "make-rpm-spec" command instead');
-            return $packaging_cmd->run('make-rpm-spec', $options, $params);
-        }
-
-        $this->ui->outputData('WARNING: "pear makerpm" is no longer available; an '.
-          'improved version is available via "pear make-rpm-spec", which '.
-          'is available by installing PEAR_Command_Packaging');
-        return true;
-    }
-
-    function doConvert($command, $options, $params)
-    {
-        $packagexml    = isset($params[0]) ? $params[0] : 'package.xml';
-        $newpackagexml = isset($params[1]) ? $params[1] : dirname($packagexml) .
-            DIRECTORY_SEPARATOR . 'package2.xml';
-        $pkg = &$this->getPackageFile($this->config, $this->_debug);
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $pf = $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($pf)) {
-            if (is_array($pf->getUserInfo())) {
-                foreach ($pf->getUserInfo() as $warning) {
-                    $this->ui->outputData($warning['message']);
-                }
-            }
-            return $this->raiseError($pf);
-        }
-
-        if (is_a($pf, 'PEAR_PackageFile_v2')) {
-            $this->ui->outputData($packagexml . ' is already a package.xml version 2.0');
-            return true;
-        }
-
-        $gen   = &$pf->getDefaultGenerator();
-        $newpf = &$gen->toV2();
-        $newpf->setPackagefile($newpackagexml);
-        $gen = &$newpf->getDefaultGenerator();
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $state = (isset($options['flat']) ? PEAR_VALIDATE_PACKAGING : PEAR_VALIDATE_NORMAL);
-        $saved = $gen->toPackageFile(dirname($newpackagexml), $state, basename($newpackagexml));
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($saved)) {
-            if (is_array($saved->getUserInfo())) {
-                foreach ($saved->getUserInfo() as $warning) {
-                    $this->ui->outputData($warning['message']);
-                }
-            }
-
-            $this->ui->outputData($saved->getMessage());
-            return true;
-        }
-
-        $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"');
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Package.xml b/lib/php/PEAR/Command/Package.xml
deleted file mode 100644
index 9f093ef62c19ab4e14f827f11046e80801a64013..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Package.xml
+++ /dev/null
@@ -1,237 +0,0 @@
-<commands version="1.0">
- <package>
-  <summary>Build Package</summary>
-  <function>doPackage</function>
-  <shortcut>p</shortcut>
-  <options>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>Do not gzip the package file</doc>
-   </nocompress>
-   <showname>
-    <shortopt>n</shortopt>
-    <doc>Print the name of the packaged file.</doc>
-   </showname>
-  </options>
-  <doc>[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml).  If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0.  The
-package.xml version 1.0 will be saved as &quot;package.xml&quot; in the archive,
-and the other as &quot;package2.xml&quot; in the archive&quot;
-</doc>
- </package>
- <package-validate>
-  <summary>Validate Package Consistency</summary>
-  <function>doPackageValidate</function>
-  <shortcut>pv</shortcut>
-  <options />
-  <doc>
-</doc>
- </package-validate>
- <cvsdiff>
-  <summary>Run a &quot;cvs diff&quot; for all files in a package</summary>
-  <function>doCvsDiff</function>
-  <shortcut>cd</shortcut>
-  <options>
-   <quiet>
-    <shortopt>q</shortopt>
-    <doc>Be quiet</doc>
-   </quiet>
-   <reallyquiet>
-    <shortopt>Q</shortopt>
-    <doc>Be really quiet</doc>
-   </reallyquiet>
-   <date>
-    <shortopt>D</shortopt>
-    <doc>Diff against revision of DATE</doc>
-    <arg>DATE</arg>
-   </date>
-   <release>
-    <shortopt>R</shortopt>
-    <doc>Diff against tag for package release REL</doc>
-    <arg>REL</arg>
-   </release>
-   <revision>
-    <shortopt>r</shortopt>
-    <doc>Diff against revision REV</doc>
-    <arg>REV</arg>
-   </revision>
-   <context>
-    <shortopt>c</shortopt>
-    <doc>Generate context diff</doc>
-   </context>
-   <unified>
-    <shortopt>u</shortopt>
-    <doc>Generate unified diff</doc>
-   </unified>
-   <ignore-case>
-    <shortopt>i</shortopt>
-    <doc>Ignore case, consider upper- and lower-case letters equivalent</doc>
-   </ignore-case>
-   <ignore-whitespace>
-    <shortopt>b</shortopt>
-    <doc>Ignore changes in amount of white space</doc>
-   </ignore-whitespace>
-   <ignore-blank-lines>
-    <shortopt>B</shortopt>
-    <doc>Ignore changes that insert or delete blank lines</doc>
-   </ignore-blank-lines>
-   <brief>
-    <shortopt></shortopt>
-    <doc>Report only whether the files differ, no details</doc>
-   </brief>
-   <dry-run>
-    <shortopt>n</shortopt>
-    <doc>Don&#039;t do anything, just pretend</doc>
-   </dry-run>
-  </options>
-  <doc>&lt;package.xml&gt;
-Compares all the files in a package.  Without any options, this
-command will compare the current code with the last checked-in code.
-Using the -r or -R option you may compare the current code with that
-of a specific release.
-</doc>
- </cvsdiff>
- <svntag>
-  <summary>Set SVN Release Tag</summary>
-  <function>doSvnTag</function>
-  <shortcut>sv</shortcut>
-  <options>
-   <quiet>
-    <shortopt>q</shortopt>
-    <doc>Be quiet</doc>
-   </quiet>
-   <slide>
-    <shortopt>F</shortopt>
-    <doc>Move (slide) tag if it exists</doc>
-   </slide>
-   <delete>
-    <shortopt>d</shortopt>
-    <doc>Remove tag</doc>
-   </delete>
-   <dry-run>
-    <shortopt>n</shortopt>
-    <doc>Don&#039;t do anything, just pretend</doc>
-   </dry-run>
-  </options>
-  <doc>&lt;package.xml&gt; [files...]
- Sets a SVN tag on all files in a package.  Use this command after you have
- packaged a distribution tarball with the &quot;package&quot; command to tag what
- revisions of what files were in that release.  If need to fix something
- after running cvstag once, but before the tarball is released to the public,
- use the &quot;slide&quot; option to move the release tag.
-
- to include files (such as a second package.xml, or tests not included in the
- release), pass them as additional parameters.
- </doc>
- </svntag>
- <cvstag>
-  <summary>Set CVS Release Tag</summary>
-  <function>doCvsTag</function>
-  <shortcut>ct</shortcut>
-  <options>
-   <quiet>
-    <shortopt>q</shortopt>
-    <doc>Be quiet</doc>
-   </quiet>
-   <reallyquiet>
-    <shortopt>Q</shortopt>
-    <doc>Be really quiet</doc>
-   </reallyquiet>
-   <slide>
-    <shortopt>F</shortopt>
-    <doc>Move (slide) tag if it exists</doc>
-   </slide>
-   <delete>
-    <shortopt>d</shortopt>
-    <doc>Remove tag</doc>
-   </delete>
-   <dry-run>
-    <shortopt>n</shortopt>
-    <doc>Don&#039;t do anything, just pretend</doc>
-   </dry-run>
-  </options>
-  <doc>&lt;package.xml&gt; [files...]
-Sets a CVS tag on all files in a package.  Use this command after you have
-packaged a distribution tarball with the &quot;package&quot; command to tag what
-revisions of what files were in that release.  If need to fix something
-after running cvstag once, but before the tarball is released to the public,
-use the &quot;slide&quot; option to move the release tag.
-
-to include files (such as a second package.xml, or tests not included in the
-release), pass them as additional parameters.
-</doc>
- </cvstag>
- <package-dependencies>
-  <summary>Show package dependencies</summary>
-  <function>doPackageDependencies</function>
-  <shortcut>pd</shortcut>
-  <options />
-  <doc>&lt;package-file&gt; or &lt;package.xml&gt; or &lt;install-package-name&gt;
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.</doc>
- </package-dependencies>
- <sign>
-  <summary>Sign a package distribution file</summary>
-  <function>doSign</function>
-  <shortcut>si</shortcut>
-  <options>
-   <verbose>
-    <shortopt>v</shortopt>
-    <doc>Display GnuPG output</doc>
-   </verbose>
-  </options>
-  <doc>&lt;package-file&gt;
-Signs a package distribution (.tar or .tgz) file with GnuPG.</doc>
- </sign>
- <makerpm>
-  <summary>Builds an RPM spec file from a PEAR package</summary>
-  <function>doMakeRPM</function>
-  <shortcut>rpm</shortcut>
-  <options>
-   <spec-template>
-    <shortopt>t</shortopt>
-    <doc>Use FILE as RPM spec file template</doc>
-    <arg>FILE</arg>
-   </spec-template>
-   <rpm-pkgname>
-    <shortopt>p</shortopt>
-    <doc>Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to &quot;PEAR::%s&quot;.</doc>
-    <arg>FORMAT</arg>
-   </rpm-pkgname>
-  </options>
-  <doc>&lt;package-file&gt;
-
-Creates an RPM .spec file for wrapping a PEAR package inside an RPM
-package.  Intended to be used from the SPECS directory, with the PEAR
-package tarball in the SOURCES directory:
-
-$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
-...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
-</doc>
- </makerpm>
- <convert>
-  <summary>Convert a package.xml 1.0 to package.xml 2.0 format</summary>
-  <function>doConvert</function>
-  <shortcut>c2</shortcut>
-  <options>
-   <flat>
-    <shortopt>f</shortopt>
-    <doc>do not beautify the filelist.</doc>
-   </flat>
-  </options>
-  <doc>[descfile] [descfile2]
-Converts a package.xml in 1.0 format into a package.xml
-in 2.0 format.  The new file will be named package2.xml by default,
-and package.xml will be used as the old file by default.
-This is not the most intelligent conversion, and should only be
-used for automated conversion or learning the format.
-</doc>
- </convert>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Pickle.php b/lib/php/PEAR/Command/Pickle.php
deleted file mode 100644
index 9cdb77b2cbe621bfdeb5e468dff1d471139c89ca..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Pickle.php
+++ /dev/null
@@ -1,421 +0,0 @@
-<?php
-/**
- * PEAR_Command_Pickle (pickle command)
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2005-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Pickle.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2005-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.1
- */
-
-class PEAR_Command_Pickle extends PEAR_Command_Common
-{
-    var $commands = array(
-        'pickle' => array(
-            'summary' => 'Build PECL Package',
-            'function' => 'doPackage',
-            'shortcut' => 'pi',
-            'options' => array(
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'Do not gzip the package file'
-                    ),
-                'showname' => array(
-                    'shortopt' => 'n',
-                    'doc' => 'Print the name of the packaged file.',
-                    ),
-                ),
-            'doc' => '[descfile]
-Creates a PECL package from its package2.xml file.
-
-An automatic conversion will be made to a package.xml 1.0 and written out to
-disk in the current directory as "package.xml".  Note that
-only simple package.xml 2.0 will be converted.  package.xml 2.0 with:
-
- - dependency types other than required/optional PECL package/ext/php/pearinstaller
- - more than one extsrcrelease or zendextsrcrelease
- - zendextbinrelease, extbinrelease, phprelease, or bundle release type
- - dependency groups
- - ignore tags in release filelist
- - tasks other than replace
- - custom roles
-
-will cause pickle to fail, and output an error message.  If your package2.xml
-uses any of these features, you are best off using PEAR_PackageFileManager to
-generate both package.xml.
-'
-            ),
-        );
-
-    /**
-     * PEAR_Command_Package constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Pickle(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    /**
-     * For unit-testing ease
-     *
-     * @return PEAR_Packager
-     */
-    function &getPackager()
-    {
-        if (!class_exists('PEAR_Packager')) {
-            require_once 'PEAR/Packager.php';
-        }
-
-        $a = &new PEAR_Packager;
-        return $a;
-    }
-
-    /**
-     * For unit-testing ease
-     *
-     * @param PEAR_Config $config
-     * @param bool $debug
-     * @param string|null $tmpdir
-     * @return PEAR_PackageFile
-     */
-    function &getPackageFile($config, $debug = false, $tmpdir = null)
-    {
-        if (!class_exists('PEAR_Common')) {
-            require_once 'PEAR/Common.php';
-        }
-
-        if (!class_exists('PEAR_PackageFile')) {
-            require_once 'PEAR/PackageFile.php';
-        }
-
-        $a = &new PEAR_PackageFile($config, $debug, $tmpdir);
-        $common = new PEAR_Common;
-        $common->ui = $this->ui;
-        $a->setLogger($common);
-        return $a;
-    }
-
-    function doPackage($command, $options, $params)
-    {
-        $this->output = '';
-        $pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml';
-        $packager = &$this->getPackager();
-        if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) {
-            return $err;
-        }
-
-        $compress = empty($options['nocompress']) ? true : false;
-        $result = $packager->package($pkginfofile, $compress, 'package.xml');
-        if (PEAR::isError($result)) {
-            return $this->raiseError($result);
-        }
-
-        // Don't want output, only the package file name just created
-        if (isset($options['showname'])) {
-            $this->ui->outputData($result, $command);
-        }
-
-        return true;
-    }
-
-    function _convertPackage($packagexml)
-    {
-        $pkg = &$this->getPackageFile($this->config);
-        $pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
-        if (!is_a($pf2, 'PEAR_PackageFile_v2')) {
-            return $this->raiseError('Cannot process "' .
-                $packagexml . '", is not a package.xml 2.0');
-        }
-
-        require_once 'PEAR/PackageFile/v1.php';
-        $pf = new PEAR_PackageFile_v1;
-        $pf->setConfig($this->config);
-        if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", is not an extension source package.  Using a PEAR_PackageFileManager-based ' .
-            'script is an option');
-        }
-
-        if (is_array($pf2->getUsesRole())) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains custom roles.  Using a PEAR_PackageFileManager-based script or ' .
-            'the convert command is an option');
-        }
-
-        if (is_array($pf2->getUsesTask())) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains custom tasks.  Using a PEAR_PackageFileManager-based script or ' .
-            'the convert command is an option');
-        }
-
-        $deps = $pf2->getDependencies();
-        if (isset($deps['group'])) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains dependency groups.  Using a PEAR_PackageFileManager-based script ' .
-            'or the convert command is an option');
-        }
-
-        if (isset($deps['required']['subpackage']) ||
-              isset($deps['optional']['subpackage'])) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains subpackage dependencies.  Using a PEAR_PackageFileManager-based  '.
-            'script is an option');
-        }
-
-        if (isset($deps['required']['os'])) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains os dependencies.  Using a PEAR_PackageFileManager-based  '.
-            'script is an option');
-        }
-
-        if (isset($deps['required']['arch'])) {
-            return $this->raiseError('Cannot safely convert "' . $packagexml .
-            '", contains arch dependencies.  Using a PEAR_PackageFileManager-based  '.
-            'script is an option');
-        }
-
-        $pf->setPackage($pf2->getPackage());
-        $pf->setSummary($pf2->getSummary());
-        $pf->setDescription($pf2->getDescription());
-        foreach ($pf2->getMaintainers() as $maintainer) {
-            $pf->addMaintainer($maintainer['role'], $maintainer['handle'],
-                $maintainer['name'], $maintainer['email']);
-        }
-
-        $pf->setVersion($pf2->getVersion());
-        $pf->setDate($pf2->getDate());
-        $pf->setLicense($pf2->getLicense());
-        $pf->setState($pf2->getState());
-        $pf->setNotes($pf2->getNotes());
-        $pf->addPhpDep($deps['required']['php']['min'], 'ge');
-        if (isset($deps['required']['php']['max'])) {
-            $pf->addPhpDep($deps['required']['php']['max'], 'le');
-        }
-
-        if (isset($deps['required']['package'])) {
-            if (!isset($deps['required']['package'][0])) {
-                $deps['required']['package'] = array($deps['required']['package']);
-            }
-
-            foreach ($deps['required']['package'] as $dep) {
-                if (!isset($dep['channel'])) {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains uri-based dependency on a package.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if ($dep['channel'] != 'pear.php.net'
-                    && $dep['channel'] != 'pecl.php.net'
-                    && $dep['channel'] != 'doc.php.net') {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains dependency on a non-standard channel package.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if (isset($dep['conflicts'])) {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains conflicts dependency.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if (isset($dep['exclude'])) {
-                    $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
-                }
-
-                if (isset($dep['min'])) {
-                    $pf->addPackageDep($dep['name'], $dep['min'], 'ge');
-                }
-
-                if (isset($dep['max'])) {
-                    $pf->addPackageDep($dep['name'], $dep['max'], 'le');
-                }
-            }
-        }
-
-        if (isset($deps['required']['extension'])) {
-            if (!isset($deps['required']['extension'][0])) {
-                $deps['required']['extension'] = array($deps['required']['extension']);
-            }
-
-            foreach ($deps['required']['extension'] as $dep) {
-                if (isset($dep['conflicts'])) {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains conflicts dependency.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if (isset($dep['exclude'])) {
-                    $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
-                }
-
-                if (isset($dep['min'])) {
-                    $pf->addExtensionDep($dep['name'], $dep['min'], 'ge');
-                }
-
-                if (isset($dep['max'])) {
-                    $pf->addExtensionDep($dep['name'], $dep['max'], 'le');
-                }
-            }
-        }
-
-        if (isset($deps['optional']['package'])) {
-            if (!isset($deps['optional']['package'][0])) {
-                $deps['optional']['package'] = array($deps['optional']['package']);
-            }
-
-            foreach ($deps['optional']['package'] as $dep) {
-                if (!isset($dep['channel'])) {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains uri-based dependency on a package.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if ($dep['channel'] != 'pear.php.net'
-                    && $dep['channel'] != 'pecl.php.net'
-                    && $dep['channel'] != 'doc.php.net') {
-                    return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
-                    ' contains dependency on a non-standard channel package.  Using a ' .
-                    'PEAR_PackageFileManager-based script is an option');
-                }
-
-                if (isset($dep['exclude'])) {
-                    $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
-                }
-
-                if (isset($dep['min'])) {
-                    $pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes');
-                }
-
-                if (isset($dep['max'])) {
-                    $pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes');
-                }
-            }
-        }
-
-        if (isset($deps['optional']['extension'])) {
-            if (!isset($deps['optional']['extension'][0])) {
-                $deps['optional']['extension'] = array($deps['optional']['extension']);
-            }
-
-            foreach ($deps['optional']['extension'] as $dep) {
-                if (isset($dep['exclude'])) {
-                    $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
-                }
-
-                if (isset($dep['min'])) {
-                    $pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes');
-                }
-
-                if (isset($dep['max'])) {
-                    $pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes');
-                }
-            }
-        }
-
-        $contents = $pf2->getContents();
-        $release  = $pf2->getReleases();
-        if (isset($releases[0])) {
-            return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
-            . 'multiple extsrcrelease/zendextsrcrelease tags.  Using a PEAR_PackageFileManager-based script ' .
-            'or the convert command is an option');
-        }
-
-        if ($configoptions = $pf2->getConfigureOptions()) {
-            foreach ($configoptions as $option) {
-                $default = isset($option['default']) ? $option['default'] : false;
-                $pf->addConfigureOption($option['name'], $option['prompt'], $default);
-            }
-        }
-
-        if (isset($release['filelist']['ignore'])) {
-            return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
-            . 'ignore tags.  Using a PEAR_PackageFileManager-based script or the convert' .
-            ' command is an option');
-        }
-
-        if (isset($release['filelist']['install']) &&
-              !isset($release['filelist']['install'][0])) {
-            $release['filelist']['install'] = array($release['filelist']['install']);
-        }
-
-        if (isset($contents['dir']['attribs']['baseinstalldir'])) {
-            $baseinstalldir = $contents['dir']['attribs']['baseinstalldir'];
-        } else {
-            $baseinstalldir = false;
-        }
-
-        if (!isset($contents['dir']['file'][0])) {
-            $contents['dir']['file'] = array($contents['dir']['file']);
-        }
-
-        foreach ($contents['dir']['file'] as $file) {
-            if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) {
-                $file['attribs']['baseinstalldir'] = $baseinstalldir;
-            }
-
-            $processFile = $file;
-            unset($processFile['attribs']);
-            if (count($processFile)) {
-                foreach ($processFile as $name => $task) {
-                    if ($name != $pf2->getTasksNs() . ':replace') {
-                        return $this->raiseError('Cannot safely process "' . $packagexml .
-                        '" contains tasks other than replace.  Using a ' .
-                        'PEAR_PackageFileManager-based script is an option.');
-                    }
-                    $file['attribs']['replace'][] = $task;
-                }
-            }
-
-            if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) {
-                return $this->raiseError('Cannot safely convert "' . $packagexml .
-                '", contains custom roles.  Using a PEAR_PackageFileManager-based script ' .
-                'or the convert command is an option');
-            }
-
-            if (isset($release['filelist']['install'])) {
-                foreach ($release['filelist']['install'] as $installas) {
-                    if ($installas['attribs']['name'] == $file['attribs']['name']) {
-                        $file['attribs']['install-as'] = $installas['attribs']['as'];
-                    }
-                }
-            }
-
-            $pf->addFile('/', $file['attribs']['name'], $file['attribs']);
-        }
-
-        if ($pf2->getChangeLog()) {
-            $this->ui->outputData('WARNING: changelog is not translated to package.xml ' .
-                '1.0, use PEAR_PackageFileManager-based script if you need changelog-' .
-                'translation for package.xml 1.0');
-        }
-
-        $gen = &$pf->getDefaultGenerator();
-        $gen->toPackageFile('.');
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Pickle.xml b/lib/php/PEAR/Command/Pickle.xml
deleted file mode 100644
index 721ecea995eba916c775717cfd2c9b9b2fe24b84..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Pickle.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<commands version="1.0">
- <pickle>
-  <summary>Build PECL Package</summary>
-  <function>doPackage</function>
-  <shortcut>pi</shortcut>
-  <options>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>Do not gzip the package file</doc>
-   </nocompress>
-   <showname>
-    <shortopt>n</shortopt>
-    <doc>Print the name of the packaged file.</doc>
-   </showname>
-  </options>
-  <doc>[descfile]
-Creates a PECL package from its package2.xml file.
-
-An automatic conversion will be made to a package.xml 1.0 and written out to
-disk in the current directory as &quot;package.xml&quot;.  Note that
-only simple package.xml 2.0 will be converted.  package.xml 2.0 with:
-
- - dependency types other than required/optional PECL package/ext/php/pearinstaller
- - more than one extsrcrelease or zendextsrcrelease
- - zendextbinrelease, extbinrelease, phprelease, or bundle release type
- - dependency groups
- - ignore tags in release filelist
- - tasks other than replace
- - custom roles
-
-will cause pickle to fail, and output an error message.  If your package2.xml
-uses any of these features, you are best off using PEAR_PackageFileManager to
-generate both package.xml.
-</doc>
- </pickle>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Registry.php b/lib/php/PEAR/Command/Registry.php
deleted file mode 100644
index 7ebc5efb4e6ed2e980fd0c6d481bf8accf1a453b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Registry.php
+++ /dev/null
@@ -1,1143 +0,0 @@
-<?php
-/**
- * PEAR_Command_Registry (list, list-files, shell-test, info commands)
- *
- * 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: Registry.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for registry manipulation
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Registry extends PEAR_Command_Common
-{
-    var $commands = array(
-        'list' => array(
-            'summary' => 'List Installed Packages In The Default Channel',
-            'function' => 'doList',
-            'shortcut' => 'l',
-            'options' => array(
-                'channel' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'list installed packages from this channel',
-                    'arg' => 'CHAN',
-                    ),
-                'allchannels' => array(
-                    'shortopt' => 'a',
-                    'doc' => 'list installed packages from all channels',
-                    ),
-                'channelinfo' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'output fully channel-aware data, even on failure',
-                    ),
-                ),
-            'doc' => '<package>
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}).  With a parameter, it
-lists the files in a package.
-',
-            ),
-        'list-files' => array(
-            'summary' => 'List Files In Installed Package',
-            'function' => 'doFileList',
-            'shortcut' => 'fl',
-            'options' => array(),
-            'doc' => '<package>
-List the files in an installed package.
-'
-            ),
-        'shell-test' => array(
-            'summary' => 'Shell Script Test',
-            'function' => 'doShellTest',
-            'shortcut' => 'st',
-            'options' => array(),
-            'doc' => '<package> [[relation] version]
-Tests if a package is installed in the system. Will exit(1) if it is not.
-   <relation>   The version comparison operator. One of:
-                <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
-   <version>    The version to compare with
-'),
-        'info' => array(
-            'summary'  => 'Display information about a package',
-            'function' => 'doInfo',
-            'shortcut' => 'in',
-            'options'  => array(),
-            'doc'      => '<package>
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.'
-            )
-        );
-
-    /**
-     * PEAR_Command_Registry constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Registry(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function _sortinfo($a, $b)
-    {
-        $apackage = isset($a['package']) ? $a['package'] : $a['name'];
-        $bpackage = isset($b['package']) ? $b['package'] : $b['name'];
-        return strcmp($apackage, $bpackage);
-    }
-
-    function doList($command, $options, $params)
-    {
-        $reg = &$this->config->getRegistry();
-        $channelinfo = isset($options['channelinfo']);
-        if (isset($options['allchannels']) && !$channelinfo) {
-            return $this->doListAll($command, array(), $params);
-        }
-
-        if (isset($options['allchannels']) && $channelinfo) {
-            // allchannels with $channelinfo
-            unset($options['allchannels']);
-            $channels = $reg->getChannels();
-            $errors = array();
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            foreach ($channels as $channel) {
-                $options['channel'] = $channel->getName();
-                $ret = $this->doList($command, $options, $params);
-
-                if (PEAR::isError($ret)) {
-                    $errors[] = $ret;
-                }
-            }
-
-            PEAR::staticPopErrorHandling();
-            if (count($errors)) {
-                // for now, only give first error
-                return PEAR::raiseError($errors[0]);
-            }
-
-            return true;
-        }
-
-        if (count($params) === 1) {
-            return $this->doFileList($command, $options, $params);
-        }
-
-        if (isset($options['channel'])) {
-            if (!$reg->channelExists($options['channel'])) {
-                return $this->raiseError('Channel "' . $options['channel'] .'" does not exist');
-            }
-
-            $channel = $reg->channelName($options['channel']);
-        } else {
-            $channel = $this->config->get('default_channel');
-        }
-
-        $installed = $reg->packageInfo(null, null, $channel);
-        usort($installed, array(&$this, '_sortinfo'));
-
-        $data = array(
-            'caption' => 'Installed packages, channel ' .
-                $channel . ':',
-            'border' => true,
-            'headline' => array('Package', 'Version', 'State'),
-            'channel' => $channel,
-            );
-        if ($channelinfo) {
-            $data['headline'] = array('Channel', 'Package', 'Version', 'State');
-        }
-
-        if (count($installed) && !isset($data['data'])) {
-            $data['data'] = array();
-        }
-
-        foreach ($installed as $package) {
-            $pobj = $reg->getPackage(isset($package['package']) ?
-                                        $package['package'] : $package['name'], $channel);
-            if ($channelinfo) {
-                $packageinfo = array($pobj->getChannel(), $pobj->getPackage(), $pobj->getVersion(),
-                                    $pobj->getState() ? $pobj->getState() : null);
-            } else {
-                $packageinfo = array($pobj->getPackage(), $pobj->getVersion(),
-                                    $pobj->getState() ? $pobj->getState() : null);
-            }
-            $data['data'][] = $packageinfo;
-        }
-
-        if (count($installed) === 0) {
-            if (!$channelinfo) {
-                $data = '(no packages installed from channel ' . $channel . ')';
-            } else {
-                $data = array(
-                    'caption' => 'Installed packages, channel ' .
-                        $channel . ':',
-                    'border' => true,
-                    'channel' => $channel,
-                    'data' => array(array('(no packages installed)')),
-                );
-            }
-        }
-
-        $this->ui->outputData($data, $command);
-        return true;
-    }
-
-    function doListAll($command, $options, $params)
-    {
-        // This duplicate code is deprecated over
-        // list --channelinfo, which gives identical
-        // output for list and list --allchannels.
-        $reg = &$this->config->getRegistry();
-        $installed = $reg->packageInfo(null, null, null);
-        foreach ($installed as $channel => $packages) {
-            usort($packages, array($this, '_sortinfo'));
-            $data = array(
-                'caption'  => 'Installed packages, channel ' . $channel . ':',
-                'border'   => true,
-                'headline' => array('Package', 'Version', 'State'),
-                'channel'  => $channel
-            );
-
-            foreach ($packages as $package) {
-                $p = isset($package['package']) ? $package['package'] : $package['name'];
-                $pobj = $reg->getPackage($p, $channel);
-                $data['data'][] = array($pobj->getPackage(), $pobj->getVersion(),
-                                        $pobj->getState() ? $pobj->getState() : null);
-            }
-
-            // Adds a blank line after each section
-            $data['data'][] = array();
-
-            if (count($packages) === 0) {
-                $data = array(
-                    'caption' => 'Installed packages, channel ' . $channel . ':',
-                    'border' => true,
-                    'data' => array(array('(no packages installed)'), array()),
-                    'channel' => $channel
-                    );
-            }
-            $this->ui->outputData($data, $command);
-        }
-        return true;
-    }
-
-    function doFileList($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError('list-files expects 1 parameter');
-        }
-
-        $reg = &$this->config->getRegistry();
-        $fp = false;
-        if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))) {
-            if ($fp) {
-                fclose($fp);
-            }
-
-            if (!class_exists('PEAR_PackageFile')) {
-                require_once 'PEAR/PackageFile.php';
-            }
-
-            $pkg = &new PEAR_PackageFile($this->config, $this->_debug);
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $info = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
-            PEAR::staticPopErrorHandling();
-            $headings = array('Package File', 'Install Path');
-            $installed = false;
-        } else {
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($parsed)) {
-                return $this->raiseError($parsed);
-            }
-
-            $info = &$reg->getPackage($parsed['package'], $parsed['channel']);
-            $headings = array('Type', 'Install Path');
-            $installed = true;
-        }
-
-        if (PEAR::isError($info)) {
-            return $this->raiseError($info);
-        }
-
-        if ($info === null) {
-            return $this->raiseError("`$params[0]' not installed");
-        }
-
-        $list = ($info->getPackagexmlVersion() == '1.0' || $installed) ?
-            $info->getFilelist() : $info->getContents();
-        if ($installed) {
-            $caption = 'Installed Files For ' . $params[0];
-        } else {
-            $caption = 'Contents of ' . basename($params[0]);
-        }
-
-        $data = array(
-            'caption' => $caption,
-            'border' => true,
-            'headline' => $headings);
-        if ($info->getPackagexmlVersion() == '1.0' || $installed) {
-            foreach ($list as $file => $att) {
-                if ($installed) {
-                    if (empty($att['installed_as'])) {
-                        continue;
-                    }
-                    $data['data'][] = array($att['role'], $att['installed_as']);
-                } else {
-                    if (isset($att['baseinstalldir']) && !in_array($att['role'],
-                          array('test', 'data', 'doc'))) {
-                        $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR .
-                            $file;
-                    } else {
-                        $dest = $file;
-                    }
-                    switch ($att['role']) {
-                        case 'test':
-                        case 'data':
-                        case 'doc':
-                            $role = $att['role'];
-                            if ($role == 'test') {
-                                $role .= 's';
-                            }
-                            $dest = $this->config->get($role . '_dir') . DIRECTORY_SEPARATOR .
-                                $info->getPackage() . DIRECTORY_SEPARATOR . $dest;
-                            break;
-                        case 'php':
-                        default:
-                            $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR .
-                                $dest;
-                    }
-                    $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
-                    $dest = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
-                                                    array(DIRECTORY_SEPARATOR,
-                                                          DIRECTORY_SEPARATOR,
-                                                          DIRECTORY_SEPARATOR),
-                                                    $dest);
-                    $file = preg_replace('!/+!', '/', $file);
-                    $data['data'][] = array($file, $dest);
-                }
-            }
-        } else { // package.xml 2.0, not installed
-            if (!isset($list['dir']['file'][0])) {
-                $list['dir']['file'] = array($list['dir']['file']);
-            }
-
-            foreach ($list['dir']['file'] as $att) {
-                $att = $att['attribs'];
-                $file = $att['name'];
-                $role = &PEAR_Installer_Role::factory($info, $att['role'], $this->config);
-                $role->setup($this, $info, $att, $file);
-                if (!$role->isInstallable()) {
-                    $dest = '(not installable)';
-                } else {
-                    $dest = $role->processInstallation($info, $att, $file, '');
-                    if (PEAR::isError($dest)) {
-                        $dest = '(Unknown role "' . $att['role'] . ')';
-                    } else {
-                        list(,, $dest) = $dest;
-                    }
-                }
-                $data['data'][] = array($file, $dest);
-            }
-        }
-
-        $this->ui->outputData($data, $command);
-        return true;
-    }
-
-    function doShellTest($command, $options, $params)
-    {
-        if (count($params) < 1) {
-            return PEAR::raiseError('ERROR, usage: pear shell-test packagename [[relation] version]');
-        }
-
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $reg = &$this->config->getRegistry();
-        $info = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
-        if (PEAR::isError($info)) {
-            exit(1); // invalid package name
-        }
-
-        $package = $info['package'];
-        $channel = $info['channel'];
-        // "pear shell-test Foo"
-        if (!$reg->packageExists($package, $channel)) {
-            if ($channel == 'pecl.php.net') {
-                if ($reg->packageExists($package, 'pear.php.net')) {
-                    $channel = 'pear.php.net'; // magically change channels for extensions
-                }
-            }
-        }
-
-        if (count($params) === 1) {
-            if (!$reg->packageExists($package, $channel)) {
-                exit(1);
-            }
-            // "pear shell-test Foo 1.0"
-        } elseif (count($params) === 2) {
-            $v = $reg->packageInfo($package, 'version', $channel);
-            if (!$v || !version_compare("$v", "{$params[1]}", "ge")) {
-                exit(1);
-            }
-            // "pear shell-test Foo ge 1.0"
-        } elseif (count($params) === 3) {
-            $v = $reg->packageInfo($package, 'version', $channel);
-            if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) {
-                exit(1);
-            }
-        } else {
-            PEAR::staticPopErrorHandling();
-            $this->raiseError("$command: expects 1 to 3 parameters");
-            exit(1);
-        }
-    }
-
-    function doInfo($command, $options, $params)
-    {
-        if (count($params) !== 1) {
-            return $this->raiseError('pear info expects 1 parameter');
-        }
-
-        $info = $fp = false;
-        $reg = &$this->config->getRegistry();
-        if ((file_exists($params[0]) && is_file($params[0]) && !is_dir($params[0])) || $fp = @fopen($params[0], 'r')) {
-            if ($fp) {
-                fclose($fp);
-            }
-
-            if (!class_exists('PEAR_PackageFile')) {
-                require_once 'PEAR/PackageFile.php';
-            }
-
-            $pkg = &new PEAR_PackageFile($this->config, $this->_debug);
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $obj = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($obj)) {
-                $uinfo = $obj->getUserInfo();
-                if (is_array($uinfo)) {
-                    foreach ($uinfo as $message) {
-                        if (is_array($message)) {
-                            $message = $message['message'];
-                        }
-                        $this->ui->outputData($message);
-                    }
-                }
-
-                return $this->raiseError($obj);
-            }
-
-            if ($obj->getPackagexmlVersion() != '1.0') {
-                return $this->_doInfo2($command, $options, $params, $obj, false);
-            }
-
-            $info = $obj->toArray();
-        } else {
-            $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
-            if (PEAR::isError($parsed)) {
-                return $this->raiseError($parsed);
-            }
-
-            $package = $parsed['package'];
-            $channel = $parsed['channel'];
-            $info = $reg->packageInfo($package, null, $channel);
-            if (isset($info['old'])) {
-                $obj = $reg->getPackage($package, $channel);
-                return $this->_doInfo2($command, $options, $params, $obj, true);
-            }
-        }
-
-        if (PEAR::isError($info)) {
-            return $info;
-        }
-
-        if (empty($info)) {
-            $this->raiseError("No information found for `$params[0]'");
-            return;
-        }
-
-        unset($info['filelist']);
-        unset($info['dirtree']);
-        unset($info['changelog']);
-        if (isset($info['xsdversion'])) {
-            $info['package.xml version'] = $info['xsdversion'];
-            unset($info['xsdversion']);
-        }
-
-        if (isset($info['packagerversion'])) {
-            $info['packaged with PEAR version'] = $info['packagerversion'];
-            unset($info['packagerversion']);
-        }
-
-        $keys = array_keys($info);
-        $longtext = array('description', 'summary');
-        foreach ($keys as $key) {
-            if (is_array($info[$key])) {
-                switch ($key) {
-                    case 'maintainers': {
-                        $i = 0;
-                        $mstr = '';
-                        foreach ($info[$key] as $m) {
-                            if ($i++ > 0) {
-                                $mstr .= "\n";
-                            }
-                            $mstr .= $m['name'] . " <";
-                            if (isset($m['email'])) {
-                                $mstr .= $m['email'];
-                            } else {
-                                $mstr .= $m['handle'] . '@php.net';
-                            }
-                            $mstr .= "> ($m[role])";
-                        }
-                        $info[$key] = $mstr;
-                        break;
-                    }
-                    case 'release_deps': {
-                        $i = 0;
-                        $dstr = '';
-                        foreach ($info[$key] as $d) {
-                            if (isset($this->_deps_rel_trans[$d['rel']])) {
-                                $rel = $this->_deps_rel_trans[$d['rel']];
-                            } else {
-                                $rel = $d['rel'];
-                            }
-                            if (isset($this->_deps_type_trans[$d['type']])) {
-                                $type = ucfirst($this->_deps_type_trans[$d['type']]);
-                            } else {
-                                $type = $d['type'];
-                            }
-                            if (isset($d['name'])) {
-                                $name = $d['name'] . ' ';
-                            } else {
-                                $name = '';
-                            }
-                            if (isset($d['version'])) {
-                                $version = $d['version'] . ' ';
-                            } else {
-                                $version = '';
-                            }
-                            if (isset($d['optional']) && $d['optional'] == 'yes') {
-                                $optional = ' (optional)';
-                            } else {
-                                $optional = '';
-                            }
-                            $dstr .= "$type $name$rel $version$optional\n";
-                        }
-                        $info[$key] = $dstr;
-                        break;
-                    }
-                    case 'provides' : {
-                        $debug = $this->config->get('verbose');
-                        if ($debug < 2) {
-                            $pstr = 'Classes: ';
-                        } else {
-                            $pstr = '';
-                        }
-                        $i = 0;
-                        foreach ($info[$key] as $p) {
-                            if ($debug < 2 && $p['type'] != "class") {
-                                continue;
-                            }
-                            // Only print classes when verbosity mode is < 2
-                            if ($debug < 2) {
-                                if ($i++ > 0) {
-                                    $pstr .= ", ";
-                                }
-                                $pstr .= $p['name'];
-                            } else {
-                                if ($i++ > 0) {
-                                    $pstr .= "\n";
-                                }
-                                $pstr .= ucfirst($p['type']) . " " . $p['name'];
-                                if (isset($p['explicit']) && $p['explicit'] == 1) {
-                                    $pstr .= " (explicit)";
-                                }
-                            }
-                        }
-                        $info[$key] = $pstr;
-                        break;
-                    }
-                    case 'configure_options' : {
-                        foreach ($info[$key] as $i => $p) {
-                            $info[$key][$i] = array_map(null, array_keys($p), array_values($p));
-                            $info[$key][$i] = array_map(create_function('$a',
-                                'return join(" = ",$a);'), $info[$key][$i]);
-                            $info[$key][$i] = implode(', ', $info[$key][$i]);
-                        }
-                        $info[$key] = implode("\n", $info[$key]);
-                        break;
-                    }
-                    default: {
-                        $info[$key] = implode(", ", $info[$key]);
-                        break;
-                    }
-                }
-            }
-
-            if ($key == '_lastmodified') {
-                $hdate = date('Y-m-d', $info[$key]);
-                unset($info[$key]);
-                $info['Last Modified'] = $hdate;
-            } elseif ($key == '_lastversion') {
-                $info['Previous Installed Version'] = $info[$key] ? $info[$key] : '- None -';
-                unset($info[$key]);
-            } else {
-                $info[$key] = trim($info[$key]);
-                if (in_array($key, $longtext)) {
-                    $info[$key] = preg_replace('/  +/', ' ', $info[$key]);
-                }
-            }
-        }
-
-        $caption = 'About ' . $info['package'] . '-' . $info['version'];
-        $data = array(
-            'caption' => $caption,
-            'border' => true);
-        foreach ($info as $key => $value) {
-            $key = ucwords(trim(str_replace('_', ' ', $key)));
-            $data['data'][] = array($key, $value);
-        }
-        $data['raw'] = $info;
-
-        $this->ui->outputData($data, 'package-info');
-    }
-
-    /**
-     * @access private
-     */
-    function _doInfo2($command, $options, $params, &$obj, $installed)
-    {
-        $reg = &$this->config->getRegistry();
-        $caption = 'About ' . $obj->getChannel() . '/' .$obj->getPackage() . '-' .
-            $obj->getVersion();
-        $data = array(
-            'caption' => $caption,
-            'border' => true);
-        switch ($obj->getPackageType()) {
-            case 'php' :
-                $release = 'PEAR-style PHP-based Package';
-            break;
-            case 'extsrc' :
-                $release = 'PECL-style PHP extension (source code)';
-            break;
-            case 'zendextsrc' :
-                $release = 'PECL-style Zend extension (source code)';
-            break;
-            case 'extbin' :
-                $release = 'PECL-style PHP extension (binary)';
-            break;
-            case 'zendextbin' :
-                $release = 'PECL-style Zend extension (binary)';
-            break;
-            case 'bundle' :
-                $release = 'Package bundle (collection of packages)';
-            break;
-        }
-        $extends = $obj->getExtends();
-        $extends = $extends ?
-            $obj->getPackage() . ' (extends ' . $extends . ')' : $obj->getPackage();
-        if ($src = $obj->getSourcePackage()) {
-            $extends .= ' (source package ' . $src['channel'] . '/' . $src['package'] . ')';
-        }
-
-        $info = array(
-            'Release Type' => $release,
-            'Name' => $extends,
-            'Channel' => $obj->getChannel(),
-            'Summary' => preg_replace('/  +/', ' ', $obj->getSummary()),
-            'Description' => preg_replace('/  +/', ' ', $obj->getDescription()),
-            );
-        $info['Maintainers'] = '';
-        foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
-            $leads = $obj->{"get{$role}s"}();
-            if (!$leads) {
-                continue;
-            }
-
-            if (isset($leads['active'])) {
-                $leads = array($leads);
-            }
-
-            foreach ($leads as $lead) {
-                if (!empty($info['Maintainers'])) {
-                    $info['Maintainers'] .= "\n";
-                }
-
-                $active = $lead['active'] == 'no' ? ', inactive' : '';
-                $info['Maintainers'] .= $lead['name'] . ' <';
-                $info['Maintainers'] .= $lead['email'] . "> ($role$active)";
-            }
-        }
-
-        $info['Release Date'] = $obj->getDate();
-        if ($time = $obj->getTime()) {
-            $info['Release Date'] .= ' ' . $time;
-        }
-
-        $info['Release Version'] = $obj->getVersion() . ' (' . $obj->getState() . ')';
-        $info['API Version'] = $obj->getVersion('api') . ' (' . $obj->getState('api') . ')';
-        $info['License'] = $obj->getLicense();
-        $uri = $obj->getLicenseLocation();
-        if ($uri) {
-            if (isset($uri['uri'])) {
-                $info['License'] .= ' (' . $uri['uri'] . ')';
-            } else {
-                $extra = $obj->getInstalledLocation($info['filesource']);
-                if ($extra) {
-                    $info['License'] .= ' (' . $uri['filesource'] . ')';
-                }
-            }
-        }
-
-        $info['Release Notes'] = $obj->getNotes();
-        if ($compat = $obj->getCompatible()) {
-            if (!isset($compat[0])) {
-                $compat = array($compat);
-            }
-
-            $info['Compatible with'] = '';
-            foreach ($compat as $package) {
-                $info['Compatible with'] .= $package['channel'] . '/' . $package['name'] .
-                    "\nVersions >= " . $package['min'] . ', <= ' . $package['max'];
-                if (isset($package['exclude'])) {
-                    if (is_array($package['exclude'])) {
-                        $package['exclude'] = implode(', ', $package['exclude']);
-                    }
-
-                    if (!isset($info['Not Compatible with'])) {
-                        $info['Not Compatible with'] = '';
-                    } else {
-                        $info['Not Compatible with'] .= "\n";
-                    }
-                    $info['Not Compatible with'] .= $package['channel'] . '/' .
-                        $package['name'] . "\nVersions " . $package['exclude'];
-                }
-            }
-        }
-
-        $usesrole = $obj->getUsesrole();
-        if ($usesrole) {
-            if (!isset($usesrole[0])) {
-                $usesrole = array($usesrole);
-            }
-
-            foreach ($usesrole as $roledata) {
-                if (isset($info['Uses Custom Roles'])) {
-                    $info['Uses Custom Roles'] .= "\n";
-                } else {
-                    $info['Uses Custom Roles'] = '';
-                }
-
-                if (isset($roledata['package'])) {
-                    $rolepackage = $reg->parsedPackageNameToString($roledata, true);
-                } else {
-                    $rolepackage = $roledata['uri'];
-                }
-                $info['Uses Custom Roles'] .= $roledata['role'] . ' (' . $rolepackage . ')';
-            }
-        }
-
-        $usestask = $obj->getUsestask();
-        if ($usestask) {
-            if (!isset($usestask[0])) {
-                $usestask = array($usestask);
-            }
-
-            foreach ($usestask as $taskdata) {
-                if (isset($info['Uses Custom Tasks'])) {
-                    $info['Uses Custom Tasks'] .= "\n";
-                } else {
-                    $info['Uses Custom Tasks'] = '';
-                }
-
-                if (isset($taskdata['package'])) {
-                    $taskpackage = $reg->parsedPackageNameToString($taskdata, true);
-                } else {
-                    $taskpackage = $taskdata['uri'];
-                }
-                $info['Uses Custom Tasks'] .= $taskdata['task'] . ' (' . $taskpackage . ')';
-            }
-        }
-
-        $deps = $obj->getDependencies();
-        $info['Required Dependencies'] = 'PHP version ' . $deps['required']['php']['min'];
-        if (isset($deps['required']['php']['max'])) {
-            $info['Required Dependencies'] .= '-' . $deps['required']['php']['max'] . "\n";
-        } else {
-            $info['Required Dependencies'] .= "\n";
-        }
-
-        if (isset($deps['required']['php']['exclude'])) {
-            if (!isset($info['Not Compatible with'])) {
-                $info['Not Compatible with'] = '';
-            } else {
-                $info['Not Compatible with'] .= "\n";
-            }
-
-            if (is_array($deps['required']['php']['exclude'])) {
-                $deps['required']['php']['exclude'] =
-                    implode(', ', $deps['required']['php']['exclude']);
-            }
-            $info['Not Compatible with'] .= "PHP versions\n  " .
-                $deps['required']['php']['exclude'];
-        }
-
-        $info['Required Dependencies'] .= 'PEAR installer version';
-        if (isset($deps['required']['pearinstaller']['max'])) {
-            $info['Required Dependencies'] .= 's ' .
-                $deps['required']['pearinstaller']['min'] . '-' .
-                $deps['required']['pearinstaller']['max'];
-        } else {
-            $info['Required Dependencies'] .= ' ' .
-                $deps['required']['pearinstaller']['min'] . ' or newer';
-        }
-
-        if (isset($deps['required']['pearinstaller']['exclude'])) {
-            if (!isset($info['Not Compatible with'])) {
-                $info['Not Compatible with'] = '';
-            } else {
-                $info['Not Compatible with'] .= "\n";
-            }
-
-            if (is_array($deps['required']['pearinstaller']['exclude'])) {
-                $deps['required']['pearinstaller']['exclude'] =
-                    implode(', ', $deps['required']['pearinstaller']['exclude']);
-            }
-            $info['Not Compatible with'] .= "PEAR installer\n  Versions " .
-                $deps['required']['pearinstaller']['exclude'];
-        }
-
-        foreach (array('Package', 'Extension') as $type) {
-            $index = strtolower($type);
-            if (isset($deps['required'][$index])) {
-                if (isset($deps['required'][$index]['name'])) {
-                    $deps['required'][$index] = array($deps['required'][$index]);
-                }
-
-                foreach ($deps['required'][$index] as $package) {
-                    if (isset($package['conflicts'])) {
-                        $infoindex = 'Not Compatible with';
-                        if (!isset($info['Not Compatible with'])) {
-                            $info['Not Compatible with'] = '';
-                        } else {
-                            $info['Not Compatible with'] .= "\n";
-                        }
-                    } else {
-                        $infoindex = 'Required Dependencies';
-                        $info[$infoindex] .= "\n";
-                    }
-
-                    if ($index == 'extension') {
-                        $name = $package['name'];
-                    } else {
-                        if (isset($package['channel'])) {
-                            $name = $package['channel'] . '/' . $package['name'];
-                        } else {
-                            $name = '__uri/' . $package['name'] . ' (static URI)';
-                        }
-                    }
-
-                    $info[$infoindex] .= "$type $name";
-                    if (isset($package['uri'])) {
-                        $info[$infoindex] .= "\n  Download URI: $package[uri]";
-                        continue;
-                    }
-
-                    if (isset($package['max']) && isset($package['min'])) {
-                        $info[$infoindex] .= " \n  Versions " .
-                            $package['min'] . '-' . $package['max'];
-                    } elseif (isset($package['min'])) {
-                        $info[$infoindex] .= " \n  Version " .
-                            $package['min'] . ' or newer';
-                    } elseif (isset($package['max'])) {
-                        $info[$infoindex] .= " \n  Version " .
-                            $package['max'] . ' or older';
-                    }
-
-                    if (isset($package['recommended'])) {
-                        $info[$infoindex] .= "\n  Recommended version: $package[recommended]";
-                    }
-
-                    if (isset($package['exclude'])) {
-                        if (!isset($info['Not Compatible with'])) {
-                            $info['Not Compatible with'] = '';
-                        } else {
-                            $info['Not Compatible with'] .= "\n";
-                        }
-
-                        if (is_array($package['exclude'])) {
-                            $package['exclude'] = implode(', ', $package['exclude']);
-                        }
-
-                        $package['package'] = $package['name']; // for parsedPackageNameToString
-                         if (isset($package['conflicts'])) {
-                            $info['Not Compatible with'] .= '=> except ';
-                        }
-                       $info['Not Compatible with'] .= 'Package ' .
-                            $reg->parsedPackageNameToString($package, true);
-                        $info['Not Compatible with'] .= "\n  Versions " . $package['exclude'];
-                    }
-                }
-            }
-        }
-
-        if (isset($deps['required']['os'])) {
-            if (isset($deps['required']['os']['name'])) {
-                $dep['required']['os']['name'] = array($dep['required']['os']['name']);
-            }
-
-            foreach ($dep['required']['os'] as $os) {
-                if (isset($os['conflicts']) && $os['conflicts'] == 'yes') {
-                    if (!isset($info['Not Compatible with'])) {
-                        $info['Not Compatible with'] = '';
-                    } else {
-                        $info['Not Compatible with'] .= "\n";
-                    }
-                    $info['Not Compatible with'] .= "$os[name] Operating System";
-                } else {
-                    $info['Required Dependencies'] .= "\n";
-                    $info['Required Dependencies'] .= "$os[name] Operating System";
-                }
-            }
-        }
-
-        if (isset($deps['required']['arch'])) {
-            if (isset($deps['required']['arch']['pattern'])) {
-                $dep['required']['arch']['pattern'] = array($dep['required']['os']['pattern']);
-            }
-
-            foreach ($dep['required']['arch'] as $os) {
-                if (isset($os['conflicts']) && $os['conflicts'] == 'yes') {
-                    if (!isset($info['Not Compatible with'])) {
-                        $info['Not Compatible with'] = '';
-                    } else {
-                        $info['Not Compatible with'] .= "\n";
-                    }
-                    $info['Not Compatible with'] .= "OS/Arch matching pattern '/$os[pattern]/'";
-                } else {
-                    $info['Required Dependencies'] .= "\n";
-                    $info['Required Dependencies'] .= "OS/Arch matching pattern '/$os[pattern]/'";
-                }
-            }
-        }
-
-        if (isset($deps['optional'])) {
-            foreach (array('Package', 'Extension') as $type) {
-                $index = strtolower($type);
-                if (isset($deps['optional'][$index])) {
-                    if (isset($deps['optional'][$index]['name'])) {
-                        $deps['optional'][$index] = array($deps['optional'][$index]);
-                    }
-
-                    foreach ($deps['optional'][$index] as $package) {
-                        if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
-                            $infoindex = 'Not Compatible with';
-                            if (!isset($info['Not Compatible with'])) {
-                                $info['Not Compatible with'] = '';
-                            } else {
-                                $info['Not Compatible with'] .= "\n";
-                            }
-                        } else {
-                            $infoindex = 'Optional Dependencies';
-                            if (!isset($info['Optional Dependencies'])) {
-                                $info['Optional Dependencies'] = '';
-                            } else {
-                                $info['Optional Dependencies'] .= "\n";
-                            }
-                        }
-
-                        if ($index == 'extension') {
-                            $name = $package['name'];
-                        } else {
-                            if (isset($package['channel'])) {
-                                $name = $package['channel'] . '/' . $package['name'];
-                            } else {
-                                $name = '__uri/' . $package['name'] . ' (static URI)';
-                            }
-                        }
-
-                        $info[$infoindex] .= "$type $name";
-                        if (isset($package['uri'])) {
-                            $info[$infoindex] .= "\n  Download URI: $package[uri]";
-                            continue;
-                        }
-
-                        if ($infoindex == 'Not Compatible with') {
-                            // conflicts is only used to say that all versions conflict
-                            continue;
-                        }
-
-                        if (isset($package['max']) && isset($package['min'])) {
-                            $info[$infoindex] .= " \n  Versions " .
-                                $package['min'] . '-' . $package['max'];
-                        } elseif (isset($package['min'])) {
-                            $info[$infoindex] .= " \n  Version " .
-                                $package['min'] . ' or newer';
-                        } elseif (isset($package['max'])) {
-                            $info[$infoindex] .= " \n  Version " .
-                                $package['min'] . ' or older';
-                        }
-
-                        if (isset($package['recommended'])) {
-                            $info[$infoindex] .= "\n  Recommended version: $package[recommended]";
-                        }
-
-                        if (isset($package['exclude'])) {
-                            if (!isset($info['Not Compatible with'])) {
-                                $info['Not Compatible with'] = '';
-                            } else {
-                                $info['Not Compatible with'] .= "\n";
-                            }
-
-                            if (is_array($package['exclude'])) {
-                                $package['exclude'] = implode(', ', $package['exclude']);
-                            }
-
-                            $info['Not Compatible with'] .= "Package $package\n  Versions " .
-                                $package['exclude'];
-                        }
-                    }
-                }
-            }
-        }
-
-        if (isset($deps['group'])) {
-            if (!isset($deps['group'][0])) {
-                $deps['group'] = array($deps['group']);
-            }
-
-            foreach ($deps['group'] as $group) {
-                $info['Dependency Group ' . $group['attribs']['name']] = $group['attribs']['hint'];
-                $groupindex = $group['attribs']['name'] . ' Contents';
-                $info[$groupindex] = '';
-                foreach (array('Package', 'Extension') as $type) {
-                    $index = strtolower($type);
-                    if (isset($group[$index])) {
-                        if (isset($group[$index]['name'])) {
-                            $group[$index] = array($group[$index]);
-                        }
-
-                        foreach ($group[$index] as $package) {
-                            if (!empty($info[$groupindex])) {
-                                $info[$groupindex] .= "\n";
-                            }
-
-                            if ($index == 'extension') {
-                                $name = $package['name'];
-                            } else {
-                                if (isset($package['channel'])) {
-                                    $name = $package['channel'] . '/' . $package['name'];
-                                } else {
-                                    $name = '__uri/' . $package['name'] . ' (static URI)';
-                                }
-                            }
-
-                            if (isset($package['uri'])) {
-                                if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
-                                    $info[$groupindex] .= "Not Compatible with $type $name";
-                                } else {
-                                    $info[$groupindex] .= "$type $name";
-                                }
-
-                                $info[$groupindex] .= "\n  Download URI: $package[uri]";
-                                continue;
-                            }
-
-                            if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
-                                $info[$groupindex] .= "Not Compatible with $type $name";
-                                continue;
-                            }
-
-                            $info[$groupindex] .= "$type $name";
-                            if (isset($package['max']) && isset($package['min'])) {
-                                $info[$groupindex] .= " \n  Versions " .
-                                    $package['min'] . '-' . $package['max'];
-                            } elseif (isset($package['min'])) {
-                                $info[$groupindex] .= " \n  Version " .
-                                    $package['min'] . ' or newer';
-                            } elseif (isset($package['max'])) {
-                                $info[$groupindex] .= " \n  Version " .
-                                    $package['min'] . ' or older';
-                            }
-
-                            if (isset($package['recommended'])) {
-                                $info[$groupindex] .= "\n  Recommended version: $package[recommended]";
-                            }
-
-                            if (isset($package['exclude'])) {
-                                if (!isset($info['Not Compatible with'])) {
-                                    $info['Not Compatible with'] = '';
-                                } else {
-                                    $info[$groupindex] .= "Not Compatible with\n";
-                                }
-
-                                if (is_array($package['exclude'])) {
-                                    $package['exclude'] = implode(', ', $package['exclude']);
-                                }
-                                $info[$groupindex] .= "  Package $package\n  Versions " .
-                                    $package['exclude'];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        if ($obj->getPackageType() == 'bundle') {
-            $info['Bundled Packages'] = '';
-            foreach ($obj->getBundledPackages() as $package) {
-                if (!empty($info['Bundled Packages'])) {
-                    $info['Bundled Packages'] .= "\n";
-                }
-
-                if (isset($package['uri'])) {
-                    $info['Bundled Packages'] .= '__uri/' . $package['name'];
-                    $info['Bundled Packages'] .= "\n  (URI: $package[uri]";
-                } else {
-                    $info['Bundled Packages'] .= $package['channel'] . '/' . $package['name'];
-                }
-            }
-        }
-
-        $info['package.xml version'] = '2.0';
-        if ($installed) {
-            if ($obj->getLastModified()) {
-                $info['Last Modified'] = date('Y-m-d H:i', $obj->getLastModified());
-            }
-
-            $v = $obj->getLastInstalledVersion();
-            $info['Previous Installed Version'] = $v ? $v : '- None -';
-        }
-
-        foreach ($info as $key => $value) {
-            $data['data'][] = array($key, $value);
-        }
-
-        $data['raw'] = $obj->getArray(); // no validation needed
-        $this->ui->outputData($data, 'package-info');
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Registry.xml b/lib/php/PEAR/Command/Registry.xml
deleted file mode 100644
index 9f4e2149672f9ed2b0b39947292108ac81444d1b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Registry.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<commands version="1.0">
- <list>
-  <summary>List Installed Packages In The Default Channel</summary>
-  <function>doList</function>
-  <shortcut>l</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>list installed packages from this channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-   <allchannels>
-    <shortopt>a</shortopt>
-    <doc>list installed packages from all channels</doc>
-   </allchannels>
-   <channelinfo>
-    <shortopt>i</shortopt>
-    <doc>output fully channel-aware data, even on failure</doc>
-   </channelinfo>
-  </options>
-  <doc>&lt;package&gt;
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}).  With a parameter, it
-lists the files in a package.
-</doc>
- </list>
- <list-files>
-  <summary>List Files In Installed Package</summary>
-  <function>doFileList</function>
-  <shortcut>fl</shortcut>
-  <options />
-  <doc>&lt;package&gt;
-List the files in an installed package.
-</doc>
- </list-files>
- <shell-test>
-  <summary>Shell Script Test</summary>
-  <function>doShellTest</function>
-  <shortcut>st</shortcut>
-  <options />
-  <doc>&lt;package&gt; [[relation] version]
-Tests if a package is installed in the system. Will exit(1) if it is not.
-   &lt;relation&gt;   The version comparison operator. One of:
-                &lt;, lt, &lt;=, le, &gt;, gt, &gt;=, ge, ==, =, eq, !=, &lt;&gt;, ne
-   &lt;version&gt;    The version to compare with
-</doc>
- </shell-test>
- <info>
-  <summary>Display information about a package</summary>
-  <function>doInfo</function>
-  <shortcut>in</shortcut>
-  <options />
-  <doc>&lt;package&gt;
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.</doc>
- </info>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Remote.php b/lib/php/PEAR/Command/Remote.php
deleted file mode 100644
index 6f87e31de7c4b79b4b51080514d70f8a9279db98..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Remote.php
+++ /dev/null
@@ -1,809 +0,0 @@
-<?php
-/**
- * PEAR_Command_Remote (remote-info, list-upgrades, remote-list, search, list-all, download,
- * clear-cache commands)
- *
- * 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: Remote.php 287477 2009-08-19 14:19:43Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-require_once 'PEAR/REST.php';
-
-/**
- * PEAR commands for remote server querying
- *
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Command_Remote extends PEAR_Command_Common
-{
-    var $commands = array(
-        'remote-info' => array(
-            'summary' => 'Information About Remote Packages',
-            'function' => 'doRemoteInfo',
-            'shortcut' => 'ri',
-            'options' => array(),
-            'doc' => '<package>
-Get details on a package from the server.',
-            ),
-        'list-upgrades' => array(
-            'summary' => 'List Available Upgrades',
-            'function' => 'doListUpgrades',
-            'shortcut' => 'lu',
-            'options' => array(
-                'channelinfo' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'output fully channel-aware data, even on failure',
-                    ),
-            ),
-            'doc' => '[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.'
-            ),
-        'remote-list' => array(
-            'summary' => 'List Remote Packages',
-            'function' => 'doRemoteList',
-            'shortcut' => 'rl',
-            'options' => array(
-                'channel' =>
-                    array(
-                    'shortopt' => 'c',
-                    'doc' => 'specify a channel other than the default channel',
-                    'arg' => 'CHAN',
-                    )
-                ),
-            'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
-            ),
-        'search' => array(
-            'summary' => 'Search remote package database',
-            'function' => 'doSearch',
-            'shortcut' => 'sp',
-            'options' => array(
-                'channel' =>
-                    array(
-                    'shortopt' => 'c',
-                    'doc' => 'specify a channel other than the default channel',
-                    'arg' => 'CHAN',
-                    ),
-                'allchannels' => array(
-                    'shortopt' => 'a',
-                    'doc' => 'search packages from all known channels',
-                    ),
-                'channelinfo' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'output fully channel-aware data, even on failure',
-                    ),
-                ),
-            'doc' => '[packagename] [packageinfo]
-Lists all packages which match the search parameters.  The first
-parameter is a fragment of a packagename.  The default channel
-will be used unless explicitly overridden.  The second parameter
-will be used to match any portion of the summary/description',
-            ),
-        'list-all' => array(
-            'summary' => 'List All Packages',
-            'function' => 'doListAll',
-            'shortcut' => 'la',
-            'options' => array(
-                'channel' =>
-                    array(
-                    'shortopt' => 'c',
-                    'doc' => 'specify a channel other than the default channel',
-                    'arg' => 'CHAN',
-                    ),
-                'channelinfo' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'output fully channel-aware data, even on failure',
-                    ),
-                ),
-            'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
-            ),
-        'download' => array(
-            'summary' => 'Download Package',
-            'function' => 'doDownload',
-            'shortcut' => 'd',
-            'options' => array(
-                'nocompress' => array(
-                    'shortopt' => 'Z',
-                    'doc' => 'download an uncompressed (.tar) file',
-                    ),
-                ),
-            'doc' => '<package>...
-Download package tarballs.  The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.',
-            ),
-        'clear-cache' => array(
-            'summary' => 'Clear Web Services Cache',
-            'function' => 'doClearCache',
-            'shortcut' => 'cc',
-            'options' => array(),
-            'doc' => '
-Clear the XML-RPC/REST cache.  See also the cache_ttl configuration
-parameter.
-',
-            ),
-        );
-
-    /**
-     * PEAR_Command_Remote constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Remote(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function _checkChannelForStatus($channel, $chan)
-    {
-        if (PEAR::isError($chan)) {
-            $this->raiseError($chan);
-        }
-        if (!is_a($chan, 'PEAR_ChannelFile')) {
-            return $this->raiseError('Internal corruption error: invalid channel "' .
-                $channel . '"');
-        }
-        $rest = new PEAR_REST($this->config);
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $mirror = $this->config->get('preferred_mirror', null,
-                                     $channel);
-        $a = $rest->downloadHttp('http://' . $channel .
-            '/channel.xml', $chan->lastModified());
-        PEAR::staticPopErrorHandling();
-        if (!PEAR::isError($a) && $a) {
-            $this->ui->outputData('WARNING: channel "' . $channel . '" has ' .
-                'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $channel .
-                '" to update');
-        }
-    }
-
-    function doRemoteInfo($command, $options, $params)
-    {
-        if (sizeof($params) != 1) {
-            return $this->raiseError("$command expects one param: the remote package name");
-        }
-        $savechannel = $channel = $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        $package = $params[0];
-        $parsed = $reg->parsePackageName($package, $channel);
-        if (PEAR::isError($parsed)) {
-            return $this->raiseError('Invalid package name "' . $package . '"');
-        }
-
-        $channel = $parsed['channel'];
-        $this->config->set('default_channel', $channel);
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
-            return $e;
-        }
-
-        $mirror = $this->config->get('preferred_mirror');
-        if ($chan->supportsREST($mirror) && $base = $chan->getBaseURL('REST1.0', $mirror)) {
-            $rest = &$this->config->getREST('1.0', array());
-            $info = $rest->packageInfo($base, $parsed['package'], $channel);
-        }
-
-        if (!isset($info)) {
-            return $this->raiseError('No supported protocol was found');
-        }
-
-        if (PEAR::isError($info)) {
-            $this->config->set('default_channel', $savechannel);
-            return $this->raiseError($info);
-        }
-
-        if (!isset($info['name'])) {
-            return $this->raiseError('No remote package "' . $package . '" was found');
-        }
-
-        $installed = $reg->packageInfo($info['name'], null, $channel);
-        $info['installed'] = $installed['version'] ? $installed['version'] : '- no -';
-        if (is_array($info['installed'])) {
-            $info['installed'] = $info['installed']['release'];
-        }
-
-        $this->ui->outputData($info, $command);
-        $this->config->set('default_channel', $savechannel);
-
-        return true;
-    }
-
-    function doRemoteList($command, $options, $params)
-    {
-        $savechannel = $channel = $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        if (isset($options['channel'])) {
-            $channel = $options['channel'];
-            if (!$reg->channelExists($channel)) {
-                return $this->raiseError('Channel "' . $channel . '" does not exist');
-            }
-
-            $this->config->set('default_channel', $channel);
-        }
-
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
-            return $e;
-        }
-
-        $list_options = false;
-        if ($this->config->get('preferred_state') == 'stable') {
-            $list_options = true;
-        }
-
-        $available = array();
-        if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))
-        ) {
-            // use faster list-all if available
-            $rest = &$this->config->getREST('1.1', array());
-            $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
-        } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
-            $rest = &$this->config->getREST('1.0', array());
-            $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
-        }
-
-        if (PEAR::isError($available)) {
-            $this->config->set('default_channel', $savechannel);
-            return $this->raiseError($available);
-        }
-
-        $i = $j = 0;
-        $data = array(
-            'caption' => 'Channel ' . $channel . ' Available packages:',
-            'border' => true,
-            'headline' => array('Package', 'Version'),
-            'channel' => $channel
-            );
-
-        if (count($available) == 0) {
-            $data = '(no packages available yet)';
-        } else {
-            foreach ($available as $name => $info) {
-                $version = (isset($info['stable']) && $info['stable']) ? $info['stable'] : '-n/a-';
-                $data['data'][] = array($name, $version);
-            }
-        }
-        $this->ui->outputData($data, $command);
-        $this->config->set('default_channel', $savechannel);
-        return true;
-    }
-
-    function doListAll($command, $options, $params)
-    {
-        $savechannel = $channel = $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        if (isset($options['channel'])) {
-            $channel = $options['channel'];
-            if (!$reg->channelExists($channel)) {
-                return $this->raiseError("Channel \"$channel\" does not exist");
-            }
-
-            $this->config->set('default_channel', $channel);
-        }
-
-        $list_options = false;
-        if ($this->config->get('preferred_state') == 'stable') {
-            $list_options = true;
-        }
-
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
-            return $e;
-        }
-
-        if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))) {
-            // use faster list-all if available
-            $rest = &$this->config->getREST('1.1', array());
-            $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName());
-        } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
-            $rest = &$this->config->getREST('1.0', array());
-            $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName());
-        }
-
-        if (PEAR::isError($available)) {
-            $this->config->set('default_channel', $savechannel);
-            return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "' . $available->getMessage() . '")');
-        }
-
-        $data = array(
-            'caption' => 'All packages [Channel ' . $channel . ']:',
-            'border' => true,
-            'headline' => array('Package', 'Latest', 'Local'),
-            'channel' => $channel,
-            );
-
-        if (isset($options['channelinfo'])) {
-            // add full channelinfo
-            $data['caption'] = 'Channel ' . $channel . ' All packages:';
-            $data['headline'] = array('Channel', 'Package', 'Latest', 'Local',
-                'Description', 'Dependencies');
-        }
-        $local_pkgs = $reg->listPackages($channel);
-
-        foreach ($available as $name => $info) {
-            $installed = $reg->packageInfo($name, null, $channel);
-            if (is_array($installed['version'])) {
-                $installed['version'] = $installed['version']['release'];
-            }
-            $desc = $info['summary'];
-            if (isset($params[$name])) {
-                $desc .= "\n\n".$info['description'];
-            }
-            if (isset($options['mode']))
-            {
-                if ($options['mode'] == 'installed' && !isset($installed['version'])) {
-                    continue;
-                }
-                if ($options['mode'] == 'notinstalled' && isset($installed['version'])) {
-                    continue;
-                }
-                if ($options['mode'] == 'upgrades'
-                      && (!isset($installed['version']) || version_compare($installed['version'],
-                      $info['stable'], '>='))) {
-                    continue;
-                }
-            }
-            $pos = array_search(strtolower($name), $local_pkgs);
-            if ($pos !== false) {
-                unset($local_pkgs[$pos]);
-            }
-
-            if (isset($info['stable']) && !$info['stable']) {
-                $info['stable'] = null;
-            }
-
-            if (isset($options['channelinfo'])) {
-                // add full channelinfo
-                if ($info['stable'] === $info['unstable']) {
-                    $state = $info['state'];
-                } else {
-                    $state = 'stable';
-                }
-                $latest = $info['stable'].' ('.$state.')';
-                $local = '';
-                if (isset($installed['version'])) {
-                    $inst_state = $reg->packageInfo($name, 'release_state', $channel);
-                    $local = $installed['version'].' ('.$inst_state.')';
-                }
-
-                $packageinfo = array(
-                    $channel,
-                    $name,
-                    $latest,
-                    $local,
-                    isset($desc) ? $desc : null,
-                    isset($info['deps']) ? $info['deps'] : null,
-                );
-            } else {
-                $packageinfo = array(
-                    $reg->channelAlias($channel) . '/' . $name,
-                    isset($info['stable']) ? $info['stable'] : null,
-                    isset($installed['version']) ? $installed['version'] : null,
-                    isset($desc) ? $desc : null,
-                    isset($info['deps']) ? $info['deps'] : null,
-                );
-            }
-            $data['data'][$info['category']][] = $packageinfo;
-        }
-
-        if (isset($options['mode']) && in_array($options['mode'], array('notinstalled', 'upgrades'))) {
-            $this->config->set('default_channel', $savechannel);
-            $this->ui->outputData($data, $command);
-            return true;
-        }
-
-        foreach ($local_pkgs as $name) {
-            $info = &$reg->getPackage($name, $channel);
-            $data['data']['Local'][] = array(
-                $reg->channelAlias($channel) . '/' . $info->getPackage(),
-                '',
-                $info->getVersion(),
-                $info->getSummary(),
-                $info->getDeps()
-                );
-        }
-
-        $this->config->set('default_channel', $savechannel);
-        $this->ui->outputData($data, $command);
-        return true;
-    }
-
-    function doSearch($command, $options, $params)
-    {
-        if ((!isset($params[0]) || empty($params[0]))
-            && (!isset($params[1]) || empty($params[1])))
-        {
-            return $this->raiseError('no valid search string supplied');
-        }
-
-        $channelinfo = isset($options['channelinfo']);
-        $reg = &$this->config->getRegistry();
-        if (isset($options['allchannels'])) {
-            // search all channels
-            unset($options['allchannels']);
-            $channels = $reg->getChannels();
-            $errors = array();
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            foreach ($channels as $channel) {
-                if ($channel->getName() != '__uri') {
-                    $options['channel'] = $channel->getName();
-                    $ret = $this->doSearch($command, $options, $params);
-                    if (PEAR::isError($ret)) {
-                        $errors[] = $ret;
-                    }
-                }
-            }
-
-            PEAR::staticPopErrorHandling();
-            if (count($errors) !== 0) {
-                // for now, only give first error
-                return PEAR::raiseError($errors[0]);
-            }
-
-            return true;
-        }
-
-        $savechannel = $channel = $this->config->get('default_channel');
-        $package = strtolower($params[0]);
-        $summary = isset($params[1]) ? $params[1] : false;
-        if (isset($options['channel'])) {
-            $reg = &$this->config->getRegistry();
-            $channel = $options['channel'];
-            if (!$reg->channelExists($channel)) {
-                return $this->raiseError('Channel "' . $channel . '" does not exist');
-            }
-
-            $this->config->set('default_channel', $channel);
-        }
-
-        $chan = $reg->getChannel($channel);
-        if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
-            return $e;
-        }
-
-        if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
-              $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
-            $rest = &$this->config->getREST('1.0', array());
-            $available = $rest->listAll($base, false, false, $package, $summary, $chan->getName());
-        }
-
-        if (PEAR::isError($available)) {
-            $this->config->set('default_channel', $savechannel);
-            return $this->raiseError($available);
-        }
-
-        if (!$available && !$channelinfo) {
-            // clean exit when not found, no error !
-            $data = 'no packages found that match pattern "' . $package . '", for channel '.$channel.'.';
-            $this->ui->outputData($data);
-            $this->config->set('default_channel', $channel);
-            return true;
-        }
-
-        if ($channelinfo) {
-            $data = array(
-                'caption' => 'Matched packages, channel ' . $channel . ':',
-                'border' => true,
-                'headline' => array('Channel', 'Package', 'Stable/(Latest)', 'Local'),
-                'channel' => $channel
-                );
-        } else {
-            $data = array(
-                'caption' => 'Matched packages, channel ' . $channel . ':',
-                'border' => true,
-                'headline' => array('Package', 'Stable/(Latest)', 'Local'),
-                'channel' => $channel
-                );
-        }
-
-        if (!$available && $channelinfo) {
-            unset($data['headline']);
-            $data['data'] = 'No packages found that match pattern "' . $package . '".';
-            $available = array();
-        }
-
-        foreach ($available as $name => $info) {
-            $installed = $reg->packageInfo($name, null, $channel);
-            $desc = $info['summary'];
-            if (isset($params[$name]))
-                $desc .= "\n\n".$info['description'];
-
-            if (!isset($info['stable']) || !$info['stable']) {
-                $version_remote = 'none';
-            } else {
-                if ($info['unstable']) {
-                    $version_remote = $info['unstable'];
-                } else {
-                    $version_remote = $info['stable'];
-                }
-                $version_remote .= ' ('.$info['state'].')';
-            }
-            $version = is_array($installed['version']) ? $installed['version']['release'] :
-                $installed['version'];
-            if ($channelinfo) {
-                $packageinfo = array(
-                    $channel,
-                    $name,
-                    $version_remote,
-                    $version,
-                    $desc,
-                );
-            } else {
-                $packageinfo = array(
-                    $name,
-                    $version_remote,
-                    $version,
-                    $desc,
-                );
-            }
-            $data['data'][$info['category']][] = $packageinfo;
-        }
-
-        $this->ui->outputData($data, $command);
-        $this->config->set('default_channel', $channel);
-        return true;
-    }
-
-    function &getDownloader($options)
-    {
-        if (!class_exists('PEAR_Downloader')) {
-            require_once 'PEAR/Downloader.php';
-        }
-        $a = &new PEAR_Downloader($this->ui, $options, $this->config);
-        return $a;
-    }
-
-    function doDownload($command, $options, $params)
-    {
-        // make certain that dependencies are ignored
-        $options['downloadonly'] = 1;
-
-        // eliminate error messages for preferred_state-related errors
-        /* TODO: Should be an option, but until now download does respect
-           prefered state */
-        /* $options['ignorepreferred_state'] = 1; */
-        // eliminate error messages for preferred_state-related errors
-
-        $downloader = &$this->getDownloader($options);
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $e = $downloader->setDownloadDir(getcwd());
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($e)) {
-            return $this->raiseError('Current directory is not writeable, cannot download');
-        }
-
-        $errors = array();
-        $downloaded = array();
-        $err = $downloader->download($params);
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-
-        $errors = $downloader->getErrorMsgs();
-        if (count($errors)) {
-            foreach ($errors as $error) {
-                if ($error !== null) {
-                    $this->ui->outputData($error);
-                }
-            }
-
-            return $this->raiseError("$command failed");
-        }
-
-        $downloaded = $downloader->getDownloadedPackages();
-        foreach ($downloaded as $pkg) {
-            $this->ui->outputData("File $pkg[file] downloaded", $command);
-        }
-
-        return true;
-    }
-
-    function downloadCallback($msg, $params = null)
-    {
-        if ($msg == 'done') {
-            $this->bytes_downloaded = $params;
-        }
-    }
-
-    function doListUpgrades($command, $options, $params)
-    {
-        require_once 'PEAR/Common.php';
-        if (isset($params[0]) && !is_array(PEAR_Common::betterStates($params[0]))) {
-            return $this->raiseError($params[0] . ' is not a valid state (stable/beta/alpha/devel/etc.) try "pear help list-upgrades"');
-        }
-
-        $savechannel = $channel = $this->config->get('default_channel');
-        $reg = &$this->config->getRegistry();
-        foreach ($reg->listChannels() as $channel) {
-            $inst = array_flip($reg->listPackages($channel));
-            if (!count($inst)) {
-                continue;
-            }
-
-            if ($channel == '__uri') {
-                continue;
-            }
-
-            $this->config->set('default_channel', $channel);
-            $state = empty($params[0]) ? $this->config->get('preferred_state') : $params[0];
-
-            $caption = $channel . ' Available Upgrades';
-            $chan = $reg->getChannel($channel);
-            if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
-                return $e;
-            }
-
-            $latest = array();
-            $base2  = false;
-            $preferred_mirror = $this->config->get('preferred_mirror');
-            if ($chan->supportsREST($preferred_mirror) &&
-                (
-                   //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) ||
-                   ($base  = $chan->getBaseURL('REST1.0', $preferred_mirror))
-                )
-
-            ) {
-                if ($base2) {
-                    $rest = &$this->config->getREST('1.4', array());
-                    $base = $base2;
-                } else {
-                    $rest = &$this->config->getREST('1.0', array());
-                }
-
-                if (empty($state) || $state == 'any') {
-                    $state = false;
-                } else {
-                    $caption .= ' (' . implode(', ', PEAR_Common::betterStates($state, true)) . ')';
-                }
-
-                PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                $latest = $rest->listLatestUpgrades($base, $state, $inst, $channel, $reg);
-                PEAR::staticPopErrorHandling();
-            }
-
-            if (PEAR::isError($latest)) {
-                $this->ui->outputData($latest->getMessage());
-                continue;
-            }
-
-            $caption .= ':';
-            if (PEAR::isError($latest)) {
-                $this->config->set('default_channel', $savechannel);
-                return $latest;
-            }
-
-            $data = array(
-                'caption' => $caption,
-                'border' => 1,
-                'headline' => array('Channel', 'Package', 'Local', 'Remote', 'Size'),
-                'channel' => $channel
-                );
-
-            foreach ((array)$latest as $pkg => $info) {
-                $package = strtolower($pkg);
-                if (!isset($inst[$package])) {
-                    // skip packages we don't have installed
-                    continue;
-                }
-
-                extract($info);
-                $inst_version = $reg->packageInfo($package, 'version', $channel);
-                $inst_state   = $reg->packageInfo($package, 'release_state', $channel);
-                if (version_compare("$version", "$inst_version", "le")) {
-                    // installed version is up-to-date
-                    continue;
-                }
-
-                if ($filesize >= 20480) {
-                    $filesize += 1024 - ($filesize % 1024);
-                    $fs = sprintf("%dkB", $filesize / 1024);
-                } elseif ($filesize > 0) {
-                    $filesize += 103 - ($filesize % 103);
-                    $fs = sprintf("%.1fkB", $filesize / 1024.0);
-                } else {
-                    $fs = "  -"; // XXX center instead
-                }
-
-                $data['data'][] = array($channel, $pkg, "$inst_version ($inst_state)", "$version ($state)", $fs);
-            }
-
-            if (isset($options['channelinfo'])) {
-                if (empty($data['data'])) {
-                    unset($data['headline']);
-                    if (count($inst) == 0) {
-                        $data['data'] = '(no packages installed)';
-                    } else {
-                        $data['data'] = '(no upgrades available)';
-                    }
-                }
-                $this->ui->outputData($data, $command);
-            } else {
-                if (empty($data['data'])) {
-                    $this->ui->outputData('Channel ' . $channel . ': No upgrades available');
-                } else {
-                    $this->ui->outputData($data, $command);
-                }
-            }
-        }
-
-        $this->config->set('default_channel', $savechannel);
-        return true;
-    }
-
-    function doClearCache($command, $options, $params)
-    {
-        $cache_dir = $this->config->get('cache_dir');
-        $verbose   = $this->config->get('verbose');
-        $output = '';
-        if (!file_exists($cache_dir) || !is_dir($cache_dir)) {
-            return $this->raiseError("$cache_dir does not exist or is not a directory");
-        }
-
-        if (!($dp = @opendir($cache_dir))) {
-            return $this->raiseError("opendir($cache_dir) failed: $php_errormsg");
-        }
-
-        if ($verbose >= 1) {
-            $output .= "reading directory $cache_dir\n";
-        }
-        $num = 0;
-        while ($ent = readdir($dp)) {
-            if (preg_match('/rest.cache(file|id)\\z/', $ent)) {
-                $path = $cache_dir . DIRECTORY_SEPARATOR . $ent;
-                if (file_exists($path)) {
-                    $ok = @unlink($path);
-                } else {
-                    $ok = false;
-                    $php_errormsg = '';
-                }
-
-                if ($ok) {
-                    if ($verbose >= 2) {
-                        $output .= "deleted $path\n";
-                    }
-                    $num++;
-                } elseif ($verbose >= 1) {
-                    $output .= "failed to delete $path $php_errormsg\n";
-                }
-            }
-        }
-
-        closedir($dp);
-        if ($verbose >= 1) {
-            $output .= "$num cache entries cleared\n";
-        }
-
-        $this->ui->outputData(rtrim($output), $command);
-        return $num;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Remote.xml b/lib/php/PEAR/Command/Remote.xml
deleted file mode 100644
index b4f6100c793109d1f8bd66ecbe70055ae348559d..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Remote.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<commands version="1.0">
- <remote-info>
-  <summary>Information About Remote Packages</summary>
-  <function>doRemoteInfo</function>
-  <shortcut>ri</shortcut>
-  <options />
-  <doc>&lt;package&gt;
-Get details on a package from the server.</doc>
- </remote-info>
- <list-upgrades>
-  <summary>List Available Upgrades</summary>
-  <function>doListUpgrades</function>
-  <shortcut>lu</shortcut>
-  <options>
-   <channelinfo>
-    <shortopt>i</shortopt>
-    <doc>output fully channel-aware data, even on failure</doc>
-   </channelinfo>
-  </options>
-  <doc>[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.</doc>
- </list-upgrades>
- <remote-list>
-  <summary>List Remote Packages</summary>
-  <function>doRemoteList</function>
-  <shortcut>rl</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>specify a channel other than the default channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-  </options>
-  <doc>
-Lists the packages available on the configured server along with the
-latest stable release of each package.</doc>
- </remote-list>
- <search>
-  <summary>Search remote package database</summary>
-  <function>doSearch</function>
-  <shortcut>sp</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>specify a channel other than the default channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-   <allchannels>
-    <shortopt>a</shortopt>
-    <doc>search packages from all known channels</doc>
-   </allchannels>
-   <channelinfo>
-    <shortopt>i</shortopt>
-    <doc>output fully channel-aware data, even on failure</doc>
-   </channelinfo>
-  </options>
-  <doc>[packagename] [packageinfo]
-Lists all packages which match the search parameters.  The first
-parameter is a fragment of a packagename.  The default channel
-will be used unless explicitly overridden.  The second parameter
-will be used to match any portion of the summary/description</doc>
- </search>
- <list-all>
-  <summary>List All Packages</summary>
-  <function>doListAll</function>
-  <shortcut>la</shortcut>
-  <options>
-   <channel>
-    <shortopt>c</shortopt>
-    <doc>specify a channel other than the default channel</doc>
-    <arg>CHAN</arg>
-   </channel>
-   <channelinfo>
-    <shortopt>i</shortopt>
-    <doc>output fully channel-aware data, even on failure</doc>
-   </channelinfo>
-  </options>
-  <doc>
-Lists the packages available on the configured server along with the
-latest stable release of each package.</doc>
- </list-all>
- <download>
-  <summary>Download Package</summary>
-  <function>doDownload</function>
-  <shortcut>d</shortcut>
-  <options>
-   <nocompress>
-    <shortopt>Z</shortopt>
-    <doc>download an uncompressed (.tar) file</doc>
-   </nocompress>
-  </options>
-  <doc>&lt;package&gt;...
-Download package tarballs.  The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.</doc>
- </download>
- <clear-cache>
-  <summary>Clear Web Services Cache</summary>
-  <function>doClearCache</function>
-  <shortcut>cc</shortcut>
-  <options />
-  <doc>
-Clear the XML-RPC/REST cache.  See also the cache_ttl configuration
-parameter.
-</doc>
- </clear-cache>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Test.php b/lib/php/PEAR/Command/Test.php
deleted file mode 100644
index 3715859ff617572bb236f88ccd0888035ee40f6a..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Test.php
+++ /dev/null
@@ -1,337 +0,0 @@
-<?php
-/**
- * PEAR_Command_Test (run-tests)
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Martin Jansen <mj@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: Test.php 279072 2009-04-20 19:57:41Z cellog $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Martin Jansen <mj@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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-
-class PEAR_Command_Test extends PEAR_Command_Common
-{
-    var $commands = array(
-        'run-tests' => array(
-            'summary' => 'Run Regression Tests',
-            'function' => 'doRunTests',
-            'shortcut' => 'rt',
-            'options' => array(
-                'recur' => array(
-                    'shortopt' => 'r',
-                    'doc' => 'Run tests in child directories, recursively.  4 dirs deep maximum',
-                ),
-                'ini' => array(
-                    'shortopt' => 'i',
-                    'doc' => 'actual string of settings to pass to php in format " -d setting=blah"',
-                    'arg' => 'SETTINGS'
-                ),
-                'realtimelog' => array(
-                    'shortopt' => 'l',
-                    'doc' => 'Log test runs/results as they are run',
-                ),
-                'quiet' => array(
-                    'shortopt' => 'q',
-                    'doc' => 'Only display detail for failed tests',
-                ),
-                'simple' => array(
-                    'shortopt' => 's',
-                    'doc' => 'Display simple output for all tests',
-                ),
-                'package' => array(
-                    'shortopt' => 'p',
-                    'doc' => 'Treat parameters as installed packages from which to run tests',
-                ),
-                'phpunit' => array(
-                    'shortopt' => 'u',
-                    'doc' => 'Search parameters for AllTests.php, and use that to run phpunit-based tests
-If none is found, all .phpt tests will be tried instead.',
-                ),
-                'tapoutput' => array(
-                    'shortopt' => 't',
-                    'doc' => 'Output run-tests.log in TAP-compliant format',
-                ),
-                'cgi' => array(
-                    'shortopt' => 'c',
-                    'doc' => 'CGI php executable (needed for tests with POST/GET section)',
-                    'arg' => 'PHPCGI',
-                ),
-                'coverage' => array(
-                    'shortopt' => 'x',
-                    'doc'      => 'Generate a code coverage report (requires Xdebug 2.0.0+)',
-                ),
-            ),
-            'doc' => '[testfile|dir ...]
-Run regression tests with PHP\'s regression testing script (run-tests.php).',
-            ),
-        );
-
-    var $output;
-
-    /**
-     * PEAR_Command_Test constructor.
-     *
-     * @access public
-     */
-    function PEAR_Command_Test(&$ui, &$config)
-    {
-        parent::PEAR_Command_Common($ui, $config);
-    }
-
-    function doRunTests($command, $options, $params)
-    {
-        if (isset($options['phpunit']) && isset($options['tapoutput'])) {
-            return $this->raiseError('ERROR: cannot use both --phpunit and --tapoutput at the same time');
-        }
-
-        require_once 'PEAR/Common.php';
-        require_once 'System.php';
-        $log = new PEAR_Common;
-        $log->ui = &$this->ui; // slightly hacky, but it will work
-        $tests = array();
-        $depth = isset($options['recur']) ? 14 : 1;
-
-        if (!count($params)) {
-            $params[] = '.';
-        }
-
-        if (isset($options['package'])) {
-            $oldparams = $params;
-            $params = array();
-            $reg = &$this->config->getRegistry();
-            foreach ($oldparams as $param) {
-                $pname = $reg->parsePackageName($param, $this->config->get('default_channel'));
-                if (PEAR::isError($pname)) {
-                    return $this->raiseError($pname);
-                }
-
-                $package = &$reg->getPackage($pname['package'], $pname['channel']);
-                if (!$package) {
-                    return PEAR::raiseError('Unknown package "' .
-                        $reg->parsedPackageNameToString($pname) . '"');
-                }
-
-                $filelist = $package->getFilelist();
-                foreach ($filelist as $name => $atts) {
-                    if (isset($atts['role']) && $atts['role'] != 'test') {
-                        continue;
-                    }
-
-                    if (isset($options['phpunit']) && preg_match('/AllTests\.php\\z/i', $name)) {
-                        $params[] = $atts['installed_as'];
-                        continue;
-                    } elseif (!preg_match('/\.phpt\\z/', $name)) {
-                        continue;
-                    }
-                    $params[] = $atts['installed_as'];
-                }
-            }
-        }
-
-        foreach ($params as $p) {
-            if (is_dir($p)) {
-                if (isset($options['phpunit'])) {
-                    $dir = System::find(array($p, '-type', 'f',
-                                                '-maxdepth', $depth,
-                                                '-name', 'AllTests.php'));
-                    if (count($dir)) {
-                        foreach ($dir as $p) {
-                            $p = realpath($p);
-                            if (!count($tests) ||
-                                  (count($tests) && strlen($p) < strlen($tests[0]))) {
-                                // this is in a higher-level directory, use this one instead.
-                                $tests = array($p);
-                            }
-                        }
-                    }
-                    continue;
-                }
-
-                $args  = array($p, '-type', 'f', '-name', '*.phpt');
-            } else {
-                if (isset($options['phpunit'])) {
-                    if (preg_match('/AllTests\.php\\z/i', $p)) {
-                        $p = realpath($p);
-                        if (!count($tests) ||
-                              (count($tests) && strlen($p) < strlen($tests[0]))) {
-                            // this is in a higher-level directory, use this one instead.
-                            $tests = array($p);
-                        }
-                    }
-                    continue;
-                }
-
-                if (file_exists($p) && preg_match('/\.phpt$/', $p)) {
-                    $tests[] = $p;
-                    continue;
-                }
-
-                if (!preg_match('/\.phpt\\z/', $p)) {
-                    $p .= '.phpt';
-                }
-
-                $args  = array(dirname($p), '-type', 'f', '-name', $p);
-            }
-
-            if (!isset($options['recur'])) {
-                $args[] = '-maxdepth';
-                $args[] = 1;
-            }
-
-            $dir   = System::find($args);
-            $tests = array_merge($tests, $dir);
-        }
-
-        $ini_settings = '';
-        if (isset($options['ini'])) {
-            $ini_settings .= $options['ini'];
-        }
-
-        if (isset($_ENV['TEST_PHP_INCLUDE_PATH'])) {
-            $ini_settings .= " -d include_path={$_ENV['TEST_PHP_INCLUDE_PATH']}";
-        }
-
-        if ($ini_settings) {
-            $this->ui->outputData('Using INI settings: "' . $ini_settings . '"');
-        }
-
-        $skipped = $passed = $failed = array();
-        $tests_count = count($tests);
-        $this->ui->outputData('Running ' . $tests_count . ' tests', $command);
-        $start = time();
-        if (isset($options['realtimelog']) && file_exists('run-tests.log')) {
-            unlink('run-tests.log');
-        }
-
-        if (isset($options['tapoutput'])) {
-            $tap = '1..' . $tests_count . "\n";
-        }
-
-        require_once 'PEAR/RunTest.php';
-        $run = new PEAR_RunTest($log, $options);
-        $run->tests_count = $tests_count;
-
-        if (isset($options['coverage']) && extension_loaded('xdebug')){
-            $run->xdebug_loaded = true;
-        } else {
-            $run->xdebug_loaded = false;
-        }
-
-        $j = $i = 1;
-        foreach ($tests as $t) {
-            if (isset($options['realtimelog'])) {
-                $fp = @fopen('run-tests.log', 'a');
-                if ($fp) {
-                    fwrite($fp, "Running test [$i / $tests_count] $t...");
-                    fclose($fp);
-                }
-            }
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            if (isset($options['phpunit'])) {
-                $result = $run->runPHPUnit($t, $ini_settings);
-            } else {
-                $result = $run->run($t, $ini_settings, $j);
-            }
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($result)) {
-                $this->ui->log($result->getMessage());
-                continue;
-            }
-
-            if (isset($options['tapoutput'])) {
-                $tap .= $result[0] . ' ' . $i . $result[1] . "\n";
-                continue;
-            }
-
-            if (isset($options['realtimelog'])) {
-                $fp = @fopen('run-tests.log', 'a');
-                if ($fp) {
-                    fwrite($fp, "$result\n");
-                    fclose($fp);
-                }
-            }
-
-            if ($result == 'FAILED') {
-                $failed[] = $t;
-            }
-            if ($result == 'PASSED') {
-                $passed[] = $t;
-            }
-            if ($result == 'SKIPPED') {
-                $skipped[] = $t;
-            }
-
-            $j++;
-        }
-
-        $total = date('i:s', time() - $start);
-        if (isset($options['tapoutput'])) {
-            $fp = @fopen('run-tests.log', 'w');
-            if ($fp) {
-                fwrite($fp, $tap, strlen($tap));
-                fclose($fp);
-                $this->ui->outputData('wrote TAP-format log to "' .realpath('run-tests.log') .
-                    '"', $command);
-            }
-        } else {
-            if (count($failed)) {
-                $output = "TOTAL TIME: $total\n";
-                $output .= count($passed) . " PASSED TESTS\n";
-                $output .= count($skipped) . " SKIPPED TESTS\n";
-                $output .= count($failed) . " FAILED TESTS:\n";
-                foreach ($failed as $failure) {
-                    $output .= $failure . "\n";
-                }
-
-                $mode = isset($options['realtimelog']) ? 'a' : 'w';
-                $fp   = @fopen('run-tests.log', $mode);
-
-                if ($fp) {
-                    fwrite($fp, $output, strlen($output));
-                    fclose($fp);
-                    $this->ui->outputData('wrote log to "' . realpath('run-tests.log') . '"', $command);
-                }
-            } elseif (file_exists('run-tests.log') && !is_dir('run-tests.log')) {
-                @unlink('run-tests.log');
-            }
-        }
-        $this->ui->outputData('TOTAL TIME: ' . $total);
-        $this->ui->outputData(count($passed) . ' PASSED TESTS', $command);
-        $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command);
-        if (count($failed)) {
-            $this->ui->outputData(count($failed) . ' FAILED TESTS:', $command);
-            foreach ($failed as $failure) {
-                $this->ui->outputData($failure, $command);
-            }
-        }
-
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Command/Test.xml b/lib/php/PEAR/Command/Test.xml
deleted file mode 100644
index bbe9fcccc51fad7569d664bc894a7b04076de5ca..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Command/Test.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<commands version="1.0">
- <run-tests>
-  <summary>Run Regression Tests</summary>
-  <function>doRunTests</function>
-  <shortcut>rt</shortcut>
-  <options>
-   <recur>
-    <shortopt>r</shortopt>
-    <doc>Run tests in child directories, recursively.  4 dirs deep maximum</doc>
-   </recur>
-   <ini>
-    <shortopt>i</shortopt>
-    <doc>actual string of settings to pass to php in format &quot; -d setting=blah&quot;</doc>
-    <arg>SETTINGS</arg>
-   </ini>
-   <realtimelog>
-    <shortopt>l</shortopt>
-    <doc>Log test runs/results as they are run</doc>
-   </realtimelog>
-   <quiet>
-    <shortopt>q</shortopt>
-    <doc>Only display detail for failed tests</doc>
-   </quiet>
-   <simple>
-    <shortopt>s</shortopt>
-    <doc>Display simple output for all tests</doc>
-   </simple>
-   <package>
-    <shortopt>p</shortopt>
-    <doc>Treat parameters as installed packages from which to run tests</doc>
-   </package>
-   <phpunit>
-    <shortopt>u</shortopt>
-    <doc>Search parameters for AllTests.php, and use that to run phpunit-based tests
-If none is found, all .phpt tests will be tried instead.</doc>
-   </phpunit>
-   <tapoutput>
-    <shortopt>t</shortopt>
-    <doc>Output run-tests.log in TAP-compliant format</doc>
-   </tapoutput>
-   <cgi>
-    <shortopt>c</shortopt>
-    <doc>CGI php executable (needed for tests with POST/GET section)</doc>
-    <arg>PHPCGI</arg>
-   </cgi>
-   <coverage>
-    <shortopt>x</shortopt>
-    <doc>Generate a code coverage report (requires Xdebug 2.0.0+)</doc>
-   </coverage>
-  </options>
-  <doc>[testfile|dir ...]
-Run regression tests with PHP&#039;s regression testing script (run-tests.php).</doc>
- </run-tests>
-</commands>
\ No newline at end of file
diff --git a/lib/php/PEAR/Common.php b/lib/php/PEAR/Common.php
deleted file mode 100644
index 5276441675d366365e460bf32dd653c15738101c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Common.php
+++ /dev/null
@@ -1,837 +0,0 @@
-<?php
-/**
- * PEAR_Common, the base class for the PEAR Installer
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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: Common.php 282969 2009-06-28 23:09:27Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1.0
- * @deprecated File deprecated since Release 1.4.0a1
- */
-
-/**
- * Include error handling
- */
-require_once 'PEAR.php';
-
-/**
- * PEAR_Common error when an invalid PHP file is passed to PEAR_Common::analyzeSourceCode()
- */
-define('PEAR_COMMON_ERROR_INVALIDPHP', 1);
-define('_PEAR_COMMON_PACKAGE_NAME_PREG', '[A-Za-z][a-zA-Z0-9_]+');
-define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/');
-
-// this should allow: 1, 1.0, 1.0RC1, 1.0dev, 1.0dev123234234234, 1.0a1, 1.0b1, 1.0pl1
-define('_PEAR_COMMON_PACKAGE_VERSION_PREG', '\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?');
-define('PEAR_COMMON_PACKAGE_VERSION_PREG', '/^' . _PEAR_COMMON_PACKAGE_VERSION_PREG . '\\z/i');
-
-// XXX far from perfect :-)
-define('_PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '(' . _PEAR_COMMON_PACKAGE_NAME_PREG .
-    ')(-([.0-9a-zA-Z]+))?');
-define('PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_PACKAGE_DOWNLOAD_PREG .
-    '\\z/');
-
-define('_PEAR_CHANNELS_NAME_PREG', '[A-Za-z][a-zA-Z0-9\.]+');
-define('PEAR_CHANNELS_NAME_PREG', '/^' . _PEAR_CHANNELS_NAME_PREG . '\\z/');
-
-// this should allow any dns or IP address, plus a path - NO UNDERSCORES ALLOWED
-define('_PEAR_CHANNELS_SERVER_PREG', '[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*(\/[a-zA-Z0-9\-]+)*');
-define('PEAR_CHANNELS_SERVER_PREG', '/^' . _PEAR_CHANNELS_SERVER_PREG . '\\z/i');
-
-define('_PEAR_CHANNELS_PACKAGE_PREG',  '(' ._PEAR_CHANNELS_SERVER_PREG . ')\/('
-         . _PEAR_COMMON_PACKAGE_NAME_PREG . ')');
-define('PEAR_CHANNELS_PACKAGE_PREG', '/^' . _PEAR_CHANNELS_PACKAGE_PREG . '\\z/i');
-
-define('_PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '(' . _PEAR_CHANNELS_NAME_PREG . ')::('
-    . _PEAR_COMMON_PACKAGE_NAME_PREG . ')(-([.0-9a-zA-Z]+))?');
-define('PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_CHANNEL_DOWNLOAD_PREG . '\\z/');
-
-/**
- * List of temporary files and directories registered by
- * PEAR_Common::addTempFile().
- * @var array
- */
-$GLOBALS['_PEAR_Common_tempfiles'] = array();
-
-/**
- * Valid maintainer roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_maintainer_roles'] = array('lead','developer','contributor','helper');
-
-/**
- * Valid release states
- * @var array
- */
-$GLOBALS['_PEAR_Common_release_states'] = array('alpha','beta','stable','snapshot','devel');
-
-/**
- * Valid dependency types
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_types'] = array('pkg','ext','php','prog','ldlib','rtlib','os','websrv','sapi');
-
-/**
- * Valid dependency relations
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not', 'ne');
-
-/**
- * Valid file roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src','script');
-
-/**
- * Valid replacement types
- * @var array
- */
-$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_provide_types'] = array('ext', 'prog', 'class', 'function', 'feature', 'api');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'pre-uninstall', 'post-uninstall', 'pre-build', 'post-build', 'pre-configure', 'post-configure', 'pre-setup', 'post-setup');
-
-/**
- * Class providing common functionality for PEAR administration classes.
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- * @deprecated This class will disappear, and its components will be spread
- *             into smaller classes, like the AT&T breakup, as of Release 1.4.0a1
- */
-class PEAR_Common extends PEAR
-{
-    /**
-     * User Interface object (PEAR_Frontend_* class).  If null,
-     * the log() method uses print.
-     * @var object
-     */
-    var $ui = null;
-
-    /**
-     * Configuration object (PEAR_Config).
-     * @var PEAR_Config
-     */
-    var $config = null;
-
-    /** stack of elements, gives some sort of XML context */
-    var $element_stack = array();
-
-    /** name of currently parsed XML element */
-    var $current_element;
-
-    /** array of attributes of the currently parsed XML element */
-    var $current_attributes = array();
-
-    /** assoc with information about a package */
-    var $pkginfo = array();
-
-    var $current_path = null;
-
-    /**
-     * Flag variable used to mark a valid package file
-     * @var boolean
-     * @access private
-     */
-    var $_validPackageFile;
-
-    /**
-     * PEAR_Common constructor
-     *
-     * @access public
-     */
-    function PEAR_Common()
-    {
-        parent::PEAR();
-        $this->config = &PEAR_Config::singleton();
-        $this->debug = $this->config->get('verbose');
-    }
-
-    /**
-     * PEAR_Common destructor
-     *
-     * @access private
-     */
-    function _PEAR_Common()
-    {
-        // doesn't work due to bug #14744
-        //$tempfiles = $this->_tempfiles;
-        $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
-        while ($file = array_shift($tempfiles)) {
-            if (@is_dir($file)) {
-                if (!class_exists('System')) {
-                    require_once 'System.php';
-                }
-
-                System::rm(array('-rf', $file));
-            } elseif (file_exists($file)) {
-                unlink($file);
-            }
-        }
-    }
-
-    /**
-     * Register a temporary file or directory.  When the destructor is
-     * executed, all registered temporary files and directories are
-     * removed.
-     *
-     * @param string  $file  name of file or directory
-     *
-     * @return void
-     *
-     * @access public
-     */
-    function addTempFile($file)
-    {
-        if (!class_exists('PEAR_Frontend')) {
-            require_once 'PEAR/Frontend.php';
-        }
-        PEAR_Frontend::addTempFile($file);
-    }
-
-    /**
-     * Wrapper to System::mkDir(), creates a directory as well as
-     * any necessary parent directories.
-     *
-     * @param string  $dir  directory name
-     *
-     * @return bool TRUE on success, or a PEAR error
-     *
-     * @access public
-     */
-    function mkDirHier($dir)
-    {
-        // Only used in Installer - move it there ?
-        $this->log(2, "+ create dir $dir");
-        if (!class_exists('System')) {
-            require_once 'System.php';
-        }
-        return System::mkDir(array('-p', $dir));
-    }
-
-    /**
-     * Logging method.
-     *
-     * @param int    $level  log level (0 is quiet, higher is noisier)
-     * @param string $msg    message to write to the log
-     *
-     * @return void
-     *
-     * @access public
-     * @static
-     */
-    function log($level, $msg, $append_crlf = true)
-    {
-        if ($this->debug >= $level) {
-            if (!class_exists('PEAR_Frontend')) {
-                require_once 'PEAR/Frontend.php';
-            }
-
-            $ui = &PEAR_Frontend::singleton();
-            if (is_a($ui, 'PEAR_Frontend')) {
-                $ui->log($msg, $append_crlf);
-            } else {
-                print "$msg\n";
-            }
-        }
-    }
-
-    /**
-     * Create and register a temporary directory.
-     *
-     * @param string $tmpdir (optional) Directory to use as tmpdir.
-     *                       Will use system defaults (for example
-     *                       /tmp or c:\windows\temp) if not specified
-     *
-     * @return string name of created directory
-     *
-     * @access public
-     */
-    function mkTempDir($tmpdir = '')
-    {
-        $topt = $tmpdir ? array('-t', $tmpdir) : array();
-        $topt = array_merge($topt, array('-d', 'pear'));
-        if (!class_exists('System')) {
-            require_once 'System.php';
-        }
-
-        if (!$tmpdir = System::mktemp($topt)) {
-            return false;
-        }
-
-        $this->addTempFile($tmpdir);
-        return $tmpdir;
-    }
-
-    /**
-     * Set object that represents the frontend to be used.
-     *
-     * @param  object Reference of the frontend object
-     * @return void
-     * @access public
-     */
-    function setFrontendObject(&$ui)
-    {
-        $this->ui = &$ui;
-    }
-
-    /**
-     * Return an array containing all of the states that are more stable than
-     * or equal to the passed in state
-     *
-     * @param string Release state
-     * @param boolean Determines whether to include $state in the list
-     * @return false|array False if $state is not a valid release state
-     */
-    function betterStates($state, $include = false)
-    {
-        static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
-        $i = array_search($state, $states);
-        if ($i === false) {
-            return false;
-        }
-        if ($include) {
-            $i--;
-        }
-        return array_slice($states, $i + 1);
-    }
-
-    /**
-     * Get the valid roles for a PEAR package maintainer
-     *
-     * @return array
-     * @static
-     */
-    function getUserRoles()
-    {
-        return $GLOBALS['_PEAR_Common_maintainer_roles'];
-    }
-
-    /**
-     * Get the valid package release states of packages
-     *
-     * @return array
-     * @static
-     */
-    function getReleaseStates()
-    {
-        return $GLOBALS['_PEAR_Common_release_states'];
-    }
-
-    /**
-     * Get the implemented dependency types (php, ext, pkg etc.)
-     *
-     * @return array
-     * @static
-     */
-    function getDependencyTypes()
-    {
-        return $GLOBALS['_PEAR_Common_dependency_types'];
-    }
-
-    /**
-     * Get the implemented dependency relations (has, lt, ge etc.)
-     *
-     * @return array
-     * @static
-     */
-    function getDependencyRelations()
-    {
-        return $GLOBALS['_PEAR_Common_dependency_relations'];
-    }
-
-    /**
-     * Get the implemented file roles
-     *
-     * @return array
-     * @static
-     */
-    function getFileRoles()
-    {
-        return $GLOBALS['_PEAR_Common_file_roles'];
-    }
-
-    /**
-     * Get the implemented file replacement types in
-     *
-     * @return array
-     * @static
-     */
-    function getReplacementTypes()
-    {
-        return $GLOBALS['_PEAR_Common_replacement_types'];
-    }
-
-    /**
-     * Get the implemented file replacement types in
-     *
-     * @return array
-     * @static
-     */
-    function getProvideTypes()
-    {
-        return $GLOBALS['_PEAR_Common_provide_types'];
-    }
-
-    /**
-     * Get the implemented file replacement types in
-     *
-     * @return array
-     * @static
-     */
-    function getScriptPhases()
-    {
-        return $GLOBALS['_PEAR_Common_script_phases'];
-    }
-
-    /**
-     * Test whether a string contains a valid package name.
-     *
-     * @param string $name the package name to test
-     *
-     * @return bool
-     *
-     * @access public
-     */
-    function validPackageName($name)
-    {
-        return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name);
-    }
-
-    /**
-     * Test whether a string contains a valid package version.
-     *
-     * @param string $ver the package version to test
-     *
-     * @return bool
-     *
-     * @access public
-     */
-    function validPackageVersion($ver)
-    {
-        return (bool)preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
-    }
-
-    /**
-     * @param string $path relative or absolute include path
-     * @return boolean
-     * @static
-     */
-    function isIncludeable($path)
-    {
-        if (file_exists($path) && is_readable($path)) {
-            return true;
-        }
-
-        $ipath = explode(PATH_SEPARATOR, ini_get('include_path'));
-        foreach ($ipath as $include) {
-            $test = realpath($include . DIRECTORY_SEPARATOR . $path);
-            if (file_exists($test) && is_readable($test)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    function _postProcessChecks($pf)
-    {
-        if (!PEAR::isError($pf)) {
-            return $this->_postProcessValidPackagexml($pf);
-        }
-
-        $errs = $pf->getUserinfo();
-        if (is_array($errs)) {
-            foreach ($errs as $error) {
-                $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
-            }
-        }
-
-        return $pf;
-    }
-
-    /**
-     * Returns information about a package file.  Expects the name of
-     * a gzipped tar file as input.
-     *
-     * @param string  $file  name of .tgz file
-     *
-     * @return array  array with package information
-     *
-     * @access public
-     * @deprecated use PEAR_PackageFile->fromTgzFile() instead
-     *
-     */
-    function infoFromTgzFile($file)
-    {
-        $packagefile = &new PEAR_PackageFile($this->config);
-        $pf = &$packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
-        return $this->_postProcessChecks($pf);
-    }
-
-    /**
-     * Returns information about a package file.  Expects the name of
-     * a package xml file as input.
-     *
-     * @param string  $descfile  name of package xml file
-     *
-     * @return array  array with package information
-     *
-     * @access public
-     * @deprecated use PEAR_PackageFile->fromPackageFile() instead
-     *
-     */
-    function infoFromDescriptionFile($descfile)
-    {
-        $packagefile = &new PEAR_PackageFile($this->config);
-        $pf = &$packagefile->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
-        return $this->_postProcessChecks($pf);
-    }
-
-    /**
-     * Returns information about a package file.  Expects the contents
-     * of a package xml file as input.
-     *
-     * @param string  $data  contents of package.xml file
-     *
-     * @return array   array with package information
-     *
-     * @access public
-     * @deprecated use PEAR_PackageFile->fromXmlstring() instead
-     *
-     */
-    function infoFromString($data)
-    {
-        $packagefile = &new PEAR_PackageFile($this->config);
-        $pf = &$packagefile->fromXmlString($data, PEAR_VALIDATE_NORMAL, false);
-        return $this->_postProcessChecks($pf);
-    }
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @return array
-     */
-    function _postProcessValidPackagexml(&$pf)
-    {
-        if (!is_a($pf, 'PEAR_PackageFile_v2')) {
-            $this->pkginfo = $pf->toArray();
-            return $this->pkginfo;
-        }
-
-        // sort of make this into a package.xml 1.0-style array
-        // changelog is not converted to old format.
-        $arr = $pf->toArray(true);
-        $arr = array_merge($arr, $arr['old']);
-        unset($arr['old'], $arr['xsdversion'], $arr['contents'], $arr['compatible'],
-              $arr['channel'], $arr['uri'], $arr['dependencies'], $arr['phprelease'],
-              $arr['extsrcrelease'], $arr['zendextsrcrelease'], $arr['extbinrelease'],
-              $arr['zendextbinrelease'], $arr['bundle'], $arr['lead'], $arr['developer'],
-              $arr['helper'], $arr['contributor']);
-        $arr['filelist'] = $pf->getFilelist();
-        $this->pkginfo = $arr;
-        return $arr;
-    }
-
-    /**
-     * Returns package information from different sources
-     *
-     * This method is able to extract information about a package
-     * from a .tgz archive or from a XML package definition file.
-     *
-     * @access public
-     * @param  string Filename of the source ('package.xml', '<package>.tgz')
-     * @return string
-     * @deprecated use PEAR_PackageFile->fromAnyFile() instead
-     */
-    function infoFromAny($info)
-    {
-        if (is_string($info) && file_exists($info)) {
-            $packagefile = &new PEAR_PackageFile($this->config);
-            $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
-            if (PEAR::isError($pf)) {
-                $errs = $pf->getUserinfo();
-                if (is_array($errs)) {
-                    foreach ($errs as $error) {
-                        $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
-                    }
-                }
-
-                return $pf;
-            }
-
-            return $this->_postProcessValidPackagexml($pf);
-        }
-
-        return $info;
-    }
-
-    /**
-     * Return an XML document based on the package info (as returned
-     * by the PEAR_Common::infoFrom* methods).
-     *
-     * @param array  $pkginfo  package info
-     *
-     * @return string XML data
-     *
-     * @access public
-     * @deprecated use a PEAR_PackageFile_v* object's generator instead
-     */
-    function xmlFromInfo($pkginfo)
-    {
-        $config      = &PEAR_Config::singleton();
-        $packagefile = &new PEAR_PackageFile($config);
-        $pf = &$packagefile->fromArray($pkginfo);
-        $gen = &$pf->getDefaultGenerator();
-        return $gen->toXml(PEAR_VALIDATE_PACKAGING);
-    }
-
-    /**
-     * Validate XML package definition file.
-     *
-     * @param  string $info Filename of the package archive or of the
-     *                package definition file
-     * @param  array $errors Array that will contain the errors
-     * @param  array $warnings Array that will contain the warnings
-     * @param  string $dir_prefix (optional) directory where source files
-     *                may be found, or empty if they are not available
-     * @access public
-     * @return boolean
-     * @deprecated use the validation of PEAR_PackageFile objects
-     */
-    function validatePackageInfo($info, &$errors, &$warnings, $dir_prefix = '')
-    {
-        $config      = &PEAR_Config::singleton();
-        $packagefile = &new PEAR_PackageFile($config);
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        if (strpos($info, '<?xml') !== false) {
-            $pf = &$packagefile->fromXmlString($info, PEAR_VALIDATE_NORMAL, '');
-        } else {
-            $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
-        }
-
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($pf)) {
-            $errs = $pf->getUserinfo();
-            if (is_array($errs)) {
-                foreach ($errs as $error) {
-                    if ($error['level'] == 'error') {
-                        $errors[] = $error['message'];
-                    } else {
-                        $warnings[] = $error['message'];
-                    }
-                }
-            }
-
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Build a "provides" array from data returned by
-     * analyzeSourceCode().  The format of the built array is like
-     * this:
-     *
-     *  array(
-     *    'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
-     *    ...
-     *  )
-     *
-     *
-     * @param array $srcinfo array with information about a source file
-     * as returned by the analyzeSourceCode() method.
-     *
-     * @return void
-     *
-     * @access public
-     *
-     */
-    function buildProvidesArray($srcinfo)
-    {
-        $file = basename($srcinfo['source_file']);
-        $pn = '';
-        if (isset($this->_packageName)) {
-            $pn = $this->_packageName;
-        }
-
-        $pnl = strlen($pn);
-        foreach ($srcinfo['declared_classes'] as $class) {
-            $key = "class;$class";
-            if (isset($this->pkginfo['provides'][$key])) {
-                continue;
-            }
-
-            $this->pkginfo['provides'][$key] =
-                array('file'=> $file, 'type' => 'class', 'name' => $class);
-            if (isset($srcinfo['inheritance'][$class])) {
-                $this->pkginfo['provides'][$key]['extends'] =
-                    $srcinfo['inheritance'][$class];
-            }
-        }
-
-        foreach ($srcinfo['declared_methods'] as $class => $methods) {
-            foreach ($methods as $method) {
-                $function = "$class::$method";
-                $key = "function;$function";
-                if ($method{0} == '_' || !strcasecmp($method, $class) ||
-                    isset($this->pkginfo['provides'][$key])) {
-                    continue;
-                }
-
-                $this->pkginfo['provides'][$key] =
-                    array('file'=> $file, 'type' => 'function', 'name' => $function);
-            }
-        }
-
-        foreach ($srcinfo['declared_functions'] as $function) {
-            $key = "function;$function";
-            if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) {
-                continue;
-            }
-
-            if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
-                $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
-            }
-
-            $this->pkginfo['provides'][$key] =
-                array('file'=> $file, 'type' => 'function', 'name' => $function);
-        }
-    }
-
-    /**
-     * Analyze the source code of the given PHP file
-     *
-     * @param  string Filename of the PHP file
-     * @return mixed
-     * @access public
-     */
-    function analyzeSourceCode($file)
-    {
-        if (!class_exists('PEAR_PackageFile_v2_Validator')) {
-            require_once 'PEAR/PackageFile/v2/Validator.php';
-        }
-
-        $a = new PEAR_PackageFile_v2_Validator;
-        return $a->analyzeSourceCode($file);
-    }
-
-    function detectDependencies($any, $status_callback = null)
-    {
-        if (!function_exists("token_get_all")) {
-            return false;
-        }
-
-        if (PEAR::isError($info = $this->infoFromAny($any))) {
-            return $this->raiseError($info);
-        }
-
-        if (!is_array($info)) {
-            return false;
-        }
-
-        $deps = array();
-        $used_c = $decl_c = $decl_f = $decl_m = array();
-        foreach ($info['filelist'] as $file => $fa) {
-            $tmp = $this->analyzeSourceCode($file);
-            $used_c = @array_merge($used_c, $tmp['used_classes']);
-            $decl_c = @array_merge($decl_c, $tmp['declared_classes']);
-            $decl_f = @array_merge($decl_f, $tmp['declared_functions']);
-            $decl_m = @array_merge($decl_m, $tmp['declared_methods']);
-            $inheri = @array_merge($inheri, $tmp['inheritance']);
-        }
-
-        $used_c = array_unique($used_c);
-        $decl_c = array_unique($decl_c);
-        $undecl_c = array_diff($used_c, $decl_c);
-
-        return array('used_classes' => $used_c,
-                     'declared_classes' => $decl_c,
-                     'declared_methods' => $decl_m,
-                     'declared_functions' => $decl_f,
-                     'undeclared_classes' => $undecl_c,
-                     'inheritance' => $inheri,
-                     );
-    }
-
-    /**
-     * Download a file through HTTP.  Considers suggested file name in
-     * Content-disposition: header and can run a callback function for
-     * different events.  The callback will be called with two
-     * parameters: the callback type, and parameters.  The implemented
-     * callback types are:
-     *
-     *  'setup'       called at the very beginning, parameter is a UI object
-     *                that should be used for all output
-     *  'message'     the parameter is a string with an informational message
-     *  'saveas'      may be used to save with a different file name, the
-     *                parameter is the filename that is about to be used.
-     *                If a 'saveas' callback returns a non-empty string,
-     *                that file name will be used as the filename instead.
-     *                Note that $save_dir will not be affected by this, only
-     *                the basename of the file.
-     *  'start'       download is starting, parameter is number of bytes
-     *                that are expected, or -1 if unknown
-     *  'bytesread'   parameter is the number of bytes read so far
-     *  'done'        download is complete, parameter is the total number
-     *                of bytes read
-     *  'connfailed'  if the TCP connection fails, this callback is called
-     *                with array(host,port,errno,errmsg)
-     *  'writefailed' if writing to disk fails, this callback is called
-     *                with array(destfile,errmsg)
-     *
-     * If an HTTP proxy has been configured (http_proxy PEAR_Config
-     * setting), the proxy will be used.
-     *
-     * @param string  $url       the URL to download
-     * @param object  $ui        PEAR_Frontend_* instance
-     * @param object  $config    PEAR_Config instance
-     * @param string  $save_dir  (optional) directory to save file in
-     * @param mixed   $callback  (optional) function/method to call for status
-     *                           updates
-     *
-     * @return string  Returns the full path of the downloaded file or a PEAR
-     *                 error on failure.  If the error is caused by
-     *                 socket-related errors, the error object will
-     *                 have the fsockopen error code available through
-     *                 getCode().
-     *
-     * @access public
-     * @deprecated in favor of PEAR_Downloader::downloadHttp()
-     */
-    function downloadHttp($url, &$ui, $save_dir = '.', $callback = null)
-    {
-        if (!class_exists('PEAR_Downloader')) {
-            require_once 'PEAR/Downloader.php';
-        }
-        return PEAR_Downloader::downloadHttp($url, $ui, $save_dir, $callback);
-    }
-}
-
-require_once 'PEAR/Config.php';
-require_once 'PEAR/PackageFile.php';
\ No newline at end of file
diff --git a/lib/php/PEAR/Config.php b/lib/php/PEAR/Config.php
deleted file mode 100644
index f47f3c08e0230e1a93a82e919208a6184d0f553b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Config.php
+++ /dev/null
@@ -1,2097 +0,0 @@
-<?php
-/**
- * PEAR_Config, customized configuration handling for the PEAR Installer
- *
- * 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: Config.php 286480 2009-07-29 02:50:02Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * Required for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Registry.php';
-require_once 'PEAR/Installer/Role.php';
-require_once 'System.php';
-
-/**
- * Last created PEAR_Config instance.
- * @var object
- */
-$GLOBALS['_PEAR_Config_instance'] = null;
-if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) {
-    $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear';
-} else {
-    $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR;
-}
-
-// Below we define constants with default values for all configuration
-// parameters except username/password.  All of them can have their
-// defaults set through environment variables.  The reason we use the
-// PHP_ prefix is for some security, PHP protects environment
-// variables starting with PHP_*.
-
-// default channel and preferred mirror is based on whether we are invoked through
-// the "pear" or the "pecl" command
-if (!defined('PEAR_RUNTYPE')) {
-    define('PEAR_RUNTYPE', 'pear');
-}
-
-if (PEAR_RUNTYPE == 'pear') {
-    define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pear.php.net');
-} else {
-    define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pecl.php.net');
-}
-
-if (getenv('PHP_PEAR_SYSCONF_DIR')) {
-    define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
-} elseif (getenv('SystemRoot')) {
-    define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
-} else {
-    define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
-}
-
-// Default for master_server
-if (getenv('PHP_PEAR_MASTER_SERVER')) {
-    define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', getenv('PHP_PEAR_MASTER_SERVER'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', 'pear.php.net');
-}
-
-// Default for http_proxy
-if (getenv('PHP_PEAR_HTTP_PROXY')) {
-    define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('PHP_PEAR_HTTP_PROXY'));
-} elseif (getenv('http_proxy')) {
-    define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('http_proxy'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', '');
-}
-
-// Default for php_dir
-if (getenv('PHP_PEAR_INSTALL_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR'));
-} else {
-    if (@file_exists($PEAR_INSTALL_DIR) && is_dir($PEAR_INSTALL_DIR)) {
-        define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR);
-    } else {
-        define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR);
-    }
-}
-
-// Default for ext_dir
-if (getenv('PHP_PEAR_EXTENSION_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR'));
-} else {
-    if (ini_get('extension_dir')) {
-        define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir'));
-    } elseif (defined('PEAR_EXTENSION_DIR') &&
-              file_exists(PEAR_EXTENSION_DIR) && is_dir(PEAR_EXTENSION_DIR)) {
-        define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR);
-    } elseif (defined('PHP_EXTENSION_DIR')) {
-        define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR);
-    } else {
-        define('PEAR_CONFIG_DEFAULT_EXT_DIR', '.');
-    }
-}
-
-// Default for doc_dir
-if (getenv('PHP_PEAR_DOC_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_DOC_DIR',
-           $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs');
-}
-
-// Default for bin_dir
-if (getenv('PHP_PEAR_BIN_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_BIN_DIR', getenv('PHP_PEAR_BIN_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_BIN_DIR', PHP_BINDIR);
-}
-
-// Default for data_dir
-if (getenv('PHP_PEAR_DATA_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_DATA_DIR',
-           $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
-}
-
-// Default for cfg_dir
-if (getenv('PHP_PEAR_CFG_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_CFG_DIR', getenv('PHP_PEAR_CFG_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_CFG_DIR',
-           $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'cfg');
-}
-
-// Default for www_dir
-if (getenv('PHP_PEAR_WWW_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_WWW_DIR', getenv('PHP_PEAR_WWW_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_WWW_DIR',
-           $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'www');
-}
-
-// Default for test_dir
-if (getenv('PHP_PEAR_TEST_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_TEST_DIR',
-           $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
-}
-
-// Default for temp_dir
-if (getenv('PHP_PEAR_TEMP_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_TEMP_DIR', getenv('PHP_PEAR_TEMP_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_TEMP_DIR',
-           System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
-           DIRECTORY_SEPARATOR . 'temp');
-}
-
-// Default for cache_dir
-if (getenv('PHP_PEAR_CACHE_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_CACHE_DIR', getenv('PHP_PEAR_CACHE_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_CACHE_DIR',
-           System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
-           DIRECTORY_SEPARATOR . 'cache');
-}
-
-// Default for download_dir
-if (getenv('PHP_PEAR_DOWNLOAD_DIR')) {
-    define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR', getenv('PHP_PEAR_DOWNLOAD_DIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR',
-           System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
-           DIRECTORY_SEPARATOR . 'download');
-}
-
-// Default for php_bin
-if (getenv('PHP_PEAR_PHP_BIN')) {
-    define('PEAR_CONFIG_DEFAULT_PHP_BIN', getenv('PHP_PEAR_PHP_BIN'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_PHP_BIN', PEAR_CONFIG_DEFAULT_BIN_DIR.
-           DIRECTORY_SEPARATOR.'php'.(OS_WINDOWS ? '.exe' : ''));
-}
-
-// Default for verbose
-if (getenv('PHP_PEAR_VERBOSE')) {
-    define('PEAR_CONFIG_DEFAULT_VERBOSE', getenv('PHP_PEAR_VERBOSE'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_VERBOSE', 1);
-}
-
-// Default for preferred_state
-if (getenv('PHP_PEAR_PREFERRED_STATE')) {
-    define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', getenv('PHP_PEAR_PREFERRED_STATE'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', 'stable');
-}
-
-// Default for umask
-if (getenv('PHP_PEAR_UMASK')) {
-    define('PEAR_CONFIG_DEFAULT_UMASK', getenv('PHP_PEAR_UMASK'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_UMASK', decoct(umask()));
-}
-
-// Default for cache_ttl
-if (getenv('PHP_PEAR_CACHE_TTL')) {
-    define('PEAR_CONFIG_DEFAULT_CACHE_TTL', getenv('PHP_PEAR_CACHE_TTL'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600);
-}
-
-// Default for sig_type
-if (getenv('PHP_PEAR_SIG_TYPE')) {
-    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg');
-}
-
-// Default for sig_bin
-if (getenv('PHP_PEAR_SIG_BIN')) {
-    define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_SIG_BIN',
-           System::which(
-               'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg'));
-}
-
-// Default for sig_keydir
-if (getenv('PHP_PEAR_SIG_KEYDIR')) {
-    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR'));
-} else {
-    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR',
-           PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys');
-}
-
-/**
- * This is a class for storing configuration data, keeping track of
- * which are system-defined, user-defined or defaulted.
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Config extends PEAR
-{
-    /**
-     * Array of config files used.
-     *
-     * @var array layer => config file
-     */
-    var $files = array(
-        'system' => '',
-        'user' => '',
-        );
-
-    var $layers = array();
-
-    /**
-     * Configuration data, two-dimensional array where the first
-     * dimension is the config layer ('user', 'system' and 'default'),
-     * and the second dimension is keyname => value.
-     *
-     * The order in the first dimension is important!  Earlier
-     * layers will shadow later ones when a config value is
-     * requested (if a 'user' value exists, it will be returned first,
-     * then 'system' and finally 'default').
-     *
-     * @var array layer => array(keyname => value, ...)
-     */
-    var $configuration = array(
-        'user' => array(),
-        'system' => array(),
-        'default' => array(),
-        );
-
-    /**
-     * Configuration values that can be set for a channel
-     *
-     * All other configuration values can only have a global value
-     * @var array
-     * @access private
-     */
-    var $_channelConfigInfo = array(
-        'php_dir', 'ext_dir', 'doc_dir', 'bin_dir', 'data_dir', 'cfg_dir',
-        'test_dir', 'www_dir', 'php_bin', 'php_prefix', 'php_suffix', 'username',
-        'password', 'verbose', 'preferred_state', 'umask', 'preferred_mirror', 'php_ini'
-        );
-
-    /**
-     * Channels that can be accessed
-     * @see setChannels()
-     * @var array
-     * @access private
-     */
-    var $_channels = array('pear.php.net', 'pecl.php.net', '__uri');
-
-    /**
-     * This variable is used to control the directory values returned
-     * @see setInstallRoot();
-     * @var string|false
-     * @access private
-     */
-    var $_installRoot = false;
-
-    /**
-     * If requested, this will always refer to the registry
-     * contained in php_dir
-     * @var PEAR_Registry
-     */
-    var $_registry = array();
-
-    /**
-     * @var array
-     * @access private
-     */
-    var $_regInitialized = array();
-
-    /**
-     * @var bool
-     * @access private
-     */
-    var $_noRegistry = false;
-
-    /**
-     * amount of errors found while parsing config
-     * @var integer
-     * @access private
-     */
-    var $_errorsFound = 0;
-    var $_lastError = null;
-
-    /**
-     * Information about the configuration data.  Stores the type,
-     * default value and a documentation string for each configuration
-     * value.
-     *
-     * @var array layer => array(infotype => value, ...)
-     */
-    var $configuration_info = array(
-        // Channels/Internet Access
-        'default_channel' => array(
-            'type' => 'string',
-            'default' => PEAR_CONFIG_DEFAULT_CHANNEL,
-            'doc' => 'the default channel to use for all non explicit commands',
-            'prompt' => 'Default Channel',
-            'group' => 'Internet Access',
-            ),
-        'preferred_mirror' => array(
-            'type' => 'string',
-            'default' => PEAR_CONFIG_DEFAULT_CHANNEL,
-            'doc' => 'the default server or mirror to use for channel actions',
-            'prompt' => 'Default Channel Mirror',
-            'group' => 'Internet Access',
-            ),
-        'remote_config' => array(
-            'type' => 'password',
-            'default' => '',
-            'doc' => 'ftp url of remote configuration file to use for synchronized install',
-            'prompt' => 'Remote Configuration File',
-            'group' => 'Internet Access',
-            ),
-        'auto_discover' => array(
-            'type' => 'integer',
-            'default' => 0,
-            'doc' => 'whether to automatically discover new channels',
-            'prompt' => 'Auto-discover new Channels',
-            'group' => 'Internet Access',
-            ),
-        // Internet Access
-        'master_server' => array(
-            'type' => 'string',
-            'default' => 'pear.php.net',
-            'doc' => 'name of the main PEAR server [NOT USED IN THIS VERSION]',
-            'prompt' => 'PEAR server [DEPRECATED]',
-            'group' => 'Internet Access',
-            ),
-        'http_proxy' => array(
-            'type' => 'string',
-            'default' => PEAR_CONFIG_DEFAULT_HTTP_PROXY,
-            'doc' => 'HTTP proxy (host:port) to use when downloading packages',
-            'prompt' => 'HTTP Proxy Server Address',
-            'group' => 'Internet Access',
-            ),
-        // File Locations
-        'php_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_PHP_DIR,
-            'doc' => 'directory where .php files are installed',
-            'prompt' => 'PEAR directory',
-            'group' => 'File Locations',
-            ),
-        'ext_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_EXT_DIR,
-            'doc' => 'directory where loadable extensions are installed',
-            'prompt' => 'PHP extension directory',
-            'group' => 'File Locations',
-            ),
-        'doc_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_DOC_DIR,
-            'doc' => 'directory where documentation is installed',
-            'prompt' => 'PEAR documentation directory',
-            'group' => 'File Locations',
-            ),
-        'bin_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_BIN_DIR,
-            'doc' => 'directory where executables are installed',
-            'prompt' => 'PEAR executables directory',
-            'group' => 'File Locations',
-            ),
-        'data_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_DATA_DIR,
-            'doc' => 'directory where data files are installed',
-            'prompt' => 'PEAR data directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'cfg_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_CFG_DIR,
-            'doc' => 'directory where modifiable configuration files are installed',
-            'prompt' => 'PEAR configuration file directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'www_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_WWW_DIR,
-            'doc' => 'directory where www frontend files (html/js) are installed',
-            'prompt' => 'PEAR www files directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'test_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_TEST_DIR,
-            'doc' => 'directory where regression tests are installed',
-            'prompt' => 'PEAR test directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'cache_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_CACHE_DIR,
-            'doc' => 'directory which is used for web service cache',
-            'prompt' => 'PEAR Installer cache directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'temp_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_TEMP_DIR,
-            'doc' => 'directory which is used for all temp files',
-            'prompt' => 'PEAR Installer temp directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'download_dir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR,
-            'doc' => 'directory which is used for all downloaded files',
-            'prompt' => 'PEAR Installer download directory',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'php_bin' => array(
-            'type' => 'file',
-            'default' => PEAR_CONFIG_DEFAULT_PHP_BIN,
-            'doc' => 'PHP CLI/CGI binary for executing scripts',
-            'prompt' => 'PHP CLI/CGI binary',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'php_prefix' => array(
-            'type' => 'string',
-            'default' => '',
-            'doc' => '--program-prefix for php_bin\'s ./configure, used for pecl installs',
-            'prompt' => '--program-prefix passed to PHP\'s ./configure',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'php_suffix' => array(
-            'type' => 'string',
-            'default' => '',
-            'doc' => '--program-suffix for php_bin\'s ./configure, used for pecl installs',
-            'prompt' => '--program-suffix passed to PHP\'s ./configure',
-            'group' => 'File Locations (Advanced)',
-            ),
-        'php_ini' => array(
-            'type' => 'file',
-            'default' => '',
-            'doc' => 'location of php.ini in which to enable PECL extensions on install',
-            'prompt' => 'php.ini location',
-            'group' => 'File Locations (Advanced)',
-            ),
-        // Maintainers
-        'username' => array(
-            'type' => 'string',
-            'default' => '',
-            'doc' => '(maintainers) your PEAR account name',
-            'prompt' => 'PEAR username (for maintainers)',
-            'group' => 'Maintainers',
-            ),
-        'password' => array(
-            'type' => 'password',
-            'default' => '',
-            'doc' => '(maintainers) your PEAR account password',
-            'prompt' => 'PEAR password (for maintainers)',
-            'group' => 'Maintainers',
-            ),
-        // Advanced
-        'verbose' => array(
-            'type' => 'integer',
-            'default' => PEAR_CONFIG_DEFAULT_VERBOSE,
-            'doc' => 'verbosity level
-0: really quiet
-1: somewhat quiet
-2: verbose
-3: debug',
-            'prompt' => 'Debug Log Level',
-            'group' => 'Advanced',
-            ),
-        'preferred_state' => array(
-            'type' => 'set',
-            'default' => PEAR_CONFIG_DEFAULT_PREFERRED_STATE,
-            'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified',
-            'valid_set' => array(
-                'stable', 'beta', 'alpha', 'devel', 'snapshot'),
-            'prompt' => 'Preferred Package State',
-            'group' => 'Advanced',
-            ),
-        'umask' => array(
-            'type' => 'mask',
-            'default' => PEAR_CONFIG_DEFAULT_UMASK,
-            'doc' => 'umask used when creating files (Unix-like systems only)',
-            'prompt' => 'Unix file mask',
-            'group' => 'Advanced',
-            ),
-        'cache_ttl' => array(
-            'type' => 'integer',
-            'default' => PEAR_CONFIG_DEFAULT_CACHE_TTL,
-            'doc' => 'amount of secs where the local cache is used and not updated',
-            'prompt' => 'Cache TimeToLive',
-            'group' => 'Advanced',
-            ),
-        'sig_type' => array(
-            'type' => 'set',
-            'default' => PEAR_CONFIG_DEFAULT_SIG_TYPE,
-            'doc' => 'which package signature mechanism to use',
-            'valid_set' => array('gpg'),
-            'prompt' => 'Package Signature Type',
-            'group' => 'Maintainers',
-            ),
-        'sig_bin' => array(
-            'type' => 'string',
-            'default' => PEAR_CONFIG_DEFAULT_SIG_BIN,
-            'doc' => 'which package signature mechanism to use',
-            'prompt' => 'Signature Handling Program',
-            'group' => 'Maintainers',
-            ),
-        'sig_keyid' => array(
-            'type' => 'string',
-            'default' => '',
-            'doc' => 'which key to use for signing with',
-            'prompt' => 'Signature Key Id',
-            'group' => 'Maintainers',
-            ),
-        'sig_keydir' => array(
-            'type' => 'directory',
-            'default' => PEAR_CONFIG_DEFAULT_SIG_KEYDIR,
-            'doc' => 'directory where signature keys are located',
-            'prompt' => 'Signature Key Directory',
-            'group' => 'Maintainers',
-            ),
-        // __channels is reserved - used for channel-specific configuration
-        );
-
-    /**
-     * Constructor.
-     *
-     * @param string file to read user-defined options from
-     * @param string file to read system-wide defaults from
-     * @param bool   determines whether a registry object "follows"
-     *               the value of php_dir (is automatically created
-     *               and moved when php_dir is changed)
-     * @param bool   if true, fails if configuration files cannot be loaded
-     *
-     * @access public
-     *
-     * @see PEAR_Config::singleton
-     */
-    function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false,
-                         $strict = true)
-    {
-        $this->PEAR();
-        PEAR_Installer_Role::initializeConfig($this);
-        $sl = DIRECTORY_SEPARATOR;
-        if (empty($user_file)) {
-            if (OS_WINDOWS) {
-                $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';
-            } else {
-                $user_file = getenv('HOME') . $sl . '.pearrc';
-            }
-        }
-
-        if (empty($system_file)) {
-            $system_file = PEAR_CONFIG_SYSCONFDIR . $sl;
-            if (OS_WINDOWS) {
-                $system_file .= 'pearsys.ini';
-            } else {
-                $system_file .= 'pear.conf';
-            }
-        }
-
-        $this->layers = array_keys($this->configuration);
-        $this->files['user']   = $user_file;
-        $this->files['system'] = $system_file;
-        if ($user_file && file_exists($user_file)) {
-            $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $this->readConfigFile($user_file, 'user', $strict);
-            $this->popErrorHandling();
-            if ($this->_errorsFound > 0) {
-                return;
-            }
-        }
-
-        if ($system_file && @file_exists($system_file)) {
-            $this->mergeConfigFile($system_file, false, 'system', $strict);
-            if ($this->_errorsFound > 0) {
-                return;
-            }
-
-        }
-
-        if (!$ftp_file) {
-            $ftp_file = $this->get('remote_config');
-        }
-
-        if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) {
-            $this->readFTPConfigFile($ftp_file);
-        }
-
-        foreach ($this->configuration_info as $key => $info) {
-            $this->configuration['default'][$key] = $info['default'];
-        }
-
-        $this->_registry['default'] = &new PEAR_Registry($this->configuration['default']['php_dir']);
-        $this->_registry['default']->setConfig($this, false);
-        $this->_regInitialized['default'] = false;
-        //$GLOBALS['_PEAR_Config_instance'] = &$this;
-    }
-
-    /**
-     * Return the default locations of user and system configuration files
-     * @static
-     */
-    function getDefaultConfigFiles()
-    {
-        $sl = DIRECTORY_SEPARATOR;
-        if (OS_WINDOWS) {
-            return array(
-                'user'   => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini',
-                'system' =>  PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'
-            );
-        }
-
-        return array(
-            'user'   => getenv('HOME') . $sl . '.pearrc',
-            'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf'
-        );
-    }
-
-    /**
-     * Static singleton method.  If you want to keep only one instance
-     * of this class in use, this method will give you a reference to
-     * the last created PEAR_Config object if one exists, or create a
-     * new object.
-     *
-     * @param string (optional) file to read user-defined options from
-     * @param string (optional) file to read system-wide defaults from
-     *
-     * @return object an existing or new PEAR_Config instance
-     *
-     * @access public
-     *
-     * @see PEAR_Config::PEAR_Config
-     */
-    function &singleton($user_file = '', $system_file = '', $strict = true)
-    {
-        if (is_object($GLOBALS['_PEAR_Config_instance'])) {
-            return $GLOBALS['_PEAR_Config_instance'];
-        }
-
-        $t_conf = &new PEAR_Config($user_file, $system_file, false, $strict);
-        if ($t_conf->_errorsFound > 0) {
-             return $t_conf->lastError;
-        }
-
-        $GLOBALS['_PEAR_Config_instance'] = &$t_conf;
-        return $GLOBALS['_PEAR_Config_instance'];
-    }
-
-    /**
-     * Determine whether any configuration files have been detected, and whether a
-     * registry object can be retrieved from this configuration.
-     * @return bool
-     * @since PEAR 1.4.0a1
-     */
-    function validConfiguration()
-    {
-        if ($this->isDefinedLayer('user') || $this->isDefinedLayer('system')) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Reads configuration data from a file.  All existing values in
-     * the config layer are discarded and replaced with data from the
-     * file.
-     * @param string file to read from, if NULL or not specified, the
-     *               last-used file for the same layer (second param) is used
-     * @param string config layer to insert data into ('user' or 'system')
-     * @return bool TRUE on success or a PEAR error on failure
-     */
-    function readConfigFile($file = null, $layer = 'user', $strict = true)
-    {
-        if (empty($this->files[$layer])) {
-            return $this->raiseError("unknown config layer `$layer'");
-        }
-
-        if ($file === null) {
-            $file = $this->files[$layer];
-        }
-
-        $data = $this->_readConfigDataFrom($file);
-        if (PEAR::isError($data)) {
-            if (!$strict) {
-                return true;
-            }
-
-            $this->_errorsFound++;
-            $this->lastError = $data;
-
-            return $data;
-        }
-
-        $this->files[$layer] = $file;
-        $this->_decodeInput($data);
-        $this->configuration[$layer] = $data;
-        $this->_setupChannels();
-        if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) {
-            $this->_registry[$layer] = &new PEAR_Registry($phpdir);
-            $this->_registry[$layer]->setConfig($this, false);
-            $this->_regInitialized[$layer] = false;
-        } else {
-            unset($this->_registry[$layer]);
-        }
-        return true;
-    }
-
-    /**
-     * @param string url to the remote config file, like ftp://www.example.com/pear/config.ini
-     * @return true|PEAR_Error
-     */
-    function readFTPConfigFile($path)
-    {
-        do { // poor man's try
-            if (!class_exists('PEAR_FTP')) {
-                if (!class_exists('PEAR_Common')) {
-                    require_once 'PEAR/Common.php';
-                }
-                if (PEAR_Common::isIncludeable('PEAR/FTP.php')) {
-                    require_once 'PEAR/FTP.php';
-                }
-            }
-
-            if (!class_exists('PEAR_FTP')) {
-                return PEAR::raiseError('PEAR_RemoteInstaller must be installed to use remote config');
-            }
-
-            $this->_ftp = &new PEAR_FTP;
-            $this->_ftp->pushErrorHandling(PEAR_ERROR_RETURN);
-            $e = $this->_ftp->init($path);
-            if (PEAR::isError($e)) {
-                $this->_ftp->popErrorHandling();
-                return $e;
-            }
-
-            $tmp = System::mktemp('-d');
-            PEAR_Common::addTempFile($tmp);
-            $e = $this->_ftp->get(basename($path), $tmp . DIRECTORY_SEPARATOR .
-                'pear.ini', false, FTP_BINARY);
-            if (PEAR::isError($e)) {
-                $this->_ftp->popErrorHandling();
-                return $e;
-            }
-
-            PEAR_Common::addTempFile($tmp . DIRECTORY_SEPARATOR . 'pear.ini');
-            $this->_ftp->disconnect();
-            $this->_ftp->popErrorHandling();
-            $this->files['ftp'] = $tmp . DIRECTORY_SEPARATOR . 'pear.ini';
-            $e = $this->readConfigFile(null, 'ftp');
-            if (PEAR::isError($e)) {
-                return $e;
-            }
-
-            $fail = array();
-            foreach ($this->configuration_info as $key => $val) {
-                if (in_array($this->getGroup($key),
-                      array('File Locations', 'File Locations (Advanced)')) &&
-                      $this->getType($key) == 'directory') {
-                    // any directory configs must be set for this to work
-                    if (!isset($this->configuration['ftp'][$key])) {
-                        $fail[] = $key;
-                    }
-                }
-            }
-
-            if (!count($fail)) {
-                return true;
-            }
-
-            $fail = '"' . implode('", "', $fail) . '"';
-            unset($this->files['ftp']);
-            unset($this->configuration['ftp']);
-            return PEAR::raiseError('ERROR: Ftp configuration file must set all ' .
-                'directory configuration variables.  These variables were not set: ' .
-                $fail);
-        } while (false); // poor man's catch
-        unset($this->files['ftp']);
-        return PEAR::raiseError('no remote host specified');
-    }
-
-    /**
-     * Reads the existing configurations and creates the _channels array from it
-     */
-    function _setupChannels()
-    {
-        $set = array_flip(array_values($this->_channels));
-        foreach ($this->configuration as $layer => $data) {
-            $i = 1000;
-            if (isset($data['__channels']) && is_array($data['__channels'])) {
-                foreach ($data['__channels'] as $channel => $info) {
-                    $set[$channel] = $i++;
-                }
-            }
-        }
-        $this->_channels = array_values(array_flip($set));
-        $this->setChannels($this->_channels);
-    }
-
-    function deleteChannel($channel)
-    {
-        $ch = strtolower($channel);
-        foreach ($this->configuration as $layer => $data) {
-            if (isset($data['__channels']) && isset($data['__channels'][$ch])) {
-                unset($this->configuration[$layer]['__channels'][$ch]);
-            }
-        }
-
-        $this->_channels = array_flip($this->_channels);
-        unset($this->_channels[$ch]);
-        $this->_channels = array_flip($this->_channels);
-    }
-
-    /**
-     * Merges data into a config layer from a file.  Does the same
-     * thing as readConfigFile, except it does not replace all
-     * existing values in the config layer.
-     * @param string file to read from
-     * @param bool whether to overwrite existing data (default TRUE)
-     * @param string config layer to insert data into ('user' or 'system')
-     * @param string if true, errors are returned if file opening fails
-     * @return bool TRUE on success or a PEAR error on failure
-     */
-    function mergeConfigFile($file, $override = true, $layer = 'user', $strict = true)
-    {
-        if (empty($this->files[$layer])) {
-            return $this->raiseError("unknown config layer `$layer'");
-        }
-
-        if ($file === null) {
-            $file = $this->files[$layer];
-        }
-
-        $data = $this->_readConfigDataFrom($file);
-        if (PEAR::isError($data)) {
-            if (!$strict) {
-                return true;
-            }
-
-            $this->_errorsFound++;
-            $this->lastError = $data;
-
-            return $data;
-        }
-
-        $this->_decodeInput($data);
-        if ($override) {
-            $this->configuration[$layer] =
-                PEAR_Config::arrayMergeRecursive($this->configuration[$layer], $data);
-        } else {
-            $this->configuration[$layer] =
-                PEAR_Config::arrayMergeRecursive($data, $this->configuration[$layer]);
-        }
-
-        $this->_setupChannels();
-        if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) {
-            $this->_registry[$layer] = &new PEAR_Registry($phpdir);
-            $this->_registry[$layer]->setConfig($this, false);
-            $this->_regInitialized[$layer] = false;
-        } else {
-            unset($this->_registry[$layer]);
-        }
-        return true;
-    }
-
-    /**
-     * @param array
-     * @param array
-     * @return array
-     * @static
-     */
-    function arrayMergeRecursive($arr2, $arr1)
-    {
-        $ret = array();
-        foreach ($arr2 as $key => $data) {
-            if (!isset($arr1[$key])) {
-                $ret[$key] = $data;
-                unset($arr1[$key]);
-                continue;
-            }
-            if (is_array($data)) {
-                if (!is_array($arr1[$key])) {
-                    $ret[$key] = $arr1[$key];
-                    unset($arr1[$key]);
-                    continue;
-                }
-                $ret[$key] = PEAR_Config::arrayMergeRecursive($arr1[$key], $arr2[$key]);
-                unset($arr1[$key]);
-            }
-        }
-
-        return array_merge($ret, $arr1);
-    }
-
-    /**
-     * Writes data into a config layer from a file.
-     *
-     * @param string|null file to read from, or null for default
-     * @param string config layer to insert data into ('user' or
-     *               'system')
-     * @param string|null data to write to config file or null for internal data [DEPRECATED]
-     * @return bool TRUE on success or a PEAR error on failure
-     */
-    function writeConfigFile($file = null, $layer = 'user', $data = null)
-    {
-        $this->_lazyChannelSetup($layer);
-        if ($layer == 'both' || $layer == 'all') {
-            foreach ($this->files as $type => $file) {
-                $err = $this->writeConfigFile($file, $type, $data);
-                if (PEAR::isError($err)) {
-                    return $err;
-                }
-            }
-            return true;
-        }
-
-        if (empty($this->files[$layer])) {
-            return $this->raiseError("unknown config file type `$layer'");
-        }
-
-        if ($file === null) {
-            $file = $this->files[$layer];
-        }
-
-        $data = ($data === null) ? $this->configuration[$layer] : $data;
-        $this->_encodeOutput($data);
-        $opt = array('-p', dirname($file));
-        if (!@System::mkDir($opt)) {
-            return $this->raiseError("could not create directory: " . dirname($file));
-        }
-
-        if (file_exists($file) && is_file($file) && !is_writeable($file)) {
-            return $this->raiseError("no write access to $file!");
-        }
-
-        $fp = @fopen($file, "w");
-        if (!$fp) {
-            return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed ($php_errormsg)");
-        }
-
-        $contents = "#PEAR_Config 0.9\n" . serialize($data);
-        if (!@fwrite($fp, $contents)) {
-            return $this->raiseError("PEAR_Config::writeConfigFile: fwrite failed ($php_errormsg)");
-        }
-        return true;
-    }
-
-    /**
-     * Reads configuration data from a file and returns the parsed data
-     * in an array.
-     *
-     * @param string file to read from
-     * @return array configuration data or a PEAR error on failure
-     * @access private
-     */
-    function _readConfigDataFrom($file)
-    {
-        $fp = false;
-        if (file_exists($file)) {
-            $fp = @fopen($file, "r");
-        }
-
-        if (!$fp) {
-            return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed");
-        }
-
-        $size = filesize($file);
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        fclose($fp);
-        $contents = file_get_contents($file);
-        if (empty($contents)) {
-            return $this->raiseError('Configuration file "' . $file . '" is empty');
-        }
-
-        set_magic_quotes_runtime($rt);
-
-        $version = false;
-        if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) {
-            $version = $matches[1];
-            $contents = substr($contents, strlen($matches[0]));
-        } else {
-            // Museum config file
-            if (substr($contents,0,2) == 'a:') {
-                $version = '0.1';
-            }
-        }
-
-        if ($version && version_compare("$version", '1', '<')) {
-            // no '@', it is possible that unserialize
-            // raises a notice but it seems to block IO to
-            // STDOUT if a '@' is used and a notice is raise
-            $data = unserialize($contents);
-
-            if (!is_array($data) && !$data) {
-                if ($contents == serialize(false)) {
-                    $data = array();
-                } else {
-                    $err = $this->raiseError("PEAR_Config: bad data in $file");
-                    return $err;
-                }
-            }
-            if (!is_array($data)) {
-                if (strlen(trim($contents)) > 0) {
-                    $error = "PEAR_Config: bad data in $file";
-                    $err = $this->raiseError($error);
-                    return $err;
-                }
-
-                $data = array();
-            }
-        // add parsing of newer formats here...
-        } else {
-            $err = $this->raiseError("$file: unknown version `$version'");
-            return $err;
-        }
-
-        return $data;
-    }
-
-    /**
-    * Gets the file used for storing the config for a layer
-    *
-    * @param string $layer 'user' or 'system'
-    */
-    function getConfFile($layer)
-    {
-        return $this->files[$layer];
-    }
-
-    /**
-     * @param string Configuration class name, used for detecting duplicate calls
-     * @param array information on a role as parsed from its xml file
-     * @return true|PEAR_Error
-     * @access private
-     */
-    function _addConfigVars($class, $vars)
-    {
-        static $called = array();
-        if (isset($called[$class])) {
-            return;
-        }
-
-        $called[$class] = 1;
-        if (count($vars) > 3) {
-            return $this->raiseError('Roles can only define 3 new config variables or less');
-        }
-
-        foreach ($vars as $name => $var) {
-            if (!is_array($var)) {
-                return $this->raiseError('Configuration information must be an array');
-            }
-
-            if (!isset($var['type'])) {
-                return $this->raiseError('Configuration information must contain a type');
-            } elseif (!in_array($var['type'],
-                    array('string', 'mask', 'password', 'directory', 'file', 'set'))) {
-                  return $this->raiseError(
-                      'Configuration type must be one of directory, file, string, ' .
-                      'mask, set, or password');
-            }
-            if (!isset($var['default'])) {
-                return $this->raiseError(
-                    'Configuration information must contain a default value ("default" index)');
-            }
-
-            if (is_array($var['default'])) {
-                $real_default = '';
-                foreach ($var['default'] as $config_var => $val) {
-                    if (strpos($config_var, 'text') === 0) {
-                        $real_default .= $val;
-                    } elseif (strpos($config_var, 'constant') === 0) {
-                        if (!defined($val)) {
-                            return $this->raiseError(
-                                'Unknown constant "' . $val . '" requested in ' .
-                                'default value for configuration variable "' .
-                                $name . '"');
-                        }
-
-                        $real_default .= constant($val);
-                    } elseif (isset($this->configuration_info[$config_var])) {
-                        $real_default .=
-                            $this->configuration_info[$config_var]['default'];
-                    } else {
-                        return $this->raiseError(
-                            'Unknown request for "' . $config_var . '" value in ' .
-                            'default value for configuration variable "' .
-                            $name . '"');
-                    }
-                }
-                $var['default'] = $real_default;
-            }
-
-            if ($var['type'] == 'integer') {
-                $var['default'] = (integer) $var['default'];
-            }
-
-            if (!isset($var['doc'])) {
-                return $this->raiseError(
-                    'Configuration information must contain a summary ("doc" index)');
-            }
-
-            if (!isset($var['prompt'])) {
-                return $this->raiseError(
-                    'Configuration information must contain a simple prompt ("prompt" index)');
-            }
-
-            if (!isset($var['group'])) {
-                return $this->raiseError(
-                    'Configuration information must contain a simple group ("group" index)');
-            }
-
-            if (isset($this->configuration_info[$name])) {
-                return $this->raiseError('Configuration variable "' . $name .
-                    '" already exists');
-            }
-
-            $this->configuration_info[$name] = $var;
-            // fix bug #7351: setting custom config variable in a channel fails
-            $this->_channelConfigInfo[] = $name;
-        }
-
-        return true;
-    }
-
-    /**
-     * Encodes/scrambles configuration data before writing to files.
-     * Currently, 'password' values will be base64-encoded as to avoid
-     * that people spot cleartext passwords by accident.
-     *
-     * @param array (reference) array to encode values in
-     * @return bool TRUE on success
-     * @access private
-     */
-    function _encodeOutput(&$data)
-    {
-        foreach ($data as $key => $value) {
-            if ($key == '__channels') {
-                foreach ($data['__channels'] as $channel => $blah) {
-                    $this->_encodeOutput($data['__channels'][$channel]);
-                }
-            }
-
-            if (!isset($this->configuration_info[$key])) {
-                continue;
-            }
-
-            $type = $this->configuration_info[$key]['type'];
-            switch ($type) {
-                // we base64-encode passwords so they are at least
-                // not shown in plain by accident
-                case 'password': {
-                    $data[$key] = base64_encode($data[$key]);
-                    break;
-                }
-                case 'mask': {
-                    $data[$key] = octdec($data[$key]);
-                    break;
-                }
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Decodes/unscrambles configuration data after reading from files.
-     *
-     * @param array (reference) array to encode values in
-     * @return bool TRUE on success
-     * @access private
-     *
-     * @see PEAR_Config::_encodeOutput
-     */
-    function _decodeInput(&$data)
-    {
-        if (!is_array($data)) {
-            return true;
-        }
-
-        foreach ($data as $key => $value) {
-            if ($key == '__channels') {
-                foreach ($data['__channels'] as $channel => $blah) {
-                    $this->_decodeInput($data['__channels'][$channel]);
-                }
-            }
-
-            if (!isset($this->configuration_info[$key])) {
-                continue;
-            }
-
-            $type = $this->configuration_info[$key]['type'];
-            switch ($type) {
-                case 'password': {
-                    $data[$key] = base64_decode($data[$key]);
-                    break;
-                }
-                case 'mask': {
-                    $data[$key] = decoct($data[$key]);
-                    break;
-                }
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Retrieve the default channel.
-     *
-     * On startup, channels are not initialized, so if the default channel is not
-     * pear.php.net, then initialize the config.
-     * @param string registry layer
-     * @return string|false
-     */
-    function getDefaultChannel($layer = null)
-    {
-        $ret = false;
-        if ($layer === null) {
-            foreach ($this->layers as $layer) {
-                if (isset($this->configuration[$layer]['default_channel'])) {
-                    $ret = $this->configuration[$layer]['default_channel'];
-                    break;
-                }
-            }
-        } elseif (isset($this->configuration[$layer]['default_channel'])) {
-            $ret = $this->configuration[$layer]['default_channel'];
-        }
-
-        if ($ret == 'pear.php.net' && defined('PEAR_RUNTYPE') && PEAR_RUNTYPE == 'pecl') {
-            $ret = 'pecl.php.net';
-        }
-
-        if ($ret) {
-            if ($ret != 'pear.php.net') {
-                $this->_lazyChannelSetup();
-            }
-
-            return $ret;
-        }
-
-        return PEAR_CONFIG_DEFAULT_CHANNEL;
-    }
-
-    /**
-     * Returns a configuration value, prioritizing layers as per the
-     * layers property.
-     *
-     * @param string config key
-     * @return mixed the config value, or NULL if not found
-     * @access public
-     */
-    function get($key, $layer = null, $channel = false)
-    {
-        if (!isset($this->configuration_info[$key])) {
-            return null;
-        }
-
-        if ($key == '__channels') {
-            return null;
-        }
-
-        if ($key == 'default_channel') {
-            return $this->getDefaultChannel($layer);
-        }
-
-        if (!$channel) {
-            $channel = $this->getDefaultChannel();
-        } elseif ($channel != 'pear.php.net') {
-            $this->_lazyChannelSetup();
-        }
-        $channel = strtolower($channel);
-
-        $test = (in_array($key, $this->_channelConfigInfo)) ?
-            $this->_getChannelValue($key, $layer, $channel) :
-            null;
-        if ($test !== null) {
-            if ($this->_installRoot) {
-                if (in_array($this->getGroup($key),
-                      array('File Locations', 'File Locations (Advanced)')) &&
-                      $this->getType($key) == 'directory') {
-                    return $this->_prependPath($test, $this->_installRoot);
-                }
-            }
-            return $test;
-        }
-
-        if ($layer === null) {
-            foreach ($this->layers as $layer) {
-                if (isset($this->configuration[$layer][$key])) {
-                    $test = $this->configuration[$layer][$key];
-                    if ($this->_installRoot) {
-                        if (in_array($this->getGroup($key),
-                              array('File Locations', 'File Locations (Advanced)')) &&
-                              $this->getType($key) == 'directory') {
-                            return $this->_prependPath($test, $this->_installRoot);
-                        }
-                    }
-
-                    if ($key == 'preferred_mirror') {
-                        $reg = &$this->getRegistry();
-                        if (is_object($reg)) {
-                            $chan = &$reg->getChannel($channel);
-                            if (PEAR::isError($chan)) {
-                                return $channel;
-                            }
-
-                            if (!$chan->getMirror($test) && $chan->getName() != $test) {
-                                return $channel; // mirror does not exist
-                            }
-                        }
-                    }
-                    return $test;
-                }
-            }
-        } elseif (isset($this->configuration[$layer][$key])) {
-            $test = $this->configuration[$layer][$key];
-            if ($this->_installRoot) {
-                if (in_array($this->getGroup($key),
-                      array('File Locations', 'File Locations (Advanced)')) &&
-                      $this->getType($key) == 'directory') {
-                    return $this->_prependPath($test, $this->_installRoot);
-                }
-            }
-
-            if ($key == 'preferred_mirror') {
-                $reg = &$this->getRegistry();
-                if (is_object($reg)) {
-                    $chan = &$reg->getChannel($channel);
-                    if (PEAR::isError($chan)) {
-                        return $channel;
-                    }
-
-                    if (!$chan->getMirror($test) && $chan->getName() != $test) {
-                        return $channel; // mirror does not exist
-                    }
-                }
-            }
-
-            return $test;
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns a channel-specific configuration value, prioritizing layers as per the
-     * layers property.
-     *
-     * @param string config key
-     * @return mixed the config value, or NULL if not found
-     * @access private
-     */
-    function _getChannelValue($key, $layer, $channel)
-    {
-        if ($key == '__channels' || $channel == 'pear.php.net') {
-            return null;
-        }
-
-        $ret = null;
-        if ($layer === null) {
-            foreach ($this->layers as $ilayer) {
-                if (isset($this->configuration[$ilayer]['__channels'][$channel][$key])) {
-                    $ret = $this->configuration[$ilayer]['__channels'][$channel][$key];
-                    break;
-                }
-            }
-        } elseif (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
-            $ret = $this->configuration[$layer]['__channels'][$channel][$key];
-        }
-
-        if ($key != 'preferred_mirror') {
-            return $ret;
-        }
-
-
-        if ($ret !== null) {
-            $reg = &$this->getRegistry($layer);
-            if (is_object($reg)) {
-                $chan = &$reg->getChannel($channel);
-                if (PEAR::isError($chan)) {
-                    return $channel;
-                }
-
-                if (!$chan->getMirror($ret) && $chan->getName() != $ret) {
-                    return $channel; // mirror does not exist
-                }
-            }
-
-            return $ret;
-        }
-
-        if ($channel != $this->getDefaultChannel($layer)) {
-            return $channel; // we must use the channel name as the preferred mirror
-                             // if the user has not chosen an alternate
-        }
-
-        return $this->getDefaultChannel($layer);
-    }
-
-    /**
-     * Set a config value in a specific layer (defaults to 'user').
-     * Enforces the types defined in the configuration_info array.  An
-     * integer config variable will be cast to int, and a set config
-     * variable will be validated against its legal values.
-     *
-     * @param string config key
-     * @param string config value
-     * @param string (optional) config layer
-     * @param string channel to set this value for, or null for global value
-     * @return bool TRUE on success, FALSE on failure
-     */
-    function set($key, $value, $layer = 'user', $channel = false)
-    {
-        if ($key == '__channels') {
-            return false;
-        }
-
-        if (!isset($this->configuration[$layer])) {
-            return false;
-        }
-
-        if ($key == 'default_channel') {
-            // can only set this value globally
-            $channel = 'pear.php.net';
-            if ($value != 'pear.php.net') {
-                $this->_lazyChannelSetup($layer);
-            }
-        }
-
-        if ($key == 'preferred_mirror') {
-            if ($channel == '__uri') {
-                return false; // can't set the __uri pseudo-channel's mirror
-            }
-
-            $reg = &$this->getRegistry($layer);
-            if (is_object($reg)) {
-                $chan = &$reg->getChannel($channel ? $channel : 'pear.php.net');
-                if (PEAR::isError($chan)) {
-                    return false;
-                }
-
-                if (!$chan->getMirror($value) && $chan->getName() != $value) {
-                    return false; // mirror does not exist
-                }
-            }
-        }
-
-        if (!isset($this->configuration_info[$key])) {
-            return false;
-        }
-
-        extract($this->configuration_info[$key]);
-        switch ($type) {
-            case 'integer':
-                $value = (int)$value;
-                break;
-            case 'set': {
-                // If a valid_set is specified, require the value to
-                // be in the set.  If there is no valid_set, accept
-                // any value.
-                if ($valid_set) {
-                    reset($valid_set);
-                    if ((key($valid_set) === 0 && !in_array($value, $valid_set)) ||
-                        (key($valid_set) !== 0 && empty($valid_set[$value])))
-                    {
-                        return false;
-                    }
-                }
-                break;
-            }
-        }
-
-        if (!$channel) {
-            $channel = $this->get('default_channel', null, 'pear.php.net');
-        }
-
-        if (!in_array($channel, $this->_channels)) {
-            $this->_lazyChannelSetup($layer);
-            $reg = &$this->getRegistry($layer);
-            if ($reg) {
-                $channel = $reg->channelName($channel);
-            }
-
-            if (!in_array($channel, $this->_channels)) {
-                return false;
-            }
-        }
-
-        if ($channel != 'pear.php.net') {
-            if (in_array($key, $this->_channelConfigInfo)) {
-                $this->configuration[$layer]['__channels'][$channel][$key] = $value;
-                return true;
-            }
-
-            return false;
-        }
-
-        if ($key == 'default_channel') {
-            if (!isset($reg)) {
-                $reg = &$this->getRegistry($layer);
-                if (!$reg) {
-                    $reg = &$this->getRegistry();
-                }
-            }
-
-            if ($reg) {
-                $value = $reg->channelName($value);
-            }
-
-            if (!$value) {
-                return false;
-            }
-        }
-
-        $this->configuration[$layer][$key] = $value;
-        if ($key == 'php_dir' && !$this->_noRegistry) {
-            if (!isset($this->_registry[$layer]) ||
-                  $value != $this->_registry[$layer]->install_dir) {
-                $this->_registry[$layer] = &new PEAR_Registry($value);
-                $this->_regInitialized[$layer] = false;
-                $this->_registry[$layer]->setConfig($this, false);
-            }
-        }
-
-        return true;
-    }
-
-    function _lazyChannelSetup($uselayer = false)
-    {
-        if ($this->_noRegistry) {
-            return;
-        }
-
-        $merge = false;
-        foreach ($this->_registry as $layer => $p) {
-            if ($uselayer && $uselayer != $layer) {
-                continue;
-            }
-
-            if (!$this->_regInitialized[$layer]) {
-                if ($layer == 'default' && isset($this->_registry['user']) ||
-                      isset($this->_registry['system'])) {
-                    // only use the default registry if there are no alternatives
-                    continue;
-                }
-
-                if (!is_object($this->_registry[$layer])) {
-                    if ($phpdir = $this->get('php_dir', $layer, 'pear.php.net')) {
-                        $this->_registry[$layer] = &new PEAR_Registry($phpdir);
-                        $this->_registry[$layer]->setConfig($this, false);
-                        $this->_regInitialized[$layer] = false;
-                    } else {
-                        unset($this->_registry[$layer]);
-                        return;
-                    }
-                }
-
-                $this->setChannels($this->_registry[$layer]->listChannels(), $merge);
-                $this->_regInitialized[$layer] = true;
-                $merge = true;
-            }
-        }
-    }
-
-    /**
-     * Set the list of channels.
-     *
-     * This should be set via a call to {@link PEAR_Registry::listChannels()}
-     * @param array
-     * @param bool
-     * @return bool success of operation
-     */
-    function setChannels($channels, $merge = false)
-    {
-        if (!is_array($channels)) {
-            return false;
-        }
-
-        if ($merge) {
-            $this->_channels = array_merge($this->_channels, $channels);
-        } else {
-            $this->_channels = $channels;
-        }
-
-        foreach ($channels as $channel) {
-            $channel = strtolower($channel);
-            if ($channel == 'pear.php.net') {
-                continue;
-            }
-
-            foreach ($this->layers as $layer) {
-                if (!isset($this->configuration[$layer]['__channels'])) {
-                    $this->configuration[$layer]['__channels'] = array();
-                }
-                if (!isset($this->configuration[$layer]['__channels'][$channel])
-                      || !is_array($this->configuration[$layer]['__channels'][$channel])) {
-                    $this->configuration[$layer]['__channels'][$channel] = array();
-                }
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Get the type of a config value.
-     *
-     * @param string  config key
-     *
-     * @return string type, one of "string", "integer", "file",
-     * "directory", "set" or "password".
-     *
-     * @access public
-     *
-     */
-    function getType($key)
-    {
-        if (isset($this->configuration_info[$key])) {
-            return $this->configuration_info[$key]['type'];
-        }
-        return false;
-    }
-
-    /**
-     * Get the documentation for a config value.
-     *
-     * @param string  config key
-     * @return string documentation string
-     *
-     * @access public
-     *
-     */
-    function getDocs($key)
-    {
-        if (isset($this->configuration_info[$key])) {
-            return $this->configuration_info[$key]['doc'];
-        }
-
-        return false;
-    }
-
-    /**
-     * Get the short documentation for a config value.
-     *
-     * @param string  config key
-     * @return string short documentation string
-     *
-     * @access public
-     *
-     */
-    function getPrompt($key)
-    {
-        if (isset($this->configuration_info[$key])) {
-            return $this->configuration_info[$key]['prompt'];
-        }
-
-        return false;
-    }
-
-    /**
-     * Get the parameter group for a config key.
-     *
-     * @param string  config key
-     * @return string parameter group
-     *
-     * @access public
-     *
-     */
-    function getGroup($key)
-    {
-        if (isset($this->configuration_info[$key])) {
-            return $this->configuration_info[$key]['group'];
-        }
-
-        return false;
-    }
-
-    /**
-     * Get the list of parameter groups.
-     *
-     * @return array list of parameter groups
-     *
-     * @access public
-     *
-     */
-    function getGroups()
-    {
-        $tmp = array();
-        foreach ($this->configuration_info as $key => $info) {
-            $tmp[$info['group']] = 1;
-        }
-
-        return array_keys($tmp);
-    }
-
-    /**
-     * Get the list of the parameters in a group.
-     *
-     * @param string $group parameter group
-     * @return array list of parameters in $group
-     *
-     * @access public
-     *
-     */
-    function getGroupKeys($group)
-    {
-        $keys = array();
-        foreach ($this->configuration_info as $key => $info) {
-            if ($info['group'] == $group) {
-                $keys[] = $key;
-            }
-        }
-
-        return $keys;
-    }
-
-    /**
-     * Get the list of allowed set values for a config value.  Returns
-     * NULL for config values that are not sets.
-     *
-     * @param string  config key
-     * @return array enumerated array of set values, or NULL if the
-     *               config key is unknown or not a set
-     *
-     * @access public
-     *
-     */
-    function getSetValues($key)
-    {
-        if (isset($this->configuration_info[$key]) &&
-            isset($this->configuration_info[$key]['type']) &&
-            $this->configuration_info[$key]['type'] == 'set')
-        {
-            $valid_set = $this->configuration_info[$key]['valid_set'];
-            reset($valid_set);
-            if (key($valid_set) === 0) {
-                return $valid_set;
-            }
-
-            return array_keys($valid_set);
-        }
-
-        return null;
-    }
-
-    /**
-     * Get all the current config keys.
-     *
-     * @return array simple array of config keys
-     *
-     * @access public
-     */
-    function getKeys()
-    {
-        $keys = array();
-        foreach ($this->layers as $layer) {
-            $test = $this->configuration[$layer];
-            if (isset($test['__channels'])) {
-                foreach ($test['__channels'] as $channel => $configs) {
-                    $keys = array_merge($keys, $configs);
-                }
-            }
-
-            unset($test['__channels']);
-            $keys = array_merge($keys, $test);
-
-        }
-        return array_keys($keys);
-    }
-
-    /**
-     * Remove the a config key from a specific config layer.
-     *
-     * @param string config key
-     * @param string (optional) config layer
-     * @param string (optional) channel (defaults to default channel)
-     * @return bool TRUE on success, FALSE on failure
-     *
-     * @access public
-     */
-    function remove($key, $layer = 'user', $channel = null)
-    {
-        if ($channel === null) {
-            $channel = $this->getDefaultChannel();
-        }
-
-        if ($channel !== 'pear.php.net') {
-            if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
-                unset($this->configuration[$layer]['__channels'][$channel][$key]);
-                return true;
-            }
-        }
-
-        if (isset($this->configuration[$layer][$key])) {
-            unset($this->configuration[$layer][$key]);
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Temporarily remove an entire config layer.  USE WITH CARE!
-     *
-     * @param string config key
-     * @param string (optional) config layer
-     * @return bool TRUE on success, FALSE on failure
-     *
-     * @access public
-     */
-    function removeLayer($layer)
-    {
-        if (isset($this->configuration[$layer])) {
-            $this->configuration[$layer] = array();
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Stores configuration data in a layer.
-     *
-     * @param string config layer to store
-     * @return bool TRUE on success, or PEAR error on failure
-     *
-     * @access public
-     */
-    function store($layer = 'user', $data = null)
-    {
-        return $this->writeConfigFile(null, $layer, $data);
-    }
-
-    /**
-     * Tells what config layer that gets to define a key.
-     *
-     * @param string config key
-     * @param boolean return the defining channel
-     *
-     * @return string|array the config layer, or an empty string if not found.
-     *
-     *         if $returnchannel, the return is an array array('layer' => layername,
-     *         'channel' => channelname), or an empty string if not found
-     *
-     * @access public
-     */
-    function definedBy($key, $returnchannel = false)
-    {
-        foreach ($this->layers as $layer) {
-            $channel = $this->getDefaultChannel();
-            if ($channel !== 'pear.php.net') {
-                if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
-                    if ($returnchannel) {
-                        return array('layer' => $layer, 'channel' => $channel);
-                    }
-                    return $layer;
-                }
-            }
-
-            if (isset($this->configuration[$layer][$key])) {
-                if ($returnchannel) {
-                    return array('layer' => $layer, 'channel' => 'pear.php.net');
-                }
-                return $layer;
-            }
-        }
-
-        return '';
-    }
-
-    /**
-     * Tells whether a given key exists as a config value.
-     *
-     * @param string config key
-     * @return bool whether <config key> exists in this object
-     *
-     * @access public
-     */
-    function isDefined($key)
-    {
-        foreach ($this->layers as $layer) {
-            if (isset($this->configuration[$layer][$key])) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Tells whether a given config layer exists.
-     *
-     * @param string config layer
-     * @return bool whether <config layer> exists in this object
-     *
-     * @access public
-     */
-    function isDefinedLayer($layer)
-    {
-        return isset($this->configuration[$layer]);
-    }
-
-    /**
-     * Returns the layers defined (except the 'default' one)
-     *
-     * @return array of the defined layers
-     */
-    function getLayers()
-    {
-        $cf = $this->configuration;
-        unset($cf['default']);
-        return array_keys($cf);
-    }
-
-    function apiVersion()
-    {
-        return '1.1';
-    }
-
-    /**
-     * @return PEAR_Registry
-     */
-    function &getRegistry($use = null)
-    {
-        $layer = $use === null ? 'user' : $use;
-        if (isset($this->_registry[$layer])) {
-            return $this->_registry[$layer];
-        } elseif ($use === null && isset($this->_registry['system'])) {
-            return $this->_registry['system'];
-        } elseif ($use === null && isset($this->_registry['default'])) {
-            return $this->_registry['default'];
-        } elseif ($use) {
-            $a = false;
-            return $a;
-        }
-
-        // only go here if null was passed in
-        echo "CRITICAL ERROR: Registry could not be initialized from any value";
-        exit(1);
-    }
-
-    /**
-     * This is to allow customization like the use of installroot
-     * @param PEAR_Registry
-     * @return bool
-     */
-    function setRegistry(&$reg, $layer = 'user')
-    {
-        if ($this->_noRegistry) {
-            return false;
-        }
-
-        if (!in_array($layer, array('user', 'system'))) {
-            return false;
-        }
-
-        $this->_registry[$layer] = &$reg;
-        if (is_object($reg)) {
-            $this->_registry[$layer]->setConfig($this, false);
-        }
-
-        return true;
-    }
-
-    function noRegistry()
-    {
-        $this->_noRegistry = true;
-    }
-
-    /**
-     * @return PEAR_REST
-     */
-    function &getREST($version, $options = array())
-    {
-        $version = str_replace('.', '', $version);
-        if (!class_exists($class = 'PEAR_REST_' . $version)) {
-            require_once 'PEAR/REST/' . $version . '.php';
-        }
-
-        $remote = &new $class($this, $options);
-        return $remote;
-    }
-
-    /**
-     * The ftp server is set in {@link readFTPConfigFile()}.  It exists only if a
-     * remote configuration file has been specified
-     * @return PEAR_FTP|false
-     */
-    function &getFTP()
-    {
-        if (isset($this->_ftp)) {
-            return $this->_ftp;
-        }
-
-        $a = false;
-        return $a;
-    }
-
-    function _prependPath($path, $prepend)
-    {
-        if (strlen($prepend) > 0) {
-            if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
-                if (preg_match('/^[a-z]:/i', $prepend)) {
-                    $prepend = substr($prepend, 2);
-                } elseif ($prepend{0} != '\\') {
-                    $prepend = "\\$prepend";
-                }
-                $path = substr($path, 0, 2) . $prepend . substr($path, 2);
-            } else {
-                $path = $prepend . $path;
-            }
-        }
-        return $path;
-    }
-
-    /**
-     * @param string|false installation directory to prepend to all _dir variables, or false to
-     *                     disable
-     */
-    function setInstallRoot($root)
-    {
-        if (substr($root, -1) == DIRECTORY_SEPARATOR) {
-            $root = substr($root, 0, -1);
-        }
-        $old = $this->_installRoot;
-        $this->_installRoot = $root;
-        if (($old != $root) && !$this->_noRegistry) {
-            foreach (array_keys($this->_registry) as $layer) {
-                if ($layer == 'ftp' || !isset($this->_registry[$layer])) {
-                    continue;
-                }
-                $this->_registry[$layer] =
-                    &new PEAR_Registry($this->get('php_dir', $layer, 'pear.php.net'));
-                $this->_registry[$layer]->setConfig($this, false);
-                $this->_regInitialized[$layer] = false;
-            }
-        }
-    }
-}
diff --git a/lib/php/PEAR/Dependency2.php b/lib/php/PEAR/Dependency2.php
deleted file mode 100644
index ce51ed1909855c6fdd81247b7387c848297516e0..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Dependency2.php
+++ /dev/null
@@ -1,1358 +0,0 @@
-<?php
-/**
- * PEAR_Dependency2, advanced dependency validation
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Dependency2.php 286494 2009-07-29 06:57:11Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Required for the PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-
-/**
- * Dependency check for PEAR packages
- *
- * This class handles both version 1.0 and 2.0 dependencies
- * WARNING: *any* changes to this class must be duplicated in the
- * test_PEAR_Dependency2 class found in tests/PEAR_Dependency2/setup.php.inc,
- * or unit tests will not actually validate the changes
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Dependency2
-{
-    /**
-     * One of the PEAR_VALIDATE_* states
-     * @see PEAR_VALIDATE_NORMAL
-     * @var integer
-     */
-    var $_state;
-
-    /**
-     * Command-line options to install/upgrade/uninstall commands
-     * @param array
-     */
-    var $_options;
-
-    /**
-     * @var OS_Guess
-     */
-    var $_os;
-
-    /**
-     * @var PEAR_Registry
-     */
-    var $_registry;
-
-    /**
-     * @var PEAR_Config
-     */
-    var $_config;
-
-    /**
-     * @var PEAR_DependencyDB
-     */
-    var $_dependencydb;
-
-    /**
-     * Output of PEAR_Registry::parsedPackageName()
-     * @var array
-     */
-    var $_currentPackage;
-
-    /**
-     * @param PEAR_Config
-     * @param array installation options
-     * @param array format of PEAR_Registry::parsedPackageName()
-     * @param int installation state (one of PEAR_VALIDATE_*)
-     */
-    function PEAR_Dependency2(&$config, $installoptions, $package,
-                              $state = PEAR_VALIDATE_INSTALLING)
-    {
-        $this->_config = &$config;
-        if (!class_exists('PEAR_DependencyDB')) {
-            require_once 'PEAR/DependencyDB.php';
-        }
-
-        if (isset($installoptions['packagingroot'])) {
-            // make sure depdb is in the right location
-            $config->setInstallRoot($installoptions['packagingroot']);
-        }
-
-        $this->_registry = &$config->getRegistry();
-        $this->_dependencydb = &PEAR_DependencyDB::singleton($config);
-        if (isset($installoptions['packagingroot'])) {
-            $config->setInstallRoot(false);
-        }
-
-        $this->_options = $installoptions;
-        $this->_state = $state;
-        if (!class_exists('OS_Guess')) {
-            require_once 'OS/Guess.php';
-        }
-
-        $this->_os = new OS_Guess;
-        $this->_currentPackage = $package;
-    }
-
-    function _getExtraString($dep)
-    {
-        $extra = ' (';
-        if (isset($dep['uri'])) {
-            return '';
-        }
-
-        if (isset($dep['recommended'])) {
-            $extra .= 'recommended version ' . $dep['recommended'];
-        } else {
-            if (isset($dep['min'])) {
-                $extra .= 'version >= ' . $dep['min'];
-            }
-
-            if (isset($dep['max'])) {
-                if ($extra != ' (') {
-                    $extra .= ', ';
-                }
-                $extra .= 'version <= ' . $dep['max'];
-            }
-
-            if (isset($dep['exclude'])) {
-                if (!is_array($dep['exclude'])) {
-                    $dep['exclude'] = array($dep['exclude']);
-                }
-
-                if ($extra != ' (') {
-                    $extra .= ', ';
-                }
-
-                $extra .= 'excluded versions: ';
-                foreach ($dep['exclude'] as $i => $exclude) {
-                    if ($i) {
-                        $extra .= ', ';
-                    }
-                    $extra .= $exclude;
-                }
-            }
-        }
-
-        $extra .= ')';
-        if ($extra == ' ()') {
-            $extra = '';
-        }
-
-        return $extra;
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function getPHP_OS()
-    {
-        return PHP_OS;
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function getsysname()
-    {
-        return $this->_os->getSysname();
-    }
-
-    /**
-     * Specify a dependency on an OS.  Use arch for detailed os/processor information
-     *
-     * There are two generic OS dependencies that will be the most common, unix and windows.
-     * Other options are linux, freebsd, darwin (OS X), sunos, irix, hpux, aix
-     */
-    function validateOsDependency($dep)
-    {
-        if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) {
-            return true;
-        }
-
-        if ($dep['name'] == '*') {
-            return true;
-        }
-
-        $not = isset($dep['conflicts']) ? true : false;
-        switch (strtolower($dep['name'])) {
-            case 'windows' :
-                if ($not) {
-                    if (strtolower(substr($this->getPHP_OS(), 0, 3)) == 'win') {
-                        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                            return $this->raiseError("Cannot install %s on Windows");
-                        }
-
-                        return $this->warning("warning: Cannot install %s on Windows");
-                    }
-                } else {
-                    if (strtolower(substr($this->getPHP_OS(), 0, 3)) != 'win') {
-                        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                            return $this->raiseError("Can only install %s on Windows");
-                        }
-
-                        return $this->warning("warning: Can only install %s on Windows");
-                    }
-                }
-            break;
-            case 'unix' :
-                $unices = array('linux', 'freebsd', 'darwin', 'sunos', 'irix', 'hpux', 'aix');
-                if ($not) {
-                    if (in_array($this->getSysname(), $unices)) {
-                        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                            return $this->raiseError("Cannot install %s on any Unix system");
-                        }
-
-                        return $this->warning( "warning: Cannot install %s on any Unix system");
-                    }
-                } else {
-                    if (!in_array($this->getSysname(), $unices)) {
-                        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                            return $this->raiseError("Can only install %s on a Unix system");
-                        }
-
-                        return $this->warning("warning: Can only install %s on a Unix system");
-                    }
-                }
-            break;
-            default :
-                if ($not) {
-                    if (strtolower($dep['name']) == strtolower($this->getSysname())) {
-                        if (!isset($this->_options['nodeps']) &&
-                              !isset($this->_options['force'])) {
-                            return $this->raiseError('Cannot install %s on ' . $dep['name'] .
-                                ' operating system');
-                        }
-
-                        return $this->warning('warning: Cannot install %s on ' .
-                            $dep['name'] . ' operating system');
-                    }
-                } else {
-                    if (strtolower($dep['name']) != strtolower($this->getSysname())) {
-                        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                            return $this->raiseError('Cannot install %s on ' .
-                                $this->getSysname() .
-                                ' operating system, can only install on ' . $dep['name']);
-                        }
-
-                        return $this->warning('warning: Cannot install %s on ' .
-                            $this->getSysname() .
-                            ' operating system, can only install on ' . $dep['name']);
-                    }
-                }
-        }
-        return true;
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function matchSignature($pattern)
-    {
-        return $this->_os->matchSignature($pattern);
-    }
-
-    /**
-     * Specify a complex dependency on an OS/processor/kernel version,
-     * Use OS for simple operating system dependency.
-     *
-     * This is the only dependency that accepts an eregable pattern.  The pattern
-     * will be matched against the php_uname() output parsed by OS_Guess
-     */
-    function validateArchDependency($dep)
-    {
-        if ($this->_state != PEAR_VALIDATE_INSTALLING) {
-            return true;
-        }
-
-        $not = isset($dep['conflicts']) ? true : false;
-        if (!$this->matchSignature($dep['pattern'])) {
-            if (!$not) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s Architecture dependency failed, does not ' .
-                        'match "' . $dep['pattern'] . '"');
-                }
-
-                return $this->warning('warning: %s Architecture dependency failed, does ' .
-                    'not match "' . $dep['pattern'] . '"');
-            }
-
-            return true;
-        }
-
-        if ($not) {
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s Architecture dependency failed, required "' .
-                    $dep['pattern'] . '"');
-            }
-
-            return $this->warning('warning: %s Architecture dependency failed, ' .
-                'required "' . $dep['pattern'] . '"');
-        }
-
-        return true;
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function extension_loaded($name)
-    {
-        return extension_loaded($name);
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function phpversion($name = null)
-    {
-        if ($name !== null) {
-            return phpversion($name);
-        }
-
-        return phpversion();
-    }
-
-    function validateExtensionDependency($dep, $required = true)
-    {
-        if ($this->_state != PEAR_VALIDATE_INSTALLING &&
-              $this->_state != PEAR_VALIDATE_DOWNLOADING) {
-            return true;
-        }
-
-        $loaded = $this->extension_loaded($dep['name']);
-        $extra  = $this->_getExtraString($dep);
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-        }
-
-        if (!isset($dep['min']) && !isset($dep['max']) &&
-            !isset($dep['recommended']) && !isset($dep['exclude'])
-        ) {
-            if ($loaded) {
-                if (isset($dep['conflicts'])) {
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s conflicts with PHP extension "' .
-                            $dep['name'] . '"' . $extra);
-                    }
-
-                    return $this->warning('warning: %s conflicts with PHP extension "' .
-                        $dep['name'] . '"' . $extra);
-                }
-
-                return true;
-            }
-
-            if (isset($dep['conflicts'])) {
-                return true;
-            }
-
-            if ($required) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires PHP extension "' .
-                        $dep['name'] . '"' . $extra);
-                }
-
-                return $this->warning('warning: %s requires PHP extension "' .
-                    $dep['name'] . '"' . $extra);
-            }
-
-            return $this->warning('%s can optionally use PHP extension "' .
-                $dep['name'] . '"' . $extra);
-        }
-
-        if (!$loaded) {
-            if (isset($dep['conflicts'])) {
-                return true;
-            }
-
-            if (!$required) {
-                return $this->warning('%s can optionally use PHP extension "' .
-                    $dep['name'] . '"' . $extra);
-            }
-
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s requires PHP extension "' . $dep['name'] .
-                    '"' . $extra);
-            }
-
-            return $this->warning('warning: %s requires PHP extension "' . $dep['name'] .
-                    '"' . $extra);
-        }
-
-        $version = (string) $this->phpversion($dep['name']);
-        if (empty($version)) {
-            $version = '0';
-        }
-
-        $fail = false;
-        if (isset($dep['min']) && !version_compare($version, $dep['min'], '>=')) {
-            $fail = true;
-        }
-
-        if (isset($dep['max']) && !version_compare($version, $dep['max'], '<=')) {
-            $fail = true;
-        }
-
-        if ($fail && !isset($dep['conflicts'])) {
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s requires PHP extension "' . $dep['name'] .
-                    '"' . $extra . ', installed version is ' . $version);
-            }
-
-            return $this->warning('warning: %s requires PHP extension "' . $dep['name'] .
-                '"' . $extra . ', installed version is ' . $version);
-        } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail && isset($dep['conflicts'])) {
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s conflicts with PHP extension "' .
-                    $dep['name'] . '"' . $extra . ', installed version is ' . $version);
-            }
-
-            return $this->warning('warning: %s conflicts with PHP extension "' .
-                $dep['name'] . '"' . $extra . ', installed version is ' . $version);
-        }
-
-        if (isset($dep['exclude'])) {
-            foreach ($dep['exclude'] as $exclude) {
-                if (version_compare($version, $exclude, '==')) {
-                    if (isset($dep['conflicts'])) {
-                        continue;
-                    }
-
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s is not compatible with PHP extension "' .
-                            $dep['name'] . '" version ' .
-                            $exclude);
-                    }
-
-                    return $this->warning('warning: %s is not compatible with PHP extension "' .
-                        $dep['name'] . '" version ' .
-                        $exclude);
-                } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) {
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s conflicts with PHP extension "' .
-                            $dep['name'] . '"' . $extra . ', installed version is ' . $version);
-                    }
-
-                    return $this->warning('warning: %s conflicts with PHP extension "' .
-                        $dep['name'] . '"' . $extra . ', installed version is ' . $version);
-                }
-            }
-        }
-
-        if (isset($dep['recommended'])) {
-            if (version_compare($version, $dep['recommended'], '==')) {
-                return true;
-            }
-
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s dependency: PHP extension ' . $dep['name'] .
-                    ' version "' . $version . '"' .
-                    ' is not the recommended version "' . $dep['recommended'] .
-                    '", but may be compatible, use --force to install');
-            }
-
-            return $this->warning('warning: %s dependency: PHP extension ' .
-                $dep['name'] . ' version "' . $version . '"' .
-                ' is not the recommended version "' . $dep['recommended'].'"');
-        }
-
-        return true;
-    }
-
-    function validatePhpDependency($dep)
-    {
-        if ($this->_state != PEAR_VALIDATE_INSTALLING &&
-              $this->_state != PEAR_VALIDATE_DOWNLOADING) {
-            return true;
-        }
-
-        $version = $this->phpversion();
-        $extra   = $this->_getExtraString($dep);
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-        }
-
-        if (isset($dep['min'])) {
-            if (!version_compare($version, $dep['min'], '>=')) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires PHP' .
-                        $extra . ', installed version is ' . $version);
-                }
-
-                return $this->warning('warning: %s requires PHP' .
-                    $extra . ', installed version is ' . $version);
-            }
-        }
-
-        if (isset($dep['max'])) {
-            if (!version_compare($version, $dep['max'], '<=')) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires PHP' .
-                        $extra . ', installed version is ' . $version);
-                }
-
-                return $this->warning('warning: %s requires PHP' .
-                    $extra . ', installed version is ' . $version);
-            }
-        }
-
-        if (isset($dep['exclude'])) {
-            foreach ($dep['exclude'] as $exclude) {
-                if (version_compare($version, $exclude, '==')) {
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s is not compatible with PHP version ' .
-                            $exclude);
-                    }
-
-                    return $this->warning(
-                        'warning: %s is not compatible with PHP version ' .
-                        $exclude);
-                }
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * This makes unit-testing a heck of a lot easier
-     */
-    function getPEARVersion()
-    {
-        return '1.9.0';
-    }
-
-    function validatePearinstallerDependency($dep)
-    {
-        $pearversion = $this->getPEARVersion();
-        $extra = $this->_getExtraString($dep);
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-        }
-
-        if (version_compare($pearversion, $dep['min'], '<')) {
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s requires PEAR Installer' . $extra .
-                    ', installed version is ' . $pearversion);
-            }
-
-            return $this->warning('warning: %s requires PEAR Installer' . $extra .
-                ', installed version is ' . $pearversion);
-        }
-
-        if (isset($dep['max'])) {
-            if (version_compare($pearversion, $dep['max'], '>')) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires PEAR Installer' . $extra .
-                        ', installed version is ' . $pearversion);
-                }
-
-                return $this->warning('warning: %s requires PEAR Installer' . $extra .
-                    ', installed version is ' . $pearversion);
-            }
-        }
-
-        if (isset($dep['exclude'])) {
-            if (!isset($dep['exclude'][0])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-
-            foreach ($dep['exclude'] as $exclude) {
-                if (version_compare($exclude, $pearversion, '==')) {
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s is not compatible with PEAR Installer ' .
-                            'version ' . $exclude);
-                    }
-
-                    return $this->warning('warning: %s is not compatible with PEAR ' .
-                        'Installer version ' . $exclude);
-                }
-            }
-        }
-
-        return true;
-    }
-
-    function validateSubpackageDependency($dep, $required, $params)
-    {
-        return $this->validatePackageDependency($dep, $required, $params);
-    }
-
-    /**
-     * @param array dependency information (2.0 format)
-     * @param boolean whether this is a required dependency
-     * @param array a list of downloaded packages to be installed, if any
-     * @param boolean if true, then deps on pear.php.net that fail will also check
-     *                against pecl.php.net packages to accomodate extensions that have
-     *                moved to pecl.php.net from pear.php.net
-     */
-    function validatePackageDependency($dep, $required, $params, $depv1 = false)
-    {
-        if ($this->_state != PEAR_VALIDATE_INSTALLING &&
-              $this->_state != PEAR_VALIDATE_DOWNLOADING) {
-            return true;
-        }
-
-        if (isset($dep['providesextension'])) {
-            if ($this->extension_loaded($dep['providesextension'])) {
-                $save = $dep;
-                $subdep = $dep;
-                $subdep['name'] = $subdep['providesextension'];
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                $ret = $this->validateExtensionDependency($subdep, $required);
-                PEAR::popErrorHandling();
-                if (!PEAR::isError($ret)) {
-                    return true;
-                }
-            }
-        }
-
-        if ($this->_state == PEAR_VALIDATE_INSTALLING) {
-            return $this->_validatePackageInstall($dep, $required, $depv1);
-        }
-
-        if ($this->_state == PEAR_VALIDATE_DOWNLOADING) {
-            return $this->_validatePackageDownload($dep, $required, $params, $depv1);
-        }
-    }
-
-    function _validatePackageDownload($dep, $required, $params, $depv1 = false)
-    {
-        $dep['package'] = $dep['name'];
-        if (isset($dep['uri'])) {
-            $dep['channel'] = '__uri';
-        }
-
-        $depname = $this->_registry->parsedPackageNameToString($dep, true);
-        $found = false;
-        foreach ($params as $param) {
-            if ($param->isEqual(
-                  array('package' => $dep['name'],
-                        'channel' => $dep['channel']))) {
-                $found = true;
-                break;
-            }
-
-            if ($depv1 && $dep['channel'] == 'pear.php.net') {
-                if ($param->isEqual(
-                  array('package' => $dep['name'],
-                        'channel' => 'pecl.php.net'))) {
-                    $found = true;
-                    break;
-                }
-            }
-        }
-
-        if (!$found && isset($dep['providesextension'])) {
-            foreach ($params as $param) {
-                if ($param->isExtension($dep['providesextension'])) {
-                    $found = true;
-                    break;
-                }
-            }
-        }
-
-        if ($found) {
-            $version = $param->getVersion();
-            $installed = false;
-            $downloaded = true;
-        } else {
-            if ($this->_registry->packageExists($dep['name'], $dep['channel'])) {
-                $installed = true;
-                $downloaded = false;
-                $version = $this->_registry->packageinfo($dep['name'], 'version',
-                    $dep['channel']);
-            } else {
-                if ($dep['channel'] == 'pecl.php.net' && $this->_registry->packageExists($dep['name'],
-                      'pear.php.net')) {
-                    $installed = true;
-                    $downloaded = false;
-                    $version = $this->_registry->packageinfo($dep['name'], 'version',
-                        'pear.php.net');
-                } else {
-                    $version = 'not installed or downloaded';
-                    $installed = false;
-                    $downloaded = false;
-                }
-            }
-        }
-
-        $extra = $this->_getExtraString($dep);
-        if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
-            $dep['exclude'] = array($dep['exclude']);
-        }
-
-        if (!isset($dep['min']) && !isset($dep['max']) &&
-              !isset($dep['recommended']) && !isset($dep['exclude'])
-        ) {
-            if ($installed || $downloaded) {
-                $installed = $installed ? 'installed' : 'downloaded';
-                if (isset($dep['conflicts'])) {
-                    $rest = '';
-                    if ($version) {
-                        $rest = ", $installed version is " . $version;
-                    }
-
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . $rest);
-                    }
-
-                    return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . $rest);
-                }
-
-                return true;
-            }
-
-            if (isset($dep['conflicts'])) {
-                return true;
-            }
-
-            if ($required) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires package "' . $depname . '"' . $extra);
-                }
-
-                return $this->warning('warning: %s requires package "' . $depname . '"' . $extra);
-            }
-
-            return $this->warning('%s can optionally use package "' . $depname . '"' . $extra);
-        }
-
-        if (!$installed && !$downloaded) {
-            if (isset($dep['conflicts'])) {
-                return true;
-            }
-
-            if ($required) {
-                if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                    return $this->raiseError('%s requires package "' . $depname . '"' . $extra);
-                }
-
-                return $this->warning('warning: %s requires package "' . $depname . '"' . $extra);
-            }
-
-            return $this->warning('%s can optionally use package "' . $depname . '"' . $extra);
-        }
-
-        $fail = false;
-        if (isset($dep['min']) && version_compare($version, $dep['min'], '<')) {
-            $fail = true;
-        }
-
-        if (isset($dep['max']) && version_compare($version, $dep['max'], '>')) {
-            $fail = true;
-        }
-
-        if ($fail && !isset($dep['conflicts'])) {
-            $installed = $installed ? 'installed' : 'downloaded';
-            $dep['package'] = $dep['name'];
-            $dep = $this->_registry->parsedPackageNameToString($dep, true);
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s requires package "' . $depname . '"' .
-                    $extra . ", $installed version is " . $version);
-            }
-
-            return $this->warning('warning: %s requires package "' . $depname . '"' .
-                $extra . ", $installed version is " . $version);
-        } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail &&
-              isset($dep['conflicts']) && !isset($dep['exclude'])) {
-            $installed = $installed ? 'installed' : 'downloaded';
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra .
-                    ", $installed version is " . $version);
-            }
-
-            return $this->warning('warning: %s conflicts with package "' . $depname . '"' .
-                $extra . ", $installed version is " . $version);
-        }
-
-        if (isset($dep['exclude'])) {
-            $installed = $installed ? 'installed' : 'downloaded';
-            foreach ($dep['exclude'] as $exclude) {
-                if (version_compare($version, $exclude, '==') && !isset($dep['conflicts'])) {
-                    if (!isset($this->_options['nodeps']) &&
-                          !isset($this->_options['force'])
-                    ) {
-                        return $this->raiseError('%s is not compatible with ' .
-                            $installed . ' package "' .
-                            $depname . '" version ' .
-                            $exclude);
-                    }
-
-                    return $this->warning('warning: %s is not compatible with ' .
-                        $installed . ' package "' .
-                        $depname . '" version ' .
-                        $exclude);
-                } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) {
-                    $installed = $installed ? 'installed' : 'downloaded';
-                    if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                        return $this->raiseError('%s conflicts with package "' . $depname . '"' .
-                            $extra . ", $installed version is " . $version);
-                    }
-
-                    return $this->warning('warning: %s conflicts with package "' . $depname . '"' .
-                        $extra . ", $installed version is " . $version);
-                }
-            }
-        }
-
-        if (isset($dep['recommended'])) {
-            $installed = $installed ? 'installed' : 'downloaded';
-            if (version_compare($version, $dep['recommended'], '==')) {
-                return true;
-            }
-
-            if (!$found && $installed) {
-                $param = $this->_registry->getPackage($dep['name'], $dep['channel']);
-            }
-
-            if ($param) {
-                $found = false;
-                foreach ($params as $parent) {
-                    if ($parent->isEqual($this->_currentPackage)) {
-                        $found = true;
-                        break;
-                    }
-                }
-
-                if ($found) {
-                    if ($param->isCompatible($parent)) {
-                        return true;
-                    }
-                } else { // this is for validPackage() calls
-                    $parent = $this->_registry->getPackage($this->_currentPackage['package'],
-                        $this->_currentPackage['channel']);
-                    if ($parent !== null && $param->isCompatible($parent)) {
-                        return true;
-                    }
-                }
-            }
-
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force']) &&
-                  !isset($this->_options['loose'])
-            ) {
-                return $this->raiseError('%s dependency package "' . $depname .
-                    '" ' . $installed . ' version ' . $version .
-                    ' is not the recommended version ' . $dep['recommended'] .
-                    ', but may be compatible, use --force to install');
-            }
-
-            return $this->warning('warning: %s dependency package "' . $depname .
-                '" ' . $installed . ' version ' . $version .
-                ' is not the recommended version ' . $dep['recommended']);
-        }
-
-        return true;
-    }
-
-    function _validatePackageInstall($dep, $required, $depv1 = false)
-    {
-        return $this->_validatePackageDownload($dep, $required, array(), $depv1);
-    }
-
-    /**
-     * Verify that uninstalling packages passed in to command line is OK.
-     *
-     * @param PEAR_Installer $dl
-     * @return PEAR_Error|true
-     */
-    function validatePackageUninstall(&$dl)
-    {
-        if (PEAR::isError($this->_dependencydb)) {
-            return $this->_dependencydb;
-        }
-
-        $params = array();
-        // construct an array of "downloaded" packages to fool the package dependency checker
-        // into using these to validate uninstalls of circular dependencies
-        $downloaded = &$dl->getUninstallPackages();
-        foreach ($downloaded as $i => $pf) {
-            if (!class_exists('PEAR_Downloader_Package')) {
-                require_once 'PEAR/Downloader/Package.php';
-            }
-            $dp = &new PEAR_Downloader_Package($dl);
-            $dp->setPackageFile($downloaded[$i]);
-            $params[$i] = &$dp;
-        }
-
-        // check cache
-        $memyselfandI = strtolower($this->_currentPackage['channel']) . '/' .
-            strtolower($this->_currentPackage['package']);
-        if (isset($dl->___uninstall_package_cache)) {
-            $badpackages = $dl->___uninstall_package_cache;
-            if (isset($badpackages[$memyselfandI]['warnings'])) {
-                foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
-                    $dl->log(0, $warning[0]);
-                }
-            }
-
-            if (isset($badpackages[$memyselfandI]['errors'])) {
-                foreach ($badpackages[$memyselfandI]['errors'] as $error) {
-                    if (is_array($error)) {
-                        $dl->log(0, $error[0]);
-                    } else {
-                        $dl->log(0, $error->getMessage());
-                    }
-                }
-
-                if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
-                    return $this->warning(
-                        'warning: %s should not be uninstalled, other installed packages depend ' .
-                        'on this package');
-                }
-
-                return $this->raiseError(
-                    '%s cannot be uninstalled, other installed packages depend on this package');
-            }
-
-            return true;
-        }
-
-        // first, list the immediate parents of each package to be uninstalled
-        $perpackagelist = array();
-        $allparents = array();
-        foreach ($params as $i => $param) {
-            $a = array(
-                'channel' => strtolower($param->getChannel()),
-                'package' => strtolower($param->getPackage())
-            );
-
-            $deps = $this->_dependencydb->getDependentPackages($a);
-            if ($deps) {
-                foreach ($deps as $d) {
-                    $pardeps = $this->_dependencydb->getDependencies($d);
-                    foreach ($pardeps as $dep) {
-                        if (strtolower($dep['dep']['channel']) == $a['channel'] &&
-                              strtolower($dep['dep']['name']) == $a['package']) {
-                            if (!isset($perpackagelist[$a['channel'] . '/' . $a['package']])) {
-                                $perpackagelist[$a['channel'] . '/' . $a['package']] = array();
-                            }
-                            $perpackagelist[$a['channel'] . '/' . $a['package']][]
-                                = array($d['channel'] . '/' . $d['package'], $dep);
-                            if (!isset($allparents[$d['channel'] . '/' . $d['package']])) {
-                                $allparents[$d['channel'] . '/' . $d['package']] = array();
-                            }
-                            if (!isset($allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']])) {
-                                $allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']] = array();
-                            }
-                            $allparents[$d['channel'] . '/' . $d['package']]
-                                       [$a['channel'] . '/' . $a['package']][]
-                                = array($d, $dep);
-                        }
-                    }
-                }
-            }
-        }
-
-        // next, remove any packages from the parents list that are not installed
-        $remove = array();
-        foreach ($allparents as $parent => $d1) {
-            foreach ($d1 as $d) {
-                if ($this->_registry->packageExists($d[0][0]['package'], $d[0][0]['channel'])) {
-                    continue;
-                }
-                $remove[$parent] = true;
-            }
-        }
-
-        // next remove any packages from the parents list that are not passed in for
-        // uninstallation
-        foreach ($allparents as $parent => $d1) {
-            foreach ($d1 as $d) {
-                foreach ($params as $param) {
-                    if (strtolower($param->getChannel()) == $d[0][0]['channel'] &&
-                          strtolower($param->getPackage()) == $d[0][0]['package']) {
-                        // found it
-                        continue 3;
-                    }
-                }
-                $remove[$parent] = true;
-            }
-        }
-
-        // remove all packages whose dependencies fail
-        // save which ones failed for error reporting
-        $badchildren = array();
-        do {
-            $fail = false;
-            foreach ($remove as $package => $unused) {
-                if (!isset($allparents[$package])) {
-                    continue;
-                }
-
-                foreach ($allparents[$package] as $kid => $d1) {
-                    foreach ($d1 as $depinfo) {
-                        if ($depinfo[1]['type'] != 'optional') {
-                            if (isset($badchildren[$kid])) {
-                                continue;
-                            }
-                            $badchildren[$kid] = true;
-                            $remove[$kid] = true;
-                            $fail = true;
-                            continue 2;
-                        }
-                    }
-                }
-                if ($fail) {
-                    // start over, we removed some children
-                    continue 2;
-                }
-            }
-        } while ($fail);
-
-        // next, construct the list of packages that can't be uninstalled
-        $badpackages = array();
-        $save = $this->_currentPackage;
-        foreach ($perpackagelist as $package => $packagedeps) {
-            foreach ($packagedeps as $parent) {
-                if (!isset($remove[$parent[0]])) {
-                    continue;
-                }
-
-                $packagename = $this->_registry->parsePackageName($parent[0]);
-                $packagename['channel'] = $this->_registry->channelAlias($packagename['channel']);
-                $pa = $this->_registry->getPackage($packagename['package'], $packagename['channel']);
-                $packagename['package'] = $pa->getPackage();
-                $this->_currentPackage = $packagename;
-                // parent is not present in uninstall list, make sure we can actually
-                // uninstall it (parent dep is optional)
-                $parentname['channel'] = $this->_registry->channelAlias($parent[1]['dep']['channel']);
-                $pa = $this->_registry->getPackage($parent[1]['dep']['name'], $parent[1]['dep']['channel']);
-                $parentname['package'] = $pa->getPackage();
-                $parent[1]['dep']['package'] = $parentname['package'];
-                $parent[1]['dep']['channel'] = $parentname['channel'];
-                if ($parent[1]['type'] == 'optional') {
-                    $test = $this->_validatePackageUninstall($parent[1]['dep'], false, $dl);
-                    if ($test !== true) {
-                        $badpackages[$package]['warnings'][] = $test;
-                    }
-                } else {
-                    $test = $this->_validatePackageUninstall($parent[1]['dep'], true, $dl);
-                    if ($test !== true) {
-                        $badpackages[$package]['errors'][] = $test;
-                    }
-                }
-            }
-        }
-
-        $this->_currentPackage          = $save;
-        $dl->___uninstall_package_cache = $badpackages;
-        if (isset($badpackages[$memyselfandI])) {
-            if (isset($badpackages[$memyselfandI]['warnings'])) {
-                foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
-                    $dl->log(0, $warning[0]);
-                }
-            }
-
-            if (isset($badpackages[$memyselfandI]['errors'])) {
-                foreach ($badpackages[$memyselfandI]['errors'] as $error) {
-                    if (is_array($error)) {
-                        $dl->log(0, $error[0]);
-                    } else {
-                        $dl->log(0, $error->getMessage());
-                    }
-                }
-
-                if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
-                    return $this->warning(
-                        'warning: %s should not be uninstalled, other installed packages depend ' .
-                        'on this package');
-                }
-
-                return $this->raiseError(
-                    '%s cannot be uninstalled, other installed packages depend on this package');
-            }
-        }
-
-        return true;
-    }
-
-    function _validatePackageUninstall($dep, $required, $dl)
-    {
-        $depname = $this->_registry->parsedPackageNameToString($dep, true);
-        $version = $this->_registry->packageinfo($dep['package'], 'version', $dep['channel']);
-        if (!$version) {
-            return true;
-        }
-
-        $extra = $this->_getExtraString($dep);
-        if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
-            $dep['exclude'] = array($dep['exclude']);
-        }
-
-        if (isset($dep['conflicts'])) {
-            return true; // uninstall OK - these packages conflict (probably installed with --force)
-        }
-
-        if (!isset($dep['min']) && !isset($dep['max'])) {
-            if (!$required) {
-                return $this->warning('"' . $depname . '" can be optionally used by ' .
-                        'installed package %s' . $extra);
-            }
-
-            if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-                return $this->raiseError('"' . $depname . '" is required by ' .
-                    'installed package %s' . $extra);
-            }
-
-            return $this->warning('warning: "' . $depname . '" is required by ' .
-                'installed package %s' . $extra);
-        }
-
-        $fail = false;
-        if (isset($dep['min']) && version_compare($version, $dep['min'], '>=')) {
-            $fail = true;
-        }
-
-        if (isset($dep['max']) && version_compare($version, $dep['max'], '<=')) {
-            $fail = true;
-        }
-
-        // we re-use this variable, preserve the original value
-        $saverequired = $required;
-        if (!$required) {
-            return $this->warning($depname . $extra . ' can be optionally used by installed package' .
-                    ' "%s"');
-        }
-
-        if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
-            return $this->raiseError($depname . $extra . ' is required by installed package' .
-                ' "%s"');
-        }
-
-        return $this->raiseError('warning: ' . $depname . $extra .
-            ' is required by installed package "%s"');
-    }
-
-    /**
-     * validate a downloaded package against installed packages
-     *
-     * As of PEAR 1.4.3, this will only validate
-     *
-     * @param array|PEAR_Downloader_Package|PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     *              $pkg package identifier (either
-     *                   array('package' => blah, 'channel' => blah) or an array with
-     *                   index 'info' referencing an object)
-     * @param PEAR_Downloader $dl
-     * @param array $params full list of packages to install
-     * @return true|PEAR_Error
-     */
-    function validatePackage($pkg, &$dl, $params = array())
-    {
-        if (is_array($pkg) && isset($pkg['info'])) {
-            $deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']);
-        } else {
-            $deps = $this->_dependencydb->getDependentPackageDependencies($pkg);
-        }
-
-        $fail = false;
-        if ($deps) {
-            if (!class_exists('PEAR_Downloader_Package')) {
-                require_once 'PEAR/Downloader/Package.php';
-            }
-
-            $dp = &new PEAR_Downloader_Package($dl);
-            if (is_object($pkg)) {
-                $dp->setPackageFile($pkg);
-            } else {
-                $dp->setDownloadURL($pkg);
-            }
-
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            foreach ($deps as $channel => $info) {
-                foreach ($info as $package => $ds) {
-                    foreach ($params as $packd) {
-                        if (strtolower($packd->getPackage()) == strtolower($package) &&
-                              $packd->getChannel() == $channel) {
-                            $dl->log(3, 'skipping installed package check of "' .
-                                        $this->_registry->parsedPackageNameToString(
-                                            array('channel' => $channel, 'package' => $package),
-                                            true) .
-                                        '", version "' . $packd->getVersion() . '" will be ' .
-                                        'downloaded and installed');
-                            continue 2; // jump to next package
-                        }
-                    }
-
-                    foreach ($ds as $d) {
-                        $checker = &new PEAR_Dependency2($this->_config, $this->_options,
-                            array('channel' => $channel, 'package' => $package), $this->_state);
-                        $dep = $d['dep'];
-                        $required = $d['type'] == 'required';
-                        $ret = $checker->_validatePackageDownload($dep, $required, array(&$dp));
-                        if (is_array($ret)) {
-                            $dl->log(0, $ret[0]);
-                        } elseif (PEAR::isError($ret)) {
-                            $dl->log(0, $ret->getMessage());
-                            $fail = true;
-                        }
-                    }
-                }
-            }
-            PEAR::popErrorHandling();
-        }
-
-        if ($fail) {
-            return $this->raiseError(
-                '%s cannot be installed, conflicts with installed packages');
-        }
-
-        return true;
-    }
-
-    /**
-     * validate a package.xml 1.0 dependency
-     */
-    function validateDependency1($dep, $params = array())
-    {
-        if (!isset($dep['optional'])) {
-            $dep['optional'] = 'no';
-        }
-
-        list($newdep, $type) = $this->normalizeDep($dep);
-        if (!$newdep) {
-            return $this->raiseError("Invalid Dependency");
-        }
-
-        if (method_exists($this, "validate{$type}Dependency")) {
-            return $this->{"validate{$type}Dependency"}($newdep, $dep['optional'] == 'no',
-                $params, true);
-        }
-    }
-
-    /**
-     * Convert a 1.0 dep into a 2.0 dep
-     */
-    function normalizeDep($dep)
-    {
-        $types = array(
-            'pkg' => 'Package',
-            'ext' => 'Extension',
-            'os' => 'Os',
-            'php' => 'Php'
-        );
-
-        if (!isset($types[$dep['type']])) {
-            return array(false, false);
-        }
-
-        $type = $types[$dep['type']];
-
-        $newdep = array();
-        switch ($type) {
-            case 'Package' :
-                $newdep['channel'] = 'pear.php.net';
-            case 'Extension' :
-            case 'Os' :
-                $newdep['name'] = $dep['name'];
-            break;
-        }
-
-        $dep['rel'] = PEAR_Dependency2::signOperator($dep['rel']);
-        switch ($dep['rel']) {
-            case 'has' :
-                return array($newdep, $type);
-            break;
-            case 'not' :
-                $newdep['conflicts'] = true;
-            break;
-            case '>=' :
-            case '>' :
-                $newdep['min'] = $dep['version'];
-                if ($dep['rel'] == '>') {
-                    $newdep['exclude'] = $dep['version'];
-                }
-            break;
-            case '<=' :
-            case '<' :
-                $newdep['max'] = $dep['version'];
-                if ($dep['rel'] == '<') {
-                    $newdep['exclude'] = $dep['version'];
-                }
-            break;
-            case 'ne' :
-            case '!=' :
-                $newdep['min'] = '0';
-                $newdep['max'] = '100000';
-                $newdep['exclude'] = $dep['version'];
-            break;
-            case '==' :
-                $newdep['min'] = $dep['version'];
-                $newdep['max'] = $dep['version'];
-            break;
-        }
-        if ($type == 'Php') {
-            if (!isset($newdep['min'])) {
-                $newdep['min'] = '4.4.0';
-            }
-
-            if (!isset($newdep['max'])) {
-                $newdep['max'] = '6.0.0';
-            }
-        }
-        return array($newdep, $type);
-    }
-
-    /**
-     * Converts text comparing operators to them sign equivalents
-     *
-     * Example: 'ge' to '>='
-     *
-     * @access public
-     * @param  string Operator
-     * @return string Sign equivalent
-     */
-    function signOperator($operator)
-    {
-        switch($operator) {
-            case 'lt': return '<';
-            case 'le': return '<=';
-            case 'gt': return '>';
-            case 'ge': return '>=';
-            case 'eq': return '==';
-            case 'ne': return '!=';
-            default:
-                return $operator;
-        }
-    }
-
-    function raiseError($msg)
-    {
-        if (isset($this->_options['ignore-errors'])) {
-            return $this->warning($msg);
-        }
-
-        return PEAR::raiseError(sprintf($msg, $this->_registry->parsedPackageNameToString(
-            $this->_currentPackage, true)));
-    }
-
-    function warning($msg)
-    {
-        return array(sprintf($msg, $this->_registry->parsedPackageNameToString(
-            $this->_currentPackage, true)));
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/DependencyDB.php b/lib/php/PEAR/DependencyDB.php
deleted file mode 100644
index 4e2de4c6a30242f744a5057255e7d137a9f515fa..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/DependencyDB.php
+++ /dev/null
@@ -1,769 +0,0 @@
-<?php
-/**
- * PEAR_DependencyDB, advanced installed packages dependency database
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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: DependencyDB.php 286686 2009-08-02 17:38:57Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-$GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array();
-/**
- * Track dependency relationships between installed packages
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Tomas V.V.Cox <cox@idec.net.com>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_DependencyDB
-{
-    // {{{ properties
-
-    /**
-     * This is initialized by {@link setConfig()}
-     * @var PEAR_Config
-     * @access private
-     */
-    var $_config;
-    /**
-     * This is initialized by {@link setConfig()}
-     * @var PEAR_Registry
-     * @access private
-     */
-    var $_registry;
-    /**
-     * Filename of the dependency DB (usually .depdb)
-     * @var string
-     * @access private
-     */
-    var $_depdb = false;
-    /**
-     * File name of the lockfile (usually .depdblock)
-     * @var string
-     * @access private
-     */
-    var $_lockfile = false;
-    /**
-     * Open file resource for locking the lockfile
-     * @var resource|false
-     * @access private
-     */
-    var $_lockFp = false;
-    /**
-     * API version of this class, used to validate a file on-disk
-     * @var string
-     * @access private
-     */
-    var $_version = '1.0';
-    /**
-     * Cached dependency database file
-     * @var array|null
-     * @access private
-     */
-    var $_cache;
-
-    // }}}
-    // {{{ & singleton()
-
-    /**
-     * Get a raw dependency database.  Calls setConfig() and assertDepsDB()
-     * @param PEAR_Config
-     * @param string|false full path to the dependency database, or false to use default
-     * @return PEAR_DependencyDB|PEAR_Error
-     * @static
-     */
-    function &singleton(&$config, $depdb = false)
-    {
-        $phpdir = $config->get('php_dir', null, 'pear.php.net');
-        if (!isset($GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir])) {
-            $a = new PEAR_DependencyDB;
-            $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir] = &$a;
-            $a->setConfig($config, $depdb);
-            $e = $a->assertDepsDB();
-            if (PEAR::isError($e)) {
-                return $e;
-            }
-        }
-
-        return $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir];
-    }
-
-    /**
-     * Set up the registry/location of dependency DB
-     * @param PEAR_Config|false
-     * @param string|false full path to the dependency database, or false to use default
-     */
-    function setConfig(&$config, $depdb = false)
-    {
-        if (!$config) {
-            $this->_config = &PEAR_Config::singleton();
-        } else {
-            $this->_config = &$config;
-        }
-
-        $this->_registry = &$this->_config->getRegistry();
-        if (!$depdb) {
-            $this->_depdb = $this->_config->get('php_dir', null, 'pear.php.net') .
-                DIRECTORY_SEPARATOR . '.depdb';
-        } else {
-            $this->_depdb = $depdb;
-        }
-
-        $this->_lockfile = dirname($this->_depdb) . DIRECTORY_SEPARATOR . '.depdblock';
-    }
-    // }}}
-
-    function hasWriteAccess()
-    {
-        if (!file_exists($this->_depdb)) {
-            $dir = $this->_depdb;
-            while ($dir && $dir != '.') {
-                $dir = dirname($dir); // cd ..
-                if ($dir != '.' && file_exists($dir)) {
-                    if (is_writeable($dir)) {
-                        return true;
-                    }
-
-                    return false;
-                }
-            }
-
-            return false;
-        }
-
-        return is_writeable($this->_depdb);
-    }
-
-    // {{{ assertDepsDB()
-
-    /**
-     * Create the dependency database, if it doesn't exist.  Error if the database is
-     * newer than the code reading it.
-     * @return void|PEAR_Error
-     */
-    function assertDepsDB()
-    {
-        if (!is_file($this->_depdb)) {
-            $this->rebuildDB();
-            return;
-        }
-
-        $depdb = $this->_getDepDB();
-        // Datatype format has been changed, rebuild the Deps DB
-        if ($depdb['_version'] < $this->_version) {
-            $this->rebuildDB();
-        }
-
-        if ($depdb['_version']{0} > $this->_version{0}) {
-            return PEAR::raiseError('Dependency database is version ' .
-                $depdb['_version'] . ', and we are version ' .
-                $this->_version . ', cannot continue');
-        }
-    }
-
-    /**
-     * Get a list of installed packages that depend on this package
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
-     * @return array|false
-     */
-    function getDependentPackages(&$pkg)
-    {
-        $data = $this->_getDepDB();
-        if (is_object($pkg)) {
-            $channel = strtolower($pkg->getChannel());
-            $package = strtolower($pkg->getPackage());
-        } else {
-            $channel = strtolower($pkg['channel']);
-            $package = strtolower($pkg['package']);
-        }
-
-        if (isset($data['packages'][$channel][$package])) {
-            return $data['packages'][$channel][$package];
-        }
-
-        return false;
-    }
-
-    /**
-     * Get a list of the actual dependencies of installed packages that depend on
-     * a package.
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
-     * @return array|false
-     */
-    function getDependentPackageDependencies(&$pkg)
-    {
-        $data = $this->_getDepDB();
-        if (is_object($pkg)) {
-            $channel = strtolower($pkg->getChannel());
-            $package = strtolower($pkg->getPackage());
-        } else {
-            $channel = strtolower($pkg['channel']);
-            $package = strtolower($pkg['package']);
-        }
-
-        $depend = $this->getDependentPackages($pkg);
-        if (!$depend) {
-            return false;
-        }
-
-        $dependencies = array();
-        foreach ($depend as $info) {
-            $temp = $this->getDependencies($info);
-            foreach ($temp as $dep) {
-                if (
-                    isset($dep['dep'], $dep['dep']['channel'], $dep['dep']['name']) &&
-                    strtolower($dep['dep']['channel']) == $channel &&
-                    strtolower($dep['dep']['name']) == $package
-                ) {
-                    if (!isset($dependencies[$info['channel']])) {
-                        $dependencies[$info['channel']] = array();
-                    }
-
-                    if (!isset($dependencies[$info['channel']][$info['package']])) {
-                        $dependencies[$info['channel']][$info['package']] = array();
-                    }
-                    $dependencies[$info['channel']][$info['package']][] = $dep;
-                }
-            }
-        }
-
-        return $dependencies;
-    }
-
-    /**
-     * Get a list of dependencies of this installed package
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
-     * @return array|false
-     */
-    function getDependencies(&$pkg)
-    {
-        if (is_object($pkg)) {
-            $channel = strtolower($pkg->getChannel());
-            $package = strtolower($pkg->getPackage());
-        } else {
-            $channel = strtolower($pkg['channel']);
-            $package = strtolower($pkg['package']);
-        }
-
-        $data = $this->_getDepDB();
-        if (isset($data['dependencies'][$channel][$package])) {
-            return $data['dependencies'][$channel][$package];
-        }
-
-        return false;
-    }
-
-    /**
-     * Determine whether $parent depends on $child, near or deep
-     * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2
-     * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2
-     */
-    function dependsOn($parent, $child)
-    {
-        $c = array();
-        $this->_getDepDB();
-        return $this->_dependsOn($parent, $child, $c);
-    }
-
-    function _dependsOn($parent, $child, &$checked)
-    {
-        if (is_object($parent)) {
-            $channel = strtolower($parent->getChannel());
-            $package = strtolower($parent->getPackage());
-        } else {
-            $channel = strtolower($parent['channel']);
-            $package = strtolower($parent['package']);
-        }
-
-        if (is_object($child)) {
-            $depchannel = strtolower($child->getChannel());
-            $deppackage = strtolower($child->getPackage());
-        } else {
-            $depchannel = strtolower($child['channel']);
-            $deppackage = strtolower($child['package']);
-        }
-
-        if (isset($checked[$channel][$package][$depchannel][$deppackage])) {
-            return false; // avoid endless recursion
-        }
-
-        $checked[$channel][$package][$depchannel][$deppackage] = true;
-        if (!isset($this->_cache['dependencies'][$channel][$package])) {
-            return false;
-        }
-
-        foreach ($this->_cache['dependencies'][$channel][$package] as $info) {
-            if (isset($info['dep']['uri'])) {
-                if (is_object($child)) {
-                    if ($info['dep']['uri'] == $child->getURI()) {
-                        return true;
-                    }
-                } elseif (isset($child['uri'])) {
-                    if ($info['dep']['uri'] == $child['uri']) {
-                        return true;
-                    }
-                }
-                return false;
-            }
-
-            if (strtolower($info['dep']['channel']) == $depchannel &&
-                  strtolower($info['dep']['name']) == $deppackage) {
-                return true;
-            }
-        }
-
-        foreach ($this->_cache['dependencies'][$channel][$package] as $info) {
-            if (isset($info['dep']['uri'])) {
-                if ($this->_dependsOn(array(
-                        'uri' => $info['dep']['uri'],
-                        'package' => $info['dep']['name']), $child, $checked)) {
-                    return true;
-                }
-            } else {
-                if ($this->_dependsOn(array(
-                        'channel' => $info['dep']['channel'],
-                        'package' => $info['dep']['name']), $child, $checked)) {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Register dependencies of a package that is being installed or upgraded
-     * @param PEAR_PackageFile_v2|PEAR_PackageFile_v2
-     */
-    function installPackage(&$package)
-    {
-        $data = $this->_getDepDB();
-        unset($this->_cache);
-        $this->_setPackageDeps($data, $package);
-        $this->_writeDepDB($data);
-    }
-
-    /**
-     * Remove dependencies of a package that is being uninstalled, or upgraded.
-     *
-     * Upgraded packages first uninstall, then install
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array If an array, then it must have
-     *        indices 'channel' and 'package'
-     */
-    function uninstallPackage(&$pkg)
-    {
-        $data = $this->_getDepDB();
-        unset($this->_cache);
-        if (is_object($pkg)) {
-            $channel = strtolower($pkg->getChannel());
-            $package = strtolower($pkg->getPackage());
-        } else {
-            $channel = strtolower($pkg['channel']);
-            $package = strtolower($pkg['package']);
-        }
-
-        if (!isset($data['dependencies'][$channel][$package])) {
-            return true;
-        }
-
-        foreach ($data['dependencies'][$channel][$package] as $dep) {
-            $found      = false;
-            $depchannel = isset($dep['dep']['uri']) ? '__uri' : strtolower($dep['dep']['channel']);
-            $depname    = strtolower($dep['dep']['name']);
-            if (isset($data['packages'][$depchannel][$depname])) {
-                foreach ($data['packages'][$depchannel][$depname] as $i => $info) {
-                    if ($info['channel'] == $channel && $info['package'] == $package) {
-                        $found = true;
-                        break;
-                    }
-                }
-            }
-
-            if ($found) {
-                unset($data['packages'][$depchannel][$depname][$i]);
-                if (!count($data['packages'][$depchannel][$depname])) {
-                    unset($data['packages'][$depchannel][$depname]);
-                    if (!count($data['packages'][$depchannel])) {
-                        unset($data['packages'][$depchannel]);
-                    }
-                } else {
-                    $data['packages'][$depchannel][$depname] =
-                        array_values($data['packages'][$depchannel][$depname]);
-                }
-            }
-        }
-
-        unset($data['dependencies'][$channel][$package]);
-        if (!count($data['dependencies'][$channel])) {
-            unset($data['dependencies'][$channel]);
-        }
-
-        if (!count($data['dependencies'])) {
-            unset($data['dependencies']);
-        }
-
-        if (!count($data['packages'])) {
-            unset($data['packages']);
-        }
-
-        $this->_writeDepDB($data);
-    }
-
-    /**
-     * Rebuild the dependency DB by reading registry entries.
-     * @return true|PEAR_Error
-     */
-    function rebuildDB()
-    {
-        $depdb = array('_version' => $this->_version);
-        if (!$this->hasWriteAccess()) {
-            // allow startup for read-only with older Registry
-            return $depdb;
-        }
-
-        $packages = $this->_registry->listAllPackages();
-        if (PEAR::isError($packages)) {
-            return $packages;
-        }
-
-        foreach ($packages as $channel => $ps) {
-            foreach ($ps as $package) {
-                $package = $this->_registry->getPackage($package, $channel);
-                if (PEAR::isError($package)) {
-                    return $package;
-                }
-                $this->_setPackageDeps($depdb, $package);
-            }
-        }
-
-        $error = $this->_writeDepDB($depdb);
-        if (PEAR::isError($error)) {
-            return $error;
-        }
-
-        $this->_cache = $depdb;
-        return true;
-    }
-
-    /**
-     * Register usage of the dependency DB to prevent race conditions
-     * @param int one of the LOCK_* constants
-     * @return true|PEAR_Error
-     * @access private
-     */
-    function _lock($mode = LOCK_EX)
-    {
-        if (stristr(php_uname(), 'Windows 9')) {
-            return true;
-        }
-
-        if ($mode != LOCK_UN && is_resource($this->_lockFp)) {
-            // XXX does not check type of lock (LOCK_SH/LOCK_EX)
-            return true;
-        }
-
-        $open_mode = 'w';
-        // XXX People reported problems with LOCK_SH and 'w'
-        if ($mode === LOCK_SH) {
-            if (!file_exists($this->_lockfile)) {
-                touch($this->_lockfile);
-            } elseif (!is_file($this->_lockfile)) {
-                return PEAR::raiseError('could not create Dependency lock file, ' .
-                    'it exists and is not a regular file');
-            }
-            $open_mode = 'r';
-        }
-
-        if (!is_resource($this->_lockFp)) {
-            $this->_lockFp = @fopen($this->_lockfile, $open_mode);
-        }
-
-        if (!is_resource($this->_lockFp)) {
-            return PEAR::raiseError("could not create Dependency lock file" .
-                                     (isset($php_errormsg) ? ": " . $php_errormsg : ""));
-        }
-
-        if (!(int)flock($this->_lockFp, $mode)) {
-            switch ($mode) {
-                case LOCK_SH: $str = 'shared';    break;
-                case LOCK_EX: $str = 'exclusive'; break;
-                case LOCK_UN: $str = 'unlock';    break;
-                default:      $str = 'unknown';   break;
-            }
-
-            return PEAR::raiseError("could not acquire $str lock ($this->_lockfile)");
-        }
-
-        return true;
-    }
-
-    /**
-     * Release usage of dependency DB
-     * @return true|PEAR_Error
-     * @access private
-     */
-    function _unlock()
-    {
-        $ret = $this->_lock(LOCK_UN);
-        if (is_resource($this->_lockFp)) {
-            fclose($this->_lockFp);
-        }
-        $this->_lockFp = null;
-        return $ret;
-    }
-
-    /**
-     * Load the dependency database from disk, or return the cache
-     * @return array|PEAR_Error
-     */
-    function _getDepDB()
-    {
-        if (!$this->hasWriteAccess()) {
-            return array('_version' => $this->_version);
-        }
-
-        if (isset($this->_cache)) {
-            return $this->_cache;
-        }
-
-        if (!$fp = fopen($this->_depdb, 'r')) {
-            $err = PEAR::raiseError("Could not open dependencies file `".$this->_depdb."'");
-            return $err;
-        }
-
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        clearstatcache();
-        fclose($fp);
-        $data = unserialize(file_get_contents($this->_depdb));
-        set_magic_quotes_runtime($rt);
-        $this->_cache = $data;
-        return $data;
-    }
-
-    /**
-     * Write out the dependency database to disk
-     * @param array the database
-     * @return true|PEAR_Error
-     * @access private
-     */
-    function _writeDepDB(&$deps)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-
-        if (!$fp = fopen($this->_depdb, 'wb')) {
-            $this->_unlock();
-            return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing");
-        }
-
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        fwrite($fp, serialize($deps));
-        set_magic_quotes_runtime($rt);
-        fclose($fp);
-        $this->_unlock();
-        $this->_cache = $deps;
-        return true;
-    }
-
-    /**
-     * Register all dependencies from a package in the dependencies database, in essence
-     * "installing" the package's dependency information
-     * @param array the database
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @access private
-     */
-    function _setPackageDeps(&$data, &$pkg)
-    {
-        $pkg->setConfig($this->_config);
-        if ($pkg->getPackagexmlVersion() == '1.0') {
-            $gen = &$pkg->getDefaultGenerator();
-            $deps = $gen->dependenciesToV2();
-        } else {
-            $deps = $pkg->getDeps(true);
-        }
-
-        if (!$deps) {
-            return;
-        }
-
-        if (!is_array($data)) {
-            $data = array();
-        }
-
-        if (!isset($data['dependencies'])) {
-            $data['dependencies'] = array();
-        }
-
-        $channel = strtolower($pkg->getChannel());
-        $package = strtolower($pkg->getPackage());
-
-        if (!isset($data['dependencies'][$channel])) {
-            $data['dependencies'][$channel] = array();
-        }
-
-        $data['dependencies'][$channel][$package] = array();
-        if (isset($deps['required']['package'])) {
-            if (!isset($deps['required']['package'][0])) {
-                $deps['required']['package'] = array($deps['required']['package']);
-            }
-
-            foreach ($deps['required']['package'] as $dep) {
-                $this->_registerDep($data, $pkg, $dep, 'required');
-            }
-        }
-
-        if (isset($deps['optional']['package'])) {
-            if (!isset($deps['optional']['package'][0])) {
-                $deps['optional']['package'] = array($deps['optional']['package']);
-            }
-
-            foreach ($deps['optional']['package'] as $dep) {
-                $this->_registerDep($data, $pkg, $dep, 'optional');
-            }
-        }
-
-        if (isset($deps['required']['subpackage'])) {
-            if (!isset($deps['required']['subpackage'][0])) {
-                $deps['required']['subpackage'] = array($deps['required']['subpackage']);
-            }
-
-            foreach ($deps['required']['subpackage'] as $dep) {
-                $this->_registerDep($data, $pkg, $dep, 'required');
-            }
-        }
-
-        if (isset($deps['optional']['subpackage'])) {
-            if (!isset($deps['optional']['subpackage'][0])) {
-                $deps['optional']['subpackage'] = array($deps['optional']['subpackage']);
-            }
-
-            foreach ($deps['optional']['subpackage'] as $dep) {
-                $this->_registerDep($data, $pkg, $dep, 'optional');
-            }
-        }
-
-        if (isset($deps['group'])) {
-            if (!isset($deps['group'][0])) {
-                $deps['group'] = array($deps['group']);
-            }
-
-            foreach ($deps['group'] as $group) {
-                if (isset($group['package'])) {
-                    if (!isset($group['package'][0])) {
-                        $group['package'] = array($group['package']);
-                    }
-
-                    foreach ($group['package'] as $dep) {
-                        $this->_registerDep($data, $pkg, $dep, 'optional',
-                            $group['attribs']['name']);
-                    }
-                }
-
-                if (isset($group['subpackage'])) {
-                    if (!isset($group['subpackage'][0])) {
-                        $group['subpackage'] = array($group['subpackage']);
-                    }
-
-                    foreach ($group['subpackage'] as $dep) {
-                        $this->_registerDep($data, $pkg, $dep, 'optional',
-                            $group['attribs']['name']);
-                    }
-                }
-            }
-        }
-
-        if ($data['dependencies'][$channel][$package] == array()) {
-            unset($data['dependencies'][$channel][$package]);
-            if (!count($data['dependencies'][$channel])) {
-                unset($data['dependencies'][$channel]);
-            }
-        }
-    }
-
-    /**
-     * @param array the database
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param array the specific dependency
-     * @param required|optional whether this is a required or an optional dep
-     * @param string|false dependency group this dependency is from, or false for ordinary dep
-     */
-    function _registerDep(&$data, &$pkg, $dep, $type, $group = false)
-    {
-        $info = array(
-            'dep'   => $dep,
-            'type'  => $type,
-            'group' => $group
-        );
-
-        $dep  = array_map('strtolower', $dep);
-        $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
-        if (!isset($data['dependencies'])) {
-            $data['dependencies'] = array();
-        }
-
-        $channel = strtolower($pkg->getChannel());
-        $package = strtolower($pkg->getPackage());
-
-        if (!isset($data['dependencies'][$channel])) {
-            $data['dependencies'][$channel] = array();
-        }
-
-        if (!isset($data['dependencies'][$channel][$package])) {
-            $data['dependencies'][$channel][$package] = array();
-        }
-
-        $data['dependencies'][$channel][$package][] = $info;
-        if (isset($data['packages'][$depchannel][$dep['name']])) {
-            $found = false;
-            foreach ($data['packages'][$depchannel][$dep['name']] as $i => $p) {
-                if ($p['channel'] == $channel && $p['package'] == $package) {
-                    $found = true;
-                    break;
-                }
-            }
-        } else {
-            if (!isset($data['packages'])) {
-                $data['packages'] = array();
-            }
-
-            if (!isset($data['packages'][$depchannel])) {
-                $data['packages'][$depchannel] = array();
-            }
-
-            if (!isset($data['packages'][$depchannel][$dep['name']])) {
-                $data['packages'][$depchannel][$dep['name']] = array();
-            }
-
-            $found = false;
-        }
-
-        if (!$found) {
-            $data['packages'][$depchannel][$dep['name']][] = array(
-                'channel' => $channel,
-                'package' => $package
-            );
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Downloader.php b/lib/php/PEAR/Downloader.php
deleted file mode 100644
index 71df797beae682a3f2a7ea2222af44fe1e036456..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Downloader.php
+++ /dev/null
@@ -1,1762 +0,0 @@
-<?php
-/**
- * PEAR_Downloader, the PEAR Installer's download utility class
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @author     Martin Jansen <mj@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Downloader.php 287109 2009-08-11 18:50:30Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.3.0
- */
-
-/**
- * Needed for constants, extending
- */
-require_once 'PEAR/Common.php';
-
-define('PEAR_INSTALLER_OK',       1);
-define('PEAR_INSTALLER_FAILED',   0);
-define('PEAR_INSTALLER_SKIPPED', -1);
-define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2);
-
-/**
- * Administration class used to download anything from the internet (PEAR Packages,
- * static URLs, xml files)
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @author     Martin Jansen <mj@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.3.0
- */
-class PEAR_Downloader extends PEAR_Common
-{
-    /**
-     * @var PEAR_Registry
-     * @access private
-     */
-    var $_registry;
-
-    /**
-     * Preferred Installation State (snapshot, devel, alpha, beta, stable)
-     * @var string|null
-     * @access private
-     */
-    var $_preferredState;
-
-    /**
-     * Options from command-line passed to Install.
-     *
-     * Recognized options:<br />
-     *  - onlyreqdeps   : install all required dependencies as well
-     *  - alldeps       : install all dependencies, including optional
-     *  - installroot   : base relative path to install files in
-     *  - force         : force a download even if warnings would prevent it
-     *  - nocompress    : download uncompressed tarballs
-     * @see PEAR_Command_Install
-     * @access private
-     * @var array
-     */
-    var $_options;
-
-    /**
-     * Downloaded Packages after a call to download().
-     *
-     * Format of each entry:
-     *
-     * <code>
-     * array('pkg' => 'package_name', 'file' => '/path/to/local/file',
-     *    'info' => array() // parsed package.xml
-     * );
-     * </code>
-     * @access private
-     * @var array
-     */
-    var $_downloadedPackages = array();
-
-    /**
-     * Packages slated for download.
-     *
-     * This is used to prevent downloading a package more than once should it be a dependency
-     * for two packages to be installed.
-     * Format of each entry:
-     *
-     * <pre>
-     * array('package_name1' => parsed package.xml, 'package_name2' => parsed package.xml,
-     * );
-     * </pre>
-     * @access private
-     * @var array
-     */
-    var $_toDownload = array();
-
-    /**
-     * Array of every package installed, with names lower-cased.
-     *
-     * Format:
-     * <code>
-     * array('package1' => 0, 'package2' => 1, );
-     * </code>
-     * @var array
-     */
-    var $_installed = array();
-
-    /**
-     * @var array
-     * @access private
-     */
-    var $_errorStack = array();
-
-    /**
-     * @var boolean
-     * @access private
-     */
-    var $_internalDownload = false;
-
-    /**
-     * Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()}
-     * @var array
-     * @access private
-     */
-    var $_packageSortTree;
-
-    /**
-     * Temporary directory, or configuration value where downloads will occur
-     * @var string
-     */
-    var $_downloadDir;
-
-    /**
-     * @param PEAR_Frontend_*
-     * @param array
-     * @param PEAR_Config
-     */
-    function PEAR_Downloader(&$ui, $options, &$config)
-    {
-        parent::PEAR_Common();
-        $this->_options = $options;
-        $this->config = &$config;
-        $this->_preferredState = $this->config->get('preferred_state');
-        $this->ui = &$ui;
-        if (!$this->_preferredState) {
-            // don't inadvertantly use a non-set preferred_state
-            $this->_preferredState = null;
-        }
-
-        if (isset($this->_options['installroot'])) {
-            $this->config->setInstallRoot($this->_options['installroot']);
-        }
-        $this->_registry = &$config->getRegistry();
-
-        if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) {
-            $this->_installed = $this->_registry->listAllPackages();
-            foreach ($this->_installed as $key => $unused) {
-                if (!count($unused)) {
-                    continue;
-                }
-                $strtolower = create_function('$a','return strtolower($a);');
-                array_walk($this->_installed[$key], $strtolower);
-            }
-        }
-    }
-
-    /**
-     * Attempt to discover a channel's remote capabilities from
-     * its server name
-     * @param string
-     * @return boolean
-     */
-    function discover($channel)
-    {
-        $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
-        if (!class_exists('System')) {
-            require_once 'System.php';
-        }
-
-        $tmp = System::mktemp(array('-d'));
-        $a   = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
-        PEAR::popErrorHandling();
-        if (PEAR::isError($a)) {
-            // Attempt to fallback to https automatically.
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
-            $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
-            PEAR::popErrorHandling();
-            if (PEAR::isError($a)) {
-                return false;
-            }
-        }
-
-        list($a, $lastmodified) = $a;
-        if (!class_exists('PEAR_ChannelFile')) {
-            require_once 'PEAR/ChannelFile.php';
-        }
-
-        $b = new PEAR_ChannelFile;
-        if ($b->fromXmlFile($a)) {
-            unlink($a);
-            if ($this->config->get('auto_discover')) {
-                $this->_registry->addChannel($b, $lastmodified);
-                $alias = $b->getName();
-                if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
-                    $alias = $b->getAlias();
-                }
-
-                $this->log(1, 'Auto-discovered channel "' . $channel .
-                    '", alias "' . $alias . '", adding to registry');
-            }
-
-            return true;
-        }
-
-        unlink($a);
-        return false;
-    }
-
-    /**
-     * For simpler unit-testing
-     * @param PEAR_Downloader
-     * @return PEAR_Downloader_Package
-     */
-    function &newDownloaderPackage(&$t)
-    {
-        if (!class_exists('PEAR_Downloader_Package')) {
-            require_once 'PEAR/Downloader/Package.php';
-        }
-        $a = &new PEAR_Downloader_Package($t);
-        return $a;
-    }
-
-    /**
-     * For simpler unit-testing
-     * @param PEAR_Config
-     * @param array
-     * @param array
-     * @param int
-     */
-    function &getDependency2Object(&$c, $i, $p, $s)
-    {
-        if (!class_exists('PEAR_Dependency2')) {
-            require_once 'PEAR/Dependency2.php';
-        }
-        $z = &new PEAR_Dependency2($c, $i, $p, $s);
-        return $z;
-    }
-
-    function &download($params)
-    {
-        if (!count($params)) {
-            $a = array();
-            return $a;
-        }
-
-        if (!isset($this->_registry)) {
-            $this->_registry = &$this->config->getRegistry();
-        }
-
-        $channelschecked = array();
-        // convert all parameters into PEAR_Downloader_Package objects
-        foreach ($params as $i => $param) {
-            $params[$i] = &$this->newDownloaderPackage($this);
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $err = $params[$i]->initialize($param);
-            PEAR::staticPopErrorHandling();
-            if (!$err) {
-                // skip parameters that were missed by preferred_state
-                continue;
-            }
-
-            if (PEAR::isError($err)) {
-                if (!isset($this->_options['soft']) && $err->getMessage() !== '') {
-                    $this->log(0, $err->getMessage());
-                }
-
-                $params[$i] = false;
-                if (is_object($param)) {
-                    $param = $param->getChannel() . '/' . $param->getPackage();
-                }
-
-                if (!isset($this->_options['soft'])) {
-                    $this->log(2, 'Package "' . $param . '" is not valid');
-                }
-
-                // Message logged above in a specific verbose mode, passing null to not show up on CLI
-                $this->pushError(null, PEAR_INSTALLER_SKIPPED);
-            } else {
-                do {
-                    if ($params[$i] && $params[$i]->getType() == 'local') {
-                        // bug #7090 skip channel.xml check for local packages
-                        break;
-                    }
-
-                    if ($params[$i] && !isset($channelschecked[$params[$i]->getChannel()]) &&
-                          !isset($this->_options['offline'])
-                    ) {
-                        $channelschecked[$params[$i]->getChannel()] = true;
-                        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-                        if (!class_exists('System')) {
-                            require_once 'System.php';
-                        }
-
-                        $curchannel = &$this->_registry->getChannel($params[$i]->getChannel());
-                        if (PEAR::isError($curchannel)) {
-                            PEAR::staticPopErrorHandling();
-                            return $this->raiseError($curchannel);
-                        }
-
-                        if (PEAR::isError($dir = $this->getDownloadDir())) {
-                            PEAR::staticPopErrorHandling();
-                            break;
-                        }
-
-                        $mirror = $this->config->get('preferred_mirror', null, $params[$i]->getChannel());
-                        $url    = 'http://' . $mirror . '/channel.xml';
-                        $a = $this->downloadHttp($url, $this->ui, $dir, null, $curchannel->lastModified());
-
-                        PEAR::staticPopErrorHandling();
-                        if (PEAR::isError($a) || !$a) {
-                            // Attempt fallback to https automatically
-                            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                            $a = $this->downloadHttp('https://' . $mirror .
-                                '/channel.xml', $this->ui, $dir, null, $curchannel->lastModified());
-
-                            PEAR::staticPopErrorHandling();
-                            if (PEAR::isError($a) || !$a) {
-                                break;
-                            }
-                        }
-                        $this->log(0, 'WARNING: channel "' . $params[$i]->getChannel() . '" has ' .
-                            'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $params[$i]->getChannel() .
-                            '" to update');
-                    }
-                } while (false);
-
-                if ($params[$i] && !isset($this->_options['downloadonly'])) {
-                    if (isset($this->_options['packagingroot'])) {
-                        $checkdir = $this->_prependPath(
-                            $this->config->get('php_dir', null, $params[$i]->getChannel()),
-                            $this->_options['packagingroot']);
-                    } else {
-                        $checkdir = $this->config->get('php_dir',
-                            null, $params[$i]->getChannel());
-                    }
-
-                    while ($checkdir && $checkdir != '/' && !file_exists($checkdir)) {
-                        $checkdir = dirname($checkdir);
-                    }
-
-                    if ($checkdir == '.') {
-                        $checkdir = '/';
-                    }
-
-                    if (!is_writeable($checkdir)) {
-                        return PEAR::raiseError('Cannot install, php_dir for channel "' .
-                            $params[$i]->getChannel() . '" is not writeable by the current user');
-                    }
-                }
-            }
-        }
-
-        unset($channelschecked);
-        PEAR_Downloader_Package::removeDuplicates($params);
-        if (!count($params)) {
-            $a = array();
-            return $a;
-        }
-
-        if (!isset($this->_options['nodeps']) && !isset($this->_options['offline'])) {
-            $reverify = true;
-            while ($reverify) {
-                $reverify = false;
-                foreach ($params as $i => $param) {
-                    //PHP Bug 40768 / PEAR Bug #10944
-                    //Nested foreaches fail in PHP 5.2.1
-                    key($params);
-                    $ret = $params[$i]->detectDependencies($params);
-                    if (PEAR::isError($ret)) {
-                        $reverify = true;
-                        $params[$i] = false;
-                        PEAR_Downloader_Package::removeDuplicates($params);
-                        if (!isset($this->_options['soft'])) {
-                            $this->log(0, $ret->getMessage());
-                        }
-                        continue 2;
-                    }
-                }
-            }
-        }
-
-        if (isset($this->_options['offline'])) {
-            $this->log(3, 'Skipping dependency download check, --offline specified');
-        }
-
-        if (!count($params)) {
-            $a = array();
-            return $a;
-        }
-
-        while (PEAR_Downloader_Package::mergeDependencies($params));
-        PEAR_Downloader_Package::removeDuplicates($params, true);
-        $errorparams = array();
-        if (PEAR_Downloader_Package::detectStupidDuplicates($params, $errorparams)) {
-            if (count($errorparams)) {
-                foreach ($errorparams as $param) {
-                    $name = $this->_registry->parsedPackageNameToString($param->getParsedPackage());
-                    $this->pushError('Duplicate package ' . $name . ' found', PEAR_INSTALLER_FAILED);
-                }
-                $a = array();
-                return $a;
-            }
-        }
-
-        PEAR_Downloader_Package::removeInstalled($params);
-        if (!count($params)) {
-            $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
-            $a = array();
-            return $a;
-        }
-
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $err = $this->analyzeDependencies($params);
-        PEAR::popErrorHandling();
-        if (!count($params)) {
-            $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
-            $a = array();
-            return $a;
-        }
-
-        $ret = array();
-        $newparams = array();
-        if (isset($this->_options['pretend'])) {
-            return $params;
-        }
-
-        $somefailed = false;
-        foreach ($params as $i => $package) {
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $pf = &$params[$i]->download();
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($pf)) {
-                if (!isset($this->_options['soft'])) {
-                    $this->log(1, $pf->getMessage());
-                    $this->log(0, 'Error: cannot download "' .
-                        $this->_registry->parsedPackageNameToString($package->getParsedPackage(),
-                            true) .
-                        '"');
-                }
-                $somefailed = true;
-                continue;
-            }
-
-            $newparams[] = &$params[$i];
-            $ret[] = array(
-                'file' => $pf->getArchiveFile(),
-                'info' => &$pf,
-                'pkg'  => $pf->getPackage()
-            );
-        }
-
-        if ($somefailed) {
-            // remove params that did not download successfully
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $err = $this->analyzeDependencies($newparams, true);
-            PEAR::popErrorHandling();
-            if (!count($newparams)) {
-                $this->pushError('Download failed', PEAR_INSTALLER_FAILED);
-                $a = array();
-                return $a;
-            }
-        }
-
-        $this->_downloadedPackages = $ret;
-        return $newparams;
-    }
-
-    /**
-     * @param array all packages to be installed
-     */
-    function analyzeDependencies(&$params, $force = false)
-    {
-        $hasfailed = $failed = false;
-        if (isset($this->_options['downloadonly'])) {
-            return;
-        }
-
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $redo  = true;
-        $reset = false;
-        while ($redo) {
-            $redo = false;
-            foreach ($params as $i => $param) {
-                $deps = $param->getDeps();
-                if (!$deps) {
-                    $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(),
-                        $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
-                    $send = $param->getPackageFile();
-
-                    $installcheck = $depchecker->validatePackage($send, $this, $params);
-                    if (PEAR::isError($installcheck)) {
-                        if (!isset($this->_options['soft'])) {
-                            $this->log(0, $installcheck->getMessage());
-                        }
-                        $hasfailed  = true;
-                        $params[$i] = false;
-                        $reset      = true;
-                        $redo       = true;
-                        $failed     = false;
-                        PEAR_Downloader_Package::removeDuplicates($params);
-                        continue 2;
-                    }
-                    continue;
-                }
-
-                if (!$reset && $param->alreadyValidated() && !$force) {
-                    continue;
-                }
-
-                if (count($deps)) {
-                    $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(),
-                        $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
-                    $send = $param->getPackageFile();
-                    if ($send === null) {
-                        $send = $param->getDownloadURL();
-                    }
-
-                    $installcheck = $depchecker->validatePackage($send, $this, $params);
-                    if (PEAR::isError($installcheck)) {
-                        if (!isset($this->_options['soft'])) {
-                            $this->log(0, $installcheck->getMessage());
-                        }
-                        $hasfailed  = true;
-                        $params[$i] = false;
-                        $reset      = true;
-                        $redo       = true;
-                        $failed     = false;
-                        PEAR_Downloader_Package::removeDuplicates($params);
-                        continue 2;
-                    }
-
-                    $failed = false;
-                    if (isset($deps['required'])) {
-                        foreach ($deps['required'] as $type => $dep) {
-                            // note: Dependency2 will never return a PEAR_Error if ignore-errors
-                            // is specified, so soft is needed to turn off logging
-                            if (!isset($dep[0])) {
-                                if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep,
-                                      true, $params))) {
-                                    $failed = true;
-                                    if (!isset($this->_options['soft'])) {
-                                        $this->log(0, $e->getMessage());
-                                    }
-                                } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                    if (!isset($this->_options['soft'])) {
-                                        $this->log(0, $e[0]);
-                                    }
-                                }
-                            } else {
-                                foreach ($dep as $d) {
-                                    if (PEAR::isError($e =
-                                          $depchecker->{"validate{$type}Dependency"}($d,
-                                          true, $params))) {
-                                        $failed = true;
-                                        if (!isset($this->_options['soft'])) {
-                                            $this->log(0, $e->getMessage());
-                                        }
-                                    } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                        if (!isset($this->_options['soft'])) {
-                                            $this->log(0, $e[0]);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        if (isset($deps['optional'])) {
-                            foreach ($deps['optional'] as $type => $dep) {
-                                if (!isset($dep[0])) {
-                                    if (PEAR::isError($e =
-                                          $depchecker->{"validate{$type}Dependency"}($dep,
-                                          false, $params))) {
-                                        $failed = true;
-                                        if (!isset($this->_options['soft'])) {
-                                            $this->log(0, $e->getMessage());
-                                        }
-                                    } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                        if (!isset($this->_options['soft'])) {
-                                            $this->log(0, $e[0]);
-                                        }
-                                    }
-                                } else {
-                                    foreach ($dep as $d) {
-                                        if (PEAR::isError($e =
-                                              $depchecker->{"validate{$type}Dependency"}($d,
-                                              false, $params))) {
-                                            $failed = true;
-                                            if (!isset($this->_options['soft'])) {
-                                                $this->log(0, $e->getMessage());
-                                            }
-                                        } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                            if (!isset($this->_options['soft'])) {
-                                                $this->log(0, $e[0]);
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        $groupname = $param->getGroup();
-                        if (isset($deps['group']) && $groupname) {
-                            if (!isset($deps['group'][0])) {
-                                $deps['group'] = array($deps['group']);
-                            }
-
-                            $found = false;
-                            foreach ($deps['group'] as $group) {
-                                if ($group['attribs']['name'] == $groupname) {
-                                    $found = true;
-                                    break;
-                                }
-                            }
-
-                            if ($found) {
-                                unset($group['attribs']);
-                                foreach ($group as $type => $dep) {
-                                    if (!isset($dep[0])) {
-                                        if (PEAR::isError($e =
-                                              $depchecker->{"validate{$type}Dependency"}($dep,
-                                              false, $params))) {
-                                            $failed = true;
-                                            if (!isset($this->_options['soft'])) {
-                                                $this->log(0, $e->getMessage());
-                                            }
-                                        } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                            if (!isset($this->_options['soft'])) {
-                                                $this->log(0, $e[0]);
-                                            }
-                                        }
-                                    } else {
-                                        foreach ($dep as $d) {
-                                            if (PEAR::isError($e =
-                                                  $depchecker->{"validate{$type}Dependency"}($d,
-                                                  false, $params))) {
-                                                $failed = true;
-                                                if (!isset($this->_options['soft'])) {
-                                                    $this->log(0, $e->getMessage());
-                                                }
-                                            } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                                if (!isset($this->_options['soft'])) {
-                                                    $this->log(0, $e[0]);
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    } else {
-                        foreach ($deps as $dep) {
-                            if (PEAR::isError($e = $depchecker->validateDependency1($dep, $params))) {
-                                $failed = true;
-                                if (!isset($this->_options['soft'])) {
-                                    $this->log(0, $e->getMessage());
-                                }
-                            } elseif (is_array($e) && !$param->alreadyValidated()) {
-                                if (!isset($this->_options['soft'])) {
-                                    $this->log(0, $e[0]);
-                                }
-                            }
-                        }
-                    }
-                    $params[$i]->setValidated();
-                }
-
-                if ($failed) {
-                    $hasfailed  = true;
-                    $params[$i] = false;
-                    $reset      = true;
-                    $redo       = true;
-                    $failed     = false;
-                    PEAR_Downloader_Package::removeDuplicates($params);
-                    continue 2;
-                }
-            }
-        }
-        PEAR::staticPopErrorHandling();
-        if ($hasfailed && (isset($this->_options['ignore-errors']) ||
-              isset($this->_options['nodeps']))) {
-            // this is probably not needed, but just in case
-            if (!isset($this->_options['soft'])) {
-                $this->log(0, 'WARNING: dependencies failed');
-            }
-        }
-    }
-
-    /**
-     * Retrieve the directory that downloads will happen in
-     * @access private
-     * @return string
-     */
-    function getDownloadDir()
-    {
-        if (isset($this->_downloadDir)) {
-            return $this->_downloadDir;
-        }
-        $downloaddir = $this->config->get('download_dir');
-        if (empty($downloaddir) || (is_dir($downloaddir) && !is_writable($downloaddir))) {
-            if  (is_dir($downloaddir) && !is_writable($downloaddir)) {
-                $this->log(0, 'WARNING: configuration download directory "' . $downloaddir .
-                    '" is not writeable.  Change download_dir config variable to ' .
-                    'a writeable dir to avoid this warning');
-            }
-            if (!class_exists('System')) {
-                require_once 'System.php';
-            }
-            if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
-                return $downloaddir;
-            }
-            $this->log(3, '+ tmp dir created at ' . $downloaddir);
-        }
-        if (!is_writable($downloaddir)) {
-            if (PEAR::isError(System::mkdir(array('-p', $downloaddir))) ||
-                  !is_writable($downloaddir)) {
-                return PEAR::raiseError('download directory "' . $downloaddir .
-                    '" is not writeable.  Change download_dir config variable to ' .
-                    'a writeable dir');
-            }
-        }
-        return $this->_downloadDir = $downloaddir;
-    }
-
-    function setDownloadDir($dir)
-    {
-        if (!@is_writable($dir)) {
-            if (PEAR::isError(System::mkdir(array('-p', $dir)))) {
-                return PEAR::raiseError('download directory "' . $dir .
-                    '" is not writeable.  Change download_dir config variable to ' .
-                    'a writeable dir');
-            }
-        }
-        $this->_downloadDir = $dir;
-    }
-
-    function configSet($key, $value, $layer = 'user', $channel = false)
-    {
-        $this->config->set($key, $value, $layer, $channel);
-        $this->_preferredState = $this->config->get('preferred_state', null, $channel);
-        if (!$this->_preferredState) {
-            // don't inadvertantly use a non-set preferred_state
-            $this->_preferredState = null;
-        }
-    }
-
-    function setOptions($options)
-    {
-        $this->_options = $options;
-    }
-
-    // }}}
-    // {{{ setOptions()
-    function getOptions()
-    {
-        return $this->_options;
-    }
-
-    /**
-     * For simpler unit-testing
-     * @param PEAR_Config
-     * @param int
-     * @param string
-     */
-    function &getPackagefileObject(&$c, $d, $t = false)
-    {
-        if (!class_exists('PEAR_PackageFile')) {
-            require_once 'PEAR/PackageFile.php';
-        }
-        $a = &new PEAR_PackageFile($c, $d, $t);
-        return $a;
-    }
-
-    /**
-     * @param array output of {@link parsePackageName()}
-     * @access private
-     */
-    function _getPackageDownloadUrl($parr)
-    {
-        $curchannel = $this->config->get('default_channel');
-        $this->configSet('default_channel', $parr['channel']);
-        // getDownloadURL returns an array.  On error, it only contains information
-        // on the latest release as array(version, info).  On success it contains
-        // array(version, info, download url string)
-        $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
-        if (!$this->_registry->channelExists($parr['channel'])) {
-            do {
-                if ($this->config->get('auto_discover') && $this->discover($parr['channel'])) {
-                    break;
-                }
-
-                $this->configSet('default_channel', $curchannel);
-                return PEAR::raiseError('Unknown remote channel: ' . $parr['channel']);
-            } while (false);
-        }
-
-        $chan = &$this->_registry->getChannel($parr['channel']);
-        if (PEAR::isError($chan)) {
-            return $chan;
-        }
-
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $version   = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']);
-        $stability = $this->_registry->packageInfo($parr['package'], 'stability', $parr['channel']);
-        // package is installed - use the installed release stability level
-        if (!isset($parr['state']) && $stability !== null) {
-            $state = $stability['release'];
-        }
-        PEAR::staticPopErrorHandling();
-        $base2 = false;
-
-        $preferred_mirror = $this->config->get('preferred_mirror');
-        if (!$chan->supportsREST($preferred_mirror) ||
-              (
-               !($base2 = $chan->getBaseURL('REST1.3', $preferred_mirror))
-               &&
-               !($base = $chan->getBaseURL('REST1.0', $preferred_mirror))
-              )
-        ) {
-            return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.');
-        }
-
-        if ($base2) {
-            $rest = &$this->config->getREST('1.3', $this->_options);
-            $base = $base2;
-        } else {
-            $rest = &$this->config->getREST('1.0', $this->_options);
-        }
-
-        $downloadVersion = false;
-        if (!isset($parr['version']) && !isset($parr['state']) && $version
-              && !PEAR::isError($version)
-              && !isset($this->_options['downloadonly'])
-        ) {
-            $downloadVersion = $version;
-        }
-
-        $url = $rest->getDownloadURL($base, $parr, $state, $downloadVersion, $chan->getName());
-        if (PEAR::isError($url)) {
-            $this->configSet('default_channel', $curchannel);
-            return $url;
-        }
-
-        if ($parr['channel'] != $curchannel) {
-            $this->configSet('default_channel', $curchannel);
-        }
-
-        if (!is_array($url)) {
-            return $url;
-        }
-
-        $url['raw'] = false; // no checking is necessary for REST
-        if (!is_array($url['info'])) {
-            return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' .
-                'this should never happen');
-        }
-
-        if (!isset($this->_options['force']) &&
-              !isset($this->_options['downloadonly']) &&
-              $version &&
-              !PEAR::isError($version) &&
-              !isset($parr['group'])
-        ) {
-            if (version_compare($version, $url['version'], '=')) {
-                return PEAR::raiseError($this->_registry->parsedPackageNameToString(
-                    $parr, true) . ' is already installed and is the same as the ' .
-                    'released version ' . $url['version'], -976);
-            }
-
-            if (version_compare($version, $url['version'], '>')) {
-                return PEAR::raiseError($this->_registry->parsedPackageNameToString(
-                    $parr, true) . ' is already installed and is newer than detected ' .
-                    'released version ' . $url['version'], -976);
-            }
-        }
-
-        if (isset($url['info']['required']) || $url['compatible']) {
-            require_once 'PEAR/PackageFile/v2.php';
-            $pf = new PEAR_PackageFile_v2;
-            $pf->setRawChannel($parr['channel']);
-            if ($url['compatible']) {
-                $pf->setRawCompatible($url['compatible']);
-            }
-        } else {
-            require_once 'PEAR/PackageFile/v1.php';
-            $pf = new PEAR_PackageFile_v1;
-        }
-
-        $pf->setRawPackage($url['package']);
-        $pf->setDeps($url['info']);
-        if ($url['compatible']) {
-            $pf->setCompatible($url['compatible']);
-        }
-
-        $pf->setRawState($url['stability']);
-        $url['info'] = &$pf;
-        if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
-            $ext = '.tar';
-        } else {
-            $ext = '.tgz';
-        }
-
-        if (is_array($url) && isset($url['url'])) {
-            $url['url'] .= $ext;
-        }
-
-        return $url;
-    }
-
-    /**
-     * @param array dependency array
-     * @access private
-     */
-    function _getDepPackageDownloadUrl($dep, $parr)
-    {
-        $xsdversion = isset($dep['rel']) ? '1.0' : '2.0';
-        $curchannel = $this->config->get('default_channel');
-        if (isset($dep['uri'])) {
-            $xsdversion = '2.0';
-            $chan = &$this->_registry->getChannel('__uri');
-            if (PEAR::isError($chan)) {
-                return $chan;
-            }
-
-            $version = $this->_registry->packageInfo($dep['name'], 'version', '__uri');
-            $this->configSet('default_channel', '__uri');
-        } else {
-            if (isset($dep['channel'])) {
-                $remotechannel = $dep['channel'];
-            } else {
-                $remotechannel = 'pear.php.net';
-            }
-
-            if (!$this->_registry->channelExists($remotechannel)) {
-                do {
-                    if ($this->config->get('auto_discover')) {
-                        if ($this->discover($remotechannel)) {
-                            break;
-                        }
-                    }
-                    return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
-                } while (false);
-            }
-
-            $chan = &$this->_registry->getChannel($remotechannel);
-            if (PEAR::isError($chan)) {
-                return $chan;
-            }
-
-            $version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel);
-            $this->configSet('default_channel', $remotechannel);
-        }
-
-        $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
-        if (isset($parr['state']) && isset($parr['version'])) {
-            unset($parr['state']);
-        }
-
-        if (isset($dep['uri'])) {
-            $info = &$this->newDownloaderPackage($this);
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $err = $info->initialize($dep);
-            PEAR::staticPopErrorHandling();
-            if (!$err) {
-                // skip parameters that were missed by preferred_state
-                return PEAR::raiseError('Cannot initialize dependency');
-            }
-
-            if (PEAR::isError($err)) {
-                if (!isset($this->_options['soft'])) {
-                    $this->log(0, $err->getMessage());
-                }
-
-                if (is_object($info)) {
-                    $param = $info->getChannel() . '/' . $info->getPackage();
-                }
-                return PEAR::raiseError('Package "' . $param . '" is not valid');
-            }
-            return $info;
-        } elseif ($chan->supportsREST($this->config->get('preferred_mirror'))
-              && $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))
-        ) {
-            $rest = &$this->config->getREST('1.0', $this->_options);
-            $url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr,
-                    $state, $version, $chan->getName());
-            if (PEAR::isError($url)) {
-                return $url;
-            }
-
-            if ($parr['channel'] != $curchannel) {
-                $this->configSet('default_channel', $curchannel);
-            }
-
-            if (!is_array($url)) {
-                return $url;
-            }
-
-            $url['raw'] = false; // no checking is necessary for REST
-            if (!is_array($url['info'])) {
-                return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' .
-                    'this should never happen');
-            }
-
-            if (isset($url['info']['required'])) {
-                if (!class_exists('PEAR_PackageFile_v2')) {
-                    require_once 'PEAR/PackageFile/v2.php';
-                }
-                $pf = new PEAR_PackageFile_v2;
-                $pf->setRawChannel($remotechannel);
-            } else {
-                if (!class_exists('PEAR_PackageFile_v1')) {
-                    require_once 'PEAR/PackageFile/v1.php';
-                }
-                $pf = new PEAR_PackageFile_v1;
-
-            }
-            $pf->setRawPackage($url['package']);
-            $pf->setDeps($url['info']);
-            if ($url['compatible']) {
-                $pf->setCompatible($url['compatible']);
-            }
-
-            $pf->setRawState($url['stability']);
-            $url['info'] = &$pf;
-            if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
-                $ext = '.tar';
-            } else {
-                $ext = '.tgz';
-            }
-
-            if (is_array($url) && isset($url['url'])) {
-                $url['url'] .= $ext;
-            }
-
-            return $url;
-        }
-
-        return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.');
-    }
-
-    /**
-     * @deprecated in favor of _getPackageDownloadUrl
-     */
-    function getPackageDownloadUrl($package, $version = null, $channel = false)
-    {
-        if ($version) {
-            $package .= "-$version";
-        }
-        if ($this === null || $this->_registry === null) {
-            $package = "http://pear.php.net/get/$package";
-        } else {
-            $chan = $this->_registry->getChannel($channel);
-            if (PEAR::isError($chan)) {
-                return '';
-            }
-            $package = "http://" . $chan->getServer() . "/get/$package";
-        }
-        if (!extension_loaded("zlib")) {
-            $package .= '?uncompress=yes';
-        }
-        return $package;
-    }
-
-    /**
-     * Retrieve a list of downloaded packages after a call to {@link download()}.
-     *
-     * Also resets the list of downloaded packages.
-     * @return array
-     */
-    function getDownloadedPackages()
-    {
-        $ret = $this->_downloadedPackages;
-        $this->_downloadedPackages = array();
-        $this->_toDownload = array();
-        return $ret;
-    }
-
-    function _downloadCallback($msg, $params = null)
-    {
-        switch ($msg) {
-            case 'saveas':
-                $this->log(1, "downloading $params ...");
-                break;
-            case 'done':
-                $this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes');
-                break;
-            case 'bytesread':
-                static $bytes;
-                if (empty($bytes)) {
-                    $bytes = 0;
-                }
-                if (!($bytes % 10240)) {
-                    $this->log(1, '.', false);
-                }
-                $bytes += $params;
-                break;
-            case 'start':
-                if($params[1] == -1) {
-                    $length = "Unknown size";
-                } else {
-                    $length = number_format($params[1], 0, '', ',')." bytes";
-                }
-                $this->log(1, "Starting to download {$params[0]} ($length)");
-                break;
-        }
-        if (method_exists($this->ui, '_downloadCallback'))
-            $this->ui->_downloadCallback($msg, $params);
-    }
-
-    function _prependPath($path, $prepend)
-    {
-        if (strlen($prepend) > 0) {
-            if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
-                if (preg_match('/^[a-z]:/i', $prepend)) {
-                    $prepend = substr($prepend, 2);
-                } elseif ($prepend{0} != '\\') {
-                    $prepend = "\\$prepend";
-                }
-                $path = substr($path, 0, 2) . $prepend . substr($path, 2);
-            } else {
-                $path = $prepend . $path;
-            }
-        }
-        return $path;
-    }
-
-    /**
-     * @param string
-     * @param integer
-     */
-    function pushError($errmsg, $code = -1)
-    {
-        array_push($this->_errorStack, array($errmsg, $code));
-    }
-
-    function getErrorMsgs()
-    {
-        $msgs = array();
-        $errs = $this->_errorStack;
-        foreach ($errs as $err) {
-            $msgs[] = $err[0];
-        }
-        $this->_errorStack = array();
-        return $msgs;
-    }
-
-    /**
-     * for BC
-     *
-     * @deprecated
-     */
-    function sortPkgDeps(&$packages, $uninstall = false)
-    {
-        $uninstall ?
-            $this->sortPackagesForUninstall($packages) :
-            $this->sortPackagesForInstall($packages);
-    }
-
-    /**
-     * Sort a list of arrays of array(downloaded packagefilename) by dependency.
-     *
-     * This uses the topological sort method from graph theory, and the
-     * Structures_Graph package to properly sort dependencies for installation.
-     * @param array an array of downloaded PEAR_Downloader_Packages
-     * @return array array of array(packagefilename, package.xml contents)
-     */
-    function sortPackagesForInstall(&$packages)
-    {
-        require_once 'Structures/Graph.php';
-        require_once 'Structures/Graph/Node.php';
-        require_once 'Structures/Graph/Manipulator/TopologicalSorter.php';
-        $depgraph = new Structures_Graph(true);
-        $nodes = array();
-        $reg = &$this->config->getRegistry();
-        foreach ($packages as $i => $package) {
-            $pname = $reg->parsedPackageNameToString(
-                array(
-                    'channel' => $package->getChannel(),
-                    'package' => strtolower($package->getPackage()),
-                ));
-            $nodes[$pname] = new Structures_Graph_Node;
-            $nodes[$pname]->setData($packages[$i]);
-            $depgraph->addNode($nodes[$pname]);
-        }
-
-        $deplinks = array();
-        foreach ($nodes as $package => $node) {
-            $pf = &$node->getData();
-            $pdeps = $pf->getDeps(true);
-            if (!$pdeps) {
-                continue;
-            }
-
-            if ($pf->getPackagexmlVersion() == '1.0') {
-                foreach ($pdeps as $dep) {
-                    if ($dep['type'] != 'pkg' ||
-                          (isset($dep['optional']) && $dep['optional'] == 'yes')) {
-                        continue;
-                    }
-
-                    $dname = $reg->parsedPackageNameToString(
-                          array(
-                              'channel' => 'pear.php.net',
-                              'package' => strtolower($dep['name']),
-                          ));
-
-                    if (isset($nodes[$dname])) {
-                        if (!isset($deplinks[$dname])) {
-                            $deplinks[$dname] = array();
-                        }
-
-                        $deplinks[$dname][$package] = 1;
-                        // dependency is in installed packages
-                        continue;
-                    }
-
-                    $dname = $reg->parsedPackageNameToString(
-                          array(
-                              'channel' => 'pecl.php.net',
-                              'package' => strtolower($dep['name']),
-                          ));
-
-                    if (isset($nodes[$dname])) {
-                        if (!isset($deplinks[$dname])) {
-                            $deplinks[$dname] = array();
-                        }
-
-                        $deplinks[$dname][$package] = 1;
-                        // dependency is in installed packages
-                        continue;
-                    }
-                }
-            } else {
-                // the only ordering we care about is:
-                // 1) subpackages must be installed before packages that depend on them
-                // 2) required deps must be installed before packages that depend on them
-                if (isset($pdeps['required']['subpackage'])) {
-                    $t = $pdeps['required']['subpackage'];
-                    if (!isset($t[0])) {
-                        $t = array($t);
-                    }
-
-                    $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
-                }
-
-                if (isset($pdeps['group'])) {
-                    if (!isset($pdeps['group'][0])) {
-                        $pdeps['group'] = array($pdeps['group']);
-                    }
-
-                    foreach ($pdeps['group'] as $group) {
-                        if (isset($group['subpackage'])) {
-                            $t = $group['subpackage'];
-                            if (!isset($t[0])) {
-                                $t = array($t);
-                            }
-
-                            $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
-                        }
-                    }
-                }
-
-                if (isset($pdeps['optional']['subpackage'])) {
-                    $t = $pdeps['optional']['subpackage'];
-                    if (!isset($t[0])) {
-                        $t = array($t);
-                    }
-
-                    $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
-                }
-
-                if (isset($pdeps['required']['package'])) {
-                    $t = $pdeps['required']['package'];
-                    if (!isset($t[0])) {
-                        $t = array($t);
-                    }
-
-                    $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
-                }
-
-                if (isset($pdeps['group'])) {
-                    if (!isset($pdeps['group'][0])) {
-                        $pdeps['group'] = array($pdeps['group']);
-                    }
-
-                    foreach ($pdeps['group'] as $group) {
-                        if (isset($group['package'])) {
-                            $t = $group['package'];
-                            if (!isset($t[0])) {
-                                $t = array($t);
-                            }
-
-                            $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
-                        }
-                    }
-                }
-            }
-        }
-
-        $this->_detectDepCycle($deplinks);
-        foreach ($deplinks as $dependent => $parents) {
-            foreach ($parents as $parent => $unused) {
-                $nodes[$dependent]->connectTo($nodes[$parent]);
-            }
-        }
-
-        $installOrder = Structures_Graph_Manipulator_TopologicalSorter::sort($depgraph);
-        $ret = array();
-        for ($i = 0, $count = count($installOrder); $i < $count; $i++) {
-            foreach ($installOrder[$i] as $index => $sortedpackage) {
-                $data = &$installOrder[$i][$index]->getData();
-                $ret[] = &$nodes[$reg->parsedPackageNameToString(
-                          array(
-                              'channel' => $data->getChannel(),
-                              'package' => strtolower($data->getPackage()),
-                          ))]->getData();
-            }
-        }
-
-        $packages = $ret;
-        return;
-    }
-
-    /**
-     * Detect recursive links between dependencies and break the cycles
-     *
-     * @param array
-     * @access private
-     */
-    function _detectDepCycle(&$deplinks)
-    {
-        do {
-            $keepgoing = false;
-            foreach ($deplinks as $dep => $parents) {
-                foreach ($parents as $parent => $unused) {
-                    // reset the parent cycle detector
-                    $this->_testCycle(null, null, null);
-                    if ($this->_testCycle($dep, $deplinks, $parent)) {
-                        $keepgoing = true;
-                        unset($deplinks[$dep][$parent]);
-                        if (count($deplinks[$dep]) == 0) {
-                            unset($deplinks[$dep]);
-                        }
-
-                        continue 3;
-                    }
-                }
-            }
-        } while ($keepgoing);
-    }
-
-    function _testCycle($test, $deplinks, $dep)
-    {
-        static $visited = array();
-        if ($test === null) {
-            $visited = array();
-            return;
-        }
-
-        // this happens when a parent has a dep cycle on another dependency
-        // but the child is not part of the cycle
-        if (isset($visited[$dep])) {
-            return false;
-        }
-
-        $visited[$dep] = 1;
-        if ($test == $dep) {
-            return true;
-        }
-
-        if (isset($deplinks[$dep])) {
-            if (in_array($test, array_keys($deplinks[$dep]), true)) {
-                return true;
-            }
-
-            foreach ($deplinks[$dep] as $parent => $unused) {
-                if ($this->_testCycle($test, $deplinks, $parent)) {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Set up the dependency for installation parsing
-     *
-     * @param array $t dependency information
-     * @param PEAR_Registry $reg
-     * @param array $deplinks list of dependency links already established
-     * @param array $nodes all existing package nodes
-     * @param string $package parent package name
-     * @access private
-     */
-    function _setupGraph($t, $reg, &$deplinks, &$nodes, $package)
-    {
-        foreach ($t as $dep) {
-            $depchannel = !isset($dep['channel']) ? '__uri': $dep['channel'];
-            $dname = $reg->parsedPackageNameToString(
-                  array(
-                      'channel' => $depchannel,
-                      'package' => strtolower($dep['name']),
-                  ));
-
-            if (isset($nodes[$dname])) {
-                if (!isset($deplinks[$dname])) {
-                    $deplinks[$dname] = array();
-                }
-                $deplinks[$dname][$package] = 1;
-            }
-        }
-    }
-
-    function _dependsOn($a, $b)
-    {
-        return $this->_checkDepTree(strtolower($a->getChannel()), strtolower($a->getPackage()), $b);
-    }
-
-    function _checkDepTree($channel, $package, $b, $checked = array())
-    {
-        $checked[$channel][$package] = true;
-        if (!isset($this->_depTree[$channel][$package])) {
-            return false;
-        }
-
-        if (isset($this->_depTree[$channel][$package][strtolower($b->getChannel())]
-              [strtolower($b->getPackage())])) {
-            return true;
-        }
-
-        foreach ($this->_depTree[$channel][$package] as $ch => $packages) {
-            foreach ($packages as $pa => $true) {
-                if ($this->_checkDepTree($ch, $pa, $b, $checked)) {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    function _sortInstall($a, $b)
-    {
-        if (!$a->getDeps() && !$b->getDeps()) {
-            return 0; // neither package has dependencies, order is insignificant
-        }
-        if ($a->getDeps() && !$b->getDeps()) {
-            return 1; // $a must be installed after $b because $a has dependencies
-        }
-        if (!$a->getDeps() && $b->getDeps()) {
-            return -1; // $b must be installed after $a because $b has dependencies
-        }
-        // both packages have dependencies
-        if ($this->_dependsOn($a, $b)) {
-            return 1;
-        }
-        if ($this->_dependsOn($b, $a)) {
-            return -1;
-        }
-        return 0;
-    }
-
-    /**
-     * Download a file through HTTP.  Considers suggested file name in
-     * Content-disposition: header and can run a callback function for
-     * different events.  The callback will be called with two
-     * parameters: the callback type, and parameters.  The implemented
-     * callback types are:
-     *
-     *  'setup'       called at the very beginning, parameter is a UI object
-     *                that should be used for all output
-     *  'message'     the parameter is a string with an informational message
-     *  'saveas'      may be used to save with a different file name, the
-     *                parameter is the filename that is about to be used.
-     *                If a 'saveas' callback returns a non-empty string,
-     *                that file name will be used as the filename instead.
-     *                Note that $save_dir will not be affected by this, only
-     *                the basename of the file.
-     *  'start'       download is starting, parameter is number of bytes
-     *                that are expected, or -1 if unknown
-     *  'bytesread'   parameter is the number of bytes read so far
-     *  'done'        download is complete, parameter is the total number
-     *                of bytes read
-     *  'connfailed'  if the TCP/SSL connection fails, this callback is called
-     *                with array(host,port,errno,errmsg)
-     *  'writefailed' if writing to disk fails, this callback is called
-     *                with array(destfile,errmsg)
-     *
-     * If an HTTP proxy has been configured (http_proxy PEAR_Config
-     * setting), the proxy will be used.
-     *
-     * @param string  $url       the URL to download
-     * @param object  $ui        PEAR_Frontend_* instance
-     * @param object  $config    PEAR_Config instance
-     * @param string  $save_dir  directory to save file in
-     * @param mixed   $callback  function/method to call for status
-     *                           updates
-     * @param false|string|array $lastmodified header values to check against for caching
-     *                           use false to return the header values from this download
-     * @param false|array $accept Accept headers to send
-     * @param false|string $channel Channel to use for retrieving authentication
-     * @return string|array  Returns the full path of the downloaded file or a PEAR
-     *                       error on failure.  If the error is caused by
-     *                       socket-related errors, the error object will
-     *                       have the fsockopen error code available through
-     *                       getCode().  If caching is requested, then return the header
-     *                       values.
-     *
-     * @access public
-     */
-    function downloadHttp($url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null,
-                          $accept = false, $channel = false)
-    {
-        static $redirect = 0;
-        // always reset , so we are clean case of error
-        $wasredirect = $redirect;
-        $redirect = 0;
-        if ($callback) {
-            call_user_func($callback, 'setup', array(&$ui));
-        }
-
-        $info = parse_url($url);
-        if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) {
-            return PEAR::raiseError('Cannot download non-http URL "' . $url . '"');
-        }
-
-        if (!isset($info['host'])) {
-            return PEAR::raiseError('Cannot download from non-URL "' . $url . '"');
-        }
-
-        $host = isset($info['host']) ? $info['host'] : null;
-        $port = isset($info['port']) ? $info['port'] : null;
-        $path = isset($info['path']) ? $info['path'] : null;
-
-        if (isset($this)) {
-            $config = &$this->config;
-        } else {
-            $config = &PEAR_Config::singleton();
-        }
-
-        $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
-        if ($config->get('http_proxy') &&
-              $proxy = parse_url($config->get('http_proxy'))) {
-            $proxy_host = isset($proxy['host']) ? $proxy['host'] : null;
-            if (isset($proxy['scheme']) && $proxy['scheme'] == 'https') {
-                $proxy_host = 'ssl://' . $proxy_host;
-            }
-            $proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080;
-            $proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null;
-            $proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null;
-
-            if ($callback) {
-                call_user_func($callback, 'message', "Using HTTP proxy $host:$port");
-            }
-        }
-
-        if (empty($port)) {
-            $port = (isset($info['scheme']) && $info['scheme'] == 'https') ? 443 : 80;
-        }
-
-        $scheme = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http';
-
-        if ($proxy_host != '') {
-            $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr);
-            if (!$fp) {
-                if ($callback) {
-                    call_user_func($callback, 'connfailed', array($proxy_host, $proxy_port,
-                                                                  $errno, $errstr));
-                }
-                return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", $errno);
-            }
-
-            if ($lastmodified === false || $lastmodified) {
-                $request  = "GET $url HTTP/1.1\r\n";
-                $request .= "Host: $host:$port\r\n";
-            } else {
-                $request  = "GET $url HTTP/1.0\r\n";
-                $request .= "Host: $host\r\n";
-            }
-        } else {
-            $network_host = $host;
-            if (isset($info['scheme']) && $info['scheme'] == 'https') {
-                $network_host = 'ssl://' . $host;
-            }
-
-            $fp = @fsockopen($network_host, $port, $errno, $errstr);
-            if (!$fp) {
-                if ($callback) {
-                    call_user_func($callback, 'connfailed', array($host, $port,
-                                                                  $errno, $errstr));
-                }
-                return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
-            }
-
-            if ($lastmodified === false || $lastmodified) {
-                $request = "GET $path HTTP/1.1\r\n";
-                $request .= "Host: $host:$port\r\n";
-            } else {
-                $request = "GET $path HTTP/1.0\r\n";
-                $request .= "Host: $host\r\n";
-            }
-        }
-
-        $ifmodifiedsince = '';
-        if (is_array($lastmodified)) {
-            if (isset($lastmodified['Last-Modified'])) {
-                $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n";
-            }
-
-            if (isset($lastmodified['ETag'])) {
-                $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n";
-            }
-        } else {
-            $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : '');
-        }
-
-        $request .= $ifmodifiedsince .
-            "User-Agent: PEAR/1.9.0/PHP/" . PHP_VERSION . "\r\n";
-
-        if (isset($this)) { // only pass in authentication for non-static calls
-            $username = $config->get('username', null, $channel);
-            $password = $config->get('password', null, $channel);
-            if ($username && $password) {
-                $tmp = base64_encode("$username:$password");
-                $request .= "Authorization: Basic $tmp\r\n";
-            }
-        }
-
-        if ($proxy_host != '' && $proxy_user != '') {
-            $request .= 'Proxy-Authorization: Basic ' .
-                base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n";
-        }
-
-        if ($accept) {
-            $request .= 'Accept: ' . implode(', ', $accept) . "\r\n";
-        }
-
-        $request .= "Connection: close\r\n";
-        $request .= "\r\n";
-        fwrite($fp, $request);
-        $headers = array();
-        $reply = 0;
-        while (trim($line = fgets($fp, 1024))) {
-            if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) {
-                $headers[strtolower($matches[1])] = trim($matches[2]);
-            } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) {
-                $reply = (int)$matches[1];
-                if ($reply == 304 && ($lastmodified || ($lastmodified === false))) {
-                    return false;
-                }
-
-                if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) {
-                    return PEAR::raiseError("File $scheme://$host:$port$path not valid (received: $line)");
-                }
-            }
-        }
-
-        if ($reply != 200) {
-            if (!isset($headers['location'])) {
-                return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirected but no location)");
-            }
-
-            if ($wasredirect > 4) {
-                return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirection looped more than 5 times)");
-            }
-
-            $redirect = $wasredirect + 1;
-            return $this->downloadHttp($headers['location'],
-                    $ui, $save_dir, $callback, $lastmodified, $accept);
-        }
-
-        if (isset($headers['content-disposition']) &&
-            preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|\\z)/', $headers['content-disposition'], $matches)) {
-            $save_as = basename($matches[1]);
-        } else {
-            $save_as = basename($url);
-        }
-
-        if ($callback) {
-            $tmp = call_user_func($callback, 'saveas', $save_as);
-            if ($tmp) {
-                $save_as = $tmp;
-            }
-        }
-
-        $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as;
-        if (!$wp = @fopen($dest_file, 'wb')) {
-            fclose($fp);
-            if ($callback) {
-                call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
-            }
-            return PEAR::raiseError("could not open $dest_file for writing");
-        }
-
-        $length = isset($headers['content-length']) ? $headers['content-length'] : -1;
-
-        $bytes = 0;
-        if ($callback) {
-            call_user_func($callback, 'start', array(basename($dest_file), $length));
-        }
-
-        while ($data = fread($fp, 1024)) {
-            $bytes += strlen($data);
-            if ($callback) {
-                call_user_func($callback, 'bytesread', $bytes);
-            }
-            if (!@fwrite($wp, $data)) {
-                fclose($fp);
-                if ($callback) {
-                    call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
-                }
-                return PEAR::raiseError("$dest_file: write failed ($php_errormsg)");
-            }
-        }
-
-        fclose($fp);
-        fclose($wp);
-        if ($callback) {
-            call_user_func($callback, 'done', $bytes);
-        }
-
-        if ($lastmodified === false || $lastmodified) {
-            if (isset($headers['etag'])) {
-                $lastmodified = array('ETag' => $headers['etag']);
-            }
-
-            if (isset($headers['last-modified'])) {
-                if (is_array($lastmodified)) {
-                    $lastmodified['Last-Modified'] = $headers['last-modified'];
-                } else {
-                    $lastmodified = $headers['last-modified'];
-                }
-            }
-            return array($dest_file, $lastmodified, $headers);
-        }
-        return $dest_file;
-    }
-}
-// }}}
\ No newline at end of file
diff --git a/lib/php/PEAR/Downloader/Package.php b/lib/php/PEAR/Downloader/Package.php
deleted file mode 100644
index 36fc494d658578a78d803dd6faa9ded2fa7cad4e..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Downloader/Package.php
+++ /dev/null
@@ -1,2004 +0,0 @@
-<?php
-/**
- * PEAR_Downloader_Package
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Package.php 287560 2009-08-21 22:36:18Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Error code when parameter initialization fails because no releases
- * exist within preferred_state, but releases do exist
- */
-define('PEAR_DOWNLOADER_PACKAGE_STATE', -1003);
-/**
- * Error code when parameter initialization fails because no releases
- * exist that will work with the existing PHP version
- */
-define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004);
-
-/**
- * Coordinates download parameters and manages their dependencies
- * prior to downloading them.
- *
- * Input can come from three sources:
- *
- * - local files (archives or package.xml)
- * - remote files (downloadable urls)
- * - abstract package names
- *
- * The first two elements are handled cleanly by PEAR_PackageFile, but the third requires
- * accessing pearweb's xml-rpc interface to determine necessary dependencies, and the
- * format returned of dependencies is slightly different from that used in package.xml.
- *
- * This class hides the differences between these elements, and makes automatic
- * dependency resolution a piece of cake.  It also manages conflicts when
- * two classes depend on incompatible dependencies, or differing versions of the same
- * package dependency.  In addition, download will not be attempted if the php version is
- * not supported, PEAR installer version is not supported, or non-PECL extensions are not
- * installed.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Downloader_Package
-{
-    /**
-     * @var PEAR_Downloader
-     */
-    var $_downloader;
-    /**
-     * @var PEAR_Config
-     */
-    var $_config;
-    /**
-     * @var PEAR_Registry
-     */
-    var $_registry;
-    /**
-     * Used to implement packagingroot properly
-     * @var PEAR_Registry
-     */
-    var $_installRegistry;
-    /**
-     * @var PEAR_PackageFile_v1|PEAR_PackageFile|v2
-     */
-    var $_packagefile;
-    /**
-     * @var array
-     */
-    var $_parsedname;
-    /**
-     * @var array
-     */
-    var $_downloadURL;
-    /**
-     * @var array
-     */
-    var $_downloadDeps = array();
-    /**
-     * @var boolean
-     */
-    var $_valid = false;
-    /**
-     * @var boolean
-     */
-    var $_analyzed = false;
-    /**
-     * if this or a parent package was invoked with Package-state, this is set to the
-     * state variable.
-     *
-     * This allows temporary reassignment of preferred_state for a parent package and all of
-     * its dependencies.
-     * @var string|false
-     */
-    var $_explicitState = false;
-    /**
-     * If this package is invoked with Package#group, this variable will be true
-     */
-    var $_explicitGroup = false;
-    /**
-     * Package type local|url
-     * @var string
-     */
-    var $_type;
-    /**
-     * Contents of package.xml, if downloaded from a remote channel
-     * @var string|false
-     * @access private
-     */
-    var $_rawpackagefile;
-    /**
-     * @var boolean
-     * @access private
-     */
-    var $_validated = false;
-
-    /**
-     * @param PEAR_Downloader
-     */
-    function PEAR_Downloader_Package(&$downloader)
-    {
-        $this->_downloader = &$downloader;
-        $this->_config = &$this->_downloader->config;
-        $this->_registry = &$this->_config->getRegistry();
-        $options = $downloader->getOptions();
-        if (isset($options['packagingroot'])) {
-            $this->_config->setInstallRoot($options['packagingroot']);
-            $this->_installRegistry = &$this->_config->getRegistry();
-            $this->_config->setInstallRoot(false);
-        } else {
-            $this->_installRegistry = &$this->_registry;
-        }
-        $this->_valid = $this->_analyzed = false;
-    }
-
-    /**
-     * Parse the input and determine whether this is a local file, a remote uri, or an
-     * abstract package name.
-     *
-     * This is the heart of the PEAR_Downloader_Package(), and is used in
-     * {@link PEAR_Downloader::download()}
-     * @param string
-     * @return bool|PEAR_Error
-     */
-    function initialize($param)
-    {
-        $origErr = $this->_fromFile($param);
-        if ($this->_valid) {
-            return true;
-        }
-
-        $options = $this->_downloader->getOptions();
-        if (isset($options['offline'])) {
-            if (PEAR::isError($origErr) && !isset($options['soft'])) {
-                foreach ($origErr->getUserInfo() as $userInfo) {
-                    if (isset($userInfo['message'])) {
-                        $this->_downloader->log(0, $userInfo['message']);
-                    }
-                }
-
-                $this->_downloader->log(0, $origErr->getMessage());
-            }
-
-            return PEAR::raiseError('Cannot download non-local package "' . $param . '"');
-        }
-
-        $err = $this->_fromUrl($param);
-        if (PEAR::isError($err) || !$this->_valid) {
-            if ($this->_type == 'url') {
-                if (PEAR::isError($err) && !isset($options['soft'])) {
-                    $this->_downloader->log(0, $err->getMessage());
-                }
-
-                return PEAR::raiseError("Invalid or missing remote package file");
-            }
-
-            $err = $this->_fromString($param);
-            if (PEAR::isError($err) || !$this->_valid) {
-                if (PEAR::isError($err) && $err->getCode() == PEAR_DOWNLOADER_PACKAGE_STATE) {
-                    return false; // instruct the downloader to silently skip
-                }
-
-                if (isset($this->_type) && $this->_type == 'local' && PEAR::isError($origErr)) {
-                    if (is_array($origErr->getUserInfo())) {
-                        foreach ($origErr->getUserInfo() as $err) {
-                            if (is_array($err)) {
-                                $err = $err['message'];
-                            }
-
-                            if (!isset($options['soft'])) {
-                                $this->_downloader->log(0, $err);
-                            }
-                        }
-                    }
-
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(0, $origErr->getMessage());
-                    }
-
-                    if (is_array($param)) {
-                        $param = $this->_registry->parsedPackageNameToString($param, true);
-                    }
-
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file");
-                    }
-
-                    // Passing no message back - already logged above
-                    return PEAR::raiseError();
-                }
-
-                if (PEAR::isError($err) && !isset($options['soft'])) {
-                    $this->_downloader->log(0, $err->getMessage());
-                }
-
-                if (is_array($param)) {
-                    $param = $this->_registry->parsedPackageNameToString($param, true);
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file");
-                }
-
-                // Passing no message back - already logged above
-                return PEAR::raiseError();
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Retrieve any non-local packages
-     * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|PEAR_Error
-     */
-    function &download()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile;
-        }
-
-        if (isset($this->_downloadURL['url'])) {
-            $this->_isvalid = false;
-            $info = $this->getParsedPackage();
-            foreach ($info as $i => $p) {
-                $info[$i] = strtolower($p);
-            }
-
-            $err = $this->_fromUrl($this->_downloadURL['url'],
-                $this->_registry->parsedPackageNameToString($this->_parsedname, true));
-            $newinfo = $this->getParsedPackage();
-            foreach ($newinfo as $i => $p) {
-                $newinfo[$i] = strtolower($p);
-            }
-
-            if ($info != $newinfo) {
-                do {
-                    if ($info['channel'] == 'pecl.php.net' && $newinfo['channel'] == 'pear.php.net') {
-                        $info['channel'] = 'pear.php.net';
-                        if ($info == $newinfo) {
-                            // skip the channel check if a pecl package says it's a PEAR package
-                            break;
-                        }
-                    }
-                    if ($info['channel'] == 'pear.php.net' && $newinfo['channel'] == 'pecl.php.net') {
-                        $info['channel'] = 'pecl.php.net';
-                        if ($info == $newinfo) {
-                            // skip the channel check if a pecl package says it's a PEAR package
-                            break;
-                        }
-                    }
-
-                    return PEAR::raiseError('CRITICAL ERROR: We are ' .
-                        $this->_registry->parsedPackageNameToString($info) . ', but the file ' .
-                        'downloaded claims to be ' .
-                        $this->_registry->parsedPackageNameToString($this->getParsedPackage()));
-                } while (false);
-            }
-
-            if (PEAR::isError($err) || !$this->_valid) {
-                return $err;
-            }
-        }
-
-        $this->_type = 'local';
-        return $this->_packagefile;
-    }
-
-    function &getPackageFile()
-    {
-        return $this->_packagefile;
-    }
-
-    function &getDownloader()
-    {
-        return $this->_downloader;
-    }
-
-    function getType()
-    {
-        return $this->_type;
-    }
-
-    /**
-     * Like {@link initialize()}, but operates on a dependency
-     */
-    function fromDepURL($dep)
-    {
-        $this->_downloadURL = $dep;
-        if (isset($dep['uri'])) {
-            $options = $this->_downloader->getOptions();
-            if (!extension_loaded("zlib") || isset($options['nocompress'])) {
-                $ext = '.tar';
-            } else {
-                $ext = '.tgz';
-            }
-
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $err = $this->_fromUrl($dep['uri'] . $ext);
-            PEAR::popErrorHandling();
-            if (PEAR::isError($err)) {
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(0, $err->getMessage());
-                }
-
-                return PEAR::raiseError('Invalid uri dependency "' . $dep['uri'] . $ext . '", ' .
-                    'cannot download');
-            }
-        } else {
-            $this->_parsedname =
-                array(
-                    'package' => $dep['info']->getPackage(),
-                    'channel' => $dep['info']->getChannel(),
-                    'version' => $dep['version']
-                );
-            if (!isset($dep['nodefault'])) {
-                $this->_parsedname['group'] = 'default'; // download the default dependency group
-                $this->_explicitGroup = false;
-            }
-
-            $this->_rawpackagefile = $dep['raw'];
-        }
-    }
-
-    function detectDependencies($params)
-    {
-        $options = $this->_downloader->getOptions();
-        if (isset($options['downloadonly'])) {
-            return;
-        }
-
-        if (isset($options['offline'])) {
-            $this->_downloader->log(3, 'Skipping dependency download check, --offline specified');
-            return;
-        }
-
-        $pname = $this->getParsedPackage();
-        if (!$pname) {
-            return;
-        }
-
-        $deps = $this->getDeps();
-        if (!$deps) {
-            return;
-        }
-
-        if (isset($deps['required'])) { // package.xml 2.0
-            return $this->_detect2($deps, $pname, $options, $params);
-        }
-
-        return $this->_detect1($deps, $pname, $options, $params);
-    }
-
-    function setValidated()
-    {
-        $this->_validated = true;
-    }
-
-    function alreadyValidated()
-    {
-        return $this->_validated;
-    }
-
-    /**
-     * Remove packages to be downloaded that are already installed
-     * @param array of PEAR_Downloader_Package objects
-     * @static
-     */
-    function removeInstalled(&$params)
-    {
-        if (!isset($params[0])) {
-            return;
-        }
-
-        $options = $params[0]->_downloader->getOptions();
-        if (!isset($options['downloadonly'])) {
-            foreach ($params as $i => $param) {
-                $package = $param->getPackage();
-                $channel = $param->getChannel();
-                // remove self if already installed with this version
-                // this does not need any pecl magic - we only remove exact matches
-                if ($param->_installRegistry->packageExists($package, $channel)) {
-                    $packageVersion = $param->_installRegistry->packageInfo($package, 'version', $channel);
-                    if (version_compare($packageVersion, $param->getVersion(), '==')) {
-                        if (!isset($options['force'])) {
-                            $info = $param->getParsedPackage();
-                            unset($info['version']);
-                            unset($info['state']);
-                            if (!isset($options['soft'])) {
-                                $param->_downloader->log(1, 'Skipping package "' .
-                                    $param->getShortName() .
-                                    '", already installed as version ' . $packageVersion);
-                            }
-                            $params[$i] = false;
-                        }
-                    } elseif (!isset($options['force']) && !isset($options['upgrade']) &&
-                          !isset($options['soft'])) {
-                        $info = $param->getParsedPackage();
-                        $param->_downloader->log(1, 'Skipping package "' .
-                            $param->getShortName() .
-                            '", already installed as version ' . $packageVersion);
-                        $params[$i] = false;
-                    }
-                }
-            }
-        }
-
-        PEAR_Downloader_Package::removeDuplicates($params);
-    }
-
-    function _detect2($deps, $pname, $options, $params)
-    {
-        $this->_downloadDeps = array();
-        $groupnotfound = false;
-        foreach (array('package', 'subpackage') as $packagetype) {
-            // get required dependency group
-            if (isset($deps['required'][$packagetype])) {
-                if (isset($deps['required'][$packagetype][0])) {
-                    foreach ($deps['required'][$packagetype] as $dep) {
-                        if (isset($dep['conflicts'])) {
-                            // skip any package that this package conflicts with
-                            continue;
-                        }
-                        $ret = $this->_detect2Dep($dep, $pname, 'required', $params);
-                        if (is_array($ret)) {
-                            $this->_downloadDeps[] = $ret;
-                        } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
-                            $this->_downloader->log(0, $ret->getMessage());
-                        }
-                    }
-                } else {
-                    $dep = $deps['required'][$packagetype];
-                    if (!isset($dep['conflicts'])) {
-                        // skip any package that this package conflicts with
-                        $ret = $this->_detect2Dep($dep, $pname, 'required', $params);
-                        if (is_array($ret)) {
-                            $this->_downloadDeps[] = $ret;
-                        } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
-                            $this->_downloader->log(0, $ret->getMessage());
-                        }
-                    }
-                }
-            }
-
-            // get optional dependency group, if any
-            if (isset($deps['optional'][$packagetype])) {
-                $skipnames = array();
-                if (!isset($deps['optional'][$packagetype][0])) {
-                    $deps['optional'][$packagetype] = array($deps['optional'][$packagetype]);
-                }
-
-                foreach ($deps['optional'][$packagetype] as $dep) {
-                    $skip = false;
-                    if (!isset($options['alldeps'])) {
-                        $dep['package'] = $dep['name'];
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(3, 'Notice: package "' .
-                              $this->_registry->parsedPackageNameToString($this->getParsedPackage(),
-                                    true) . '" optional dependency "' .
-                                $this->_registry->parsedPackageNameToString(array('package' =>
-                                    $dep['name'], 'channel' => 'pear.php.net'), true) .
-                                '" will not be automatically downloaded');
-                        }
-                        $skipnames[] = $this->_registry->parsedPackageNameToString($dep, true);
-                        $skip = true;
-                        unset($dep['package']);
-                    }
-
-                    $ret = $this->_detect2Dep($dep, $pname, 'optional', $params);
-                    if (PEAR::isError($ret) && !isset($options['soft'])) {
-                        $this->_downloader->log(0, $ret->getMessage());
-                    }
-
-                    if (!$ret) {
-                        $dep['package'] = $dep['name'];
-                        $skip = count($skipnames) ?
-                            $skipnames[count($skipnames) - 1] : '';
-                        if ($skip ==
-                              $this->_registry->parsedPackageNameToString($dep, true)) {
-                            array_pop($skipnames);
-                        }
-                    }
-
-                    if (!$skip && is_array($ret)) {
-                        $this->_downloadDeps[] = $ret;
-                    }
-                }
-
-                if (count($skipnames)) {
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(1, 'Did not download optional dependencies: ' .
-                            implode(', ', $skipnames) .
-                            ', use --alldeps to download automatically');
-                    }
-                }
-            }
-
-            // get requested dependency group, if any
-            $groupname = $this->getGroup();
-            $explicit  = $this->_explicitGroup;
-            if (!$groupname) {
-                if (!$this->canDefault()) {
-                    continue;
-                }
-
-                $groupname = 'default'; // try the default dependency group
-            }
-
-            if ($groupnotfound) {
-                continue;
-            }
-
-            if (isset($deps['group'])) {
-                if (isset($deps['group']['attribs'])) {
-                    if (strtolower($deps['group']['attribs']['name']) == strtolower($groupname)) {
-                        $group = $deps['group'];
-                    } elseif ($explicit) {
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(0, 'Warning: package "' .
-                                $this->_registry->parsedPackageNameToString($pname, true) .
-                                '" has no dependency ' . 'group named "' . $groupname . '"');
-                        }
-
-                        $groupnotfound = true;
-                        continue;
-                    }
-                } else {
-                    $found = false;
-                    foreach ($deps['group'] as $group) {
-                        if (strtolower($group['attribs']['name']) == strtolower($groupname)) {
-                            $found = true;
-                            break;
-                        }
-                    }
-
-                    if (!$found) {
-                        if ($explicit) {
-                            if (!isset($options['soft'])) {
-                                $this->_downloader->log(0, 'Warning: package "' .
-                                    $this->_registry->parsedPackageNameToString($pname, true) .
-                                    '" has no dependency ' . 'group named "' . $groupname . '"');
-                            }
-                        }
-
-                        $groupnotfound = true;
-                        continue;
-                    }
-                }
-            }
-
-            if (isset($group) && isset($group[$packagetype])) {
-                if (isset($group[$packagetype][0])) {
-                    foreach ($group[$packagetype] as $dep) {
-                        $ret = $this->_detect2Dep($dep, $pname, 'dependency group "' .
-                            $group['attribs']['name'] . '"', $params);
-                        if (is_array($ret)) {
-                            $this->_downloadDeps[] = $ret;
-                        } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
-                            $this->_downloader->log(0, $ret->getMessage());
-                        }
-                    }
-                } else {
-                    $ret = $this->_detect2Dep($group[$packagetype], $pname,
-                        'dependency group "' .
-                        $group['attribs']['name'] . '"', $params);
-                    if (is_array($ret)) {
-                        $this->_downloadDeps[] = $ret;
-                    } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
-                        $this->_downloader->log(0, $ret->getMessage());
-                    }
-                }
-            }
-        }
-    }
-
-    function _detect2Dep($dep, $pname, $group, $params)
-    {
-        if (isset($dep['conflicts'])) {
-            return true;
-        }
-
-        $options = $this->_downloader->getOptions();
-        if (isset($dep['uri'])) {
-            return array('uri' => $dep['uri'], 'dep' => $dep);;
-        }
-
-        $testdep = $dep;
-        $testdep['package'] = $dep['name'];
-        if (PEAR_Downloader_Package::willDownload($testdep, $params)) {
-            $dep['package'] = $dep['name'];
-            if (!isset($options['soft'])) {
-                $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group .
-                    ' dependency "' .
-                    $this->_registry->parsedPackageNameToString($dep, true) .
-                    '", will be installed');
-            }
-            return false;
-        }
-
-        $options = $this->_downloader->getOptions();
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        if ($this->_explicitState) {
-            $pname['state'] = $this->_explicitState;
-        }
-
-        $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
-        if (PEAR::isError($url)) {
-            PEAR::popErrorHandling();
-            return $url;
-        }
-
-        $dep['package'] = $dep['name'];
-        $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params, $group == 'optional' &&
-            !isset($options['alldeps']), true);
-        PEAR::popErrorHandling();
-        if (PEAR::isError($ret)) {
-            if (!isset($options['soft'])) {
-                $this->_downloader->log(0, $ret->getMessage());
-            }
-
-            return false;
-        }
-
-        // check to see if a dep is already installed and is the same or newer
-        if (!isset($dep['min']) && !isset($dep['max']) && !isset($dep['recommended'])) {
-            $oper = 'has';
-        } else {
-            $oper = 'gt';
-        }
-
-        // do not try to move this before getDepPackageDownloadURL
-        // we can't determine whether upgrade is necessary until we know what
-        // version would be downloaded
-        if (!isset($options['force']) && $this->isInstalled($ret, $oper)) {
-            $version = $this->_installRegistry->packageInfo($dep['name'], 'version', $dep['channel']);
-            $dep['package'] = $dep['name'];
-            if (!isset($options['soft'])) {
-                $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group .
-                    ' dependency "' .
-                $this->_registry->parsedPackageNameToString($dep, true) .
-                    '" version ' . $url['version'] . ', already installed as version ' .
-                    $version);
-            }
-
-            return false;
-        }
-
-        if (isset($dep['nodefault'])) {
-            $ret['nodefault'] = true;
-        }
-
-        return $ret;
-    }
-
-    function _detect1($deps, $pname, $options, $params)
-    {
-        $this->_downloadDeps = array();
-        $skipnames = array();
-        foreach ($deps as $dep) {
-            $nodownload = false;
-            if (isset ($dep['type']) && $dep['type'] === 'pkg') {
-                $dep['channel'] = 'pear.php.net';
-                $dep['package'] = $dep['name'];
-                switch ($dep['rel']) {
-                    case 'not' :
-                        continue 2;
-                    case 'ge' :
-                    case 'eq' :
-                    case 'gt' :
-                    case 'has' :
-                        $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
-                            'required' :
-                            'optional';
-                        if (PEAR_Downloader_Package::willDownload($dep, $params)) {
-                            $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group
-                                . ' dependency "' .
-                                $this->_registry->parsedPackageNameToString($dep, true) .
-                                '", will be installed');
-                            continue 2;
-                        }
-                        $fakedp = new PEAR_PackageFile_v1;
-                        $fakedp->setPackage($dep['name']);
-                        // skip internet check if we are not upgrading (bug #5810)
-                        if (!isset($options['upgrade']) && $this->isInstalled(
-                              $fakedp, $dep['rel'])) {
-                            $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group
-                                . ' dependency "' .
-                                $this->_registry->parsedPackageNameToString($dep, true) .
-                                '", is already installed');
-                            continue 2;
-                        }
-                }
-
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                if ($this->_explicitState) {
-                    $pname['state'] = $this->_explicitState;
-                }
-
-                $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
-                $chan = 'pear.php.net';
-                if (PEAR::isError($url)) {
-                    // check to see if this is a pecl package that has jumped
-                    // from pear.php.net to pecl.php.net channel
-                    if (!class_exists('PEAR_Dependency2')) {
-                        require_once 'PEAR/Dependency2.php';
-                    }
-
-                    $newdep = PEAR_Dependency2::normalizeDep($dep);
-                    $newdep = $newdep[0];
-                    $newdep['channel'] = 'pecl.php.net';
-                    $chan = 'pecl.php.net';
-                    $url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname);
-                    $obj = &$this->_installRegistry->getPackage($dep['name']);
-                    if (PEAR::isError($url)) {
-                        PEAR::popErrorHandling();
-                        if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) {
-                            $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
-                                'required' :
-                                'optional';
-                            $dep['package'] = $dep['name'];
-                            if (!isset($options['soft'])) {
-                                $this->_downloader->log(3, $this->getShortName() .
-                                    ': Skipping ' . $group . ' dependency "' .
-                                    $this->_registry->parsedPackageNameToString($dep, true) .
-                                    '", already installed as version ' . $obj->getVersion());
-                            }
-                            $skip = count($skipnames) ?
-                                $skipnames[count($skipnames) - 1] : '';
-                            if ($skip ==
-                                  $this->_registry->parsedPackageNameToString($dep, true)) {
-                                array_pop($skipnames);
-                            }
-                            continue;
-                        } else {
-                            if (isset($dep['optional']) && $dep['optional'] == 'yes') {
-                                $this->_downloader->log(2, $this->getShortName() .
-                                    ': Skipping optional dependency "' .
-                                    $this->_registry->parsedPackageNameToString($dep, true) .
-                                    '", no releases exist');
-                                continue;
-                            } else {
-                                return $url;
-                            }
-                        }
-                    }
-                }
-
-                PEAR::popErrorHandling();
-                if (!isset($options['alldeps'])) {
-                    if (isset($dep['optional']) && $dep['optional'] == 'yes') {
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(3, 'Notice: package "' .
-                                $this->getShortName() .
-                                '" optional dependency "' .
-                                $this->_registry->parsedPackageNameToString(
-                                    array('channel' => $chan, 'package' =>
-                                    $dep['name']), true) .
-                                '" will not be automatically downloaded');
-                        }
-                        $skipnames[] = $this->_registry->parsedPackageNameToString(
-                                array('channel' => $chan, 'package' =>
-                                $dep['name']), true);
-                        $nodownload = true;
-                    }
-                }
-
-                if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
-                    if (!isset($dep['optional']) || $dep['optional'] == 'no') {
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(3, 'Notice: package "' .
-                                $this->getShortName() .
-                                '" required dependency "' .
-                                $this->_registry->parsedPackageNameToString(
-                                    array('channel' => $chan, 'package' =>
-                                    $dep['name']), true) .
-                                '" will not be automatically downloaded');
-                        }
-                        $skipnames[] = $this->_registry->parsedPackageNameToString(
-                                array('channel' => $chan, 'package' =>
-                                $dep['name']), true);
-                        $nodownload = true;
-                    }
-                }
-
-                // check to see if a dep is already installed
-                // do not try to move this before getDepPackageDownloadURL
-                // we can't determine whether upgrade is necessary until we know what
-                // version would be downloaded
-                if (!isset($options['force']) && $this->isInstalled(
-                        $url, $dep['rel'])) {
-                    $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
-                        'required' :
-                        'optional';
-                    $dep['package'] = $dep['name'];
-                    if (isset($newdep)) {
-                        $version = $this->_installRegistry->packageInfo($newdep['name'], 'version', $newdep['channel']);
-                    } else {
-                        $version = $this->_installRegistry->packageInfo($dep['name'], 'version');
-                    }
-
-                    $dep['version'] = $url['version'];
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group .
-                            ' dependency "' .
-                            $this->_registry->parsedPackageNameToString($dep, true) .
-                            '", already installed as version ' . $version);
-                    }
-
-                    $skip = count($skipnames) ?
-                        $skipnames[count($skipnames) - 1] : '';
-                    if ($skip ==
-                          $this->_registry->parsedPackageNameToString($dep, true)) {
-                        array_pop($skipnames);
-                    }
-
-                    continue;
-                }
-
-                if ($nodownload) {
-                    continue;
-                }
-
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                if (isset($newdep)) {
-                    $dep = $newdep;
-                }
-
-                $dep['package'] = $dep['name'];
-                $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params,
-                    isset($dep['optional']) && $dep['optional'] == 'yes' &&
-                    !isset($options['alldeps']), true);
-                PEAR::popErrorHandling();
-                if (PEAR::isError($ret)) {
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(0, $ret->getMessage());
-                    }
-                    continue;
-                }
-
-                $this->_downloadDeps[] = $ret;
-            }
-        }
-
-        if (count($skipnames)) {
-            if (!isset($options['soft'])) {
-                $this->_downloader->log(1, 'Did not download dependencies: ' .
-                    implode(', ', $skipnames) .
-                    ', use --alldeps or --onlyreqdeps to download automatically');
-            }
-        }
-    }
-
-    function setDownloadURL($pkg)
-    {
-        $this->_downloadURL = $pkg;
-    }
-
-    /**
-     * Set the package.xml object for this downloaded package
-     *
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 $pkg
-     */
-    function setPackageFile(&$pkg)
-    {
-        $this->_packagefile = &$pkg;
-    }
-
-    function getShortName()
-    {
-        return $this->_registry->parsedPackageNameToString(array('channel' => $this->getChannel(),
-            'package' => $this->getPackage()), true);
-    }
-
-    function getParsedPackage()
-    {
-        if (isset($this->_packagefile) || isset($this->_parsedname)) {
-            return array('channel' => $this->getChannel(),
-                'package' => $this->getPackage(),
-                'version' => $this->getVersion());
-        }
-
-        return false;
-    }
-
-    function getDownloadURL()
-    {
-        return $this->_downloadURL;
-    }
-
-    function canDefault()
-    {
-        if (isset($this->_downloadURL) && isset($this->_downloadURL['nodefault'])) {
-            return false;
-        }
-
-        return true;
-    }
-
-    function getPackage()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getPackage();
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->getPackage();
-        }
-
-        return false;
-    }
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     */
-    function isSubpackage(&$pf)
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->isSubpackage($pf);
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->isSubpackage($pf);
-        }
-
-        return false;
-    }
-
-    function getPackageType()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getPackageType();
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->getPackageType();
-        }
-
-        return false;
-    }
-
-    function isBundle()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getPackageType() == 'bundle';
-        }
-
-        return false;
-    }
-
-    function getPackageXmlVersion()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getPackagexmlVersion();
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->getPackagexmlVersion();
-        }
-
-        return '1.0';
-    }
-
-    function getChannel()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getChannel();
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->getChannel();
-        }
-
-        return false;
-    }
-
-    function getURI()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getURI();
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->getURI();
-        }
-
-        return false;
-    }
-
-    function getVersion()
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->getVersion();
-        } elseif (isset($this->_downloadURL['version'])) {
-            return $this->_downloadURL['version'];
-        }
-
-        return false;
-    }
-
-    function isCompatible($pf)
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->isCompatible($pf);
-        } elseif (isset($this->_downloadURL['info'])) {
-            return $this->_downloadURL['info']->isCompatible($pf);
-        }
-
-        return true;
-    }
-
-    function setGroup($group)
-    {
-        $this->_parsedname['group'] = $group;
-    }
-
-    function getGroup()
-    {
-        if (isset($this->_parsedname['group'])) {
-            return $this->_parsedname['group'];
-        }
-
-        return '';
-    }
-
-    function isExtension($name)
-    {
-        if (isset($this->_packagefile)) {
-            return $this->_packagefile->isExtension($name);
-        } elseif (isset($this->_downloadURL['info'])) {
-            if ($this->_downloadURL['info']->getPackagexmlVersion() == '2.0') {
-                return $this->_downloadURL['info']->getProvidesExtension() == $name;
-            }
-
-            return false;
-        }
-
-        return false;
-    }
-
-    function getDeps()
-    {
-        if (isset($this->_packagefile)) {
-            $ver = $this->_packagefile->getPackagexmlVersion();
-            if (version_compare($ver, '2.0', '>=')) {
-                return $this->_packagefile->getDeps(true);
-            }
-
-            return $this->_packagefile->getDeps();
-        } elseif (isset($this->_downloadURL['info'])) {
-            $ver = $this->_downloadURL['info']->getPackagexmlVersion();
-            if (version_compare($ver, '2.0', '>=')) {
-                return $this->_downloadURL['info']->getDeps(true);
-            }
-
-            return $this->_downloadURL['info']->getDeps();
-        }
-
-        return array();
-    }
-
-    /**
-     * @param array Parsed array from {@link PEAR_Registry::parsePackageName()} or a dependency
-     *                     returned from getDepDownloadURL()
-     */
-    function isEqual($param)
-    {
-        if (is_object($param)) {
-            $channel = $param->getChannel();
-            $package = $param->getPackage();
-            if ($param->getURI()) {
-                $param = array(
-                    'channel' => $param->getChannel(),
-                    'package' => $param->getPackage(),
-                    'version' => $param->getVersion(),
-                    'uri' => $param->getURI(),
-                );
-            } else {
-                $param = array(
-                    'channel' => $param->getChannel(),
-                    'package' => $param->getPackage(),
-                    'version' => $param->getVersion(),
-                );
-            }
-        } else {
-            if (isset($param['uri'])) {
-                if ($this->getChannel() != '__uri') {
-                    return false;
-                }
-                return $param['uri'] == $this->getURI();
-            }
-
-            $package = isset($param['package']) ? $param['package'] : $param['info']->getPackage();
-            $channel = isset($param['channel']) ? $param['channel'] : $param['info']->getChannel();
-            if (isset($param['rel'])) {
-                if (!class_exists('PEAR_Dependency2')) {
-                    require_once 'PEAR/Dependency2.php';
-                }
-
-                $newdep = PEAR_Dependency2::normalizeDep($param);
-                $newdep = $newdep[0];
-            } elseif (isset($param['min'])) {
-                $newdep = $param;
-            }
-        }
-
-        if (isset($newdep)) {
-            if (!isset($newdep['min'])) {
-                $newdep['min'] = '0';
-            }
-
-            if (!isset($newdep['max'])) {
-                $newdep['max'] = '100000000000000000000';
-            }
-
-            // use magic to support pecl packages suddenly jumping to the pecl channel
-            // we need to support both dependency possibilities
-            if ($channel == 'pear.php.net' && $this->getChannel() == 'pecl.php.net') {
-                if ($package == $this->getPackage()) {
-                    $channel = 'pecl.php.net';
-                }
-            }
-            if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
-                if ($package == $this->getPackage()) {
-                    $channel = 'pear.php.net';
-                }
-            }
-
-            return (strtolower($package) == strtolower($this->getPackage()) &&
-                $channel == $this->getChannel() &&
-                version_compare($newdep['min'], $this->getVersion(), '<=') &&
-                version_compare($newdep['max'], $this->getVersion(), '>='));
-        }
-
-        // use magic to support pecl packages suddenly jumping to the pecl channel
-        if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
-            if (strtolower($package) == strtolower($this->getPackage())) {
-                $channel = 'pear.php.net';
-            }
-        }
-
-        if (isset($param['version'])) {
-            return (strtolower($package) == strtolower($this->getPackage()) &&
-                $channel == $this->getChannel() &&
-                $param['version'] == $this->getVersion());
-        }
-
-        return strtolower($package) == strtolower($this->getPackage()) &&
-            $channel == $this->getChannel();
-    }
-
-    function isInstalled($dep, $oper = '==')
-    {
-        if (!$dep) {
-            return false;
-        }
-
-        if ($oper != 'ge' && $oper != 'gt' && $oper != 'has' && $oper != '==') {
-            return false;
-        }
-
-        if (is_object($dep)) {
-            $package = $dep->getPackage();
-            $channel = $dep->getChannel();
-            if ($dep->getURI()) {
-                $dep = array(
-                    'uri' => $dep->getURI(),
-                    'version' => $dep->getVersion(),
-                );
-            } else {
-                $dep = array(
-                    'version' => $dep->getVersion(),
-                );
-            }
-        } else {
-            if (isset($dep['uri'])) {
-                $channel = '__uri';
-                $package = $dep['dep']['name'];
-            } else {
-                $channel = $dep['info']->getChannel();
-                $package = $dep['info']->getPackage();
-            }
-        }
-
-        $options = $this->_downloader->getOptions();
-        $test    = $this->_installRegistry->packageExists($package, $channel);
-        if (!$test && $channel == 'pecl.php.net') {
-            // do magic to allow upgrading from old pecl packages to new ones
-            $test = $this->_installRegistry->packageExists($package, 'pear.php.net');
-            $channel = 'pear.php.net';
-        }
-
-        if ($test) {
-            if (isset($dep['uri'])) {
-                if ($this->_installRegistry->packageInfo($package, 'uri', '__uri') == $dep['uri']) {
-                    return true;
-                }
-            }
-
-            if (isset($options['upgrade'])) {
-                $packageVersion = $this->_installRegistry->packageInfo($package, 'version', $channel);
-                if (version_compare($packageVersion, $dep['version'], '>=')) {
-                    return true;
-                }
-
-                return false;
-            }
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Detect duplicate package names with differing versions
-     *
-     * If a user requests to install Date 1.4.6 and Date 1.4.7,
-     * for instance, this is a logic error.  This method
-     * detects this situation.
-     *
-     * @param array $params array of PEAR_Downloader_Package objects
-     * @param array $errorparams empty array
-     * @return array array of stupid duplicated packages in PEAR_Downloader_Package obejcts
-     */
-    function detectStupidDuplicates($params, &$errorparams)
-    {
-        $existing = array();
-        foreach ($params as $i => $param) {
-            $package = $param->getPackage();
-            $channel = $param->getChannel();
-            $group   = $param->getGroup();
-            if (!isset($existing[$channel . '/' . $package])) {
-                $existing[$channel . '/' . $package] = array();
-            }
-
-            if (!isset($existing[$channel . '/' . $package][$group])) {
-                $existing[$channel . '/' . $package][$group] = array();
-            }
-
-            $existing[$channel . '/' . $package][$group][] = $i;
-        }
-
-        $indices = array();
-        foreach ($existing as $package => $groups) {
-            foreach ($groups as $group => $dupes) {
-                if (count($dupes) > 1) {
-                    $indices = $indices + $dupes;
-                }
-            }
-        }
-
-        $indices = array_unique($indices);
-        foreach ($indices as $index) {
-            $errorparams[] = $params[$index];
-        }
-
-        return count($errorparams);
-    }
-
-    /**
-     * @param array
-     * @param bool ignore install groups - for final removal of dupe packages
-     * @static
-     */
-    function removeDuplicates(&$params, $ignoreGroups = false)
-    {
-        $pnames = array();
-        foreach ($params as $i => $param) {
-            if (!$param) {
-                continue;
-            }
-
-            if ($param->getPackage()) {
-                $group = $ignoreGroups ? '' : $param->getGroup();
-                $pnames[$i] = $param->getChannel() . '/' .
-                    $param->getPackage() . '-' . $param->getVersion() . '#' . $group;
-            }
-        }
-
-        $pnames = array_unique($pnames);
-        $unset  = array_diff(array_keys($params), array_keys($pnames));
-        $testp  = array_flip($pnames);
-        foreach ($params as $i => $param) {
-            if (!$param) {
-                $unset[] = $i;
-                continue;
-            }
-
-            if (!is_a($param, 'PEAR_Downloader_Package')) {
-                $unset[] = $i;
-                continue;
-            }
-
-            $group = $ignoreGroups ? '' : $param->getGroup();
-            if (!isset($testp[$param->getChannel() . '/' . $param->getPackage() . '-' .
-                  $param->getVersion() . '#' . $group])) {
-                $unset[] = $i;
-            }
-        }
-
-        foreach ($unset as $i) {
-            unset($params[$i]);
-        }
-
-        $ret = array();
-        foreach ($params as $i => $param) {
-            $ret[] = &$params[$i];
-        }
-
-        $params = array();
-        foreach ($ret as $i => $param) {
-            $params[] = &$ret[$i];
-        }
-    }
-
-    function explicitState()
-    {
-        return $this->_explicitState;
-    }
-
-    function setExplicitState($s)
-    {
-        $this->_explicitState = $s;
-    }
-
-    /**
-     * @static
-     */
-    function mergeDependencies(&$params)
-    {
-        $bundles = $newparams = array();
-        foreach ($params as $i => $param) {
-            if (!$param->isBundle()) {
-                continue;
-            }
-
-            $bundles[] = $i;
-            $pf = &$param->getPackageFile();
-            $newdeps = array();
-            $contents = $pf->getBundledPackages();
-            if (!is_array($contents)) {
-                $contents = array($contents);
-            }
-
-            foreach ($contents as $file) {
-                $filecontents = $pf->getFileContents($file);
-                $dl = &$param->getDownloader();
-                $options = $dl->getOptions();
-                if (PEAR::isError($dir = $dl->getDownloadDir())) {
-                    return $dir;
-                }
-
-                $fp = @fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb');
-                if (!$fp) {
-                    continue;
-                }
-
-                fwrite($fp, $filecontents, strlen($filecontents));
-                fclose($fp);
-                if ($s = $params[$i]->explicitState()) {
-                    $obj->setExplicitState($s);
-                }
-
-                $obj = &new PEAR_Downloader_Package($params[$i]->getDownloader());
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                if (PEAR::isError($dir = $dl->getDownloadDir())) {
-                    PEAR::popErrorHandling();
-                    return $dir;
-                }
-
-                $e = $obj->_fromFile($a = $dir . DIRECTORY_SEPARATOR . $file);
-                PEAR::popErrorHandling();
-                if (PEAR::isError($e)) {
-                    if (!isset($options['soft'])) {
-                        $dl->log(0, $e->getMessage());
-                    }
-                    continue;
-                }
-
-                $j = &$obj;
-                if (!PEAR_Downloader_Package::willDownload($j,
-                      array_merge($params, $newparams)) && !$param->isInstalled($j)) {
-                    $newparams[] = &$j;
-                }
-            }
-        }
-
-        foreach ($bundles as $i) {
-            unset($params[$i]); // remove bundles - only their contents matter for installation
-        }
-
-        PEAR_Downloader_Package::removeDuplicates($params); // strip any unset indices
-        if (count($newparams)) { // add in bundled packages for install
-            foreach ($newparams as $i => $unused) {
-                $params[] = &$newparams[$i];
-            }
-            $newparams = array();
-        }
-
-        foreach ($params as $i => $param) {
-            $newdeps = array();
-            foreach ($param->_downloadDeps as $dep) {
-                $merge = array_merge($params, $newparams);
-                if (!PEAR_Downloader_Package::willDownload($dep, $merge)
-                    && !$param->isInstalled($dep)
-                ) {
-                    $newdeps[] = $dep;
-                } else {
-                    //var_dump($dep);
-                    // detect versioning conflicts here
-                }
-            }
-
-            // convert the dependencies into PEAR_Downloader_Package objects for the next time around
-            $params[$i]->_downloadDeps = array();
-            foreach ($newdeps as $dep) {
-                $obj = &new PEAR_Downloader_Package($params[$i]->getDownloader());
-                if ($s = $params[$i]->explicitState()) {
-                    $obj->setExplicitState($s);
-                }
-
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                $e = $obj->fromDepURL($dep);
-                PEAR::popErrorHandling();
-                if (PEAR::isError($e)) {
-                    if (!isset($options['soft'])) {
-                        $obj->_downloader->log(0, $e->getMessage());
-                    }
-                    continue;
-                }
-
-                $e = $obj->detectDependencies($params);
-                if (PEAR::isError($e)) {
-                    if (!isset($options['soft'])) {
-                        $obj->_downloader->log(0, $e->getMessage());
-                    }
-                }
-
-                $j = &$obj;
-                $newparams[] = &$j;
-            }
-        }
-
-        if (count($newparams)) {
-            foreach ($newparams as $i => $unused) {
-                $params[] = &$newparams[$i];
-            }
-            return true;
-        }
-
-        return false;
-    }
-
-
-    /**
-     * @static
-     */
-    function willDownload($param, $params)
-    {
-        if (!is_array($params)) {
-            return false;
-        }
-
-        foreach ($params as $obj) {
-            if ($obj->isEqual($param)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * For simpler unit-testing
-     * @param PEAR_Config
-     * @param int
-     * @param string
-     */
-    function &getPackagefileObject(&$c, $d, $t = false)
-    {
-        $a = &new PEAR_PackageFile($c, $d, $t);
-        return $a;
-    }
-
-
-    /**
-     * This will retrieve from a local file if possible, and parse out
-     * a group name as well.  The original parameter will be modified to reflect this.
-     * @param string|array can be a parsed package name as well
-     * @access private
-     */
-    function _fromFile(&$param)
-    {
-        $saveparam = $param;
-        if (is_string($param)) {
-            if (!@file_exists($param)) {
-                $test = explode('#', $param);
-                $group = array_pop($test);
-                if (@file_exists(implode('#', $test))) {
-                    $this->setGroup($group);
-                    $param = implode('#', $test);
-                    $this->_explicitGroup = true;
-                }
-            }
-
-            if (@is_file($param)) {
-                $this->_type = 'local';
-                $options = $this->_downloader->getOptions();
-                if (isset($options['downloadonly'])) {
-                    $pkg = &$this->getPackagefileObject($this->_config,
-                        $this->_downloader->_debug);
-                } else {
-                    if (PEAR::isError($dir = $this->_downloader->getDownloadDir())) {
-                        return $dir;
-                    }
-                    $pkg = &$this->getPackagefileObject($this->_config,
-                        $this->_downloader->_debug, $dir);
-                }
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                $pf = &$pkg->fromAnyFile($param, PEAR_VALIDATE_INSTALLING);
-                PEAR::popErrorHandling();
-                if (PEAR::isError($pf)) {
-                    $this->_valid = false;
-                    $param = $saveparam;
-                    return $pf;
-                }
-                $this->_packagefile = &$pf;
-                if (!$this->getGroup()) {
-                    $this->setGroup('default'); // install the default dependency group
-                }
-                return $this->_valid = true;
-            }
-        }
-        $param = $saveparam;
-        return $this->_valid = false;
-    }
-
-    function _fromUrl($param, $saveparam = '')
-    {
-        if (!is_array($param) && (preg_match('#^(http|https|ftp)://#', $param))) {
-            $options = $this->_downloader->getOptions();
-            $this->_type = 'url';
-            $callback = $this->_downloader->ui ?
-                array(&$this->_downloader, '_downloadCallback') : null;
-            $this->_downloader->pushErrorHandling(PEAR_ERROR_RETURN);
-            if (PEAR::isError($dir = $this->_downloader->getDownloadDir())) {
-                $this->_downloader->popErrorHandling();
-                return $dir;
-            }
-
-            $this->_downloader->log(3, 'Downloading "' . $param . '"');
-            $file = $this->_downloader->downloadHttp($param, $this->_downloader->ui,
-                $dir, $callback, null, false, $this->getChannel());
-            $this->_downloader->popErrorHandling();
-            if (PEAR::isError($file)) {
-                if (!empty($saveparam)) {
-                    $saveparam = ", cannot download \"$saveparam\"";
-                }
-                $err = PEAR::raiseError('Could not download from "' . $param .
-                    '"' . $saveparam . ' (' . $file->getMessage() . ')');
-                    return $err;
-            }
-
-            if ($this->_rawpackagefile) {
-                require_once 'Archive/Tar.php';
-                $tar = &new Archive_Tar($file);
-                $packagexml = $tar->extractInString('package2.xml');
-                if (!$packagexml) {
-                    $packagexml = $tar->extractInString('package.xml');
-                }
-
-                if (str_replace(array("\n", "\r"), array('',''), $packagexml) !=
-                      str_replace(array("\n", "\r"), array('',''), $this->_rawpackagefile)) {
-                    if ($this->getChannel() != 'pear.php.net') {
-                        return PEAR::raiseError('CRITICAL ERROR: package.xml downloaded does ' .
-                            'not match value returned from xml-rpc');
-                    }
-
-                    // be more lax for the existing PEAR packages that have not-ok
-                    // characters in their package.xml
-                    $this->_downloader->log(0, 'CRITICAL WARNING: The "' .
-                        $this->getPackage() . '" package has invalid characters in its ' .
-                        'package.xml.  The next version of PEAR may not be able to install ' .
-                        'this package for security reasons.  Please open a bug report at ' .
-                        'http://pear.php.net/package/' . $this->getPackage() . '/bugs');
-                }
-            }
-
-            // whew, download worked!
-            if (isset($options['downloadonly'])) {
-                $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->debug);
-            } else {
-                $dir = $this->_downloader->getDownloadDir();
-                if (PEAR::isError($dir)) {
-                    return $dir;
-                }
-                $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->debug, $dir);
-            }
-
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $pf = &$pkg->fromAnyFile($file, PEAR_VALIDATE_INSTALLING);
-            PEAR::popErrorHandling();
-            if (PEAR::isError($pf)) {
-                if (is_array($pf->getUserInfo())) {
-                    foreach ($pf->getUserInfo() as $err) {
-                        if (is_array($err)) {
-                            $err = $err['message'];
-                        }
-
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(0, "Validation Error: $err");
-                        }
-                    }
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(0, $pf->getMessage());
-                }
-
-                ///FIXME need to pass back some error code that we can use to match with to cancel all further operations
-                /// At least stop all deps of this package from being installed
-                $out = $saveparam ? $saveparam : $param;
-                $err = PEAR::raiseError('Download of "' . $out . '" succeeded, but it is not a valid package archive');
-                $this->_valid = false;
-                return $err;
-            }
-
-            $this->_packagefile = &$pf;
-            $this->setGroup('default'); // install the default dependency group
-            return $this->_valid = true;
-        }
-
-        return $this->_valid = false;
-    }
-
-    /**
-     *
-     * @param string|array pass in an array of format
-     *                     array(
-     *                      'package' => 'pname',
-     *                     ['channel' => 'channame',]
-     *                     ['version' => 'version',]
-     *                     ['state' => 'state',])
-     *                     or a string of format [channame/]pname[-version|-state]
-     */
-    function _fromString($param)
-    {
-        $options = $this->_downloader->getOptions();
-        $channel = $this->_config->get('default_channel');
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $pname = $this->_registry->parsePackageName($param, $channel);
-        PEAR::popErrorHandling();
-        if (PEAR::isError($pname)) {
-            if ($pname->getCode() == 'invalid') {
-                $this->_valid = false;
-                return false;
-            }
-
-            if ($pname->getCode() == 'channel') {
-                $parsed = $pname->getUserInfo();
-                if ($this->_downloader->discover($parsed['channel'])) {
-                    if ($this->_config->get('auto_discover')) {
-                        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                        $pname = $this->_registry->parsePackageName($param, $channel);
-                        PEAR::popErrorHandling();
-                    } else {
-                        if (!isset($options['soft'])) {
-                            $this->_downloader->log(0, 'Channel "' . $parsed['channel'] .
-                                '" is not initialized, use ' .
-                                '"pear channel-discover ' . $parsed['channel'] . '" to initialize' .
-                                'or pear config-set auto_discover 1');
-                        }
-                    }
-                }
-
-                if (PEAR::isError($pname)) {
-                    if (!isset($options['soft'])) {
-                        $this->_downloader->log(0, $pname->getMessage());
-                    }
-
-                    if (is_array($param)) {
-                        $param = $this->_registry->parsedPackageNameToString($param);
-                    }
-
-                    $err = PEAR::raiseError('invalid package name/package file "' . $param . '"');
-                    $this->_valid = false;
-                    return $err;
-                }
-            } else {
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(0, $pname->getMessage());
-                }
-
-                $err = PEAR::raiseError('invalid package name/package file "' . $param . '"');
-                $this->_valid = false;
-                return $err;
-            }
-        }
-
-        if (!isset($this->_type)) {
-            $this->_type = 'rest';
-        }
-
-        $this->_parsedname    = $pname;
-        $this->_explicitState = isset($pname['state']) ? $pname['state'] : false;
-        $this->_explicitGroup = isset($pname['group']) ? true : false;
-
-        $info = $this->_downloader->_getPackageDownloadUrl($pname);
-        if (PEAR::isError($info)) {
-            if ($info->getCode() != -976 && $pname['channel'] == 'pear.php.net') {
-                // try pecl
-                $pname['channel'] = 'pecl.php.net';
-                if ($test = $this->_downloader->_getPackageDownloadUrl($pname)) {
-                    if (!PEAR::isError($test)) {
-                        $info = PEAR::raiseError($info->getMessage() . ' - package ' .
-                            $this->_registry->parsedPackageNameToString($pname, true) .
-                            ' can be installed with "pecl install ' . $pname['package'] .
-                            '"');
-                    } else {
-                        $pname['channel'] = 'pear.php.net';
-                    }
-                } else {
-                    $pname['channel'] = 'pear.php.net';
-                }
-            }
-
-            return $info;
-        }
-
-        $this->_rawpackagefile = $info['raw'];
-        $ret = $this->_analyzeDownloadURL($info, $param, $pname);
-        if (PEAR::isError($ret)) {
-            return $ret;
-        }
-
-        if ($ret) {
-            $this->_downloadURL = $ret;
-            return $this->_valid = (bool) $ret;
-        }
-    }
-
-    /**
-     * @param array output of package.getDownloadURL
-     * @param string|array|object information for detecting packages to be downloaded, and
-     *                            for errors
-     * @param array name information of the package
-     * @param array|null packages to be downloaded
-     * @param bool is this an optional dependency?
-     * @param bool is this any kind of dependency?
-     * @access private
-     */
-    function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false,
-                                 $isdependency = false)
-    {
-        if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
-            return false;
-        }
-
-        if ($info === false) {
-            $saveparam = !is_string($param) ? ", cannot download \"$param\"" : '';
-
-            // no releases exist
-            return PEAR::raiseError('No releases for package "' .
-                $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
-        }
-
-        if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
-            $err = false;
-            if ($pname['channel'] == 'pecl.php.net') {
-                if ($info['info']->getChannel() != 'pear.php.net') {
-                    $err = true;
-                }
-            } elseif ($info['info']->getChannel() == 'pecl.php.net') {
-                if ($pname['channel'] != 'pear.php.net') {
-                    $err = true;
-                }
-            } else {
-                $err = true;
-            }
-
-            if ($err) {
-                return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] .
-                    '" retrieved another channel\'s name for download! ("' .
-                    $info['info']->getChannel() . '")');
-            }
-        }
-
-        $preferred_state = $this->_config->get('preferred_state');
-        if (!isset($info['url'])) {
-            $package_version = $this->_registry->packageInfo($info['info']->getPackage(),
-            'version', $info['info']->getChannel());
-            if ($this->isInstalled($info)) {
-                if ($isdependency && version_compare($info['version'], $package_version, '<=')) {
-                    // ignore bogus errors of "failed to download dependency"
-                    // if it is already installed and the one that would be
-                    // downloaded is older or the same version (Bug #7219)
-                    return false;
-                }
-            }
-
-            if ($info['version'] === $package_version) {
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
-                        '/' . $pname['package'] . '-' . $package_version. ', additionally the suggested version' .
-                        ' (' . $package_version . ') is the same as the locally installed one.');
-                }
-
-                return false;
-            }
-
-            if (version_compare($info['version'], $package_version, '<=')) {
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
-                        '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' .
-                        ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').');
-                }
-
-                return false;
-            }
-
-            $instead =  ', will instead download version ' . $info['version'] .
-                        ', stability "' . $info['info']->getState() . '"';
-            // releases exist, but we failed to get any
-            if (isset($this->_downloader->_options['force'])) {
-                if (isset($pname['version'])) {
-                    $vs = ', version "' . $pname['version'] . '"';
-                } elseif (isset($pname['state'])) {
-                    $vs = ', stability "' . $pname['state'] . '"';
-                } elseif ($param == 'dependency') {
-                    if (!class_exists('PEAR_Common')) {
-                        require_once 'PEAR/Common.php';
-                    }
-
-                    if (!in_array($info['info']->getState(),
-                          PEAR_Common::betterStates($preferred_state, true))) {
-                        if ($optional) {
-                            // don't spit out confusing error message
-                            return $this->_downloader->_getPackageDownloadUrl(
-                                array('package' => $pname['package'],
-                                      'channel' => $pname['channel'],
-                                      'version' => $info['version']));
-                        }
-                        $vs = ' within preferred state "' . $preferred_state .
-                            '"';
-                    } else {
-                        if (!class_exists('PEAR_Dependency2')) {
-                            require_once 'PEAR/Dependency2.php';
-                        }
-
-                        if ($optional) {
-                            // don't spit out confusing error message
-                            return $this->_downloader->_getPackageDownloadUrl(
-                                array('package' => $pname['package'],
-                                      'channel' => $pname['channel'],
-                                      'version' => $info['version']));
-                        }
-                        $vs = PEAR_Dependency2::_getExtraString($pname);
-                        $instead = '';
-                    }
-                } else {
-                    $vs = ' within preferred state "' . $preferred_state . '"';
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
-                        '/' . $pname['package'] . $vs . $instead);
-                }
-
-                // download the latest release
-                return $this->_downloader->_getPackageDownloadUrl(
-                    array('package' => $pname['package'],
-                          'channel' => $pname['channel'],
-                          'version' => $info['version']));
-            } else {
-                if (isset($info['php']) && $info['php']) {
-                    $err = PEAR::raiseError('Failed to download ' .
-                        $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'],
-                                  'package' => $pname['package']),
-                                true) .
-                        ', latest release is version ' . $info['php']['v'] .
-                        ', but it requires PHP version "' .
-                        $info['php']['m'] . '", use "' .
-                        $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'], 'package' => $pname['package'],
-                            'version' => $info['php']['v'])) . '" to install',
-                            PEAR_DOWNLOADER_PACKAGE_PHPVERSION);
-                    return $err;
-                }
-
-                // construct helpful error message
-                if (isset($pname['version'])) {
-                    $vs = ', version "' . $pname['version'] . '"';
-                } elseif (isset($pname['state'])) {
-                    $vs = ', stability "' . $pname['state'] . '"';
-                } elseif ($param == 'dependency') {
-                    if (!class_exists('PEAR_Common')) {
-                        require_once 'PEAR/Common.php';
-                    }
-
-                    if (!in_array($info['info']->getState(),
-                          PEAR_Common::betterStates($preferred_state, true))) {
-                        if ($optional) {
-                            // don't spit out confusing error message, and don't die on
-                            // optional dep failure!
-                            return $this->_downloader->_getPackageDownloadUrl(
-                                array('package' => $pname['package'],
-                                      'channel' => $pname['channel'],
-                                      'version' => $info['version']));
-                        }
-                        $vs = ' within preferred state "' . $preferred_state . '"';
-                    } else {
-                        if (!class_exists('PEAR_Dependency2')) {
-                            require_once 'PEAR/Dependency2.php';
-                        }
-
-                        if ($optional) {
-                            // don't spit out confusing error message, and don't die on
-                            // optional dep failure!
-                            return $this->_downloader->_getPackageDownloadUrl(
-                                array('package' => $pname['package'],
-                                      'channel' => $pname['channel'],
-                                      'version' => $info['version']));
-                        }
-                        $vs = PEAR_Dependency2::_getExtraString($pname);
-                    }
-                } else {
-                    $vs = ' within preferred state "' . $this->_downloader->config->get('preferred_state') . '"';
-                }
-
-                $options = $this->_downloader->getOptions();
-                // this is only set by the "download-all" command
-                if (isset($options['ignorepreferred_state'])) {
-                    $err = PEAR::raiseError(
-                        'Failed to download ' . $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'], 'package' => $pname['package']),
-                                true)
-                         . $vs .
-                        ', latest release is version ' . $info['version'] .
-                        ', stability "' . $info['info']->getState() . '", use "' .
-                        $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'], 'package' => $pname['package'],
-                            'version' => $info['version'])) . '" to install',
-                            PEAR_DOWNLOADER_PACKAGE_STATE);
-                    return $err;
-                }
-
-                // Checks if the user has a package installed already and checks the release against
-                // the state against the installed package, this allows upgrades for packages
-                // with lower stability than the preferred_state
-                $stability = $this->_registry->packageInfo($pname['package'], 'stability', $pname['channel']);
-                if (!$this->isInstalled($info)
-                    || !in_array($info['info']->getState(), PEAR_Common::betterStates($stability['release'], true))
-                ) {
-                    $err = PEAR::raiseError(
-                        'Failed to download ' . $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'], 'package' => $pname['package']),
-                                true)
-                         . $vs .
-                        ', latest release is version ' . $info['version'] .
-                        ', stability "' . $info['info']->getState() . '", use "' .
-                        $this->_registry->parsedPackageNameToString(
-                            array('channel' => $pname['channel'], 'package' => $pname['package'],
-                            'version' => $info['version'])) . '" to install');
-                    return $err;
-                }
-            }
-        }
-
-        if (isset($info['deprecated']) && $info['deprecated']) {
-            $this->_downloader->log(0,
-                'WARNING: "' .
-                    $this->_registry->parsedPackageNameToString(
-                            array('channel' => $info['info']->getChannel(),
-                                  'package' => $info['info']->getPackage()), true) .
-                '" is deprecated in favor of "' .
-                    $this->_registry->parsedPackageNameToString($info['deprecated'], true) .
-                '"');
-        }
-
-        return $info;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/ErrorStack.php b/lib/php/PEAR/ErrorStack.php
deleted file mode 100644
index 7072ac9fc7d51c3e1330bbd81db29a8515db5ca1..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/ErrorStack.php
+++ /dev/null
@@ -1,985 +0,0 @@
-<?php
-/**
- * Error Stack Implementation
- * 
- * This is an incredibly simple implementation of a very complex error handling
- * facility.  It contains the ability
- * to track multiple errors from multiple packages simultaneously.  In addition,
- * it can track errors of many levels, save data along with the error, context
- * information such as the exact file, line number, class and function that
- * generated the error, and if necessary, it can raise a traditional PEAR_Error.
- * It has built-in support for PEAR::Log, to log errors as they occur
- * 
- * Since version 0.2alpha, it is also possible to selectively ignore errors,
- * through the use of an error callback, see {@link pushCallback()}
- * 
- * Since version 0.3alpha, it is possible to specify the exception class
- * returned from {@link push()}
- *
- * Since version PEAR1.3.2, ErrorStack no longer instantiates an exception class.  This can
- * still be done quite handily in an error callback or by manipulating the returned array
- * @category   Debugging
- * @package    PEAR_ErrorStack
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2004-2008 Greg Beaver
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: ErrorStack.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR_ErrorStack
- */
-
-/**
- * Singleton storage
- * 
- * Format:
- * <pre>
- * array(
- *  'package1' => PEAR_ErrorStack object,
- *  'package2' => PEAR_ErrorStack object,
- *  ...
- * )
- * </pre>
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_SINGLETON']
- */
-$GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array();
-
-/**
- * Global error callback (default)
- * 
- * This is only used if set to non-false.  * is the default callback for
- * all packages, whereas specific packages may set a default callback
- * for all instances, regardless of whether they are a singleton or not.
- *
- * To exclude non-singletons, only set the local callback for the singleton
- * @see PEAR_ErrorStack::setDefaultCallback()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK']
- */
-$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'] = array(
-    '*' => false,
-);
-
-/**
- * Global Log object (default)
- * 
- * This is only used if set to non-false.  Use to set a default log object for
- * all stacks, regardless of instantiation order or location
- * @see PEAR_ErrorStack::setDefaultLogger()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']
- */
-$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = false;
-
-/**
- * Global Overriding Callback
- * 
- * This callback will override any error callbacks that specific loggers have set.
- * Use with EXTREME caution
- * @see PEAR_ErrorStack::staticPushCallback()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']
- */
-$GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
-
-/**#@+
- * One of four possible return values from the error Callback
- * @see PEAR_ErrorStack::_errorCallback()
- */
-/**
- * If this is returned, then the error will be both pushed onto the stack
- * and logged.
- */
-define('PEAR_ERRORSTACK_PUSHANDLOG', 1);
-/**
- * If this is returned, then the error will only be pushed onto the stack,
- * and not logged.
- */
-define('PEAR_ERRORSTACK_PUSH', 2);
-/**
- * If this is returned, then the error will only be logged, but not pushed
- * onto the error stack.
- */
-define('PEAR_ERRORSTACK_LOG', 3);
-/**
- * If this is returned, then the error is completely ignored.
- */
-define('PEAR_ERRORSTACK_IGNORE', 4);
-/**
- * If this is returned, then the error is logged and die() is called.
- */
-define('PEAR_ERRORSTACK_DIE', 5);
-/**#@-*/
-
-/**
- * Error code for an attempt to instantiate a non-class as a PEAR_ErrorStack in
- * the singleton method.
- */
-define('PEAR_ERRORSTACK_ERR_NONCLASS', 1);
-
-/**
- * Error code for an attempt to pass an object into {@link PEAR_ErrorStack::getMessage()}
- * that has no __toString() method
- */
-define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2);
-/**
- * Error Stack Implementation
- *
- * Usage:
- * <code>
- * // global error stack
- * $global_stack = &PEAR_ErrorStack::singleton('MyPackage');
- * // local error stack
- * $local_stack = new PEAR_ErrorStack('MyPackage');
- * </code>
- * @author     Greg Beaver <cellog@php.net>
- * @version    1.9.0
- * @package    PEAR_ErrorStack
- * @category   Debugging
- * @copyright  2004-2008 Greg Beaver
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: ErrorStack.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR_ErrorStack
- */
-class PEAR_ErrorStack {
-    /**
-     * Errors are stored in the order that they are pushed on the stack.
-     * @since 0.4alpha Errors are no longer organized by error level.
-     * This renders pop() nearly unusable, and levels could be more easily
-     * handled in a callback anyway
-     * @var array
-     * @access private
-     */
-    var $_errors = array();
-
-    /**
-     * Storage of errors by level.
-     *
-     * Allows easy retrieval and deletion of only errors from a particular level
-     * @since PEAR 1.4.0dev
-     * @var array
-     * @access private
-     */
-    var $_errorsByLevel = array();
-
-    /**
-     * Package name this error stack represents
-     * @var string
-     * @access protected
-     */
-    var $_package;
-    
-    /**
-     * Determines whether a PEAR_Error is thrown upon every error addition
-     * @var boolean
-     * @access private
-     */
-    var $_compat = false;
-    
-    /**
-     * If set to a valid callback, this will be used to generate the error
-     * message from the error code, otherwise the message passed in will be
-     * used
-     * @var false|string|array
-     * @access private
-     */
-    var $_msgCallback = false;
-    
-    /**
-     * If set to a valid callback, this will be used to generate the error
-     * context for an error.  For PHP-related errors, this will be a file
-     * and line number as retrieved from debug_backtrace(), but can be
-     * customized for other purposes.  The error might actually be in a separate
-     * configuration file, or in a database query.
-     * @var false|string|array
-     * @access protected
-     */
-    var $_contextCallback = false;
-    
-    /**
-     * If set to a valid callback, this will be called every time an error
-     * is pushed onto the stack.  The return value will be used to determine
-     * whether to allow an error to be pushed or logged.
-     * 
-     * The return value must be one an PEAR_ERRORSTACK_* constant
-     * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
-     * @var false|string|array
-     * @access protected
-     */
-    var $_errorCallback = array();
-    
-    /**
-     * PEAR::Log object for logging errors
-     * @var false|Log
-     * @access protected
-     */
-    var $_logger = false;
-    
-    /**
-     * Error messages - designed to be overridden
-     * @var array
-     * @abstract
-     */
-    var $_errorMsgs = array();
-    
-    /**
-     * Set up a new error stack
-     * 
-     * @param string   $package name of the package this error stack represents
-     * @param callback $msgCallback callback used for error message generation
-     * @param callback $contextCallback callback used for context generation,
-     *                 defaults to {@link getFileLine()}
-     * @param boolean  $throwPEAR_Error
-     */
-    function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false,
-                         $throwPEAR_Error = false)
-    {
-        $this->_package = $package;
-        $this->setMessageCallback($msgCallback);
-        $this->setContextCallback($contextCallback);
-        $this->_compat = $throwPEAR_Error;
-    }
-    
-    /**
-     * Return a single error stack for this package.
-     * 
-     * Note that all parameters are ignored if the stack for package $package
-     * has already been instantiated
-     * @param string   $package name of the package this error stack represents
-     * @param callback $msgCallback callback used for error message generation
-     * @param callback $contextCallback callback used for context generation,
-     *                 defaults to {@link getFileLine()}
-     * @param boolean  $throwPEAR_Error
-     * @param string   $stackClass class to instantiate
-     * @static
-     * @return PEAR_ErrorStack
-     */
-    function &singleton($package, $msgCallback = false, $contextCallback = false,
-                         $throwPEAR_Error = false, $stackClass = 'PEAR_ErrorStack')
-    {
-        if (isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
-            return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package];
-        }
-        if (!class_exists($stackClass)) {
-            if (function_exists('debug_backtrace')) {
-                $trace = debug_backtrace();
-            }
-            PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_NONCLASS,
-                'exception', array('stackclass' => $stackClass),
-                'stack class "%stackclass%" is not a valid class name (should be like PEAR_ErrorStack)',
-                false, $trace);
-        }
-        $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package] =
-            new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error);
-
-        return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package];
-    }
-
-    /**
-     * Internal error handler for PEAR_ErrorStack class
-     * 
-     * Dies if the error is an exception (and would have died anyway)
-     * @access private
-     */
-    function _handleError($err)
-    {
-        if ($err['level'] == 'exception') {
-            $message = $err['message'];
-            if (isset($_SERVER['REQUEST_URI'])) {
-                echo '<br />';
-            } else {
-                echo "\n";
-            }
-            var_dump($err['context']);
-            die($message);
-        }
-    }
-    
-    /**
-     * Set up a PEAR::Log object for all error stacks that don't have one
-     * @param Log $log 
-     * @static
-     */
-    function setDefaultLogger(&$log)
-    {
-        if (is_object($log) && method_exists($log, 'log') ) {
-            $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log;
-        } elseif (is_callable($log)) {
-            $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log;
-	}
-    }
-    
-    /**
-     * Set up a PEAR::Log object for this error stack
-     * @param Log $log 
-     */
-    function setLogger(&$log)
-    {
-        if (is_object($log) && method_exists($log, 'log') ) {
-            $this->_logger = &$log;
-        } elseif (is_callable($log)) {
-            $this->_logger = &$log;
-        }
-    }
-    
-    /**
-     * Set an error code => error message mapping callback
-     * 
-     * This method sets the callback that can be used to generate error
-     * messages for any instance
-     * @param array|string Callback function/method
-     */
-    function setMessageCallback($msgCallback)
-    {
-        if (!$msgCallback) {
-            $this->_msgCallback = array(&$this, 'getErrorMessage');
-        } else {
-            if (is_callable($msgCallback)) {
-                $this->_msgCallback = $msgCallback;
-            }
-        }
-    }
-    
-    /**
-     * Get an error code => error message mapping callback
-     * 
-     * This method returns the current callback that can be used to generate error
-     * messages
-     * @return array|string|false Callback function/method or false if none
-     */
-    function getMessageCallback()
-    {
-        return $this->_msgCallback;
-    }
-    
-    /**
-     * Sets a default callback to be used by all error stacks
-     * 
-     * This method sets the callback that can be used to generate error
-     * messages for a singleton
-     * @param array|string Callback function/method
-     * @param string Package name, or false for all packages
-     * @static
-     */
-    function setDefaultCallback($callback = false, $package = false)
-    {
-        if (!is_callable($callback)) {
-            $callback = false;
-        }
-        $package = $package ? $package : '*';
-        $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$package] = $callback;
-    }
-    
-    /**
-     * Set a callback that generates context information (location of error) for an error stack
-     * 
-     * This method sets the callback that can be used to generate context
-     * information for an error.  Passing in NULL will disable context generation
-     * and remove the expensive call to debug_backtrace()
-     * @param array|string|null Callback function/method
-     */
-    function setContextCallback($contextCallback)
-    {
-        if ($contextCallback === null) {
-            return $this->_contextCallback = false;
-        }
-        if (!$contextCallback) {
-            $this->_contextCallback = array(&$this, 'getFileLine');
-        } else {
-            if (is_callable($contextCallback)) {
-                $this->_contextCallback = $contextCallback;
-            }
-        }
-    }
-    
-    /**
-     * Set an error Callback
-     * If set to a valid callback, this will be called every time an error
-     * is pushed onto the stack.  The return value will be used to determine
-     * whether to allow an error to be pushed or logged.
-     * 
-     * The return value must be one of the ERRORSTACK_* constants.
-     * 
-     * This functionality can be used to emulate PEAR's pushErrorHandling, and
-     * the PEAR_ERROR_CALLBACK mode, without affecting the integrity of
-     * the error stack or logging
-     * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
-     * @see popCallback()
-     * @param string|array $cb
-     */
-    function pushCallback($cb)
-    {
-        array_push($this->_errorCallback, $cb);
-    }
-    
-    /**
-     * Remove a callback from the error callback stack
-     * @see pushCallback()
-     * @return array|string|false
-     */
-    function popCallback()
-    {
-        if (!count($this->_errorCallback)) {
-            return false;
-        }
-        return array_pop($this->_errorCallback);
-    }
-    
-    /**
-     * Set a temporary overriding error callback for every package error stack
-     *
-     * Use this to temporarily disable all existing callbacks (can be used
-     * to emulate the @ operator, for instance)
-     * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
-     * @see staticPopCallback(), pushCallback()
-     * @param string|array $cb
-     * @static
-     */
-    function staticPushCallback($cb)
-    {
-        array_push($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'], $cb);
-    }
-    
-    /**
-     * Remove a temporary overriding error callback
-     * @see staticPushCallback()
-     * @return array|string|false
-     * @static
-     */
-    function staticPopCallback()
-    {
-        $ret = array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']);
-        if (!is_array($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'])) {
-            $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
-        }
-        return $ret;
-    }
-    
-    /**
-     * Add an error to the stack
-     * 
-     * If the message generator exists, it is called with 2 parameters.
-     *  - the current Error Stack object
-     *  - an array that is in the same format as an error.  Available indices
-     *    are 'code', 'package', 'time', 'params', 'level', and 'context'
-     * 
-     * Next, if the error should contain context information, this is
-     * handled by the context grabbing method.
-     * Finally, the error is pushed onto the proper error stack
-     * @param int    $code      Package-specific error code
-     * @param string $level     Error level.  This is NOT spell-checked
-     * @param array  $params    associative array of error parameters
-     * @param string $msg       Error message, or a portion of it if the message
-     *                          is to be generated
-     * @param array  $repackage If this error re-packages an error pushed by
-     *                          another package, place the array returned from
-     *                          {@link pop()} in this parameter
-     * @param array  $backtrace Protected parameter: use this to pass in the
-     *                          {@link debug_backtrace()} that should be used
-     *                          to find error context
-     * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also
-     * thrown.  If a PEAR_Error is returned, the userinfo
-     * property is set to the following array:
-     * 
-     * <code>
-     * array(
-     *    'code' => $code,
-     *    'params' => $params,
-     *    'package' => $this->_package,
-     *    'level' => $level,
-     *    'time' => time(),
-     *    'context' => $context,
-     *    'message' => $msg,
-     * //['repackage' => $err] repackaged error array/Exception class
-     * );
-     * </code>
-     * 
-     * Normally, the previous array is returned.
-     */
-    function push($code, $level = 'error', $params = array(), $msg = false,
-                  $repackage = false, $backtrace = false)
-    {
-        $context = false;
-        // grab error context
-        if ($this->_contextCallback) {
-            if (!$backtrace) {
-                $backtrace = debug_backtrace();
-            }
-            $context = call_user_func($this->_contextCallback, $code, $params, $backtrace);
-        }
-        
-        // save error
-        $time = explode(' ', microtime());
-        $time = $time[1] + $time[0];
-        $err = array(
-                'code' => $code,
-                'params' => $params,
-                'package' => $this->_package,
-                'level' => $level,
-                'time' => $time,
-                'context' => $context,
-                'message' => $msg,
-               );
-
-        if ($repackage) {
-            $err['repackage'] = $repackage;
-        }
-
-        // set up the error message, if necessary
-        if ($this->_msgCallback) {
-            $msg = call_user_func_array($this->_msgCallback,
-                                        array(&$this, $err));
-            $err['message'] = $msg;
-        }        
-        $push = $log = true;
-        $die = false;
-        // try the overriding callback first
-        $callback = $this->staticPopCallback();
-        if ($callback) {
-            $this->staticPushCallback($callback);
-        }
-        if (!is_callable($callback)) {
-            // try the local callback next
-            $callback = $this->popCallback();
-            if (is_callable($callback)) {
-                $this->pushCallback($callback);
-            } else {
-                // try the default callback
-                $callback = isset($GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package]) ?
-                    $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package] :
-                    $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK']['*'];
-            }
-        }
-        if (is_callable($callback)) {
-            switch(call_user_func($callback, $err)){
-            	case PEAR_ERRORSTACK_IGNORE: 
-            		return $err;
-        		break;
-            	case PEAR_ERRORSTACK_PUSH: 
-            		$log = false;
-        		break;
-            	case PEAR_ERRORSTACK_LOG: 
-            		$push = false;
-        		break;
-            	case PEAR_ERRORSTACK_DIE: 
-            		$die = true;
-        		break;
-                // anything else returned has the same effect as pushandlog
-            }
-        }
-        if ($push) {
-            array_unshift($this->_errors, $err);
-            if (!isset($this->_errorsByLevel[$err['level']])) {
-                $this->_errorsByLevel[$err['level']] = array();
-            }
-            $this->_errorsByLevel[$err['level']][] = &$this->_errors[0];
-        }
-        if ($log) {
-            if ($this->_logger || $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']) {
-                $this->_log($err);
-            }
-        }
-        if ($die) {
-            die();
-        }
-        if ($this->_compat && $push) {
-            return $this->raiseError($msg, $code, null, null, $err);
-        }
-        return $err;
-    }
-    
-    /**
-     * Static version of {@link push()}
-     * 
-     * @param string $package   Package name this error belongs to
-     * @param int    $code      Package-specific error code
-     * @param string $level     Error level.  This is NOT spell-checked
-     * @param array  $params    associative array of error parameters
-     * @param string $msg       Error message, or a portion of it if the message
-     *                          is to be generated
-     * @param array  $repackage If this error re-packages an error pushed by
-     *                          another package, place the array returned from
-     *                          {@link pop()} in this parameter
-     * @param array  $backtrace Protected parameter: use this to pass in the
-     *                          {@link debug_backtrace()} that should be used
-     *                          to find error context
-     * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also
-     *                          thrown.  see docs for {@link push()}
-     * @static
-     */
-    function staticPush($package, $code, $level = 'error', $params = array(),
-                        $msg = false, $repackage = false, $backtrace = false)
-    {
-        $s = &PEAR_ErrorStack::singleton($package);
-        if ($s->_contextCallback) {
-            if (!$backtrace) {
-                if (function_exists('debug_backtrace')) {
-                    $backtrace = debug_backtrace();
-                }
-            }
-        }
-        return $s->push($code, $level, $params, $msg, $repackage, $backtrace);
-    }
-    
-    /**
-     * Log an error using PEAR::Log
-     * @param array $err Error array
-     * @param array $levels Error level => Log constant map
-     * @access protected
-     */
-    function _log($err)
-    {
-        if ($this->_logger) {
-            $logger = &$this->_logger;
-        } else {
-            $logger = &$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'];
-        }
-        if (is_a($logger, 'Log')) {
-            $levels = array(
-                'exception' => PEAR_LOG_CRIT,
-                'alert' => PEAR_LOG_ALERT,
-                'critical' => PEAR_LOG_CRIT,
-                'error' => PEAR_LOG_ERR,
-                'warning' => PEAR_LOG_WARNING,
-                'notice' => PEAR_LOG_NOTICE,
-                'info' => PEAR_LOG_INFO,
-                'debug' => PEAR_LOG_DEBUG);
-            if (isset($levels[$err['level']])) {
-                $level = $levels[$err['level']];
-            } else {
-                $level = PEAR_LOG_INFO;
-            }
-            $logger->log($err['message'], $level, $err);
-        } else { // support non-standard logs
-            call_user_func($logger, $err);
-        }
-    }
-
-    
-    /**
-     * Pop an error off of the error stack
-     * 
-     * @return false|array
-     * @since 0.4alpha it is no longer possible to specify a specific error
-     * level to return - the last error pushed will be returned, instead
-     */
-    function pop()
-    {
-        $err = @array_shift($this->_errors);
-        if (!is_null($err)) {
-            @array_pop($this->_errorsByLevel[$err['level']]);
-            if (!count($this->_errorsByLevel[$err['level']])) {
-                unset($this->_errorsByLevel[$err['level']]);
-            }
-        }
-        return $err;
-    }
-
-    /**
-     * Pop an error off of the error stack, static method
-     *
-     * @param string package name
-     * @return boolean
-     * @since PEAR1.5.0a1
-     */
-    function staticPop($package)
-    {
-        if ($package) {
-            if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
-                return false;
-            }
-            return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->pop();
-        }
-    }
-
-    /**
-     * Determine whether there are any errors on the stack
-     * @param string|array Level name.  Use to determine if any errors
-     * of level (string), or levels (array) have been pushed
-     * @return boolean
-     */
-    function hasErrors($level = false)
-    {
-        if ($level) {
-            return isset($this->_errorsByLevel[$level]);
-        }
-        return count($this->_errors);
-    }
-    
-    /**
-     * Retrieve all errors since last purge
-     * 
-     * @param boolean set in order to empty the error stack
-     * @param string level name, to return only errors of a particular severity
-     * @return array
-     */
-    function getErrors($purge = false, $level = false)
-    {
-        if (!$purge) {
-            if ($level) {
-                if (!isset($this->_errorsByLevel[$level])) {
-                    return array();
-                } else {
-                    return $this->_errorsByLevel[$level];
-                }
-            } else {
-                return $this->_errors;
-            }
-        }
-        if ($level) {
-            $ret = $this->_errorsByLevel[$level];
-            foreach ($this->_errorsByLevel[$level] as $i => $unused) {
-                // entries are references to the $_errors array
-                $this->_errorsByLevel[$level][$i] = false;
-            }
-            // array_filter removes all entries === false
-            $this->_errors = array_filter($this->_errors);
-            unset($this->_errorsByLevel[$level]);
-            return $ret;
-        }
-        $ret = $this->_errors;
-        $this->_errors = array();
-        $this->_errorsByLevel = array();
-        return $ret;
-    }
-    
-    /**
-     * Determine whether there are any errors on a single error stack, or on any error stack
-     *
-     * The optional parameter can be used to test the existence of any errors without the need of
-     * singleton instantiation
-     * @param string|false Package name to check for errors
-     * @param string Level name to check for a particular severity
-     * @return boolean
-     * @static
-     */
-    function staticHasErrors($package = false, $level = false)
-    {
-        if ($package) {
-            if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
-                return false;
-            }
-            return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->hasErrors($level);
-        }
-        foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) {
-            if ($obj->hasErrors($level)) {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    /**
-     * Get a list of all errors since last purge, organized by package
-     * @since PEAR 1.4.0dev BC break! $level is now in the place $merge used to be
-     * @param boolean $purge Set to purge the error stack of existing errors
-     * @param string  $level Set to a level name in order to retrieve only errors of a particular level
-     * @param boolean $merge Set to return a flat array, not organized by package
-     * @param array   $sortfunc Function used to sort a merged array - default
-     *        sorts by time, and should be good for most cases
-     * @static
-     * @return array 
-     */
-    function staticGetErrors($purge = false, $level = false, $merge = false,
-                             $sortfunc = array('PEAR_ErrorStack', '_sortErrors'))
-    {
-        $ret = array();
-        if (!is_callable($sortfunc)) {
-            $sortfunc = array('PEAR_ErrorStack', '_sortErrors');
-        }
-        foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) {
-            $test = $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->getErrors($purge, $level);
-            if ($test) {
-                if ($merge) {
-                    $ret = array_merge($ret, $test);
-                } else {
-                    $ret[$package] = $test;
-                }
-            }
-        }
-        if ($merge) {
-            usort($ret, $sortfunc);
-        }
-        return $ret;
-    }
-    
-    /**
-     * Error sorting function, sorts by time
-     * @access private
-     */
-    function _sortErrors($a, $b)
-    {
-        if ($a['time'] == $b['time']) {
-            return 0;
-        }
-        if ($a['time'] < $b['time']) {
-            return 1;
-        }
-        return -1;
-    }
-
-    /**
-     * Standard file/line number/function/class context callback
-     *
-     * This function uses a backtrace generated from {@link debug_backtrace()}
-     * and so will not work at all in PHP < 4.3.0.  The frame should
-     * reference the frame that contains the source of the error.
-     * @return array|false either array('file' => file, 'line' => line,
-     *         'function' => function name, 'class' => class name) or
-     *         if this doesn't work, then false
-     * @param unused
-     * @param integer backtrace frame.
-     * @param array Results of debug_backtrace()
-     * @static
-     */
-    function getFileLine($code, $params, $backtrace = null)
-    {
-        if ($backtrace === null) {
-            return false;
-        }
-        $frame = 0;
-        $functionframe = 1;
-        if (!isset($backtrace[1])) {
-            $functionframe = 0;
-        } else {
-            while (isset($backtrace[$functionframe]['function']) &&
-                  $backtrace[$functionframe]['function'] == 'eval' &&
-                  isset($backtrace[$functionframe + 1])) {
-                $functionframe++;
-            }
-        }
-        if (isset($backtrace[$frame])) {
-            if (!isset($backtrace[$frame]['file'])) {
-                $frame++;
-            }
-            $funcbacktrace = $backtrace[$functionframe];
-            $filebacktrace = $backtrace[$frame];
-            $ret = array('file' => $filebacktrace['file'],
-                         'line' => $filebacktrace['line']);
-            // rearrange for eval'd code or create function errors
-            if (strpos($filebacktrace['file'], '(') && 
-            	  preg_match(';^(.*?)\((\d+)\) : (.*?)\\z;', $filebacktrace['file'],
-                  $matches)) {
-                $ret['file'] = $matches[1];
-                $ret['line'] = $matches[2] + 0;
-            }
-            if (isset($funcbacktrace['function']) && isset($backtrace[1])) {
-                if ($funcbacktrace['function'] != 'eval') {
-                    if ($funcbacktrace['function'] == '__lambda_func') {
-                        $ret['function'] = 'create_function() code';
-                    } else {
-                        $ret['function'] = $funcbacktrace['function'];
-                    }
-                }
-            }
-            if (isset($funcbacktrace['class']) && isset($backtrace[1])) {
-                $ret['class'] = $funcbacktrace['class'];
-            }
-            return $ret;
-        }
-        return false;
-    }
-    
-    /**
-     * Standard error message generation callback
-     * 
-     * This method may also be called by a custom error message generator
-     * to fill in template values from the params array, simply
-     * set the third parameter to the error message template string to use
-     * 
-     * The special variable %__msg% is reserved: use it only to specify
-     * where a message passed in by the user should be placed in the template,
-     * like so:
-     * 
-     * Error message: %msg% - internal error
-     * 
-     * If the message passed like so:
-     * 
-     * <code>
-     * $stack->push(ERROR_CODE, 'error', array(), 'server error 500');
-     * </code>
-     * 
-     * The returned error message will be "Error message: server error 500 -
-     * internal error"
-     * @param PEAR_ErrorStack
-     * @param array
-     * @param string|false Pre-generated error message template
-     * @static
-     * @return string
-     */
-    function getErrorMessage(&$stack, $err, $template = false)
-    {
-        if ($template) {
-            $mainmsg = $template;
-        } else {
-            $mainmsg = $stack->getErrorMessageTemplate($err['code']);
-        }
-        $mainmsg = str_replace('%__msg%', $err['message'], $mainmsg);
-        if (is_array($err['params']) && count($err['params'])) {
-            foreach ($err['params'] as $name => $val) {
-                if (is_array($val)) {
-                    // @ is needed in case $val is a multi-dimensional array
-                    $val = @implode(', ', $val);
-                }
-                if (is_object($val)) {
-                    if (method_exists($val, '__toString')) {
-                        $val = $val->__toString();
-                    } else {
-                        PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_OBJTOSTRING,
-                            'warning', array('obj' => get_class($val)),
-                            'object %obj% passed into getErrorMessage, but has no __toString() method');
-                        $val = 'Object';
-                    }
-                }
-                $mainmsg = str_replace('%' . $name . '%', $val, $mainmsg);
-            }
-        }
-        return $mainmsg;
-    }
-    
-    /**
-     * Standard Error Message Template generator from code
-     * @return string
-     */
-    function getErrorMessageTemplate($code)
-    {
-        if (!isset($this->_errorMsgs[$code])) {
-            return '%__msg%';
-        }
-        return $this->_errorMsgs[$code];
-    }
-    
-    /**
-     * Set the Error Message Template array
-     * 
-     * The array format must be:
-     * <pre>
-     * array(error code => 'message template',...)
-     * </pre>
-     * 
-     * Error message parameters passed into {@link push()} will be used as input
-     * for the error message.  If the template is 'message %foo% was %bar%', and the
-     * parameters are array('foo' => 'one', 'bar' => 'six'), the error message returned will
-     * be 'message one was six'
-     * @return string
-     */
-    function setErrorMessageTemplate($template)
-    {
-        $this->_errorMsgs = $template;
-    }
-    
-    
-    /**
-     * emulate PEAR::raiseError()
-     * 
-     * @return PEAR_Error
-     */
-    function raiseError()
-    {
-        require_once 'PEAR.php';
-        $args = func_get_args();
-        return call_user_func_array(array('PEAR', 'raiseError'), $args);
-    }
-}
-$stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack');
-$stack->pushCallback(array('PEAR_ErrorStack', '_handleError'));
-?>
diff --git a/lib/php/PEAR/Exception.php b/lib/php/PEAR/Exception.php
deleted file mode 100644
index ba4dd21976e2465fa46b3a56f65315961213b406..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Exception.php
+++ /dev/null
@@ -1,391 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-/**
- * PEAR_Exception
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @author     Hans Lellelid <hans@velum.net>
- * @author     Bertrand Mansion <bmansion@mamasam.com>
- * @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: Exception.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.3.3
- */
-
-
-/**
- * Base PEAR_Exception Class
- *
- * 1) Features:
- *
- * - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception))
- * - Definable triggers, shot when exceptions occur
- * - Pretty and informative error messages
- * - Added more context info available (like class, method or cause)
- * - cause can be a PEAR_Exception or an array of mixed
- *   PEAR_Exceptions/PEAR_ErrorStack warnings
- * - callbacks for specific exception classes and their children
- *
- * 2) Ideas:
- *
- * - Maybe a way to define a 'template' for the output
- *
- * 3) Inherited properties from PHP Exception Class:
- *
- * protected $message
- * protected $code
- * protected $line
- * protected $file
- * private   $trace
- *
- * 4) Inherited methods from PHP Exception Class:
- *
- * __clone
- * __construct
- * getMessage
- * getCode
- * getFile
- * getLine
- * getTraceSafe
- * getTraceSafeAsString
- * __toString
- *
- * 5) Usage example
- *
- * <code>
- *  require_once 'PEAR/Exception.php';
- *
- *  class Test {
- *     function foo() {
- *         throw new PEAR_Exception('Error Message', ERROR_CODE);
- *     }
- *  }
- *
- *  function myLogger($pear_exception) {
- *     echo $pear_exception->getMessage();
- *  }
- *  // each time a exception is thrown the 'myLogger' will be called
- *  // (its use is completely optional)
- *  PEAR_Exception::addObserver('myLogger');
- *  $test = new Test;
- *  try {
- *     $test->foo();
- *  } catch (PEAR_Exception $e) {
- *     print $e;
- *  }
- * </code>
- *
- * @category   pear
- * @package    PEAR
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @author     Hans Lellelid <hans@velum.net>
- * @author     Bertrand Mansion <bmansion@mamasam.com>
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.3.3
- *
- */
-class PEAR_Exception extends Exception
-{
-    const OBSERVER_PRINT = -2;
-    const OBSERVER_TRIGGER = -4;
-    const OBSERVER_DIE = -8;
-    protected $cause;
-    private static $_observers = array();
-    private static $_uniqueid = 0;
-    private $_trace;
-
-    /**
-     * Supported signatures:
-     *  - PEAR_Exception(string $message);
-     *  - PEAR_Exception(string $message, int $code);
-     *  - PEAR_Exception(string $message, Exception $cause);
-     *  - PEAR_Exception(string $message, Exception $cause, int $code);
-     *  - PEAR_Exception(string $message, PEAR_Error $cause);
-     *  - PEAR_Exception(string $message, PEAR_Error $cause, int $code);
-     *  - PEAR_Exception(string $message, array $causes);
-     *  - PEAR_Exception(string $message, array $causes, int $code);
-     * @param string exception message
-     * @param int|Exception|PEAR_Error|array|null exception cause
-     * @param int|null exception code or null
-     */
-    public function __construct($message, $p2 = null, $p3 = null)
-    {
-        if (is_int($p2)) {
-            $code = $p2;
-            $this->cause = null;
-        } elseif (is_object($p2) || is_array($p2)) {
-            // using is_object allows both Exception and PEAR_Error
-            if (is_object($p2) && !($p2 instanceof Exception)) {
-                if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) {
-                    throw new PEAR_Exception('exception cause must be Exception, ' .
-                        'array, or PEAR_Error');
-                }
-            }
-            $code = $p3;
-            if (is_array($p2) && isset($p2['message'])) {
-                // fix potential problem of passing in a single warning
-                $p2 = array($p2);
-            }
-            $this->cause = $p2;
-        } else {
-            $code = null;
-            $this->cause = null;
-        }
-        parent::__construct($message, $code);
-        $this->signal();
-    }
-
-    /**
-     * @param mixed $callback  - A valid php callback, see php func is_callable()
-     *                         - A PEAR_Exception::OBSERVER_* constant
-     *                         - An array(const PEAR_Exception::OBSERVER_*,
-     *                           mixed $options)
-     * @param string $label    The name of the observer. Use this if you want
-     *                         to remove it later with removeObserver()
-     */
-    public static function addObserver($callback, $label = 'default')
-    {
-        self::$_observers[$label] = $callback;
-    }
-
-    public static function removeObserver($label = 'default')
-    {
-        unset(self::$_observers[$label]);
-    }
-
-    /**
-     * @return int unique identifier for an observer
-     */
-    public static function getUniqueId()
-    {
-        return self::$_uniqueid++;
-    }
-
-    private function signal()
-    {
-        foreach (self::$_observers as $func) {
-            if (is_callable($func)) {
-                call_user_func($func, $this);
-                continue;
-            }
-            settype($func, 'array');
-            switch ($func[0]) {
-                case self::OBSERVER_PRINT :
-                    $f = (isset($func[1])) ? $func[1] : '%s';
-                    printf($f, $this->getMessage());
-                    break;
-                case self::OBSERVER_TRIGGER :
-                    $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
-                    trigger_error($this->getMessage(), $f);
-                    break;
-                case self::OBSERVER_DIE :
-                    $f = (isset($func[1])) ? $func[1] : '%s';
-                    die(printf($f, $this->getMessage()));
-                    break;
-                default:
-                    trigger_error('invalid observer type', E_USER_WARNING);
-            }
-        }
-    }
-
-    /**
-     * Return specific error information that can be used for more detailed
-     * error messages or translation.
-     *
-     * This method may be overridden in child exception classes in order
-     * to add functionality not present in PEAR_Exception and is a placeholder
-     * to define API
-     *
-     * The returned array must be an associative array of parameter => value like so:
-     * <pre>
-     * array('name' => $name, 'context' => array(...))
-     * </pre>
-     * @return array
-     */
-    public function getErrorData()
-    {
-        return array();
-    }
-
-    /**
-     * Returns the exception that caused this exception to be thrown
-     * @access public
-     * @return Exception|array The context of the exception
-     */
-    public function getCause()
-    {
-        return $this->cause;
-    }
-
-    /**
-     * Function must be public to call on caused exceptions
-     * @param array
-     */
-    public function getCauseMessage(&$causes)
-    {
-        $trace = $this->getTraceSafe();
-        $cause = array('class'   => get_class($this),
-                       'message' => $this->message,
-                       'file' => 'unknown',
-                       'line' => 'unknown');
-        if (isset($trace[0])) {
-            if (isset($trace[0]['file'])) {
-                $cause['file'] = $trace[0]['file'];
-                $cause['line'] = $trace[0]['line'];
-            }
-        }
-        $causes[] = $cause;
-        if ($this->cause instanceof PEAR_Exception) {
-            $this->cause->getCauseMessage($causes);
-        } elseif ($this->cause instanceof Exception) {
-            $causes[] = array('class'   => get_class($this->cause),
-                              'message' => $this->cause->getMessage(),
-                              'file' => $this->cause->getFile(),
-                              'line' => $this->cause->getLine());
-        } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
-            $causes[] = array('class' => get_class($this->cause),
-                              'message' => $this->cause->getMessage(),
-                              'file' => 'unknown',
-                              'line' => 'unknown');
-        } elseif (is_array($this->cause)) {
-            foreach ($this->cause as $cause) {
-                if ($cause instanceof PEAR_Exception) {
-                    $cause->getCauseMessage($causes);
-                } elseif ($cause instanceof Exception) {
-                    $causes[] = array('class'   => get_class($cause),
-                                   'message' => $cause->getMessage(),
-                                   'file' => $cause->getFile(),
-                                   'line' => $cause->getLine());
-                } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) {
-                    $causes[] = array('class' => get_class($cause),
-                                      'message' => $cause->getMessage(),
-                                      'file' => 'unknown',
-                                      'line' => 'unknown');
-                } elseif (is_array($cause) && isset($cause['message'])) {
-                    // PEAR_ErrorStack warning
-                    $causes[] = array(
-                        'class' => $cause['package'],
-                        'message' => $cause['message'],
-                        'file' => isset($cause['context']['file']) ?
-                                            $cause['context']['file'] :
-                                            'unknown',
-                        'line' => isset($cause['context']['line']) ?
-                                            $cause['context']['line'] :
-                                            'unknown',
-                    );
-                }
-            }
-        }
-    }
-
-    public function getTraceSafe()
-    {   
-        if (!isset($this->_trace)) {
-            $this->_trace = $this->getTrace();
-            if (empty($this->_trace)) {
-                $backtrace = debug_backtrace();
-                $this->_trace = array($backtrace[count($backtrace)-1]);
-            }
-        }
-        return $this->_trace;
-    }
-
-    public function getErrorClass()
-    {
-        $trace = $this->getTraceSafe();
-        return $trace[0]['class'];
-    }
-
-    public function getErrorMethod()
-    {
-        $trace = $this->getTraceSafe();
-        return $trace[0]['function'];
-    }
-
-    public function __toString()
-    {
-        if (isset($_SERVER['REQUEST_URI'])) {
-            return $this->toHtml();
-        }
-        return $this->toText();
-    }
-
-    public function toHtml()
-    {
-        $trace = $this->getTraceSafe();
-        $causes = array();
-        $this->getCauseMessage($causes);
-        $html =  '<table border="1" cellspacing="0">' . "\n";
-        foreach ($causes as $i => $cause) {
-            $html .= '<tr><td colspan="3" bgcolor="#ff9999">'
-               . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
-               . htmlspecialchars($cause['message']) . ' in <b>' . $cause['file'] . '</b> '
-               . 'on line <b>' . $cause['line'] . '</b>'
-               . "</td></tr>\n";
-        }
-        $html .= '<tr><td colspan="3" bgcolor="#aaaaaa" align="center"><b>Exception trace</b></td></tr>' . "\n"
-               . '<tr><td align="center" bgcolor="#cccccc" width="20"><b>#</b></td>'
-               . '<td align="center" bgcolor="#cccccc"><b>Function</b></td>'
-               . '<td align="center" bgcolor="#cccccc"><b>Location</b></td></tr>' . "\n";
-
-        foreach ($trace as $k => $v) {
-            $html .= '<tr><td align="center">' . $k . '</td>'
-                   . '<td>';
-            if (!empty($v['class'])) {
-                $html .= $v['class'] . $v['type'];
-            }
-            $html .= $v['function'];
-            $args = array();
-            if (!empty($v['args'])) {
-                foreach ($v['args'] as $arg) {
-                    if (is_null($arg)) $args[] = 'null';
-                    elseif (is_array($arg)) $args[] = 'Array';
-                    elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')';
-                    elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false';
-                    elseif (is_int($arg) || is_double($arg)) $args[] = $arg;
-                    else {
-                        $arg = (string)$arg;
-                        $str = htmlspecialchars(substr($arg, 0, 16));
-                        if (strlen($arg) > 16) $str .= '&hellip;';
-                        $args[] = "'" . $str . "'";
-                    }
-                }
-            }
-            $html .= '(' . implode(', ',$args) . ')'
-                   . '</td>'
-                   . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
-                   . ':' . (isset($v['line']) ? $v['line'] : 'unknown')
-                   . '</td></tr>' . "\n";
-        }
-        $html .= '<tr><td align="center">' . ($k+1) . '</td>'
-               . '<td>{main}</td>'
-               . '<td>&nbsp;</td></tr>' . "\n"
-               . '</table>';
-        return $html;
-    }
-
-    public function toText()
-    {
-        $causes = array();
-        $this->getCauseMessage($causes);
-        $causeMsg = '';
-        foreach ($causes as $i => $cause) {
-            $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
-                   . $cause['message'] . ' in ' . $cause['file']
-                   . ' on line ' . $cause['line'] . "\n";
-        }
-        return $causeMsg . $this->getTraceAsString();
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/FixPHP5PEARWarnings.php b/lib/php/PEAR/FixPHP5PEARWarnings.php
deleted file mode 100644
index be5dc3ce707c3e06189b89395819ae49edbab19c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/FixPHP5PEARWarnings.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-if ($skipmsg) {
-    $a = &new $ec($code, $mode, $options, $userinfo);
-} else {
-    $a = &new $ec($message, $code, $mode, $options, $userinfo);
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Frontend.php b/lib/php/PEAR/Frontend.php
deleted file mode 100644
index d355a7f596737573a979ea7f9466543ae1c8897c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Frontend.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * PEAR_Frontend, the singleton-based frontend for user input/output
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Frontend.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Include error handling
- */
-//require_once 'PEAR.php';
-
-/**
- * Which user interface class is being used.
- * @var string class name
- */
-$GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI';
-
-/**
- * Instance of $_PEAR_Command_uiclass.
- * @var object
- */
-$GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null;
-
-/**
- * Singleton-based frontend for PEAR user input/output
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Frontend extends PEAR
-{
-    /**
-     * Retrieve the frontend object
-     * @return PEAR_Frontend_CLI|PEAR_Frontend_Web|PEAR_Frontend_Gtk
-     * @static
-     */
-    function &singleton($type = null)
-    {
-        if ($type === null) {
-            if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) {
-                $a = false;
-                return $a;
-            }
-            return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
-        }
-
-        $a = PEAR_Frontend::setFrontendClass($type);
-        return $a;
-    }
-
-    /**
-     * Set the frontend class that will be used by calls to {@link singleton()}
-     *
-     * Frontends are expected to conform to the PEAR naming standard of
-     * _ => DIRECTORY_SEPARATOR (PEAR_Frontend_CLI is in PEAR/Frontend/CLI.php)
-     * @param string $uiclass full class name
-     * @return PEAR_Frontend
-     * @static
-     */
-    function &setFrontendClass($uiclass)
-    {
-        if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
-              is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) {
-            return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
-        }
-
-        if (!class_exists($uiclass)) {
-            $file = str_replace('_', '/', $uiclass) . '.php';
-            if (PEAR_Frontend::isIncludeable($file)) {
-                include_once $file;
-            }
-        }
-
-        if (class_exists($uiclass)) {
-            $obj = &new $uiclass;
-            // quick test to see if this class implements a few of the most
-            // important frontend methods
-            if (is_a($obj, 'PEAR_Frontend')) {
-                $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj;
-                $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass;
-                return $obj;
-            }
-
-            $err = PEAR::raiseError("not a frontend class: $uiclass");
-            return $err;
-        }
-
-        $err = PEAR::raiseError("no such class: $uiclass");
-        return $err;
-    }
-
-    /**
-     * Set the frontend class that will be used by calls to {@link singleton()}
-     *
-     * Frontends are expected to be a descendant of PEAR_Frontend
-     * @param PEAR_Frontend
-     * @return PEAR_Frontend
-     * @static
-     */
-    function &setFrontendObject($uiobject)
-    {
-        if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
-              is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) {
-            return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
-        }
-
-        if (!is_a($uiobject, 'PEAR_Frontend')) {
-            $err = PEAR::raiseError('not a valid frontend class: (' .
-                get_class($uiobject) . ')');
-            return $err;
-        }
-
-        $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject;
-        $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject);
-        return $uiobject;
-    }
-
-    /**
-     * @param string $path relative or absolute include path
-     * @return boolean
-     * @static
-     */
-    function isIncludeable($path)
-    {
-        if (file_exists($path) && is_readable($path)) {
-            return true;
-        }
-
-        $fp = @fopen($path, 'r', true);
-        if ($fp) {
-            fclose($fp);
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * @param PEAR_Config
-     */
-    function setConfig(&$config)
-    {
-    }
-
-    /**
-     * This can be overridden to allow session-based temporary file management
-     *
-     * By default, all files are deleted at the end of a session.  The web installer
-     * needs to be able to sustain a list over many sessions in order to support
-     * user interaction with install scripts
-     */
-    function addTempFile($file)
-    {
-        $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
-    }
-
-    /**
-     * Log an action
-     *
-     * @param string $msg the message to log
-     * @param boolean $append_crlf
-     * @return boolean true
-     * @abstract
-     */
-    function log($msg, $append_crlf = true)
-    {
-    }
-
-    /**
-     * Run a post-installation script
-     *
-     * @param array $scripts array of post-install scripts
-     * @abstract
-     */
-    function runPostinstallScripts(&$scripts)
-    {
-    }
-
-    /**
-     * Display human-friendly output formatted depending on the
-     * $command parameter.
-     *
-     * This should be able to handle basic output data with no command
-     * @param mixed  $data    data structure containing the information to display
-     * @param string $command command from which this method was called
-     * @abstract
-     */
-    function outputData($data, $command = '_default')
-    {
-    }
-
-    /**
-     * Display a modal form dialog and return the given input
-     *
-     * A frontend that requires multiple requests to retrieve and process
-     * data must take these needs into account, and implement the request
-     * handling code.
-     * @param string $command  command from which this method was called
-     * @param array  $prompts  associative array. keys are the input field names
-     *                         and values are the description
-     * @param array  $types    array of input field types (text, password,
-     *                         etc.) keys have to be the same like in $prompts
-     * @param array  $defaults array of default values. again keys have
-     *                         to be the same like in $prompts.  Do not depend
-     *                         on a default value being set.
-     * @return array input sent by the user
-     * @abstract
-     */
-    function userDialog($command, $prompts, $types = array(), $defaults = array())
-    {
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Frontend/CLI.php b/lib/php/PEAR/Frontend/CLI.php
deleted file mode 100644
index 374f0872cd38e53a67375cdcecac01253e7d8478..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Frontend/CLI.php
+++ /dev/null
@@ -1,732 +0,0 @@
-<?php
-/**
- * PEAR_Frontend_CLI
- *
- * 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: CLI.php 278236 2009-04-04 00:09:14Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-/**
- * base class
- */
-require_once 'PEAR/Frontend.php';
-
-/**
- * Command-line Frontend for the PEAR Installer
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Frontend_CLI extends PEAR_Frontend
-{
-    /**
-     * What type of user interface this frontend is for.
-     * @var string
-     * @access public
-     */
-    var $type = 'CLI';
-    var $lp = ''; // line prefix
-
-    var $params = array();
-    var $term = array(
-        'bold'   => '',
-        'normal' => '',
-    );
-
-    function PEAR_Frontend_CLI()
-    {
-        parent::PEAR();
-        $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1
-        if (function_exists('posix_isatty') && !posix_isatty(1)) {
-            // output is being redirected to a file or through a pipe
-        } elseif ($term) {
-            if (preg_match('/^(xterm|vt220|linux)/', $term)) {
-                $this->term['bold']   = sprintf("%c%c%c%c", 27, 91, 49, 109);
-                $this->term['normal'] = sprintf("%c%c%c", 27, 91, 109);
-            } elseif (preg_match('/^vt100/', $term)) {
-                $this->term['bold']   = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0);
-                $this->term['normal'] = sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0);
-            }
-        } elseif (OS_WINDOWS) {
-            // XXX add ANSI codes here
-        }
-    }
-
-    /**
-     * @param object PEAR_Error object
-     */
-    function displayError($e)
-    {
-        return $this->_displayLine($e->getMessage());
-    }
-
-    /**
-     * @param object PEAR_Error object
-     */
-    function displayFatalError($eobj)
-    {
-        $this->displayError($eobj);
-        if (class_exists('PEAR_Config')) {
-            $config = &PEAR_Config::singleton();
-            if ($config->get('verbose') > 5) {
-                if (function_exists('debug_print_backtrace')) {
-                    debug_print_backtrace();
-                    exit(1);
-                }
-
-                $raised = false;
-                foreach (debug_backtrace() as $i => $frame) {
-                    if (!$raised) {
-                        if (isset($frame['class'])
-                            && strtolower($frame['class']) == 'pear'
-                            && strtolower($frame['function']) == 'raiseerror'
-                        ) {
-                            $raised = true;
-                        } else {
-                            continue;
-                        }
-                    }
-
-                    $frame['class']    = !isset($frame['class'])    ? '' : $frame['class'];
-                    $frame['type']     = !isset($frame['type'])     ? '' : $frame['type'];
-                    $frame['function'] = !isset($frame['function']) ? '' : $frame['function'];
-                    $frame['line']     = !isset($frame['line'])     ? '' : $frame['line'];
-                    $this->_displayLine("#$i: $frame[class]$frame[type]$frame[function] $frame[line]");
-                }
-            }
-        }
-
-        exit(1);
-    }
-
-    /**
-     * Instruct the runInstallScript method to skip a paramgroup that matches the
-     * id value passed in.
-     *
-     * This method is useful for dynamically configuring which sections of a post-install script
-     * will be run based on the user's setup, which is very useful for making flexible
-     * post-install scripts without losing the cross-Frontend ability to retrieve user input
-     * @param string
-     */
-    function skipParamgroup($id)
-    {
-        $this->_skipSections[$id] = true;
-    }
-
-    function runPostinstallScripts(&$scripts)
-    {
-        foreach ($scripts as $i => $script) {
-            $this->runInstallScript($scripts[$i]->_params, $scripts[$i]->_obj);
-        }
-    }
-
-    /**
-     * @param array $xml contents of postinstallscript tag
-     * @param object $script post-installation script
-     * @param string install|upgrade
-     */
-    function runInstallScript($xml, &$script)
-    {
-        $this->_skipSections = array();
-        if (!is_array($xml) || !isset($xml['paramgroup'])) {
-            $script->run(array(), '_default');
-            return;
-        }
-
-        $completedPhases = array();
-        if (!isset($xml['paramgroup'][0])) {
-            $xml['paramgroup'] = array($xml['paramgroup']);
-        }
-
-        foreach ($xml['paramgroup'] as $group) {
-            if (isset($this->_skipSections[$group['id']])) {
-                // the post-install script chose to skip this section dynamically
-                continue;
-            }
-
-            if (isset($group['name'])) {
-                $paramname = explode('::', $group['name']);
-                if ($lastgroup['id'] != $paramname[0]) {
-                    continue;
-                }
-
-                $group['name'] = $paramname[1];
-                if (!isset($answers)) {
-                    return;
-                }
-
-                if (isset($answers[$group['name']])) {
-                    switch ($group['conditiontype']) {
-                        case '=' :
-                            if ($answers[$group['name']] != $group['value']) {
-                                continue 2;
-                            }
-                        break;
-                        case '!=' :
-                            if ($answers[$group['name']] == $group['value']) {
-                                continue 2;
-                            }
-                        break;
-                        case 'preg_match' :
-                            if (!@preg_match('/' . $group['value'] . '/',
-                                  $answers[$group['name']])) {
-                                continue 2;
-                            }
-                        break;
-                        default :
-                        return;
-                    }
-                }
-            }
-
-            $lastgroup = $group;
-            if (isset($group['instructions'])) {
-                $this->_display($group['instructions']);
-            }
-
-            if (!isset($group['param'][0])) {
-                $group['param'] = array($group['param']);
-            }
-
-            if (isset($group['param'])) {
-                if (method_exists($script, 'postProcessPrompts')) {
-                    $prompts = $script->postProcessPrompts($group['param'], $group['id']);
-                    if (!is_array($prompts) || count($prompts) != count($group['param'])) {
-                        $this->outputData('postinstall', 'Error: post-install script did not ' .
-                            'return proper post-processed prompts');
-                        $prompts = $group['param'];
-                    } else {
-                        foreach ($prompts as $i => $var) {
-                            if (!is_array($var) || !isset($var['prompt']) ||
-                                  !isset($var['name']) ||
-                                  ($var['name'] != $group['param'][$i]['name']) ||
-                                  ($var['type'] != $group['param'][$i]['type'])
-                            ) {
-                                $this->outputData('postinstall', 'Error: post-install script ' .
-                                    'modified the variables or prompts, severe security risk. ' .
-                                    'Will instead use the defaults from the package.xml');
-                                $prompts = $group['param'];
-                            }
-                        }
-                    }
-
-                    $answers = $this->confirmDialog($prompts);
-                } else {
-                    $answers = $this->confirmDialog($group['param']);
-                }
-            }
-
-            if ((isset($answers) && $answers) || !isset($group['param'])) {
-                if (!isset($answers)) {
-                    $answers = array();
-                }
-
-                array_unshift($completedPhases, $group['id']);
-                if (!$script->run($answers, $group['id'])) {
-                    $script->run($completedPhases, '_undoOnError');
-                    return;
-                }
-            } else {
-                $script->run($completedPhases, '_undoOnError');
-                return;
-            }
-        }
-    }
-
-    /**
-     * Ask for user input, confirm the answers and continue until the user is satisfied
-     * @param array an array of arrays, format array('name' => 'paramname', 'prompt' =>
-     *              'text to display', 'type' => 'string'[, default => 'default value'])
-     * @return array
-     */
-    function confirmDialog($params)
-    {
-        $answers = $prompts = $types = array();
-        foreach ($params as $param) {
-            $prompts[$param['name']] = $param['prompt'];
-            $types[$param['name']]   = $param['type'];
-            $answers[$param['name']] = isset($param['default']) ? $param['default'] : '';
-        }
-
-        $tried = false;
-        do {
-            if ($tried) {
-                $i = 1;
-                foreach ($answers as $var => $value) {
-                    if (!strlen($value)) {
-                        echo $this->bold("* Enter an answer for #" . $i . ": ({$prompts[$var]})\n");
-                    }
-                    $i++;
-                }
-            }
-
-            $answers = $this->userDialog('', $prompts, $types, $answers);
-            $tried   = true;
-        } while (is_array($answers) && count(array_filter($answers)) != count($prompts));
-
-        return $answers;
-    }
-
-    function userDialog($command, $prompts, $types = array(), $defaults = array(), $screensize = 20)
-    {
-        if (!is_array($prompts)) {
-            return array();
-        }
-
-        $testprompts = array_keys($prompts);
-        $result      = $defaults;
-
-        reset($prompts);
-        if (count($prompts) === 1) {
-            foreach ($prompts as $key => $prompt) {
-                $type    = $types[$key];
-                $default = @$defaults[$key];
-                print "$prompt ";
-                if ($default) {
-                    print "[$default] ";
-                }
-                print ": ";
-
-                $line         = fgets(STDIN, 2048);
-                $result[$key] =  ($default && trim($line) == '') ? $default : trim($line);
-            }
-
-            return $result;
-        }
-
-        $first_run = true;
-        while (true) {
-            $descLength = max(array_map('strlen', $prompts));
-            $descFormat = "%-{$descLength}s";
-            $last       = count($prompts);
-
-            $i = 0;
-            foreach ($prompts as $n => $var) {
-                $res = isset($result[$n]) ? $result[$n] : null;
-                printf("%2d. $descFormat : %s\n", ++$i, $prompts[$n], $res);
-            }
-            print "\n1-$last, 'all', 'abort', or Enter to continue: ";
-
-            $tmp = trim(fgets(STDIN, 1024));
-            if (empty($tmp)) {
-                break;
-            }
-
-            if ($tmp == 'abort') {
-                return false;
-            }
-
-            if (isset($testprompts[(int)$tmp - 1])) {
-                $var     = $testprompts[(int)$tmp - 1];
-                $desc    = $prompts[$var];
-                $current = @$result[$var];
-                print "$desc [$current] : ";
-                $tmp = trim(fgets(STDIN, 1024));
-                if ($tmp !== '') {
-                    $result[$var] = $tmp;
-                }
-            } elseif ($tmp == 'all') {
-                foreach ($prompts as $var => $desc) {
-                    $current = $result[$var];
-                    print "$desc [$current] : ";
-                    $tmp = trim(fgets(STDIN, 1024));
-                    if (trim($tmp) !== '') {
-                        $result[$var] = trim($tmp);
-                    }
-                }
-            }
-
-            $first_run = false;
-        }
-
-        return $result;
-    }
-
-    function userConfirm($prompt, $default = 'yes')
-    {
-        trigger_error("PEAR_Frontend_CLI::userConfirm not yet converted", E_USER_ERROR);
-        static $positives = array('y', 'yes', 'on', '1');
-        static $negatives = array('n', 'no', 'off', '0');
-        print "$this->lp$prompt [$default] : ";
-        $fp = fopen("php://stdin", "r");
-        $line = fgets($fp, 2048);
-        fclose($fp);
-        $answer = strtolower(trim($line));
-        if (empty($answer)) {
-            $answer = $default;
-        }
-        if (in_array($answer, $positives)) {
-            return true;
-        }
-        if (in_array($answer, $negatives)) {
-            return false;
-        }
-        if (in_array($default, $positives)) {
-            return true;
-        }
-        return false;
-    }
-
-    function outputData($data, $command = '_default')
-    {
-        switch ($command) {
-            case 'channel-info':
-                foreach ($data as $type => $section) {
-                    if ($type == 'main') {
-                        $section['data'] = array_values($section['data']);
-                    }
-
-                    $this->outputData($section);
-                }
-                break;
-            case 'install':
-            case 'upgrade':
-            case 'upgrade-all':
-                if (isset($data['release_warnings'])) {
-                    $this->_displayLine('');
-                    $this->_startTable(array(
-                        'border' => false,
-                        'caption' => 'Release Warnings'
-                    ));
-                    $this->_tableRow(array($data['release_warnings']), null, array(1 => array('wrap' => 55)));
-                    $this->_endTable();
-                    $this->_displayLine('');
-                }
-
-                $this->_displayLine($data['data']);
-                break;
-            case 'search':
-                $this->_startTable($data);
-                if (isset($data['headline']) && is_array($data['headline'])) {
-                    $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
-                }
-
-                foreach($data['data'] as $category) {
-                    foreach($category as $pkg) {
-                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
-                    }
-                }
-
-                $this->_endTable();
-                break;
-            case 'list-all':
-                if (!isset($data['data'])) {
-                      $this->_displayLine('No packages in channel');
-                      break;
-                }
-
-                $this->_startTable($data);
-                if (isset($data['headline']) && is_array($data['headline'])) {
-                    $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
-                }
-
-                foreach($data['data'] as $category) {
-                    foreach($category as $pkg) {
-                        unset($pkg[4], $pkg[5]);
-                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
-                    }
-                }
-
-                $this->_endTable();
-                break;
-            case 'config-show':
-                $data['border'] = false;
-                $opts = array(
-                    0 => array('wrap' => 30),
-                    1 => array('wrap' => 20),
-                    2 => array('wrap' => 35)
-                );
-
-                $this->_startTable($data);
-                if (isset($data['headline']) && is_array($data['headline'])) {
-                    $this->_tableRow($data['headline'], array('bold' => true), $opts);
-                }
-
-                foreach ($data['data'] as $group) {
-                    foreach ($group as $value) {
-                        if ($value[2] == '') {
-                            $value[2] = "<not set>";
-                        }
-
-                        $this->_tableRow($value, null, $opts);
-                    }
-                }
-
-                $this->_endTable();
-                break;
-            case 'remote-info':
-                $d = $data;
-                $data = array(
-                    'caption' => 'Package details:',
-                    'border'  => false,
-                    'data'    => array(
-                        array("Latest",      $data['stable']),
-                        array("Installed",   $data['installed']),
-                        array("Package",     $data['name']),
-                        array("License",     $data['license']),
-                        array("Category",    $data['category']),
-                        array("Summary",     $data['summary']),
-                        array("Description", $data['description']),
-                    ),
-                );
-
-                if (isset($d['deprecated']) && $d['deprecated']) {
-                    $conf = &PEAR_Config::singleton();
-                    $reg = $conf->getRegistry();
-                    $name = $reg->parsedPackageNameToString($d['deprecated'], true);
-                    $data['data'][] = array('Deprecated! use', $name);
-                }
-            default: {
-                if (is_array($data)) {
-                    $this->_startTable($data);
-                    $count = count($data['data'][0]);
-                    if ($count == 2) {
-                        $opts = array(0 => array('wrap' => 25),
-                                      1 => array('wrap' => 48)
-                        );
-                    } elseif ($count == 3) {
-                        $opts = array(0 => array('wrap' => 30),
-                                      1 => array('wrap' => 20),
-                                      2 => array('wrap' => 35)
-                        );
-                    } else {
-                        $opts = null;
-                    }
-                    if (isset($data['headline']) && is_array($data['headline'])) {
-                        $this->_tableRow($data['headline'],
-                                         array('bold' => true),
-                                         $opts);
-                    }
-
-                    foreach($data['data'] as $row) {
-                        $this->_tableRow($row, null, $opts);
-                    }
-                    $this->_endTable();
-                } else {
-                    $this->_displayLine($data);
-                }
-            }
-        }
-    }
-
-    function log($text, $append_crlf = true)
-    {
-        if ($append_crlf) {
-            return $this->_displayLine($text);
-        }
-
-        return $this->_display($text);
-    }
-
-    function bold($text)
-    {
-        if (empty($this->term['bold'])) {
-            return strtoupper($text);
-        }
-
-        return $this->term['bold'] . $text . $this->term['normal'];
-    }
-
-    function _displayHeading($title)
-    {
-        print $this->lp.$this->bold($title)."\n";
-        print $this->lp.str_repeat("=", strlen($title))."\n";
-    }
-
-    function _startTable($params = array())
-    {
-        $params['table_data'] = array();
-        $params['widest']     = array();  // indexed by column
-        $params['highest']    = array(); // indexed by row
-        $params['ncols']      = 0;
-        $this->params         = $params;
-    }
-
-    function _tableRow($columns, $rowparams = array(), $colparams = array())
-    {
-        $highest = 1;
-        for ($i = 0; $i < count($columns); $i++) {
-            $col = &$columns[$i];
-            if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) {
-                $col = wordwrap($col, $colparams[$i]['wrap']);
-            }
-
-            if (strpos($col, "\n") !== false) {
-                $multiline = explode("\n", $col);
-                $w = 0;
-                foreach ($multiline as $n => $line) {
-                    $len = strlen($line);
-                    if ($len > $w) {
-                        $w = $len;
-                    }
-                }
-                $lines = count($multiline);
-            } else {
-                $w = strlen($col);
-            }
-
-            if (isset($this->params['widest'][$i])) {
-                if ($w > $this->params['widest'][$i]) {
-                    $this->params['widest'][$i] = $w;
-                }
-            } else {
-                $this->params['widest'][$i] = $w;
-            }
-
-            $tmp = count_chars($columns[$i], 1);
-            // handle unix, mac and windows formats
-            $lines = (isset($tmp[10]) ? $tmp[10] : (isset($tmp[13]) ? $tmp[13] : 0)) + 1;
-            if ($lines > $highest) {
-                $highest = $lines;
-            }
-        }
-
-        if (count($columns) > $this->params['ncols']) {
-            $this->params['ncols'] = count($columns);
-        }
-
-        $new_row = array(
-            'data'      => $columns,
-            'height'    => $highest,
-            'rowparams' => $rowparams,
-            'colparams' => $colparams,
-        );
-        $this->params['table_data'][] = $new_row;
-    }
-
-    function _endTable()
-    {
-        extract($this->params);
-        if (!empty($caption)) {
-            $this->_displayHeading($caption);
-        }
-
-        if (count($table_data) === 0) {
-            return;
-        }
-
-        if (!isset($width)) {
-            $width = $widest;
-        } else {
-            for ($i = 0; $i < $ncols; $i++) {
-                if (!isset($width[$i])) {
-                    $width[$i] = $widest[$i];
-                }
-            }
-        }
-
-        $border = false;
-        if (empty($border)) {
-            $cellstart  = '';
-            $cellend    = ' ';
-            $rowend     = '';
-            $padrowend  = false;
-            $borderline = '';
-        } else {
-            $cellstart  = '| ';
-            $cellend    = ' ';
-            $rowend     = '|';
-            $padrowend  = true;
-            $borderline = '+';
-            foreach ($width as $w) {
-                $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1);
-                $borderline .= '+';
-            }
-        }
-
-        if ($borderline) {
-            $this->_displayLine($borderline);
-        }
-
-        for ($i = 0; $i < count($table_data); $i++) {
-            extract($table_data[$i]);
-            if (!is_array($rowparams)) {
-                $rowparams = array();
-            }
-
-            if (!is_array($colparams)) {
-                $colparams = array();
-            }
-
-            $rowlines = array();
-            if ($height > 1) {
-                for ($c = 0; $c < count($data); $c++) {
-                    $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]);
-                    if (count($rowlines[$c]) < $height) {
-                        $rowlines[$c] = array_pad($rowlines[$c], $height, '');
-                    }
-                }
-            } else {
-                for ($c = 0; $c < count($data); $c++) {
-                    $rowlines[$c] = array($data[$c]);
-                }
-            }
-
-            for ($r = 0; $r < $height; $r++) {
-                $rowtext = '';
-                for ($c = 0; $c < count($data); $c++) {
-                    if (isset($colparams[$c])) {
-                        $attribs = array_merge($rowparams, $colparams);
-                    } else {
-                        $attribs = $rowparams;
-                    }
-
-                    $w = isset($width[$c]) ? $width[$c] : 0;
-                    //$cell = $data[$c];
-                    $cell = $rowlines[$c][$r];
-                    $l = strlen($cell);
-                    if ($l > $w) {
-                        $cell = substr($cell, 0, $w);
-                    }
-
-                    if (isset($attribs['bold'])) {
-                        $cell = $this->bold($cell);
-                    }
-
-                    if ($l < $w) {
-                        // not using str_pad here because we may
-                        // add bold escape characters to $cell
-                        $cell .= str_repeat(' ', $w - $l);
-                    }
-
-                    $rowtext .= $cellstart . $cell . $cellend;
-                }
-
-                if (!$border) {
-                    $rowtext = rtrim($rowtext);
-                }
-
-                $rowtext .= $rowend;
-                $this->_displayLine($rowtext);
-            }
-        }
-
-        if ($borderline) {
-            $this->_displayLine($borderline);
-        }
-    }
-
-    function _displayLine($text)
-    {
-        print "$this->lp$text\n";
-    }
-
-    function _display($text)
-    {
-        print $text;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer.php b/lib/php/PEAR/Installer.php
deleted file mode 100644
index cdd4be88efc03eb74d8e731bf47b6d7f4e15305c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer.php
+++ /dev/null
@@ -1,1823 +0,0 @@
-<?php
-/**
- * PEAR_Installer
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Martin Jansen <mj@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: Installer.php 287446 2009-08-18 11:45:05Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * Used for installation groups in package.xml 2.0 and platform exceptions
- */
-require_once 'OS/Guess.php';
-require_once 'PEAR/Downloader.php';
-
-define('PEAR_INSTALLER_NOBINARY', -240);
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V. Cox <cox@idecnet.com>
- * @author     Martin Jansen <mj@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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Installer extends PEAR_Downloader
-{
-    // {{{ properties
-
-    /** name of the package directory, for example Foo-1.0
-     * @var string
-     */
-    var $pkgdir;
-
-    /** directory where PHP code files go
-     * @var string
-     */
-    var $phpdir;
-
-    /** directory where PHP extension files go
-     * @var string
-     */
-    var $extdir;
-
-    /** directory where documentation goes
-     * @var string
-     */
-    var $docdir;
-
-    /** installation root directory (ala PHP's INSTALL_ROOT or
-     * automake's DESTDIR
-     * @var string
-     */
-    var $installroot = '';
-
-    /** debug level
-     * @var int
-     */
-    var $debug = 1;
-
-    /** temporary directory
-     * @var string
-     */
-    var $tmpdir;
-
-    /**
-     * PEAR_Registry object used by the installer
-     * @var PEAR_Registry
-     */
-    var $registry;
-
-    /**
-     * array of PEAR_Downloader_Packages
-     * @var array
-     */
-    var $_downloadedPackages;
-
-    /** List of file transactions queued for an install/upgrade/uninstall.
-     *
-     *  Format:
-     *    array(
-     *      0 => array("rename => array("from-file", "to-file")),
-     *      1 => array("delete" => array("file-to-delete")),
-     *      ...
-     *    )
-     *
-     * @var array
-     */
-    var $file_operations = array();
-
-    // }}}
-
-    // {{{ constructor
-
-    /**
-     * PEAR_Installer constructor.
-     *
-     * @param object $ui user interface object (instance of PEAR_Frontend_*)
-     *
-     * @access public
-     */
-    function PEAR_Installer(&$ui)
-    {
-        parent::PEAR_Common();
-        $this->setFrontendObject($ui);
-        $this->debug = $this->config->get('verbose');
-    }
-
-    function setOptions($options)
-    {
-        $this->_options = $options;
-    }
-
-    function setConfig(&$config)
-    {
-        $this->config    = &$config;
-        $this->_registry = &$config->getRegistry();
-    }
-
-    // }}}
-
-    function _removeBackups($files)
-    {
-        foreach ($files as $path) {
-            $this->addFileOperation('removebackup', array($path));
-        }
-    }
-
-    // {{{ _deletePackageFiles()
-
-    /**
-     * Delete a package's installed files, does not remove empty directories.
-     *
-     * @param string package name
-     * @param string channel name
-     * @param bool if true, then files are backed up first
-     * @return bool TRUE on success, or a PEAR error on failure
-     * @access protected
-     */
-    function _deletePackageFiles($package, $channel = false, $backup = false)
-    {
-        if (!$channel) {
-            $channel = 'pear.php.net';
-        }
-
-        if (!strlen($package)) {
-            return $this->raiseError("No package to uninstall given");
-        }
-
-        if (strtolower($package) == 'pear' && $channel == 'pear.php.net') {
-            // to avoid race conditions, include all possible needed files
-            require_once 'PEAR/Task/Common.php';
-            require_once 'PEAR/Task/Replace.php';
-            require_once 'PEAR/Task/Unixeol.php';
-            require_once 'PEAR/Task/Windowseol.php';
-            require_once 'PEAR/PackageFile/v1.php';
-            require_once 'PEAR/PackageFile/v2.php';
-            require_once 'PEAR/PackageFile/Generator/v1.php';
-            require_once 'PEAR/PackageFile/Generator/v2.php';
-        }
-
-        $filelist = $this->_registry->packageInfo($package, 'filelist', $channel);
-        if ($filelist == null) {
-            return $this->raiseError("$channel/$package not installed");
-        }
-
-        $ret = array();
-        foreach ($filelist as $file => $props) {
-            if (empty($props['installed_as'])) {
-                continue;
-            }
-
-            $path = $props['installed_as'];
-            if ($backup) {
-                $this->addFileOperation('backup', array($path));
-                $ret[] = $path;
-            }
-
-            $this->addFileOperation('delete', array($path));
-        }
-
-        if ($backup) {
-            return $ret;
-        }
-
-        return true;
-    }
-
-    // }}}
-    // {{{ _installFile()
-
-    /**
-     * @param string filename
-     * @param array attributes from <file> tag in package.xml
-     * @param string path to install the file in
-     * @param array options from command-line
-     * @access private
-     */
-    function _installFile($file, $atts, $tmp_path, $options)
-    {
-        // {{{ return if this file is meant for another platform
-        static $os;
-        if (!isset($this->_registry)) {
-            $this->_registry = &$this->config->getRegistry();
-        }
-
-        if (isset($atts['platform'])) {
-            if (empty($os)) {
-                $os = new OS_Guess();
-            }
-
-            if (strlen($atts['platform']) && $atts['platform']{0} == '!') {
-                $negate   = true;
-                $platform = substr($atts['platform'], 1);
-            } else {
-                $negate    = false;
-                $platform = $atts['platform'];
-            }
-
-            if ((bool) $os->matchSignature($platform) === $negate) {
-                $this->log(3, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")");
-                return PEAR_INSTALLER_SKIPPED;
-            }
-        }
-        // }}}
-
-        $channel = $this->pkginfo->getChannel();
-        // {{{ assemble the destination paths
-        switch ($atts['role']) {
-            case 'src':
-            case 'extsrc':
-                $this->source_files++;
-                return;
-            case 'doc':
-            case 'data':
-            case 'test':
-                $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel) .
-                            DIRECTORY_SEPARATOR . $this->pkginfo->getPackage();
-                unset($atts['baseinstalldir']);
-                break;
-            case 'ext':
-            case 'php':
-                $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel);
-                break;
-            case 'script':
-                $dest_dir = $this->config->get('bin_dir', null, $channel);
-                break;
-            default:
-                return $this->raiseError("Invalid role `$atts[role]' for file $file");
-        }
-
-        $save_destdir = $dest_dir;
-        if (!empty($atts['baseinstalldir'])) {
-            $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
-        }
-
-        if (dirname($file) != '.' && empty($atts['install-as'])) {
-            $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
-        }
-
-        if (empty($atts['install-as'])) {
-            $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
-        } else {
-            $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
-        }
-        $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
-
-        // Clean up the DIRECTORY_SEPARATOR mess
-        $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
-        list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
-                                                    array(DIRECTORY_SEPARATOR,
-                                                          DIRECTORY_SEPARATOR,
-                                                          DIRECTORY_SEPARATOR),
-                                                    array($dest_file, $orig_file));
-        $final_dest_file = $installed_as = $dest_file;
-        if (isset($this->_options['packagingroot'])) {
-            $installedas_dest_dir  = dirname($final_dest_file);
-            $installedas_dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
-            $final_dest_file = $this->_prependPath($final_dest_file, $this->_options['packagingroot']);
-        } else {
-            $installedas_dest_dir  = dirname($final_dest_file);
-            $installedas_dest_file = $installedas_dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
-        }
-
-        $dest_dir  = dirname($final_dest_file);
-        $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
-        if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) {
-            return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED);
-        }
-        // }}}
-
-        if (empty($this->_options['register-only']) &&
-              (!file_exists($dest_dir) || !is_dir($dest_dir))) {
-            if (!$this->mkDirHier($dest_dir)) {
-                return $this->raiseError("failed to mkdir $dest_dir",
-                                         PEAR_INSTALLER_FAILED);
-            }
-            $this->log(3, "+ mkdir $dest_dir");
-        }
-
-        // pretty much nothing happens if we are only registering the install
-        if (empty($this->_options['register-only'])) {
-            if (empty($atts['replacements'])) {
-                if (!file_exists($orig_file)) {
-                    return $this->raiseError("file $orig_file does not exist",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                if (!@copy($orig_file, $dest_file)) {
-                    return $this->raiseError("failed to write $dest_file: $php_errormsg",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                $this->log(3, "+ cp $orig_file $dest_file");
-                if (isset($atts['md5sum'])) {
-                    $md5sum = md5_file($dest_file);
-                }
-            } else {
-                // {{{ file with replacements
-                if (!file_exists($orig_file)) {
-                    return $this->raiseError("file does not exist",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                $contents = file_get_contents($orig_file);
-                if ($contents === false) {
-                    $contents = '';
-                }
-
-                if (isset($atts['md5sum'])) {
-                    $md5sum = md5($contents);
-                }
-
-                $subst_from = $subst_to = array();
-                foreach ($atts['replacements'] as $a) {
-                    $to = '';
-                    if ($a['type'] == 'php-const') {
-                        if (preg_match('/^[a-z0-9_]+\\z/i', $a['to'])) {
-                            eval("\$to = $a[to];");
-                        } else {
-                            if (!isset($options['soft'])) {
-                                $this->log(0, "invalid php-const replacement: $a[to]");
-                            }
-                            continue;
-                        }
-                    } elseif ($a['type'] == 'pear-config') {
-                        if ($a['to'] == 'master_server') {
-                            $chan = $this->_registry->getChannel($channel);
-                            if (!PEAR::isError($chan)) {
-                                $to = $chan->getServer();
-                            } else {
-                                $to = $this->config->get($a['to'], null, $channel);
-                            }
-                        } else {
-                            $to = $this->config->get($a['to'], null, $channel);
-                        }
-                        if (is_null($to)) {
-                            if (!isset($options['soft'])) {
-                                $this->log(0, "invalid pear-config replacement: $a[to]");
-                            }
-                            continue;
-                        }
-                    } elseif ($a['type'] == 'package-info') {
-                        if ($t = $this->pkginfo->packageInfo($a['to'])) {
-                            $to = $t;
-                        } else {
-                            if (!isset($options['soft'])) {
-                                $this->log(0, "invalid package-info replacement: $a[to]");
-                            }
-                            continue;
-                        }
-                    }
-                    if (!is_null($to)) {
-                        $subst_from[] = $a['from'];
-                        $subst_to[] = $to;
-                    }
-                }
-
-                $this->log(3, "doing ".sizeof($subst_from)." substitution(s) for $final_dest_file");
-                if (sizeof($subst_from)) {
-                    $contents = str_replace($subst_from, $subst_to, $contents);
-                }
-
-                $wp = @fopen($dest_file, "wb");
-                if (!is_resource($wp)) {
-                    return $this->raiseError("failed to create $dest_file: $php_errormsg",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                if (@fwrite($wp, $contents) === false) {
-                    return $this->raiseError("failed writing to $dest_file: $php_errormsg",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                fclose($wp);
-                // }}}
-            }
-
-            // {{{ check the md5
-            if (isset($md5sum)) {
-                if (strtolower($md5sum) === strtolower($atts['md5sum'])) {
-                    $this->log(2, "md5sum ok: $final_dest_file");
-                } else {
-                    if (empty($options['force'])) {
-                        // delete the file
-                        if (file_exists($dest_file)) {
-                            unlink($dest_file);
-                        }
-
-                        if (!isset($options['ignore-errors'])) {
-                            return $this->raiseError("bad md5sum for file $final_dest_file",
-                                                 PEAR_INSTALLER_FAILED);
-                        }
-
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "warning : bad md5sum for file $final_dest_file");
-                        }
-                    } else {
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "warning : bad md5sum for file $final_dest_file");
-                        }
-                    }
-                }
-            }
-            // }}}
-            // {{{ set file permissions
-            if (!OS_WINDOWS) {
-                if ($atts['role'] == 'script') {
-                    $mode = 0777 & ~(int)octdec($this->config->get('umask'));
-                    $this->log(3, "+ chmod +x $dest_file");
-                } else {
-                    $mode = 0666 & ~(int)octdec($this->config->get('umask'));
-                }
-
-                if ($atts['role'] != 'src') {
-                    $this->addFileOperation("chmod", array($mode, $dest_file));
-                    if (!@chmod($dest_file, $mode)) {
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "failed to change mode of $dest_file: $php_errormsg");
-                        }
-                    }
-                }
-            }
-            // }}}
-
-            if ($atts['role'] == 'src') {
-                rename($dest_file, $final_dest_file);
-                $this->log(2, "renamed source file $dest_file to $final_dest_file");
-            } else {
-                $this->addFileOperation("rename", array($dest_file, $final_dest_file,
-                    $atts['role'] == 'ext'));
-            }
-        }
-
-        // Store the full path where the file was installed for easy unistall
-        if ($atts['role'] != 'script') {
-            $loc = $this->config->get($atts['role'] . '_dir');
-        } else {
-            $loc = $this->config->get('bin_dir');
-        }
-
-        if ($atts['role'] != 'src') {
-            $this->addFileOperation("installed_as", array($file, $installed_as,
-                                    $loc,
-                                    dirname(substr($installedas_dest_file, strlen($loc)))));
-        }
-
-        //$this->log(2, "installed: $dest_file");
-        return PEAR_INSTALLER_OK;
-    }
-
-    // }}}
-    // {{{ _installFile2()
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param string filename
-     * @param array attributes from <file> tag in package.xml
-     * @param string path to install the file in
-     * @param array options from command-line
-     * @access private
-     */
-    function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options)
-    {
-        $atts = $real_atts;
-        if (!isset($this->_registry)) {
-            $this->_registry = &$this->config->getRegistry();
-        }
-
-        $channel = $pkg->getChannel();
-        // {{{ assemble the destination paths
-        if (!in_array($atts['attribs']['role'],
-              PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) {
-            return $this->raiseError('Invalid role `' . $atts['attribs']['role'] .
-                    "' for file $file");
-        }
-
-        $role = &PEAR_Installer_Role::factory($pkg, $atts['attribs']['role'], $this->config);
-        $err  = $role->setup($this, $pkg, $atts['attribs'], $file);
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-
-        if (!$role->isInstallable()) {
-            return;
-        }
-
-        $info = $role->processInstallation($pkg, $atts['attribs'], $file, $tmp_path);
-        if (PEAR::isError($info)) {
-            return $info;
-        }
-
-        list($save_destdir, $dest_dir, $dest_file, $orig_file) = $info;
-        if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) {
-            return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED);
-        }
-
-        $final_dest_file = $installed_as = $dest_file;
-        if (isset($this->_options['packagingroot'])) {
-            $final_dest_file = $this->_prependPath($final_dest_file,
-                $this->_options['packagingroot']);
-        }
-
-        $dest_dir  = dirname($final_dest_file);
-        $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
-        // }}}
-
-        if (empty($this->_options['register-only'])) {
-            if (!file_exists($dest_dir) || !is_dir($dest_dir)) {
-                if (!$this->mkDirHier($dest_dir)) {
-                    return $this->raiseError("failed to mkdir $dest_dir",
-                                             PEAR_INSTALLER_FAILED);
-                }
-                $this->log(3, "+ mkdir $dest_dir");
-            }
-        }
-
-        $attribs = $atts['attribs'];
-        unset($atts['attribs']);
-        // pretty much nothing happens if we are only registering the install
-        if (empty($this->_options['register-only'])) {
-            if (!count($atts)) { // no tasks
-                if (!file_exists($orig_file)) {
-                    return $this->raiseError("file $orig_file does not exist",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                if (!@copy($orig_file, $dest_file)) {
-                    return $this->raiseError("failed to write $dest_file: $php_errormsg",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                $this->log(3, "+ cp $orig_file $dest_file");
-                if (isset($attribs['md5sum'])) {
-                    $md5sum = md5_file($dest_file);
-                }
-            } else { // file with tasks
-                if (!file_exists($orig_file)) {
-                    return $this->raiseError("file $orig_file does not exist",
-                                             PEAR_INSTALLER_FAILED);
-                }
-
-                $contents = file_get_contents($orig_file);
-                if ($contents === false) {
-                    $contents = '';
-                }
-
-                if (isset($attribs['md5sum'])) {
-                    $md5sum = md5($contents);
-                }
-
-                foreach ($atts as $tag => $raw) {
-                    $tag = str_replace(array($pkg->getTasksNs() . ':', '-'), array('', '_'), $tag);
-                    $task = "PEAR_Task_$tag";
-                    $task = &new $task($this->config, $this, PEAR_TASK_INSTALL);
-                    if (!$task->isScript()) { // scripts are only handled after installation
-                        $task->init($raw, $attribs, $pkg->getLastInstalledVersion());
-                        $res = $task->startSession($pkg, $contents, $final_dest_file);
-                        if ($res === false) {
-                            continue; // skip this file
-                        }
-
-                        if (PEAR::isError($res)) {
-                            return $res;
-                        }
-
-                        $contents = $res; // save changes
-                    }
-
-                    $wp = @fopen($dest_file, "wb");
-                    if (!is_resource($wp)) {
-                        return $this->raiseError("failed to create $dest_file: $php_errormsg",
-                                                 PEAR_INSTALLER_FAILED);
-                    }
-
-                    if (fwrite($wp, $contents) === false) {
-                        return $this->raiseError("failed writing to $dest_file: $php_errormsg",
-                                                 PEAR_INSTALLER_FAILED);
-                    }
-
-                    fclose($wp);
-                }
-            }
-
-            // {{{ check the md5
-            if (isset($md5sum)) {
-                // Make sure the original md5 sum matches with expected
-                if (strtolower($md5sum) === strtolower($attribs['md5sum'])) {
-                    $this->log(2, "md5sum ok: $final_dest_file");
-
-                    if (isset($contents)) {
-                        // set md5 sum based on $content in case any tasks were run.
-                        $real_atts['attribs']['md5sum'] = md5($contents);
-                    }
-                } else {
-                    if (empty($options['force'])) {
-                        // delete the file
-                        if (file_exists($dest_file)) {
-                            unlink($dest_file);
-                        }
-
-                        if (!isset($options['ignore-errors'])) {
-                            return $this->raiseError("bad md5sum for file $final_dest_file",
-                                                     PEAR_INSTALLER_FAILED);
-                        }
-
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "warning : bad md5sum for file $final_dest_file");
-                        }
-                    } else {
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "warning : bad md5sum for file $final_dest_file");
-                        }
-                    }
-                }
-            } else {
-                $real_atts['attribs']['md5sum'] = md5_file($dest_file);
-            }
-
-            // }}}
-            // {{{ set file permissions
-            if (!OS_WINDOWS) {
-                if ($role->isExecutable()) {
-                    $mode = 0777 & ~(int)octdec($this->config->get('umask'));
-                    $this->log(3, "+ chmod +x $dest_file");
-                } else {
-                    $mode = 0666 & ~(int)octdec($this->config->get('umask'));
-                }
-
-                if ($attribs['role'] != 'src') {
-                    $this->addFileOperation("chmod", array($mode, $dest_file));
-                    if (!@chmod($dest_file, $mode)) {
-                        if (!isset($options['soft'])) {
-                            $this->log(0, "failed to change mode of $dest_file: $php_errormsg");
-                        }
-                    }
-                }
-            }
-            // }}}
-
-            if ($attribs['role'] == 'src') {
-                rename($dest_file, $final_dest_file);
-                $this->log(2, "renamed source file $dest_file to $final_dest_file");
-            } else {
-                $this->addFileOperation("rename", array($dest_file, $final_dest_file, $role->isExtension()));
-            }
-        }
-
-        // Store the full path where the file was installed for easy uninstall
-        if ($attribs['role'] != 'src') {
-            $loc = $this->config->get($role->getLocationConfig(), null, $channel);
-            $this->addFileOperation('installed_as', array($file, $installed_as,
-                                $loc,
-                                dirname(substr($installed_as, strlen($loc)))));
-        }
-
-        //$this->log(2, "installed: $dest_file");
-        return PEAR_INSTALLER_OK;
-    }
-
-    // }}}
-    // {{{ addFileOperation()
-
-    /**
-     * Add a file operation to the current file transaction.
-     *
-     * @see startFileTransaction()
-     * @param string $type This can be one of:
-     *    - rename:  rename a file ($data has 3 values)
-     *    - backup:  backup an existing file ($data has 1 value)
-     *    - removebackup:  clean up backups created during install ($data has 1 value)
-     *    - chmod:   change permissions on a file ($data has 2 values)
-     *    - delete:  delete a file ($data has 1 value)
-     *    - rmdir:   delete a directory if empty ($data has 1 value)
-     *    - installed_as: mark a file as installed ($data has 4 values).
-     * @param array $data For all file operations, this array must contain the
-     *    full path to the file or directory that is being operated on.  For
-     *    the rename command, the first parameter must be the file to rename,
-     *    the second its new name, the third whether this is a PHP extension.
-     *
-     *    The installed_as operation contains 4 elements in this order:
-     *    1. Filename as listed in the filelist element from package.xml
-     *    2. Full path to the installed file
-     *    3. Full path from the php_dir configuration variable used in this
-     *       installation
-     *    4. Relative path from the php_dir that this file is installed in
-     */
-    function addFileOperation($type, $data)
-    {
-        if (!is_array($data)) {
-            return $this->raiseError('Internal Error: $data in addFileOperation'
-                . ' must be an array, was ' . gettype($data));
-        }
-
-        if ($type == 'chmod') {
-            $octmode = decoct($data[0]);
-            $this->log(3, "adding to transaction: $type $octmode $data[1]");
-        } else {
-            $this->log(3, "adding to transaction: $type " . implode(" ", $data));
-        }
-        $this->file_operations[] = array($type, $data);
-    }
-
-    // }}}
-    // {{{ startFileTransaction()
-
-    function startFileTransaction($rollback_in_case = false)
-    {
-        if (count($this->file_operations) && $rollback_in_case) {
-            $this->rollbackFileTransaction();
-        }
-        $this->file_operations = array();
-    }
-
-    // }}}
-    // {{{ commitFileTransaction()
-
-    function commitFileTransaction()
-    {
-        $n = count($this->file_operations);
-        $this->log(2, "about to commit $n file operations");
-        // {{{ first, check permissions and such manually
-        $errors = array();
-        foreach ($this->file_operations as $tr) {
-            list($type, $data) = $tr;
-            switch ($type) {
-                case 'rename':
-                    if (!file_exists($data[0])) {
-                        $errors[] = "cannot rename file $data[0], doesn't exist";
-                    }
-
-                    // check that dest dir. is writable
-                    if (!is_writable(dirname($data[1]))) {
-                        $errors[] = "permission denied ($type): $data[1]";
-                    }
-                    break;
-                case 'chmod':
-                    // check that file is writable
-                    if (!is_writable($data[1])) {
-                        $errors[] = "permission denied ($type): $data[1] " . decoct($data[0]);
-                    }
-                    break;
-                case 'delete':
-                    if (!file_exists($data[0])) {
-                        $this->log(2, "warning: file $data[0] doesn't exist, can't be deleted");
-                    }
-                    // check that directory is writable
-                    if (file_exists($data[0])) {
-                        if (!is_writable(dirname($data[0]))) {
-                            $errors[] = "permission denied ($type): $data[0]";
-                        } else {
-                            // make sure the file to be deleted can be opened for writing
-                            $fp = false;
-                            if (!is_dir($data[0]) &&
-                                  (!is_writable($data[0]) || !($fp = @fopen($data[0], 'a')))) {
-                                $errors[] = "permission denied ($type): $data[0]";
-                            } elseif ($fp) {
-                                fclose($fp);
-                            }
-                        }
-                    }
-                    break;
-            }
-
-        }
-        // }}}
-        $m = count($errors);
-        if ($m > 0) {
-            foreach ($errors as $error) {
-                if (!isset($this->_options['soft'])) {
-                    $this->log(1, $error);
-                }
-            }
-
-            if (!isset($this->_options['ignore-errors'])) {
-                return false;
-            }
-        }
-
-        $this->_dirtree = array();
-        // {{{ really commit the transaction
-        foreach ($this->file_operations as $i => $tr) {
-            if (!$tr) {
-                // support removal of non-existing backups
-                continue;
-            }
-
-            list($type, $data) = $tr;
-            switch ($type) {
-                case 'backup':
-                    if (!file_exists($data[0])) {
-                        $this->file_operations[$i] = false;
-                        break;
-                    }
-
-                    if (!@copy($data[0], $data[0] . '.bak')) {
-                        $this->log(1, 'Could not copy ' . $data[0] . ' to ' . $data[0] .
-                            '.bak ' . $php_errormsg);
-                        return false;
-                    }
-                    $this->log(3, "+ backup $data[0] to $data[0].bak");
-                    break;
-                case 'removebackup':
-                    if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) {
-                        unlink($data[0] . '.bak');
-                        $this->log(3, "+ rm backup of $data[0] ($data[0].bak)");
-                    }
-                    break;
-                case 'rename':
-                    $test = file_exists($data[1]) ? @unlink($data[1]) : null;
-                    if (!$test && file_exists($data[1])) {
-                        if ($data[2]) {
-                            $extra = ', this extension must be installed manually.  Rename to "' .
-                                basename($data[1]) . '"';
-                        } else {
-                            $extra = '';
-                        }
-
-                        if (!isset($this->_options['soft'])) {
-                            $this->log(1, 'Could not delete ' . $data[1] . ', cannot rename ' .
-                                $data[0] . $extra);
-                        }
-
-                        if (!isset($this->_options['ignore-errors'])) {
-                            return false;
-                        }
-                    }
-
-                    // permissions issues with rename - copy() is far superior
-                    $perms = @fileperms($data[0]);
-                    if (!@copy($data[0], $data[1])) {
-                        $this->log(1, 'Could not rename ' . $data[0] . ' to ' . $data[1] .
-                            ' ' . $php_errormsg);
-                        return false;
-                    }
-
-                    // copy over permissions, otherwise they are lost
-                    @chmod($data[1], $perms);
-                    @unlink($data[0]);
-                    $this->log(3, "+ mv $data[0] $data[1]");
-                    break;
-                case 'chmod':
-                    if (!@chmod($data[1], $data[0])) {
-                        $this->log(1, 'Could not chmod ' . $data[1] . ' to ' .
-                            decoct($data[0]) . ' ' . $php_errormsg);
-                        return false;
-                    }
-
-                    $octmode = decoct($data[0]);
-                    $this->log(3, "+ chmod $octmode $data[1]");
-                    break;
-                case 'delete':
-                    if (file_exists($data[0])) {
-                        if (!@unlink($data[0])) {
-                            $this->log(1, 'Could not delete ' . $data[0] . ' ' .
-                                $php_errormsg);
-                            return false;
-                        }
-                        $this->log(3, "+ rm $data[0]");
-                    }
-                    break;
-                case 'rmdir':
-                    if (file_exists($data[0])) {
-                        do {
-                            $testme = opendir($data[0]);
-                            while (false !== ($entry = readdir($testme))) {
-                                if ($entry == '.' || $entry == '..') {
-                                    continue;
-                                }
-                                closedir($testme);
-                                break 2; // this directory is not empty and can't be
-                                         // deleted
-                            }
-
-                            closedir($testme);
-                            if (!@rmdir($data[0])) {
-                                $this->log(1, 'Could not rmdir ' . $data[0] . ' ' .
-                                    $php_errormsg);
-                                return false;
-                            }
-                            $this->log(3, "+ rmdir $data[0]");
-                        } while (false);
-                    }
-                    break;
-                case 'installed_as':
-                    $this->pkginfo->setInstalledAs($data[0], $data[1]);
-                    if (!isset($this->_dirtree[dirname($data[1])])) {
-                        $this->_dirtree[dirname($data[1])] = true;
-                        $this->pkginfo->setDirtree(dirname($data[1]));
-
-                        while(!empty($data[3]) && dirname($data[3]) != $data[3] &&
-                                $data[3] != '/' && $data[3] != '\\') {
-                            $this->pkginfo->setDirtree($pp =
-                                $this->_prependPath($data[3], $data[2]));
-                            $this->_dirtree[$pp] = true;
-                            $data[3] = dirname($data[3]);
-                        }
-                    }
-                    break;
-            }
-        }
-        // }}}
-        $this->log(2, "successfully committed $n file operations");
-        $this->file_operations = array();
-        return true;
-    }
-
-    // }}}
-    // {{{ rollbackFileTransaction()
-
-    function rollbackFileTransaction()
-    {
-        $n = count($this->file_operations);
-        $this->log(2, "rolling back $n file operations");
-        foreach ($this->file_operations as $tr) {
-            list($type, $data) = $tr;
-            switch ($type) {
-                case 'backup':
-                    if (file_exists($data[0] . '.bak')) {
-                        if (file_exists($data[0] && is_writable($data[0]))) {
-                            unlink($data[0]);
-                        }
-                        @copy($data[0] . '.bak', $data[0]);
-                        $this->log(3, "+ restore $data[0] from $data[0].bak");
-                    }
-                    break;
-                case 'removebackup':
-                    if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) {
-                        unlink($data[0] . '.bak');
-                        $this->log(3, "+ rm backup of $data[0] ($data[0].bak)");
-                    }
-                    break;
-                case 'rename':
-                    @unlink($data[0]);
-                    $this->log(3, "+ rm $data[0]");
-                    break;
-                case 'mkdir':
-                    @rmdir($data[0]);
-                    $this->log(3, "+ rmdir $data[0]");
-                    break;
-                case 'chmod':
-                    break;
-                case 'delete':
-                    break;
-                case 'installed_as':
-                    $this->pkginfo->setInstalledAs($data[0], false);
-                    break;
-            }
-        }
-        $this->pkginfo->resetDirtree();
-        $this->file_operations = array();
-    }
-
-    // }}}
-    // {{{ mkDirHier($dir)
-
-    function mkDirHier($dir)
-    {
-        $this->addFileOperation('mkdir', array($dir));
-        return parent::mkDirHier($dir);
-    }
-
-    // }}}
-    // {{{ download()
-
-    /**
-     * Download any files and their dependencies, if necessary
-     *
-     * @param array a mixed list of package names, local files, or package.xml
-     * @param PEAR_Config
-     * @param array options from the command line
-     * @param array this is the array that will be populated with packages to
-     *              install.  Format of each entry:
-     *
-     * <code>
-     * array('pkg' => 'package_name', 'file' => '/path/to/local/file',
-     *    'info' => array() // parsed package.xml
-     * );
-     * </code>
-     * @param array this will be populated with any error messages
-     * @param false private recursion variable
-     * @param false private recursion variable
-     * @param false private recursion variable
-     * @deprecated in favor of PEAR_Downloader
-     */
-    function download($packages, $options, &$config, &$installpackages,
-                      &$errors, $installed = false, $willinstall = false, $state = false)
-    {
-        // trickiness: initialize here
-        parent::PEAR_Downloader($this->ui, $options, $config);
-        $ret             = parent::download($packages);
-        $errors          = $this->getErrorMsgs();
-        $installpackages = $this->getDownloadedPackages();
-        trigger_error("PEAR Warning: PEAR_Installer::download() is deprecated " .
-                      "in favor of PEAR_Downloader class", E_USER_WARNING);
-        return $ret;
-    }
-
-    // }}}
-    // {{{ _parsePackageXml()
-
-    function _parsePackageXml(&$descfile, &$tmpdir)
-    {
-        if (substr($descfile, -4) == '.xml') {
-            $tmpdir = false;
-        } else {
-            // {{{ Decompress pack in tmp dir -------------------------------------
-
-            // To allow relative package file names
-            $descfile = realpath($descfile);
-
-            if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
-                return $tmpdir;
-            }
-            $this->log(3, '+ tmp dir created at ' . $tmpdir);
-            // }}}
-        }
-
-        // Parse xml file -----------------------------------------------
-        $pkg = new PEAR_PackageFile($this->config, $this->debug, $tmpdir);
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $p = &$pkg->fromAnyFile($descfile, PEAR_VALIDATE_INSTALLING);
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($p)) {
-            if (is_array($p->getUserInfo())) {
-                foreach ($p->getUserInfo() as $err) {
-                    $loglevel = $err['level'] == 'error' ? 0 : 1;
-                    if (!isset($this->_options['soft'])) {
-                        $this->log($loglevel, ucfirst($err['level']) . ': ' . $err['message']);
-                    }
-                }
-            }
-            return $this->raiseError('Installation failed: invalid package file');
-        }
-
-        $descfile = $p->getPackageFile();
-        return $p;
-    }
-
-    // }}}
-    /**
-     * Set the list of PEAR_Downloader_Package objects to allow more sane
-     * dependency validation
-     * @param array
-     */
-    function setDownloadedPackages(&$pkgs)
-    {
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $err = $this->analyzeDependencies($pkgs);
-        PEAR::popErrorHandling();
-        if (PEAR::isError($err)) {
-            return $err;
-        }
-        $this->_downloadedPackages = &$pkgs;
-    }
-
-    /**
-     * Set the list of PEAR_Downloader_Package objects to allow more sane
-     * dependency validation
-     * @param array
-     */
-    function setUninstallPackages(&$pkgs)
-    {
-        $this->_downloadedPackages = &$pkgs;
-    }
-
-    function getInstallPackages()
-    {
-        return $this->_downloadedPackages;
-    }
-
-    // {{{ install()
-
-    /**
-     * Installs the files within the package file specified.
-     *
-     * @param string|PEAR_Downloader_Package $pkgfile path to the package file,
-     *        or a pre-initialized packagefile object
-     * @param array $options
-     * recognized options:
-     * - installroot   : optional prefix directory for installation
-     * - force         : force installation
-     * - register-only : update registry but don't install files
-     * - upgrade       : upgrade existing install
-     * - soft          : fail silently
-     * - nodeps        : ignore dependency conflicts/missing dependencies
-     * - alldeps       : install all dependencies
-     * - onlyreqdeps   : install only required dependencies
-     *
-     * @return array|PEAR_Error package info if successful
-     */
-    function install($pkgfile, $options = array())
-    {
-        $this->_options = $options;
-        $this->_registry = &$this->config->getRegistry();
-        if (is_object($pkgfile)) {
-            $dlpkg    = &$pkgfile;
-            $pkg      = $pkgfile->getPackageFile();
-            $pkgfile  = $pkg->getArchiveFile();
-            $descfile = $pkg->getPackageFile();
-            $tmpdir   = dirname($descfile);
-        } else {
-            $descfile = $pkgfile;
-            $tmpdir   = '';
-            $pkg      = $this->_parsePackageXml($descfile, $tmpdir);
-            if (PEAR::isError($pkg)) {
-                return $pkg;
-            }
-        }
-
-        if (realpath($descfile) != realpath($pkgfile)) {
-            $tar = new Archive_Tar($pkgfile);
-            if (!$tar->extract($tmpdir)) {
-                return $this->raiseError("unable to unpack $pkgfile");
-            }
-        }
-
-        $pkgname = $pkg->getName();
-        $channel = $pkg->getChannel();
-        if (isset($this->_options['packagingroot'])) {
-            $regdir = $this->_prependPath(
-                $this->config->get('php_dir', null, 'pear.php.net'),
-                $this->_options['packagingroot']);
-
-            $packrootphp_dir = $this->_prependPath(
-                $this->config->get('php_dir', null, $channel),
-                $this->_options['packagingroot']);
-        }
-
-        if (isset($options['installroot'])) {
-            $this->config->setInstallRoot($options['installroot']);
-            $this->_registry = &$this->config->getRegistry();
-            $installregistry = &$this->_registry;
-            $this->installroot = ''; // all done automagically now
-            $php_dir = $this->config->get('php_dir', null, $channel);
-        } else {
-            $this->config->setInstallRoot(false);
-            $this->_registry = &$this->config->getRegistry();
-            if (isset($this->_options['packagingroot'])) {
-                $installregistry = &new PEAR_Registry($regdir);
-                if (!$installregistry->channelExists($channel, true)) {
-                    // we need to fake a channel-discover of this channel
-                    $chanobj = $this->_registry->getChannel($channel, true);
-                    $installregistry->addChannel($chanobj);
-                }
-                $php_dir = $packrootphp_dir;
-            } else {
-                $installregistry = &$this->_registry;
-                $php_dir = $this->config->get('php_dir', null, $channel);
-            }
-            $this->installroot = '';
-        }
-
-        // {{{ checks to do when not in "force" mode
-        if (empty($options['force']) &&
-              (file_exists($this->config->get('php_dir')) &&
-               is_dir($this->config->get('php_dir')))) {
-            $testp = $channel == 'pear.php.net' ? $pkgname : array($channel, $pkgname);
-            $instfilelist = $pkg->getInstallationFileList(true);
-            if (PEAR::isError($instfilelist)) {
-                return $instfilelist;
-            }
-
-            // ensure we have the most accurate registry
-            $installregistry->flushFileMap();
-            $test = $installregistry->checkFileMap($instfilelist, $testp, '1.1');
-            if (PEAR::isError($test)) {
-                return $test;
-            }
-
-            if (sizeof($test)) {
-                $pkgs = $this->getInstallPackages();
-                $found = false;
-                foreach ($pkgs as $param) {
-                    if ($pkg->isSubpackageOf($param)) {
-                        $found = true;
-                        break;
-                    }
-                }
-
-                if ($found) {
-                    // subpackages can conflict with earlier versions of parent packages
-                    $parentreg = $installregistry->packageInfo($param->getPackage(), null, $param->getChannel());
-                    $tmp = $test;
-                    foreach ($tmp as $file => $info) {
-                        if (is_array($info)) {
-                            if (strtolower($info[1]) == strtolower($param->getPackage()) &&
-                                  strtolower($info[0]) == strtolower($param->getChannel())
-                            ) {
-                                if (isset($parentreg['filelist'][$file])) {
-                                    unset($parentreg['filelist'][$file]);
-                                } else{
-                                    $pos     = strpos($file, '/');
-                                    $basedir = substr($file, 0, $pos);
-                                    $file2   = substr($file, $pos + 1);
-                                    if (isset($parentreg['filelist'][$file2]['baseinstalldir'])
-                                        && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
-                                    ) {
-                                        unset($parentreg['filelist'][$file2]);
-                                    }
-                                }
-
-                                unset($test[$file]);
-                            }
-                        } else {
-                            if (strtolower($param->getChannel()) != 'pear.php.net') {
-                                continue;
-                            }
-
-                            if (strtolower($info) == strtolower($param->getPackage())) {
-                                if (isset($parentreg['filelist'][$file])) {
-                                    unset($parentreg['filelist'][$file]);
-                                } else{
-                                    $pos     = strpos($file, '/');
-                                    $basedir = substr($file, 0, $pos);
-                                    $file2   = substr($file, $pos + 1);
-                                    if (isset($parentreg['filelist'][$file2]['baseinstalldir'])
-                                        && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
-                                    ) {
-                                        unset($parentreg['filelist'][$file2]);
-                                    }
-                                }
-
-                                unset($test[$file]);
-                            }
-                        }
-                    }
-
-                    $pfk = &new PEAR_PackageFile($this->config);
-                    $parentpkg = &$pfk->fromArray($parentreg);
-                    $installregistry->updatePackage2($parentpkg);
-                }
-
-                if ($param->getChannel() == 'pecl.php.net' && isset($options['upgrade'])) {
-                    $tmp = $test;
-                    foreach ($tmp as $file => $info) {
-                        if (is_string($info)) {
-                            // pear.php.net packages are always stored as strings
-                            if (strtolower($info) == strtolower($param->getPackage())) {
-                                // upgrading existing package
-                                unset($test[$file]);
-                            }
-                        }
-                    }
-                }
-
-                if (count($test)) {
-                    $msg = "$channel/$pkgname: conflicting files found:\n";
-                    $longest = max(array_map("strlen", array_keys($test)));
-                    $fmt = "%${longest}s (%s)\n";
-                    foreach ($test as $file => $info) {
-                        if (!is_array($info)) {
-                            $info = array('pear.php.net', $info);
-                        }
-                        $info = $info[0] . '/' . $info[1];
-                        $msg .= sprintf($fmt, $file, $info);
-                    }
-
-                    if (!isset($options['ignore-errors'])) {
-                        return $this->raiseError($msg);
-                    }
-
-                    if (!isset($options['soft'])) {
-                        $this->log(0, "WARNING: $msg");
-                    }
-                }
-            }
-        }
-        // }}}
-
-        $this->startFileTransaction();
-
-        if (empty($options['upgrade']) && empty($options['soft'])) {
-            // checks to do only when installing new packages
-            if ($channel == 'pecl.php.net') {
-                $test = $installregistry->packageExists($pkgname, $channel);
-                if (!$test) {
-                    $test = $installregistry->packageExists($pkgname, 'pear.php.net');
-                }
-            } else {
-                $test = $installregistry->packageExists($pkgname, $channel);
-            }
-
-            if (empty($options['force']) && $test) {
-                return $this->raiseError("$channel/$pkgname is already installed");
-            }
-        } else {
-            $usechannel = $channel;
-            if ($channel == 'pecl.php.net') {
-                $test = $installregistry->packageExists($pkgname, $channel);
-                if (!$test) {
-                    $test = $installregistry->packageExists($pkgname, 'pear.php.net');
-                    $usechannel = 'pear.php.net';
-                }
-            } else {
-                $test = $installregistry->packageExists($pkgname, $channel);
-            }
-
-            if ($test) {
-                $v1 = $installregistry->packageInfo($pkgname, 'version', $usechannel);
-                $v2 = $pkg->getVersion();
-                $cmp = version_compare("$v1", "$v2", 'gt');
-                if (empty($options['force']) && !version_compare("$v2", "$v1", 'gt')) {
-                    return $this->raiseError("upgrade to a newer version ($v2 is not newer than $v1)");
-                }
-
-                if (empty($options['register-only'])) {
-                    // when upgrading, remove old release's files first:
-                    if (PEAR::isError($err = $this->_deletePackageFiles($pkgname, $usechannel,
-                          true))) {
-                        if (!isset($options['ignore-errors'])) {
-                            return $this->raiseError($err);
-                        }
-
-                        if (!isset($options['soft'])) {
-                            $this->log(0, 'WARNING: ' . $err->getMessage());
-                        }
-                    } else {
-                        $backedup = $err;
-                    }
-                }
-            }
-        }
-
-        // {{{ Copy files to dest dir ---------------------------------------
-
-        // info from the package it self we want to access from _installFile
-        $this->pkginfo = &$pkg;
-        // used to determine whether we should build any C code
-        $this->source_files = 0;
-
-        $savechannel = $this->config->get('default_channel');
-        if (empty($options['register-only']) && !is_dir($php_dir)) {
-            if (PEAR::isError(System::mkdir(array('-p'), $php_dir))) {
-                return $this->raiseError("no installation destination directory '$php_dir'\n");
-            }
-        }
-
-        $tmp_path = dirname($descfile);
-        if (substr($pkgfile, -4) != '.xml') {
-            $tmp_path .= DIRECTORY_SEPARATOR . $pkgname . '-' . $pkg->getVersion();
-        }
-
-        $this->configSet('default_channel', $channel);
-        // {{{ install files
-
-        $ver = $pkg->getPackagexmlVersion();
-        if (version_compare($ver, '2.0', '>=')) {
-            $filelist = $pkg->getInstallationFilelist();
-        } else {
-            $filelist = $pkg->getFileList();
-        }
-
-        if (PEAR::isError($filelist)) {
-            return $filelist;
-        }
-
-        $p = &$installregistry->getPackage($pkgname, $channel);
-        $dirtree = (empty($options['register-only']) && $p) ? $p->getDirTree() : false;
-
-        $pkg->resetFilelist();
-        $pkg->setLastInstalledVersion($installregistry->packageInfo($pkg->getPackage(),
-            'version', $pkg->getChannel()));
-        foreach ($filelist as $file => $atts) {
-            $this->expectError(PEAR_INSTALLER_FAILED);
-            if ($pkg->getPackagexmlVersion() == '1.0') {
-                $res = $this->_installFile($file, $atts, $tmp_path, $options);
-            } else {
-                $res = $this->_installFile2($pkg, $file, $atts, $tmp_path, $options);
-            }
-            $this->popExpect();
-
-            if (PEAR::isError($res)) {
-                if (empty($options['ignore-errors'])) {
-                    $this->rollbackFileTransaction();
-                    if ($res->getMessage() == "file does not exist") {
-                        $this->raiseError("file $file in package.xml does not exist");
-                    }
-
-                    return $this->raiseError($res);
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->log(0, "Warning: " . $res->getMessage());
-                }
-            }
-
-            $real = isset($atts['attribs']) ? $atts['attribs'] : $atts;
-            if ($res == PEAR_INSTALLER_OK && $real['role'] != 'src') {
-                // Register files that were installed
-                $pkg->installedFile($file, $atts);
-            }
-        }
-        // }}}
-
-        // {{{ compile and install source files
-        if ($this->source_files > 0 && empty($options['nobuild'])) {
-            if (PEAR::isError($err =
-                  $this->_compileSourceFiles($savechannel, $pkg))) {
-                return $err;
-            }
-        }
-        // }}}
-
-        if (isset($backedup)) {
-            $this->_removeBackups($backedup);
-        }
-
-        if (!$this->commitFileTransaction()) {
-            $this->rollbackFileTransaction();
-            $this->configSet('default_channel', $savechannel);
-            return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED);
-        }
-        // }}}
-
-        $ret          = false;
-        $installphase = 'install';
-        $oldversion   = false;
-        // {{{ Register that the package is installed -----------------------
-        if (empty($options['upgrade'])) {
-            // if 'force' is used, replace the info in registry
-            $usechannel = $channel;
-            if ($channel == 'pecl.php.net') {
-                $test = $installregistry->packageExists($pkgname, $channel);
-                if (!$test) {
-                    $test = $installregistry->packageExists($pkgname, 'pear.php.net');
-                    $usechannel = 'pear.php.net';
-                }
-            } else {
-                $test = $installregistry->packageExists($pkgname, $channel);
-            }
-
-            if (!empty($options['force']) && $test) {
-                $oldversion = $installregistry->packageInfo($pkgname, 'version', $usechannel);
-                $installregistry->deletePackage($pkgname, $usechannel);
-            }
-            $ret = $installregistry->addPackage2($pkg);
-        } else {
-            if ($dirtree) {
-                $this->startFileTransaction();
-                // attempt to delete empty directories
-                uksort($dirtree, array($this, '_sortDirs'));
-                foreach($dirtree as $dir => $notused) {
-                    $this->addFileOperation('rmdir', array($dir));
-                }
-                $this->commitFileTransaction();
-            }
-
-            $usechannel = $channel;
-            if ($channel == 'pecl.php.net') {
-                $test = $installregistry->packageExists($pkgname, $channel);
-                if (!$test) {
-                    $test = $installregistry->packageExists($pkgname, 'pear.php.net');
-                    $usechannel = 'pear.php.net';
-                }
-            } else {
-                $test = $installregistry->packageExists($pkgname, $channel);
-            }
-
-            // new: upgrade installs a package if it isn't installed
-            if (!$test) {
-                $ret = $installregistry->addPackage2($pkg);
-            } else {
-                if ($usechannel != $channel) {
-                    $installregistry->deletePackage($pkgname, $usechannel);
-                    $ret = $installregistry->addPackage2($pkg);
-                } else {
-                    $ret = $installregistry->updatePackage2($pkg);
-                }
-                $installphase = 'upgrade';
-            }
-        }
-
-        if (!$ret) {
-            $this->configSet('default_channel', $savechannel);
-            return $this->raiseError("Adding package $channel/$pkgname to registry failed");
-        }
-        // }}}
-
-        $this->configSet('default_channel', $savechannel);
-        if (class_exists('PEAR_Task_Common')) { // this is auto-included if any tasks exist
-            if (PEAR_Task_Common::hasPostinstallTasks()) {
-                PEAR_Task_Common::runPostinstallTasks($installphase);
-            }
-        }
-
-        return $pkg->toArray(true);
-    }
-
-    // }}}
-
-    // {{{ _compileSourceFiles()
-    /**
-     * @param string
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     */
-    function _compileSourceFiles($savechannel, &$filelist)
-    {
-        require_once 'PEAR/Builder.php';
-        $this->log(1, "$this->source_files source files, building");
-        $bob = &new PEAR_Builder($this->ui);
-        $bob->debug = $this->debug;
-        $built = $bob->build($filelist, array(&$this, '_buildCallback'));
-        if (PEAR::isError($built)) {
-            $this->rollbackFileTransaction();
-            $this->configSet('default_channel', $savechannel);
-            return $built;
-        }
-
-        $this->log(1, "\nBuild process completed successfully");
-        foreach ($built as $ext) {
-            $bn = basename($ext['file']);
-            list($_ext_name, $_ext_suff) = explode('.', $bn);
-            if ($_ext_suff == '.so' || $_ext_suff == '.dll') {
-                if (extension_loaded($_ext_name)) {
-                    $this->raiseError("Extension '$_ext_name' already loaded. " .
-                                      'Please unload it in your php.ini file ' .
-                                      'prior to install or upgrade');
-                }
-                $role = 'ext';
-            } else {
-                $role = 'src';
-            }
-
-            $dest = $ext['dest'];
-            $packagingroot = '';
-            if (isset($this->_options['packagingroot'])) {
-                $packagingroot = $this->_options['packagingroot'];
-            }
-
-            $copyto = $this->_prependPath($dest, $packagingroot);
-            $extra  = $copyto != $dest ? " as '$copyto'" : '';
-            $this->log(1, "Installing '$dest'$extra");
-
-            $copydir = dirname($copyto);
-            // pretty much nothing happens if we are only registering the install
-            if (empty($this->_options['register-only'])) {
-                if (!file_exists($copydir) || !is_dir($copydir)) {
-                    if (!$this->mkDirHier($copydir)) {
-                        return $this->raiseError("failed to mkdir $copydir",
-                            PEAR_INSTALLER_FAILED);
-                    }
-
-                    $this->log(3, "+ mkdir $copydir");
-                }
-
-                if (!@copy($ext['file'], $copyto)) {
-                    return $this->raiseError("failed to write $copyto ($php_errormsg)", PEAR_INSTALLER_FAILED);
-                }
-
-                $this->log(3, "+ cp $ext[file] $copyto");
-                $this->addFileOperation('rename', array($ext['file'], $copyto));
-                if (!OS_WINDOWS) {
-                    $mode = 0666 & ~(int)octdec($this->config->get('umask'));
-                    $this->addFileOperation('chmod', array($mode, $copyto));
-                    if (!@chmod($copyto, $mode)) {
-                        $this->log(0, "failed to change mode of $copyto ($php_errormsg)");
-                    }
-                }
-            }
-
-
-            $data = array(
-                'role'         => $role,
-                'name'         => $bn,
-                'installed_as' => $dest,
-                'php_api'      => $ext['php_api'],
-                'zend_mod_api' => $ext['zend_mod_api'],
-                'zend_ext_api' => $ext['zend_ext_api'],
-            );
-
-            if ($filelist->getPackageXmlVersion() == '1.0') {
-                $filelist->installedFile($bn, $data);
-            } else {
-                $filelist->installedFile($bn, array('attribs' => $data));
-            }
-        }
-    }
-
-    // }}}
-    function &getUninstallPackages()
-    {
-        return $this->_downloadedPackages;
-    }
-    // {{{ uninstall()
-
-    /**
-     * Uninstall a package
-     *
-     * This method removes all files installed by the application, and then
-     * removes any empty directories.
-     * @param string package name
-     * @param array Command-line options.  Possibilities include:
-     *
-     *              - installroot: base installation dir, if not the default
-     *              - register-only : update registry but don't remove files
-     *              - nodeps: do not process dependencies of other packages to ensure
-     *                        uninstallation does not break things
-     */
-    function uninstall($package, $options = array())
-    {
-        $installRoot = isset($options['installroot']) ? $options['installroot'] : '';
-        $this->config->setInstallRoot($installRoot);
-
-        $this->installroot = '';
-        $this->_registry = &$this->config->getRegistry();
-        if (is_object($package)) {
-            $channel = $package->getChannel();
-            $pkg     = $package;
-            $package = $pkg->getPackage();
-        } else {
-            $pkg = false;
-            $info = $this->_registry->parsePackageName($package,
-                $this->config->get('default_channel'));
-            $channel = $info['channel'];
-            $package = $info['package'];
-        }
-
-        $savechannel = $this->config->get('default_channel');
-        $this->configSet('default_channel', $channel);
-        if (!is_object($pkg)) {
-            $pkg = $this->_registry->getPackage($package, $channel);
-        }
-
-        if (!$pkg) {
-            $this->configSet('default_channel', $savechannel);
-            return $this->raiseError($this->_registry->parsedPackageNameToString(
-                array(
-                    'channel' => $channel,
-                    'package' => $package
-                ), true) . ' not installed');
-        }
-
-        if ($pkg->getInstalledBinary()) {
-            // this is just an alias for a binary package
-            return $this->_registry->deletePackage($package, $channel);
-        }
-
-        $filelist = $pkg->getFilelist();
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        if (!class_exists('PEAR_Dependency2')) {
-            require_once 'PEAR/Dependency2.php';
-        }
-
-        $depchecker = &new PEAR_Dependency2($this->config, $options,
-            array('channel' => $channel, 'package' => $package),
-            PEAR_VALIDATE_UNINSTALLING);
-        $e = $depchecker->validatePackageUninstall($this);
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($e)) {
-            if (!isset($options['ignore-errors'])) {
-                return $this->raiseError($e);
-            }
-
-            if (!isset($options['soft'])) {
-                $this->log(0, 'WARNING: ' . $e->getMessage());
-            }
-        } elseif (is_array($e)) {
-            if (!isset($options['soft'])) {
-                $this->log(0, $e[0]);
-            }
-        }
-
-        $this->pkginfo = &$pkg;
-        // pretty much nothing happens if we are only registering the uninstall
-        if (empty($options['register-only'])) {
-            // {{{ Delete the files
-            $this->startFileTransaction();
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            if (PEAR::isError($err = $this->_deletePackageFiles($package, $channel))) {
-                PEAR::popErrorHandling();
-                $this->rollbackFileTransaction();
-                $this->configSet('default_channel', $savechannel);
-                if (!isset($options['ignore-errors'])) {
-                    return $this->raiseError($err);
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->log(0, 'WARNING: ' . $err->getMessage());
-                }
-            } else {
-                PEAR::popErrorHandling();
-            }
-
-            if (!$this->commitFileTransaction()) {
-                $this->rollbackFileTransaction();
-                if (!isset($options['ignore-errors'])) {
-                    return $this->raiseError("uninstall failed");
-                }
-
-                if (!isset($options['soft'])) {
-                    $this->log(0, 'WARNING: uninstall failed');
-                }
-            } else {
-                $this->startFileTransaction();
-                $dirtree = $pkg->getDirTree();
-                if ($dirtree === false) {
-                    $this->configSet('default_channel', $savechannel);
-                    return $this->_registry->deletePackage($package, $channel);
-                }
-
-                // attempt to delete empty directories
-                uksort($dirtree, array($this, '_sortDirs'));
-                foreach($dirtree as $dir => $notused) {
-                    $this->addFileOperation('rmdir', array($dir));
-                }
-
-                if (!$this->commitFileTransaction()) {
-                    $this->rollbackFileTransaction();
-                    if (!isset($options['ignore-errors'])) {
-                        return $this->raiseError("uninstall failed");
-                    }
-
-                    if (!isset($options['soft'])) {
-                        $this->log(0, 'WARNING: uninstall failed');
-                    }
-                }
-            }
-            // }}}
-        }
-
-        $this->configSet('default_channel', $savechannel);
-        // Register that the package is no longer installed
-        return $this->_registry->deletePackage($package, $channel);
-    }
-
-    /**
-     * Sort a list of arrays of array(downloaded packagefilename) by dependency.
-     *
-     * It also removes duplicate dependencies
-     * @param array an array of PEAR_PackageFile_v[1/2] objects
-     * @return array|PEAR_Error array of array(packagefilename, package.xml contents)
-     */
-    function sortPackagesForUninstall(&$packages)
-    {
-        $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->config);
-        if (PEAR::isError($this->_dependencyDB)) {
-            return $this->_dependencyDB;
-        }
-        usort($packages, array(&$this, '_sortUninstall'));
-    }
-
-    function _sortUninstall($a, $b)
-    {
-        if (!$a->getDeps() && !$b->getDeps()) {
-            return 0; // neither package has dependencies, order is insignificant
-        }
-        if ($a->getDeps() && !$b->getDeps()) {
-            return -1; // $a must be installed after $b because $a has dependencies
-        }
-        if (!$a->getDeps() && $b->getDeps()) {
-            return 1; // $b must be installed after $a because $b has dependencies
-        }
-        // both packages have dependencies
-        if ($this->_dependencyDB->dependsOn($a, $b)) {
-            return -1;
-        }
-        if ($this->_dependencyDB->dependsOn($b, $a)) {
-            return 1;
-        }
-        return 0;
-    }
-
-    // }}}
-    // {{{ _sortDirs()
-    function _sortDirs($a, $b)
-    {
-        if (strnatcmp($a, $b) == -1) return 1;
-        if (strnatcmp($a, $b) == 1) return -1;
-        return 0;
-    }
-
-    // }}}
-
-    // {{{ _buildCallback()
-
-    function _buildCallback($what, $data)
-    {
-        if (($what == 'cmdoutput' && $this->debug > 1) ||
-            ($what == 'output' && $this->debug > 0)) {
-            $this->ui->outputData(rtrim($data), 'build');
-        }
-    }
-
-    // }}}
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role.php b/lib/php/PEAR/Installer/Role.php
deleted file mode 100644
index 3d7e68d869df01f587683caa3a4e433996b16104..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Role.php 278552 2009-04-10 19:42:49Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * base class for installer roles
- */
-require_once 'PEAR/Installer/Role/Common.php';
-require_once 'PEAR/XMLParser.php';
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role
-{
-    /**
-     * Set up any additional configuration variables that file roles require
-     *
-     * Never call this directly, it is called by the PEAR_Config constructor
-     * @param PEAR_Config
-     * @access private
-     * @static
-     */
-    function initializeConfig(&$config)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $class => $info) {
-            if (!$info['config_vars']) {
-                continue;
-            }
-
-            $config->_addConfigVars($class, $info['config_vars']);
-        }
-    }
-
-    /**
-     * @param PEAR_PackageFile_v2
-     * @param string role name
-     * @param PEAR_Config
-     * @return PEAR_Installer_Role_Common
-     * @static
-     */
-    function &factory($pkg, $role, &$config)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        if (!in_array($role, PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) {
-            $a = false;
-            return $a;
-        }
-
-        $a = 'PEAR_Installer_Role_' . ucfirst($role);
-        if (!class_exists($a)) {
-            require_once str_replace('_', '/', $a) . '.php';
-        }
-
-        $b = new $a($config);
-        return $b;
-    }
-
-    /**
-     * Get a list of file roles that are valid for the particular release type.
-     *
-     * For instance, src files serve no purpose in regular php releases.
-     * @param string
-     * @param bool clear cache
-     * @return array
-     * @static
-     */
-    function getValidRoles($release, $clear = false)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        static $ret = array();
-        if ($clear) {
-            $ret = array();
-        }
-
-        if (isset($ret[$release])) {
-            return $ret[$release];
-        }
-
-        $ret[$release] = array();
-        foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
-            if (in_array($release, $okreleases['releasetypes'])) {
-                $ret[$release][] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
-            }
-        }
-
-        return $ret[$release];
-    }
-
-    /**
-     * Get a list of roles that require their files to be installed
-     *
-     * Most roles must be installed, but src and package roles, for instance
-     * are pseudo-roles.  src files are compiled into a new extension.  Package
-     * roles are actually fully bundled releases of a package
-     * @param bool clear cache
-     * @return array
-     * @static
-     */
-    function getInstallableRoles($clear = false)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        static $ret;
-        if ($clear) {
-            unset($ret);
-        }
-
-        if (isset($ret)) {
-            return $ret;
-        }
-
-        $ret = array();
-        foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
-            if ($okreleases['installable']) {
-                $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
-            }
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Return an array of roles that are affected by the baseinstalldir attribute
-     *
-     * Most roles ignore this attribute, and instead install directly into:
-     * PackageName/filepath
-     * so a tests file tests/file.phpt is installed into PackageName/tests/filepath.php
-     * @param bool clear cache
-     * @return array
-     * @static
-     */
-    function getBaseinstallRoles($clear = false)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        static $ret;
-        if ($clear) {
-            unset($ret);
-        }
-
-        if (isset($ret)) {
-            return $ret;
-        }
-
-        $ret = array();
-        foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
-            if ($okreleases['honorsbaseinstall']) {
-                $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
-            }
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Return an array of file roles that should be analyzed for PHP content at package time,
-     * like the "php" role.
-     * @param bool clear cache
-     * @return array
-     * @static
-     */
-    function getPhpRoles($clear = false)
-    {
-        if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
-            PEAR_Installer_Role::registerRoles();
-        }
-
-        static $ret;
-        if ($clear) {
-            unset($ret);
-        }
-
-        if (isset($ret)) {
-            return $ret;
-        }
-
-        $ret = array();
-        foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
-            if ($okreleases['phpfile']) {
-                $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
-            }
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Scan through the Command directory looking for classes
-     * and see what commands they implement.
-     * @param string which directory to look for classes, defaults to
-     *               the Installer/Roles subdirectory of
-     *               the directory from where this file (__FILE__) is
-     *               included.
-     *
-     * @return bool TRUE on success, a PEAR error on failure
-     * @access public
-     * @static
-     */
-    function registerRoles($dir = null)
-    {
-        $GLOBALS['_PEAR_INSTALLER_ROLES'] = array();
-        $parser = new PEAR_XMLParser;
-        if ($dir === null) {
-            $dir = dirname(__FILE__) . '/Role';
-        }
-
-        if (!file_exists($dir) || !is_dir($dir)) {
-            return PEAR::raiseError("registerRoles: opendir($dir) failed: does not exist/is not directory");
-        }
-
-        $dp = @opendir($dir);
-        if (empty($dp)) {
-            return PEAR::raiseError("registerRoles: opendir($dir) failed: $php_errmsg");
-        }
-
-        while ($entry = readdir($dp)) {
-            if ($entry{0} == '.' || substr($entry, -4) != '.xml') {
-                continue;
-            }
-
-            $class = "PEAR_Installer_Role_".substr($entry, 0, -4);
-            // List of roles
-            if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) {
-                $file = "$dir/$entry";
-                $parser->parse(file_get_contents($file));
-                $data = $parser->getData();
-                if (!is_array($data['releasetypes'])) {
-                    $data['releasetypes'] = array($data['releasetypes']);
-                }
-
-                $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data;
-            }
-        }
-
-        closedir($dp);
-        ksort($GLOBALS['_PEAR_INSTALLER_ROLES']);
-        PEAR_Installer_Role::getBaseinstallRoles(true);
-        PEAR_Installer_Role::getInstallableRoles(true);
-        PEAR_Installer_Role::getPhpRoles(true);
-        PEAR_Installer_Role::getValidRoles('****', true);
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Cfg.php b/lib/php/PEAR/Installer/Role/Cfg.php
deleted file mode 100644
index e7ea6e93203732cd73a359dec38f4978b44647a3..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Cfg.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Cfg
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2007-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Cfg.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.7.0
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2007-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.7.0
- */
-class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common
-{
-    /**
-     * @var PEAR_Installer
-     */
-    var $installer;
-
-    /**
-     * the md5 of the original file
-     *
-     * @var unknown_type
-     */
-    var $md5 = null;
-
-    /**
-     * Do any unusual setup here
-     * @param PEAR_Installer
-     * @param PEAR_PackageFile_v2
-     * @param array file attributes
-     * @param string file name
-     */
-    function setup(&$installer, $pkg, $atts, $file)
-    {
-        $this->installer = &$installer;
-        $reg = &$this->installer->config->getRegistry();
-        $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel());
-        if ($package) {
-            $filelist = $package->getFilelist();
-            if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) {
-                $this->md5 = $filelist[$file]['md5sum'];
-            }
-        }
-    }
-
-    function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
-    {
-        $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer);
-        if (@file_exists($test[2]) && @file_exists($test[3])) {
-            $md5 = md5_file($test[2]);
-            // configuration has already been installed, check for mods
-            if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) {
-                // configuration has been modified, so save our version as
-                // configfile-version
-                $old = $test[2];
-                $test[2] .= '.new-' . $pkg->getVersion();
-                // backup original and re-install it
-                PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                $tmpcfg = $this->config->get('temp_dir');
-                $newloc = System::mkdir(array('-p', $tmpcfg));
-                if (!$newloc) {
-                    // try temp_dir
-                    $newloc = System::mktemp(array('-d'));
-                    if (!$newloc || PEAR::isError($newloc)) {
-                        PEAR::popErrorHandling();
-                        return PEAR::raiseError('Could not save existing configuration file '.
-                            $old . ', unable to install.  Please set temp_dir ' .
-                            'configuration variable to a writeable location and try again');
-                    }
-                } else {
-                    $newloc = $tmpcfg;
-                }
-
-                $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile');
-                if (!@copy($old, $temp_file)) {
-                    PEAR::popErrorHandling();
-                    return PEAR::raiseError('Could not save existing configuration file '.
-                        $old . ', unable to install.  Please set temp_dir ' .
-                        'configuration variable to a writeable location and try again');
-                }
-
-                PEAR::popErrorHandling();
-                $this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file");
-                $this->installer->addFileOperation('rename', array($temp_file, $old, false));
-                $this->installer->addFileOperation('delete', array($temp_file));
-            }
-        }
-
-        return $test;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Cfg.xml b/lib/php/PEAR/Installer/Role/Cfg.xml
deleted file mode 100644
index 7a415dc466ab9a58607c4bed3dc2900f7414e76d..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Cfg.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>cfg_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall>1</unusualbaseinstall>
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Common.php b/lib/php/PEAR/Installer/Role/Common.php
deleted file mode 100644
index 751456011c8bff73ee14b2201d280bf16b8312dc..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Common.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/**
- * Base class for all installation roles.
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Common.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * Base class for all installation roles.
- *
- * This class allows extensibility of file roles.  Packages with complex
- * customization can now provide custom file roles along with the possibility of
- * adding configuration values to match.
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Common
-{
-    /**
-     * @var PEAR_Config
-     * @access protected
-     */
-    var $config;
-
-    /**
-     * @param PEAR_Config
-     */
-    function PEAR_Installer_Role_Common(&$config)
-    {
-        $this->config = $config;
-    }
-
-    /**
-     * Retrieve configuration information about a file role from its XML info
-     *
-     * @param string $role Role Classname, as in "PEAR_Installer_Role_Data"
-     * @return array
-     */
-    function getInfo($role)
-    {
-        if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$role])) {
-            return PEAR::raiseError('Unknown Role class: "' . $role . '"');
-        }
-        return $GLOBALS['_PEAR_INSTALLER_ROLES'][$role];
-    }
-
-    /**
-     * This is called for each file to set up the directories and files
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param array attributes from the <file> tag
-     * @param string file name
-     * @return array an array consisting of:
-     *
-     *    1 the original, pre-baseinstalldir installation directory
-     *    2 the final installation directory
-     *    3 the full path to the final location of the file
-     *    4 the location of the pre-installation file
-     */
-    function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
-    {
-        $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 
-            ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
-        if (PEAR::isError($roleInfo)) {
-            return $roleInfo;
-        }
-        if (!$roleInfo['locationconfig']) {
-            return false;
-        }
-        if ($roleInfo['honorsbaseinstall']) {
-            $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer,
-                $pkg->getChannel());
-            if (!empty($atts['baseinstalldir'])) {
-                $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
-            }
-        } elseif ($roleInfo['unusualbaseinstall']) {
-            $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
-                    $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
-            if (!empty($atts['baseinstalldir'])) {
-                $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
-            }
-        } else {
-            $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
-                    $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
-        }
-        if (dirname($file) != '.' && empty($atts['install-as'])) {
-            $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
-        }
-        if (empty($atts['install-as'])) {
-            $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
-        } else {
-            $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
-        }
-        $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
-
-        // Clean up the DIRECTORY_SEPARATOR mess
-        $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
-        
-        list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
-                                                    array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
-                                                          DIRECTORY_SEPARATOR),
-                                                    array($dest_dir, $dest_file, $orig_file));
-        return array($save_destdir, $dest_dir, $dest_file, $orig_file);
-    }
-
-    /**
-     * Get the name of the configuration variable that specifies the location of this file
-     * @return string|false
-     */
-    function getLocationConfig()
-    {
-        $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 
-            ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
-        if (PEAR::isError($roleInfo)) {
-            return $roleInfo;
-        }
-        return $roleInfo['locationconfig'];
-    }
-
-    /**
-     * Do any unusual setup here
-     * @param PEAR_Installer
-     * @param PEAR_PackageFile_v2
-     * @param array file attributes
-     * @param string file name
-     */
-    function setup(&$installer, $pkg, $atts, $file)
-    {
-    }
-
-    function isExecutable()
-    {
-        $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 
-            ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
-        if (PEAR::isError($roleInfo)) {
-            return $roleInfo;
-        }
-        return $roleInfo['executable'];
-    }
-
-    function isInstallable()
-    {
-        $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 
-            ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
-        if (PEAR::isError($roleInfo)) {
-            return $roleInfo;
-        }
-        return $roleInfo['installable'];
-    }
-
-    function isExtension()
-    {
-        $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 
-            ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
-        if (PEAR::isError($roleInfo)) {
-            return $roleInfo;
-        }
-        return $roleInfo['phpextension'];
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Data.php b/lib/php/PEAR/Installer/Role/Data.php
deleted file mode 100644
index 7a1d4cc7512a49b82b4acfeb76d3cf0568719a2c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Data.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Data
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Data.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Data.xml b/lib/php/PEAR/Installer/Role/Data.xml
deleted file mode 100644
index eae63720d3ba4022846e7ed36880cd71af734139..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Data.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>data_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Doc.php b/lib/php/PEAR/Installer/Role/Doc.php
deleted file mode 100644
index 64c200345b92c1ac6af0e76b67fe9051c7ccae81..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Doc.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Doc
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Doc.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Doc.xml b/lib/php/PEAR/Installer/Role/Doc.xml
deleted file mode 100644
index 173afba011a0f45e88da18659bd47c3cb47471a1..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Doc.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>doc_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Ext.php b/lib/php/PEAR/Installer/Role/Ext.php
deleted file mode 100644
index 5784e95e04dbb1eb07e3f5e19f0353f74fe52326..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Ext.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Ext
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Ext.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Ext.xml b/lib/php/PEAR/Installer/Role/Ext.xml
deleted file mode 100644
index e2940fe1f22cbe7dc1c7a1b02e97e0c6ab9ca7ef..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Ext.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<role version="1.0">
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>ext_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension>1</phpextension>
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Php.php b/lib/php/PEAR/Installer/Role/Php.php
deleted file mode 100644
index 15bd163ea8f53e53406e58e02e2a968f79c578b2..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Php.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Php
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Php.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Php.xml b/lib/php/PEAR/Installer/Role/Php.xml
deleted file mode 100644
index 6b9a0e67af9ac8d90543de9575988a7da3427da8..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Php.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>php_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile>1</phpfile>
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Script.php b/lib/php/PEAR/Installer/Role/Script.php
deleted file mode 100644
index 6169899b25811485fee87d7cb816bbb5e8c9012c..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Script.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Script
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Script.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Script.xml b/lib/php/PEAR/Installer/Role/Script.xml
deleted file mode 100644
index e732cf2af6f8e3731d0f91068053787eb23ad4eb..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Script.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>bin_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable>1</executable>
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Src.php b/lib/php/PEAR/Installer/Role/Src.php
deleted file mode 100644
index 918fff4a0996479b561ab61acfb5b1366ee89c7d..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Src.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Src
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Src.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common
-{
-    function setup(&$installer, $pkg, $atts, $file)
-    {
-        $installer->source_files++;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Src.xml b/lib/php/PEAR/Installer/Role/Src.xml
deleted file mode 100644
index 103483402f04d40d2630ffa2e46d866c039d806a..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Src.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<role version="1.0">
- <releasetypes>extsrc</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <installable>1</installable>
- <locationconfig>temp_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Test.php b/lib/php/PEAR/Installer/Role/Test.php
deleted file mode 100644
index ad69def26b2f99425fcb9c223e5c2c70d2376e37..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Test.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Test
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Test.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Test.xml b/lib/php/PEAR/Installer/Role/Test.xml
deleted file mode 100644
index 51d5b894e07b695f5766bf10a7c70a8630eefa61..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Test.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>test_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Www.php b/lib/php/PEAR/Installer/Role/Www.php
deleted file mode 100644
index bcc55d35724e4463b2af1186a5da81a65b86301e..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Www.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Www
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2007-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: Www.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.7.0
- */
-
-/**
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  2007-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.7.0
- */
-class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Installer/Role/Www.xml b/lib/php/PEAR/Installer/Role/Www.xml
deleted file mode 100644
index 7598be38892571d3eca2d32d24b5413377ad6099..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Installer/Role/Www.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>www_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role>
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile.php b/lib/php/PEAR/PackageFile.php
deleted file mode 100644
index e6979bffa06a7cad624137a6a2616817e50c699b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile.php
+++ /dev/null
@@ -1,501 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile, package.xml parsing utility class
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: PackageFile.php 286670 2009-08-02 14:16:06Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * needed for PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-/**
- * Error code if the package.xml <package> tag does not contain a valid version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION', 1);
-/**
- * Error code if the package.xml <package> tag version is not supported (version 1.0 and 1.1 are the only supported versions,
- * currently
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2);
-/**
- * Abstraction for the package.xml package description file
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile
-{
-    /**
-     * @var PEAR_Config
-     */
-    var $_config;
-    var $_debug;
-    /**
-     * Temp directory for uncompressing tgz files.
-     * @var string|false
-     */
-    var $_tmpdir;
-    var $_logger = false;
-    /**
-     * @var boolean
-     */
-    var $_rawReturn = false;
-
-    /**
-     *
-     * @param   PEAR_Config $config
-     * @param   ?   $debug
-     * @param   string @tmpdir Optional temporary directory for uncompressing
-     *          files
-     */
-    function PEAR_PackageFile(&$config, $debug = false, $tmpdir = false)
-    {
-        $this->_config = $config;
-        $this->_debug = $debug;
-        $this->_tmpdir = $tmpdir;
-    }
-
-    /**
-     * Turn off validation - return a parsed package.xml without checking it
-     *
-     * This is used by the package-validate command
-     */
-    function rawReturn()
-    {
-        $this->_rawReturn = true;
-    }
-
-    function setLogger(&$l)
-    {
-        $this->_logger = &$l;
-    }
-
-    /**
-     * Create a PEAR_PackageFile_Parser_v* of a given version.
-     * @param   int $version
-     * @return  PEAR_PackageFile_Parser_v1|PEAR_PackageFile_Parser_v1
-     */
-    function &parserFactory($version)
-    {
-        if (!in_array($version{0}, array('1', '2'))) {
-            $a = false;
-            return $a;
-        }
-
-        include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php';
-        $version = $version{0};
-        $class = "PEAR_PackageFile_Parser_v$version";
-        $a = new $class;
-        return $a;
-    }
-
-    /**
-     * For simpler unit-testing
-     * @return string
-     */
-    function getClassPrefix()
-    {
-        return 'PEAR_PackageFile_v';
-    }
-
-    /**
-     * Create a PEAR_PackageFile_v* of a given version.
-     * @param   int $version
-     * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v1
-     */
-    function &factory($version)
-    {
-        if (!in_array($version{0}, array('1', '2'))) {
-            $a = false;
-            return $a;
-        }
-
-        include_once 'PEAR/PackageFile/v' . $version{0} . '.php';
-        $version = $version{0};
-        $class = $this->getClassPrefix() . $version;
-        $a = new $class;
-        return $a;
-    }
-
-    /**
-     * Create a PEAR_PackageFile_v* from its toArray() method
-     *
-     * WARNING: no validation is performed, the array is assumed to be valid,
-     * always parse from xml if you want validation.
-     * @param   array $arr
-     * @return PEAR_PackageFileManager_v1|PEAR_PackageFileManager_v2
-     * @uses    factory() to construct the returned object.
-     */
-    function &fromArray($arr)
-    {
-        if (isset($arr['xsdversion'])) {
-            $obj = &$this->factory($arr['xsdversion']);
-            if ($this->_logger) {
-                $obj->setLogger($this->_logger);
-            }
-
-            $obj->setConfig($this->_config);
-            $obj->fromArray($arr);
-            return $obj;
-        }
-
-        if (isset($arr['package']['attribs']['version'])) {
-            $obj = &$this->factory($arr['package']['attribs']['version']);
-        } else {
-            $obj = &$this->factory('1.0');
-        }
-
-        if ($this->_logger) {
-            $obj->setLogger($this->_logger);
-        }
-
-        $obj->setConfig($this->_config);
-        $obj->fromArray($arr);
-        return $obj;
-    }
-
-    /**
-     * Create a PEAR_PackageFile_v* from an XML string.
-     * @access  public
-     * @param   string $data contents of package.xml file
-     * @param   int $state package state (one of PEAR_VALIDATE_* constants)
-     * @param   string $file full path to the package.xml file (and the files
-     *          it references)
-     * @param   string $archive optional name of the archive that the XML was
-     *          extracted from, if any
-     * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @uses    parserFactory() to construct a parser to load the package.
-     */
-    function &fromXmlString($data, $state, $file, $archive = false)
-    {
-        if (preg_match('/<package[^>]+version="([0-9]+\.[0-9]+)"/', $data, $packageversion)) {
-            if (!in_array($packageversion[1], array('1.0', '2.0', '2.1'))) {
-                return PEAR::raiseError('package.xml version "' . $packageversion[1] .
-                    '" is not supported, only 1.0, 2.0, and 2.1 are supported.');
-            }
-
-            $object = &$this->parserFactory($packageversion[1]);
-            if ($this->_logger) {
-                $object->setLogger($this->_logger);
-            }
-
-            $object->setConfig($this->_config);
-            $pf = $object->parse($data, $file, $archive);
-            if (PEAR::isError($pf)) {
-                return $pf;
-            }
-
-            if ($this->_rawReturn) {
-                return $pf;
-            }
-
-            if (!$pf->validate($state)) {;
-                if ($this->_config->get('verbose') > 0
-                    && $this->_logger && $pf->getValidationWarnings(false)
-                ) {
-                    foreach ($pf->getValidationWarnings(false) as $warning) {
-                        $this->_logger->log(0, 'ERROR: ' . $warning['message']);
-                    }
-                }
-
-                $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed',
-                    2, null, null, $pf->getValidationWarnings());
-                return $a;
-            }
-
-            if ($this->_logger && $pf->getValidationWarnings(false)) {
-                foreach ($pf->getValidationWarnings() as $warning) {
-                    $this->_logger->log(0, 'WARNING: ' . $warning['message']);
-                }
-            }
-
-            if (method_exists($pf, 'flattenFilelist')) {
-                $pf->flattenFilelist(); // for v2
-            }
-
-            return $pf;
-        } elseif (preg_match('/<package[^>]+version="([^"]+)"/', $data, $packageversion)) {
-            $a = PEAR::raiseError('package.xml file "' . $file .
-                '" has unsupported package.xml <package> version "' . $packageversion[1] . '"');
-            return $a;
-        } else {
-            if (!class_exists('PEAR_ErrorStack')) {
-                require_once 'PEAR/ErrorStack.php';
-            }
-
-            PEAR_ErrorStack::staticPush('PEAR_PackageFile',
-                PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION,
-                'warning', array('xml' => $data), 'package.xml "' . $file .
-                    '" has no package.xml <package> version');
-            $object = &$this->parserFactory('1.0');
-            $object->setConfig($this->_config);
-            $pf = $object->parse($data, $file, $archive);
-            if (PEAR::isError($pf)) {
-                return $pf;
-            }
-
-            if ($this->_rawReturn) {
-                return $pf;
-            }
-
-            if (!$pf->validate($state)) {
-                $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed',
-                    2, null, null, $pf->getValidationWarnings());
-                return $a;
-            }
-
-            if ($this->_logger && $pf->getValidationWarnings(false)) {
-                foreach ($pf->getValidationWarnings() as $warning) {
-                    $this->_logger->log(0, 'WARNING: ' . $warning['message']);
-                }
-            }
-
-            if (method_exists($pf, 'flattenFilelist')) {
-                $pf->flattenFilelist(); // for v2
-            }
-
-            return $pf;
-        }
-    }
-
-    /**
-     * Register a temporary file or directory.  When the destructor is
-     * executed, all registered temporary files and directories are
-     * removed.
-     *
-     * @param string  $file  name of file or directory
-     * @return  void
-     */
-    function addTempFile($file)
-    {
-        $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
-    }
-
-    /**
-     * Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file.
-     * @access  public
-     * @param string contents of package.xml file
-     * @param int package state (one of PEAR_VALIDATE_* constants)
-     * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @using   Archive_Tar to extract the files
-     * @using   fromPackageFile() to load the package after the package.xml
-     *          file is extracted.
-     */
-    function &fromTgzFile($file, $state)
-    {
-        if (!class_exists('Archive_Tar')) {
-            require_once 'Archive/Tar.php';
-        }
-
-        $tar = new Archive_Tar($file);
-        if ($this->_debug <= 1) {
-            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
-        }
-
-        $content = $tar->listContent();
-        if ($this->_debug <= 1) {
-            $tar->popErrorHandling();
-        }
-
-        if (!is_array($content)) {
-            if (is_string($file) && strlen($file < 255) &&
-                  (!file_exists($file) || !@is_file($file))) {
-                $ret = PEAR::raiseError("could not open file \"$file\"");
-                return $ret;
-            }
-
-            $file = realpath($file);
-            $ret = PEAR::raiseError("Could not get contents of package \"$file\"".
-                                     '. Invalid tgz file.');
-            return $ret;
-        }
-
-        if (!count($content) && !@is_file($file)) {
-            $ret = PEAR::raiseError("could not open file \"$file\"");
-            return $ret;
-        }
-
-        $xml      = null;
-        $origfile = $file;
-        foreach ($content as $file) {
-            $name = $file['filename'];
-            if ($name == 'package2.xml') { // allow a .tgz to distribute both versions
-                $xml = $name;
-                break;
-            }
-
-            if ($name == 'package.xml') {
-                $xml = $name;
-                break;
-            } elseif (preg_match('/package.xml$/', $name, $match)) {
-                $xml = $name;
-                break;
-            }
-        }
-
-        if ($this->_tmpdir) {
-            $tmpdir = $this->_tmpdir;
-        } else {
-            $tmpdir = System::mkTemp(array('-t', $this->_config->get('temp_dir'), '-d', 'pear'));
-            if ($tmpdir === false) {
-                $ret = PEAR::raiseError("there was a problem with getting the configured temp directory");
-                return $ret;
-            }
-
-            PEAR_PackageFile::addTempFile($tmpdir);
-        }
-
-        $this->_extractErrors();
-        PEAR::staticPushErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_extractErrors'));
-        if (!$xml || !$tar->extractList(array($xml), $tmpdir)) {
-            $extra = implode("\n", $this->_extractErrors());
-            if ($extra) {
-                $extra = ' ' . $extra;
-            }
-
-            PEAR::staticPopErrorHandling();
-            $ret = PEAR::raiseError('could not extract the package.xml file from "' .
-                $origfile . '"' . $extra);
-            return $ret;
-        }
-
-        PEAR::staticPopErrorHandling();
-        $ret = &PEAR_PackageFile::fromPackageFile("$tmpdir/$xml", $state, $origfile);
-        return $ret;
-    }
-
-    /**
-     * helper for extracting Archive_Tar errors
-     * @var array
-     * @access private
-     */
-    var $_extractErrors = array();
-
-    /**
-     * helper callback for extracting Archive_Tar errors
-     *
-     * @param PEAR_Error|null $err
-     * @return array
-     * @access private
-     */
-    function _extractErrors($err = null)
-    {
-        static $errors = array();
-        if ($err === null) {
-            $e = $errors;
-            $errors = array();
-            return $e;
-        }
-        $errors[] = $err->getMessage();
-    }
-
-    /**
-     * Create a PEAR_PackageFile_v* from a package.xml file.
-     *
-     * @access public
-     * @param   string  $descfile  name of package xml file
-     * @param   int     $state package state (one of PEAR_VALIDATE_* constants)
-     * @param   string|false $archive name of the archive this package.xml came
-     *          from, if any
-     * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @uses    PEAR_PackageFile::fromXmlString to create the oject after the
-     *          XML is loaded from the package.xml file.
-     */
-    function &fromPackageFile($descfile, $state, $archive = false)
-    {
-        $fp = false;
-        if (is_string($descfile) && strlen($descfile) < 255 &&
-             (
-              !file_exists($descfile) || !is_file($descfile) || !is_readable($descfile)
-              || (!$fp = @fopen($descfile, 'r'))
-             )
-        ) {
-            $a = PEAR::raiseError("Unable to open $descfile");
-            return $a;
-        }
-
-        // read the whole thing so we only get one cdata callback
-        // for each block of cdata
-        fclose($fp);
-        $data = file_get_contents($descfile);
-        $ret = &PEAR_PackageFile::fromXmlString($data, $state, $descfile, $archive);
-        return $ret;
-    }
-
-
-    /**
-     * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
-     *
-     * This method is able to extract information about a package from a .tgz
-     * archive or from a XML package definition file.
-     *
-     * @access public
-     * @param   string  $info file name
-     * @param   int     $state package state (one of PEAR_VALIDATE_* constants)
-     * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @uses    fromPackageFile() if the file appears to be XML
-     * @uses    fromTgzFile() to load all non-XML files
-     */
-    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')))
-        ) {
-
-            if ($fp) {
-                fclose($fp);
-            }
-
-            $tmp = substr($info, -4);
-            if ($tmp == '.xml') {
-                $info = &PEAR_PackageFile::fromPackageFile($info, $state);
-            } elseif ($tmp == '.tar' || $tmp == '.tgz') {
-                $info = &PEAR_PackageFile::fromTgzFile($info, $state);
-            } else {
-                $fp   = fopen($info, 'r');
-                $test = fread($fp, 5);
-                fclose($fp);
-                if ($test == '<?xml') {
-                    $info = &PEAR_PackageFile::fromPackageFile($info, $state);
-                } else {
-                    $info = &PEAR_PackageFile::fromTgzFile($info, $state);
-                }
-            }
-
-            return $info;
-        }
-
-        $info = PEAR::raiseError("Cannot open '$info' for parsing");
-        return $info;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/Generator/v1.php b/lib/php/PEAR/PackageFile/Generator/v1.php
deleted file mode 100644
index 5599392755cc5bafa0b74b3f344b0c7d93f9408d..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/Generator/v1.php
+++ /dev/null
@@ -1,1284 +0,0 @@
-<?php
-/**
- * package.xml generation class, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: v1.php 286494 2009-07-29 06:57:11Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * needed for PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-require_once 'System.php';
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * This class converts a PEAR_PackageFile_v1 object into any output format.
- *
- * Supported output formats include array, XML string, and a PEAR_PackageFile_v2
- * object, for converting package.xml 1.0 into package.xml 2.0 with no sweat.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Generator_v1
-{
-    /**
-     * @var PEAR_PackageFile_v1
-     */
-    var $_packagefile;
-    function PEAR_PackageFile_Generator_v1(&$packagefile)
-    {
-        $this->_packagefile = &$packagefile;
-    }
-
-    function getPackagerVersion()
-    {
-        return '1.9.0';
-    }
-
-    /**
-     * @param PEAR_Packager
-     * @param bool if true, a .tgz is written, otherwise a .tar is written
-     * @param string|null directory in which to save the .tgz
-     * @return string|PEAR_Error location of package or error object
-     */
-    function toTgz(&$packager, $compress = true, $where = null)
-    {
-        require_once 'Archive/Tar.php';
-        if ($where === null) {
-            if (!($where = System::mktemp(array('-d')))) {
-                return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: mktemp failed');
-            }
-        } elseif (!@System::mkDir(array('-p', $where))) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: "' . $where . '" could' .
-                ' not be created');
-        }
-        if (file_exists($where . DIRECTORY_SEPARATOR . 'package.xml') &&
-              !is_file($where . DIRECTORY_SEPARATOR . 'package.xml')) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: unable to save package.xml as' .
-                ' "' . $where . DIRECTORY_SEPARATOR . 'package.xml"');
-        }
-        if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: invalid package file');
-        }
-        $pkginfo = $this->_packagefile->getArray();
-        $ext = $compress ? '.tgz' : '.tar';
-        $pkgver = $pkginfo['package'] . '-' . $pkginfo['version'];
-        $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext;
-        if (file_exists(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext) &&
-              !is_file(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext)) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: cannot create tgz file "' .
-                getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext . '"');
-        }
-        if ($pkgfile = $this->_packagefile->getPackageFile()) {
-            $pkgdir = dirname(realpath($pkgfile));
-            $pkgfile = basename($pkgfile);
-        } else {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: package file object must ' .
-                'be created from a real file');
-        }
-        // {{{ Create the package file list
-        $filelist = array();
-        $i = 0;
-
-        foreach ($this->_packagefile->getFilelist() as $fname => $atts) {
-            $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
-            if (!file_exists($file)) {
-                return PEAR::raiseError("File does not exist: $fname");
-            } else {
-                $filelist[$i++] = $file;
-                if (!isset($atts['md5sum'])) {
-                    $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($file));
-                }
-                $packager->log(2, "Adding file $fname");
-            }
-        }
-        // }}}
-        $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
-        if ($packagexml) {
-            $tar =& new Archive_Tar($dest_package, $compress);
-            $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
-            // ----- Creates with the package.xml file
-            $ok = $tar->createModify(array($packagexml), '', $where);
-            if (PEAR::isError($ok)) {
-                return $ok;
-            } elseif (!$ok) {
-                return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed');
-            }
-            // ----- Add the content of the package
-            if (!$tar->addModify($filelist, $pkgver, $pkgdir)) {
-                return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed');
-            }
-            return $dest_package;
-        }
-    }
-
-    /**
-     * @param string|null directory to place the package.xml in, or null for a temporary dir
-     * @param int one of the PEAR_VALIDATE_* constants
-     * @param string name of the generated file
-     * @param bool if true, then no analysis will be performed on role="php" files
-     * @return string|PEAR_Error path to the created file on success
-     */
-    function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml',
-                           $nofilechecking = false)
-    {
-        if (!$this->_packagefile->validate($state, $nofilechecking)) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: invalid package.xml',
-                null, null, null, $this->_packagefile->getValidationWarnings());
-        }
-        if ($where === null) {
-            if (!($where = System::mktemp(array('-d')))) {
-                return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: mktemp failed');
-            }
-        } elseif (!@System::mkDir(array('-p', $where))) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: "' . $where . '" could' .
-                ' not be created');
-        }
-        $newpkgfile = $where . DIRECTORY_SEPARATOR . $name;
-        $np = @fopen($newpkgfile, 'wb');
-        if (!$np) {
-            return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: unable to save ' .
-               "$name as $newpkgfile");
-        }
-        fwrite($np, $this->toXml($state, true));
-        fclose($np);
-        return $newpkgfile;
-    }
-
-    /**
-     * fix both XML encoding to be UTF8, and replace standard XML entities < > " & '
-     *
-     * @param string $string
-     * @return string
-     * @access private
-     */
-    function _fixXmlEncoding($string)
-    {
-        if (version_compare(phpversion(), '5.0.0', 'lt')) {
-            $string = utf8_encode($string);
-        }
-        return strtr($string, array(
-                                          '&'  => '&amp;',
-                                          '>'  => '&gt;',
-                                          '<'  => '&lt;',
-                                          '"'  => '&quot;',
-                                          '\'' => '&apos;' ));
-    }
-
-    /**
-     * Return an XML document based on the package info (as returned
-     * by the PEAR_Common::infoFrom* methods).
-     *
-     * @return string XML data
-     */
-    function toXml($state = PEAR_VALIDATE_NORMAL, $nofilevalidation = false)
-    {
-        $this->_packagefile->setDate(date('Y-m-d'));
-        if (!$this->_packagefile->validate($state, $nofilevalidation)) {
-            return false;
-        }
-        $pkginfo = $this->_packagefile->getArray();
-        static $maint_map = array(
-            "handle" => "user",
-            "name" => "name",
-            "email" => "email",
-            "role" => "role",
-            );
-        $ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
-        $ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n";
-        $ret .= "<package version=\"1.0\" packagerversion=\"1.9.0\">\n" .
-" <name>$pkginfo[package]</name>";
-        if (isset($pkginfo['extends'])) {
-            $ret .= "\n<extends>$pkginfo[extends]</extends>";
-        }
-        $ret .=
- "\n <summary>".$this->_fixXmlEncoding($pkginfo['summary'])."</summary>\n" .
-" <description>".trim($this->_fixXmlEncoding($pkginfo['description']))."\n </description>\n" .
-" <maintainers>\n";
-        foreach ($pkginfo['maintainers'] as $maint) {
-            $ret .= "  <maintainer>\n";
-            foreach ($maint_map as $idx => $elm) {
-                $ret .= "   <$elm>";
-                $ret .= $this->_fixXmlEncoding($maint[$idx]);
-                $ret .= "</$elm>\n";
-            }
-            $ret .= "  </maintainer>\n";
-        }
-        $ret .= "  </maintainers>\n";
-        $ret .= $this->_makeReleaseXml($pkginfo, false, $state);
-        if (isset($pkginfo['changelog']) && count($pkginfo['changelog']) > 0) {
-            $ret .= " <changelog>\n";
-            foreach ($pkginfo['changelog'] as $oldrelease) {
-                $ret .= $this->_makeReleaseXml($oldrelease, true);
-            }
-            $ret .= " </changelog>\n";
-        }
-        $ret .= "</package>\n";
-        return $ret;
-    }
-
-    // }}}
-    // {{{ _makeReleaseXml()
-
-    /**
-     * Generate part of an XML description with release information.
-     *
-     * @param array  $pkginfo    array with release information
-     * @param bool   $changelog  whether the result will be in a changelog element
-     *
-     * @return string XML data
-     *
-     * @access private
-     */
-    function _makeReleaseXml($pkginfo, $changelog = false, $state = PEAR_VALIDATE_NORMAL)
-    {
-        // XXX QUOTE ENTITIES IN PCDATA, OR EMBED IN CDATA BLOCKS!!
-        $indent = $changelog ? "  " : "";
-        $ret = "$indent <release>\n";
-        if (!empty($pkginfo['version'])) {
-            $ret .= "$indent  <version>$pkginfo[version]</version>\n";
-        }
-        if (!empty($pkginfo['release_date'])) {
-            $ret .= "$indent  <date>$pkginfo[release_date]</date>\n";
-        }
-        if (!empty($pkginfo['release_license'])) {
-            $ret .= "$indent  <license>$pkginfo[release_license]</license>\n";
-        }
-        if (!empty($pkginfo['release_state'])) {
-            $ret .= "$indent  <state>$pkginfo[release_state]</state>\n";
-        }
-        if (!empty($pkginfo['release_notes'])) {
-            $ret .= "$indent  <notes>".trim($this->_fixXmlEncoding($pkginfo['release_notes']))
-            ."\n$indent  </notes>\n";
-        }
-        if (!empty($pkginfo['release_warnings'])) {
-            $ret .= "$indent  <warnings>".$this->_fixXmlEncoding($pkginfo['release_warnings'])."</warnings>\n";
-        }
-        if (isset($pkginfo['release_deps']) && sizeof($pkginfo['release_deps']) > 0) {
-            $ret .= "$indent  <deps>\n";
-            foreach ($pkginfo['release_deps'] as $dep) {
-                $ret .= "$indent   <dep type=\"$dep[type]\" rel=\"$dep[rel]\"";
-                if (isset($dep['version'])) {
-                    $ret .= " version=\"$dep[version]\"";
-                }
-                if (isset($dep['optional'])) {
-                    $ret .= " optional=\"$dep[optional]\"";
-                }
-                if (isset($dep['name'])) {
-                    $ret .= ">$dep[name]</dep>\n";
-                } else {
-                    $ret .= "/>\n";
-                }
-            }
-            $ret .= "$indent  </deps>\n";
-        }
-        if (isset($pkginfo['configure_options'])) {
-            $ret .= "$indent  <configureoptions>\n";
-            foreach ($pkginfo['configure_options'] as $c) {
-                $ret .= "$indent   <configureoption name=\"".
-                    $this->_fixXmlEncoding($c['name']) . "\"";
-                if (isset($c['default'])) {
-                    $ret .= " default=\"" . $this->_fixXmlEncoding($c['default']) . "\"";
-                }
-                $ret .= " prompt=\"" . $this->_fixXmlEncoding($c['prompt']) . "\"";
-                $ret .= "/>\n";
-            }
-            $ret .= "$indent  </configureoptions>\n";
-        }
-        if (isset($pkginfo['provides'])) {
-            foreach ($pkginfo['provides'] as $key => $what) {
-                $ret .= "$indent  <provides type=\"$what[type]\" ";
-                $ret .= "name=\"$what[name]\" ";
-                if (isset($what['extends'])) {
-                    $ret .= "extends=\"$what[extends]\" ";
-                }
-                $ret .= "/>\n";
-            }
-        }
-        if (isset($pkginfo['filelist'])) {
-            $ret .= "$indent  <filelist>\n";
-            if ($state ^ PEAR_VALIDATE_PACKAGING) {
-                $ret .= $this->recursiveXmlFilelist($pkginfo['filelist']);
-            } else {
-                foreach ($pkginfo['filelist'] as $file => $fa) {
-                    if (!isset($fa['role'])) {
-                        $fa['role'] = '';
-                    }
-                    $ret .= "$indent   <file role=\"$fa[role]\"";
-                    if (isset($fa['baseinstalldir'])) {
-                        $ret .= ' baseinstalldir="' .
-                            $this->_fixXmlEncoding($fa['baseinstalldir']) . '"';
-                    }
-                    if (isset($fa['md5sum'])) {
-                        $ret .= " md5sum=\"$fa[md5sum]\"";
-                    }
-                    if (isset($fa['platform'])) {
-                        $ret .= " platform=\"$fa[platform]\"";
-                    }
-                    if (!empty($fa['install-as'])) {
-                        $ret .= ' install-as="' .
-                            $this->_fixXmlEncoding($fa['install-as']) . '"';
-                    }
-                    $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';
-                    if (empty($fa['replacements'])) {
-                        $ret .= "/>\n";
-                    } else {
-                        $ret .= ">\n";
-                        foreach ($fa['replacements'] as $r) {
-                            $ret .= "$indent    <replace";
-                            foreach ($r as $k => $v) {
-                                $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';
-                            }
-                            $ret .= "/>\n";
-                        }
-                        $ret .= "$indent   </file>\n";
-                    }
-                }
-            }
-            $ret .= "$indent  </filelist>\n";
-        }
-        $ret .= "$indent </release>\n";
-        return $ret;
-    }
-
-    /**
-     * @param array
-     * @access protected
-     */
-    function recursiveXmlFilelist($list)
-    {
-        $this->_dirs = array();
-        foreach ($list as $file => $attributes) {
-            $this->_addDir($this->_dirs, explode('/', dirname($file)), $file, $attributes);
-        }
-        return $this->_formatDir($this->_dirs);
-    }
-
-    /**
-     * @param array
-     * @param array
-     * @param string|null
-     * @param array|null
-     * @access private
-     */
-    function _addDir(&$dirs, $dir, $file = null, $attributes = null)
-    {
-        if ($dir == array() || $dir == array('.')) {
-            $dirs['files'][basename($file)] = $attributes;
-            return;
-        }
-        $curdir = array_shift($dir);
-        if (!isset($dirs['dirs'][$curdir])) {
-            $dirs['dirs'][$curdir] = array();
-        }
-        $this->_addDir($dirs['dirs'][$curdir], $dir, $file, $attributes);
-    }
-
-    /**
-     * @param array
-     * @param string
-     * @param string
-     * @access private
-     */
-    function _formatDir($dirs, $indent = '', $curdir = '')
-    {
-        $ret = '';
-        if (!count($dirs)) {
-            return '';
-        }
-        if (isset($dirs['dirs'])) {
-            uksort($dirs['dirs'], 'strnatcasecmp');
-            foreach ($dirs['dirs'] as $dir => $contents) {
-                $usedir = "$curdir/$dir";
-                $ret .= "$indent   <dir name=\"$dir\">\n";
-                $ret .= $this->_formatDir($contents, "$indent ", $usedir);
-                $ret .= "$indent   </dir> <!-- $usedir -->\n";
-            }
-        }
-        if (isset($dirs['files'])) {
-            uksort($dirs['files'], 'strnatcasecmp');
-            foreach ($dirs['files'] as $file => $attribs) {
-                $ret .= $this->_formatFile($file, $attribs, $indent);
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * @param string
-     * @param array
-     * @param string
-     * @access private
-     */
-    function _formatFile($file, $attributes, $indent)
-    {
-        $ret = "$indent   <file role=\"$attributes[role]\"";
-        if (isset($attributes['baseinstalldir'])) {
-            $ret .= ' baseinstalldir="' .
-                $this->_fixXmlEncoding($attributes['baseinstalldir']) . '"';
-        }
-        if (isset($attributes['md5sum'])) {
-            $ret .= " md5sum=\"$attributes[md5sum]\"";
-        }
-        if (isset($attributes['platform'])) {
-            $ret .= " platform=\"$attributes[platform]\"";
-        }
-        if (!empty($attributes['install-as'])) {
-            $ret .= ' install-as="' .
-                $this->_fixXmlEncoding($attributes['install-as']) . '"';
-        }
-        $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';
-        if (empty($attributes['replacements'])) {
-            $ret .= "/>\n";
-        } else {
-            $ret .= ">\n";
-            foreach ($attributes['replacements'] as $r) {
-                $ret .= "$indent    <replace";
-                foreach ($r as $k => $v) {
-                    $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';
-                }
-                $ret .= "/>\n";
-            }
-            $ret .= "$indent   </file>\n";
-        }
-        return $ret;
-    }
-
-    // {{{ _unIndent()
-
-    /**
-     * Unindent given string (?)
-     *
-     * @param string $str The string that has to be unindented.
-     * @return string
-     * @access private
-     */
-    function _unIndent($str)
-    {
-        // remove leading newlines
-        $str = preg_replace('/^[\r\n]+/', '', $str);
-        // find whitespace at the beginning of the first line
-        $indent_len = strspn($str, " \t");
-        $indent = substr($str, 0, $indent_len);
-        $data = '';
-        // remove the same amount of whitespace from following lines
-        foreach (explode("\n", $str) as $line) {
-            if (substr($line, 0, $indent_len) == $indent) {
-                $data .= substr($line, $indent_len) . "\n";
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * @return array
-     */
-    function dependenciesToV2()
-    {
-        $arr = array();
-        $this->_convertDependencies2_0($arr);
-        return $arr['dependencies'];
-    }
-
-    /**
-     * Convert a package.xml version 1.0 into version 2.0
-     *
-     * Note that this does a basic conversion, to allow more advanced
-     * features like bundles and multiple releases
-     * @param string the classname to instantiate and return.  This must be
-     *               PEAR_PackageFile_v2 or a descendant
-     * @param boolean if true, only valid, deterministic package.xml 1.0 as defined by the
-     *                strictest parameters will be converted
-     * @return PEAR_PackageFile_v2|PEAR_Error
-     */
-    function &toV2($class = 'PEAR_PackageFile_v2', $strict = false)
-    {
-        if ($strict) {
-            if (!$this->_packagefile->validate()) {
-                $a = PEAR::raiseError('invalid package.xml version 1.0 cannot be converted' .
-                    ' to version 2.0', null, null, null,
-                    $this->_packagefile->getValidationWarnings(true));
-                return $a;
-            }
-        }
-
-        $arr = array(
-            'attribs' => array(
-                             'version' => '2.0',
-                             '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',
-                             'xsi:schemaLocation' => "http://pear.php.net/dtd/tasks-1.0\n" .
-"http://pear.php.net/dtd/tasks-1.0.xsd\n" .
-"http://pear.php.net/dtd/package-2.0\n" .
-'http://pear.php.net/dtd/package-2.0.xsd',
-                         ),
-            'name' => $this->_packagefile->getPackage(),
-            'channel' => 'pear.php.net',
-        );
-        $arr['summary'] = $this->_packagefile->getSummary();
-        $arr['description'] = $this->_packagefile->getDescription();
-        $maintainers = $this->_packagefile->getMaintainers();
-        foreach ($maintainers as $maintainer) {
-            if ($maintainer['role'] != 'lead') {
-                continue;
-            }
-            $new = array(
-                'name' => $maintainer['name'],
-                'user' => $maintainer['handle'],
-                'email' => $maintainer['email'],
-                'active' => 'yes',
-            );
-            $arr['lead'][] = $new;
-        }
-
-        if (!isset($arr['lead'])) { // some people... you know?
-            $arr['lead'] = array(
-                'name' => 'unknown',
-                'user' => 'unknown',
-                'email' => 'noleadmaintainer@example.com',
-                'active' => 'no',
-            );
-        }
-
-        if (count($arr['lead']) == 1) {
-            $arr['lead'] = $arr['lead'][0];
-        }
-
-        foreach ($maintainers as $maintainer) {
-            if ($maintainer['role'] == 'lead') {
-                continue;
-            }
-            $new = array(
-                'name' => $maintainer['name'],
-                'user' => $maintainer['handle'],
-                'email' => $maintainer['email'],
-                'active' => 'yes',
-            );
-            $arr[$maintainer['role']][] = $new;
-        }
-
-        if (isset($arr['developer']) && count($arr['developer']) == 1) {
-            $arr['developer'] = $arr['developer'][0];
-        }
-
-        if (isset($arr['contributor']) && count($arr['contributor']) == 1) {
-            $arr['contributor'] = $arr['contributor'][0];
-        }
-
-        if (isset($arr['helper']) && count($arr['helper']) == 1) {
-            $arr['helper'] = $arr['helper'][0];
-        }
-
-        $arr['date'] = $this->_packagefile->getDate();
-        $arr['version'] =
-            array(
-                'release' => $this->_packagefile->getVersion(),
-                'api' => $this->_packagefile->getVersion(),
-            );
-        $arr['stability'] =
-            array(
-                'release' => $this->_packagefile->getState(),
-                'api' => $this->_packagefile->getState(),
-            );
-        $licensemap =
-            array(
-                'php' => 'http://www.php.net/license',
-                'php license' => 'http://www.php.net/license',
-                'lgpl' => 'http://www.gnu.org/copyleft/lesser.html',
-                'bsd' => 'http://www.opensource.org/licenses/bsd-license.php',
-                'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php',
-                'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php',
-                'mit' => 'http://www.opensource.org/licenses/mit-license.php',
-                'gpl' => 'http://www.gnu.org/copyleft/gpl.html',
-                'apache' => 'http://www.opensource.org/licenses/apache2.0.php'
-            );
-
-        if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) {
-            $arr['license'] = array(
-                'attribs' => array('uri' =>
-                    $licensemap[strtolower($this->_packagefile->getLicense())]),
-                '_content' => $this->_packagefile->getLicense()
-                );
-        } else {
-            // don't use bogus uri
-            $arr['license'] = $this->_packagefile->getLicense();
-        }
-
-        $arr['notes'] = $this->_packagefile->getNotes();
-        $temp = array();
-        $arr['contents'] = $this->_convertFilelist2_0($temp);
-        $this->_convertDependencies2_0($arr);
-        $release = ($this->_packagefile->getConfigureOptions() || $this->_isExtension) ?
-            'extsrcrelease' : 'phprelease';
-        if ($release == 'extsrcrelease') {
-            $arr['channel'] = 'pecl.php.net';
-            $arr['providesextension'] = $arr['name']; // assumption
-        }
-
-        $arr[$release] = array();
-        if ($this->_packagefile->getConfigureOptions()) {
-            $arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions();
-            foreach ($arr[$release]['configureoption'] as $i => $opt) {
-                $arr[$release]['configureoption'][$i] = array('attribs' => $opt);
-            }
-            if (count($arr[$release]['configureoption']) == 1) {
-                $arr[$release]['configureoption'] = $arr[$release]['configureoption'][0];
-            }
-        }
-
-        $this->_convertRelease2_0($arr[$release], $temp);
-        if ($release == 'extsrcrelease' && count($arr[$release]) > 1) {
-            // multiple extsrcrelease tags added in PEAR 1.4.1
-            $arr['dependencies']['required']['pearinstaller']['min'] = '1.4.1';
-        }
-
-        if ($cl = $this->_packagefile->getChangelog()) {
-            foreach ($cl as $release) {
-                $rel = array();
-                $rel['version'] =
-                    array(
-                        'release' => $release['version'],
-                        'api' => $release['version'],
-                    );
-                if (!isset($release['release_state'])) {
-                    $release['release_state'] = 'stable';
-                }
-
-                $rel['stability'] =
-                    array(
-                        'release' => $release['release_state'],
-                        'api' => $release['release_state'],
-                    );
-                if (isset($release['release_date'])) {
-                    $rel['date'] = $release['release_date'];
-                } else {
-                    $rel['date'] = date('Y-m-d');
-                }
-
-                if (isset($release['release_license'])) {
-                    if (isset($licensemap[strtolower($release['release_license'])])) {
-                        $uri = $licensemap[strtolower($release['release_license'])];
-                    } else {
-                        $uri = 'http://www.example.com';
-                    }
-                    $rel['license'] = array(
-                            'attribs' => array('uri' => $uri),
-                            '_content' => $release['release_license']
-                        );
-                } else {
-                    $rel['license'] = $arr['license'];
-                }
-
-                if (!isset($release['release_notes'])) {
-                    $release['release_notes'] = 'no release notes';
-                }
-
-                $rel['notes'] = $release['release_notes'];
-                $arr['changelog']['release'][] = $rel;
-            }
-        }
-
-        $ret = new $class;
-        $ret->setConfig($this->_packagefile->_config);
-        if (isset($this->_packagefile->_logger) && is_object($this->_packagefile->_logger)) {
-            $ret->setLogger($this->_packagefile->_logger);
-        }
-
-        $ret->fromArray($arr);
-        return $ret;
-    }
-
-    /**
-     * @param array
-     * @param bool
-     * @access private
-     */
-    function _convertDependencies2_0(&$release, $internal = false)
-    {
-        $peardep = array('pearinstaller' =>
-            array('min' => '1.4.0b1')); // this is a lot safer
-        $required = $optional = array();
-        $release['dependencies'] = array('required' => array());
-        if ($this->_packagefile->hasDeps()) {
-            foreach ($this->_packagefile->getDeps() as $dep) {
-                if (!isset($dep['optional']) || $dep['optional'] == 'no') {
-                    $required[] = $dep;
-                } else {
-                    $optional[] = $dep;
-                }
-            }
-            foreach (array('required', 'optional') as $arr) {
-                $deps = array();
-                foreach ($$arr as $dep) {
-                    // organize deps by dependency type and name
-                    if (!isset($deps[$dep['type']])) {
-                        $deps[$dep['type']] = array();
-                    }
-                    if (isset($dep['name'])) {
-                        $deps[$dep['type']][$dep['name']][] = $dep;
-                    } else {
-                        $deps[$dep['type']][] = $dep;
-                    }
-                }
-                do {
-                    if (isset($deps['php'])) {
-                        $php = array();
-                        if (count($deps['php']) > 1) {
-                            $php = $this->_processPhpDeps($deps['php']);
-                        } else {
-                            if (!isset($deps['php'][0])) {
-                                list($key, $blah) = each ($deps['php']); // stupid buggy versions
-                                $deps['php'] = array($blah[0]);
-                            }
-                            $php = $this->_processDep($deps['php'][0]);
-                            if (!$php) {
-                                break; // poor mans throw
-                            }
-                        }
-                        $release['dependencies'][$arr]['php'] = $php;
-                    }
-                } while (false);
-                do {
-                    if (isset($deps['pkg'])) {
-                        $pkg = array();
-                        $pkg = $this->_processMultipleDepsName($deps['pkg']);
-                        if (!$pkg) {
-                            break; // poor mans throw
-                        }
-                        $release['dependencies'][$arr]['package'] = $pkg;
-                    }
-                } while (false);
-                do {
-                    if (isset($deps['ext'])) {
-                        $pkg = array();
-                        $pkg = $this->_processMultipleDepsName($deps['ext']);
-                        $release['dependencies'][$arr]['extension'] = $pkg;
-                    }
-                } while (false);
-                // skip sapi - it's not supported so nobody will have used it
-                // skip os - it's not supported in 1.0
-            }
-        }
-        if (isset($release['dependencies']['required'])) {
-            $release['dependencies']['required'] =
-                array_merge($peardep, $release['dependencies']['required']);
-        } else {
-            $release['dependencies']['required'] = $peardep;
-        }
-        if (!isset($release['dependencies']['required']['php'])) {
-            $release['dependencies']['required']['php'] =
-                array('min' => '4.0.0');
-        }
-        $order = array();
-        $bewm = $release['dependencies']['required'];
-        $order['php'] = $bewm['php'];
-        $order['pearinstaller'] = $bewm['pearinstaller'];
-        isset($bewm['package']) ? $order['package'] = $bewm['package'] :0;
-        isset($bewm['extension']) ? $order['extension'] = $bewm['extension'] :0;
-        $release['dependencies']['required'] = $order;
-    }
-
-    /**
-     * @param array
-     * @access private
-     */
-    function _convertFilelist2_0(&$package)
-    {
-        $ret = array('dir' =>
-                    array(
-                        'attribs' => array('name' => '/'),
-                        'file' => array()
-                        )
-                    );
-        $package['platform'] =
-        $package['install-as'] = array();
-        $this->_isExtension = false;
-        foreach ($this->_packagefile->getFilelist() as $name => $file) {
-            $file['name'] = $name;
-            if (isset($file['role']) && $file['role'] == 'src') {
-                $this->_isExtension = true;
-            }
-            if (isset($file['replacements'])) {
-                $repl = $file['replacements'];
-                unset($file['replacements']);
-            } else {
-                unset($repl);
-            }
-            if (isset($file['install-as'])) {
-                $package['install-as'][$name] = $file['install-as'];
-                unset($file['install-as']);
-            }
-            if (isset($file['platform'])) {
-                $package['platform'][$name] = $file['platform'];
-                unset($file['platform']);
-            }
-            $file = array('attribs' => $file);
-            if (isset($repl)) {
-                foreach ($repl as $replace ) {
-                    $file['tasks:replace'][] = array('attribs' => $replace);
-                }
-                if (count($repl) == 1) {
-                    $file['tasks:replace'] = $file['tasks:replace'][0];
-                }
-            }
-            $ret['dir']['file'][] = $file;
-        }
-        return $ret;
-    }
-
-    /**
-     * Post-process special files with install-as/platform attributes and
-     * make the release tag.
-     *
-     * This complex method follows this work-flow to create the release tags:
-     *
-     * <pre>
-     * - if any install-as/platform exist, create a generic release and fill it with
-     *   o <install as=..> tags for <file name=... install-as=...>
-     *   o <install as=..> tags for <file name=... platform=!... install-as=..>
-     *   o <ignore> tags for <file name=... platform=...>
-     *   o <ignore> tags for <file name=... platform=... install-as=..>
-     * - create a release for each platform encountered and fill with
-     *   o <install as..> tags for <file name=... install-as=...>
-     *   o <install as..> tags for <file name=... platform=this platform install-as=..>
-     *   o <install as..> tags for <file name=... platform=!other platform install-as=..>
-     *   o <ignore> tags for <file name=... platform=!this platform>
-     *   o <ignore> tags for <file name=... platform=other platform>
-     *   o <ignore> tags for <file name=... platform=other platform install-as=..>
-     *   o <ignore> tags for <file name=... platform=!this platform install-as=..>
-     * </pre>
-     *
-     * It does this by accessing the $package parameter, which contains an array with
-     * indices:
-     *
-     *  - platform: mapping of file => OS the file should be installed on
-     *  - install-as: mapping of file => installed name
-     *  - osmap: mapping of OS => list of files that should be installed
-     *    on that OS
-     *  - notosmap: mapping of OS => list of files that should not be
-     *    installed on that OS
-     *
-     * @param array
-     * @param array
-     * @access private
-     */
-    function _convertRelease2_0(&$release, $package)
-    {
-        //- if any install-as/platform exist, create a generic release and fill it with
-        if (count($package['platform']) || count($package['install-as'])) {
-            $generic = array();
-            $genericIgnore = array();
-            foreach ($package['install-as'] as $file => $as) {
-                //o <install as=..> tags for <file name=... install-as=...>
-                if (!isset($package['platform'][$file])) {
-                    $generic[] = $file;
-                    continue;
-                }
-                //o <install as=..> tags for <file name=... platform=!... install-as=..>
-                if (isset($package['platform'][$file]) &&
-                      $package['platform'][$file]{0} == '!') {
-                    $generic[] = $file;
-                    continue;
-                }
-                //o <ignore> tags for <file name=... platform=... install-as=..>
-                if (isset($package['platform'][$file]) &&
-                      $package['platform'][$file]{0} != '!') {
-                    $genericIgnore[] = $file;
-                    continue;
-                }
-            }
-            foreach ($package['platform'] as $file => $platform) {
-                if (isset($package['install-as'][$file])) {
-                    continue;
-                }
-                if ($platform{0} != '!') {
-                    //o <ignore> tags for <file name=... platform=...>
-                    $genericIgnore[] = $file;
-                }
-            }
-            if (count($package['platform'])) {
-                $oses = $notplatform = $platform = array();
-                foreach ($package['platform'] as $file => $os) {
-                    // get a list of oses
-                    if ($os{0} == '!') {
-                        if (isset($oses[substr($os, 1)])) {
-                            continue;
-                        }
-                        $oses[substr($os, 1)] = count($oses);
-                    } else {
-                        if (isset($oses[$os])) {
-                            continue;
-                        }
-                        $oses[$os] = count($oses);
-                    }
-                }
-                //- create a release for each platform encountered and fill with
-                foreach ($oses as $os => $releaseNum) {
-                    $release[$releaseNum]['installconditions']['os']['name'] = $os;
-                    $release[$releaseNum]['filelist'] = array('install' => array(),
-                        'ignore' => array());
-                    foreach ($package['install-as'] as $file => $as) {
-                        //o <install as=..> tags for <file name=... install-as=...>
-                        if (!isset($package['platform'][$file])) {
-                            $release[$releaseNum]['filelist']['install'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                        'as' => $as,
-                                    ),
-                                );
-                            continue;
-                        }
-                        //o <install as..> tags for
-                        //  <file name=... platform=this platform install-as=..>
-                        if (isset($package['platform'][$file]) &&
-                              $package['platform'][$file] == $os) {
-                            $release[$releaseNum]['filelist']['install'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                        'as' => $as,
-                                    ),
-                                );
-                            continue;
-                        }
-                        //o <install as..> tags for
-                        //  <file name=... platform=!other platform install-as=..>
-                        if (isset($package['platform'][$file]) &&
-                              $package['platform'][$file] != "!$os" &&
-                              $package['platform'][$file]{0} == '!') {
-                            $release[$releaseNum]['filelist']['install'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                        'as' => $as,
-                                    ),
-                                );
-                            continue;
-                        }
-                        //o <ignore> tags for
-                        //  <file name=... platform=!this platform install-as=..>
-                        if (isset($package['platform'][$file]) &&
-                              $package['platform'][$file] == "!$os") {
-                            $release[$releaseNum]['filelist']['ignore'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                    ),
-                                );
-                            continue;
-                        }
-                        //o <ignore> tags for
-                        //  <file name=... platform=other platform install-as=..>
-                        if (isset($package['platform'][$file]) &&
-                              $package['platform'][$file]{0} != '!' &&
-                              $package['platform'][$file] != $os) {
-                            $release[$releaseNum]['filelist']['ignore'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                    ),
-                                );
-                            continue;
-                        }
-                    }
-                    foreach ($package['platform'] as $file => $platform) {
-                        if (isset($package['install-as'][$file])) {
-                            continue;
-                        }
-                        //o <ignore> tags for <file name=... platform=!this platform>
-                        if ($platform == "!$os") {
-                            $release[$releaseNum]['filelist']['ignore'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                    ),
-                                );
-                            continue;
-                        }
-                        //o <ignore> tags for <file name=... platform=other platform>
-                        if ($platform{0} != '!' && $platform != $os) {
-                            $release[$releaseNum]['filelist']['ignore'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                    ),
-                                );
-                        }
-                    }
-                    if (!count($release[$releaseNum]['filelist']['install'])) {
-                        unset($release[$releaseNum]['filelist']['install']);
-                    }
-                    if (!count($release[$releaseNum]['filelist']['ignore'])) {
-                        unset($release[$releaseNum]['filelist']['ignore']);
-                    }
-                }
-                if (count($generic) || count($genericIgnore)) {
-                    $release[count($oses)] = array();
-                    if (count($generic)) {
-                        foreach ($generic as $file) {
-                            if (isset($package['install-as'][$file])) {
-                                $installas = $package['install-as'][$file];
-                            } else {
-                                $installas = $file;
-                            }
-                            $release[count($oses)]['filelist']['install'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                        'as' => $installas,
-                                    )
-                                );
-                        }
-                    }
-                    if (count($genericIgnore)) {
-                        foreach ($genericIgnore as $file) {
-                            $release[count($oses)]['filelist']['ignore'][] =
-                                array(
-                                    'attribs' => array(
-                                        'name' => $file,
-                                    )
-                                );
-                        }
-                    }
-                }
-                // cleanup
-                foreach ($release as $i => $rel) {
-                    if (isset($rel['filelist']['install']) &&
-                          count($rel['filelist']['install']) == 1) {
-                        $release[$i]['filelist']['install'] =
-                            $release[$i]['filelist']['install'][0];
-                    }
-                    if (isset($rel['filelist']['ignore']) &&
-                          count($rel['filelist']['ignore']) == 1) {
-                        $release[$i]['filelist']['ignore'] =
-                            $release[$i]['filelist']['ignore'][0];
-                    }
-                }
-                if (count($release) == 1) {
-                    $release = $release[0];
-                }
-            } else {
-                // no platform atts, but some install-as atts
-                foreach ($package['install-as'] as $file => $value) {
-                    $release['filelist']['install'][] =
-                        array(
-                            'attribs' => array(
-                                'name' => $file,
-                                'as' => $value
-                            )
-                        );
-                }
-                if (count($release['filelist']['install']) == 1) {
-                    $release['filelist']['install'] = $release['filelist']['install'][0];
-                }
-            }
-        }
-    }
-
-    /**
-     * @param array
-     * @return array
-     * @access private
-     */
-    function _processDep($dep)
-    {
-        if ($dep['type'] == 'php') {
-            if ($dep['rel'] == 'has') {
-                // come on - everyone has php!
-                return false;
-            }
-        }
-        $php = array();
-        if ($dep['type'] != 'php') {
-            $php['name'] = $dep['name'];
-            if ($dep['type'] == 'pkg') {
-                $php['channel'] = 'pear.php.net';
-            }
-        }
-        switch ($dep['rel']) {
-            case 'gt' :
-                $php['min'] = $dep['version'];
-                $php['exclude'] = $dep['version'];
-            break;
-            case 'ge' :
-                if (!isset($dep['version'])) {
-                    if ($dep['type'] == 'php') {
-                        if (isset($dep['name'])) {
-                            $dep['version'] = $dep['name'];
-                        }
-                    }
-                }
-                $php['min'] = $dep['version'];
-            break;
-            case 'lt' :
-                $php['max'] = $dep['version'];
-                $php['exclude'] = $dep['version'];
-            break;
-            case 'le' :
-                $php['max'] = $dep['version'];
-            break;
-            case 'eq' :
-                $php['min'] = $dep['version'];
-                $php['max'] = $dep['version'];
-            break;
-            case 'ne' :
-                $php['exclude'] = $dep['version'];
-            break;
-            case 'not' :
-                $php['conflicts'] = 'yes';
-            break;
-        }
-        return $php;
-    }
-
-    /**
-     * @param array
-     * @return array
-     */
-    function _processPhpDeps($deps)
-    {
-        $test = array();
-        foreach ($deps as $dep) {
-            $test[] = $this->_processDep($dep);
-        }
-        $min = array();
-        $max = array();
-        foreach ($test as $dep) {
-            if (!$dep) {
-                continue;
-            }
-            if (isset($dep['min'])) {
-                $min[$dep['min']] = count($min);
-            }
-            if (isset($dep['max'])) {
-                $max[$dep['max']] = count($max);
-            }
-        }
-        if (count($min) > 0) {
-            uksort($min, 'version_compare');
-        }
-        if (count($max) > 0) {
-            uksort($max, 'version_compare');
-        }
-        if (count($min)) {
-            // get the highest minimum
-            $min = array_pop($a = array_flip($min));
-        } else {
-            $min = false;
-        }
-        if (count($max)) {
-            // get the lowest maximum
-            $max = array_shift($a = array_flip($max));
-        } else {
-            $max = false;
-        }
-        if ($min) {
-            $php['min'] = $min;
-        }
-        if ($max) {
-            $php['max'] = $max;
-        }
-        $exclude = array();
-        foreach ($test as $dep) {
-            if (!isset($dep['exclude'])) {
-                continue;
-            }
-            $exclude[] = $dep['exclude'];
-        }
-        if (count($exclude)) {
-            $php['exclude'] = $exclude;
-        }
-        return $php;
-    }
-
-    /**
-     * process multiple dependencies that have a name, like package deps
-     * @param array
-     * @return array
-     * @access private
-     */
-    function _processMultipleDepsName($deps)
-    {
-        $ret = $tests = array();
-        foreach ($deps as $name => $dep) {
-            foreach ($dep as $d) {
-                $tests[$name][] = $this->_processDep($d);
-            }
-        }
-
-        foreach ($tests as $name => $test) {
-            $max = $min = $php = array();
-            $php['name'] = $name;
-            foreach ($test as $dep) {
-                if (!$dep) {
-                    continue;
-                }
-                if (isset($dep['channel'])) {
-                    $php['channel'] = 'pear.php.net';
-                }
-                if (isset($dep['conflicts']) && $dep['conflicts'] == 'yes') {
-                    $php['conflicts'] = 'yes';
-                }
-                if (isset($dep['min'])) {
-                    $min[$dep['min']] = count($min);
-                }
-                if (isset($dep['max'])) {
-                    $max[$dep['max']] = count($max);
-                }
-            }
-            if (count($min) > 0) {
-                uksort($min, 'version_compare');
-            }
-            if (count($max) > 0) {
-                uksort($max, 'version_compare');
-            }
-            if (count($min)) {
-                // get the highest minimum
-                $min = array_pop($a = array_flip($min));
-            } else {
-                $min = false;
-            }
-            if (count($max)) {
-                // get the lowest maximum
-                $max = array_shift($a = array_flip($max));
-            } else {
-                $max = false;
-            }
-            if ($min) {
-                $php['min'] = $min;
-            }
-            if ($max) {
-                $php['max'] = $max;
-            }
-            $exclude = array();
-            foreach ($test as $dep) {
-                if (!isset($dep['exclude'])) {
-                    continue;
-                }
-                $exclude[] = $dep['exclude'];
-            }
-            if (count($exclude)) {
-                $php['exclude'] = $exclude;
-            }
-            $ret[] = $php;
-        }
-        return $ret;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/Generator/v2.php b/lib/php/PEAR/PackageFile/Generator/v2.php
deleted file mode 100644
index d0a2df943ec4461f15c80ecdc35edfd60dbe6ee1..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/Generator/v2.php
+++ /dev/null
@@ -1,893 +0,0 @@
-<?php
-/**
- * package.xml generation class, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Stephan Schmidt (original XML_Serializer code)
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: v2.php 278907 2009-04-17 21:10:04Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * file/dir manipulation routines
- */
-require_once 'System.php';
-require_once 'XML/Util.php';
-
-/**
- * This class converts a PEAR_PackageFile_v2 object into any output format.
- *
- * Supported output formats include array, XML string (using S. Schmidt's
- * XML_Serializer, slightly customized)
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Stephan Schmidt (original XML_Serializer code)
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: 1.9.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Generator_v2
-{
-   /**
-    * default options for the serialization
-    * @access private
-    * @var array $_defaultOptions
-    */
-    var $_defaultOptions = array(
-        'indent'             => ' ',                    // string used for indentation
-        'linebreak'          => "\n",                  // string used for newlines
-        'typeHints'          => false,                 // automatically add type hin attributes
-        'addDecl'            => true,                 // add an XML declaration
-        'defaultTagName'     => 'XML_Serializer_Tag',  // tag used for indexed arrays or invalid names
-        'classAsTagName'     => false,                 // use classname for objects in indexed arrays
-        'keyAttribute'       => '_originalKey',        // attribute where original key is stored
-        'typeAttribute'      => '_type',               // attribute for type (only if typeHints => true)
-        'classAttribute'     => '_class',              // attribute for class of objects (only if typeHints => true)
-        'scalarAsAttributes' => false,                 // scalar values (strings, ints,..) will be serialized as attribute
-        'prependAttributes'  => '',                    // prepend string for attributes
-        'indentAttributes'   => false,                 // indent the attributes, if set to '_auto', it will indent attributes so they all start at the same column
-        'mode'               => 'simplexml',             // use 'simplexml' to use parent name as tagname if transforming an indexed array
-        'addDoctype'         => false,                 // add a doctype declaration
-        'doctype'            => null,                  // supply a string or an array with id and uri ({@see XML_Util::getDoctypeDeclaration()}
-        'rootName'           => 'package',                  // name of the root tag
-        'rootAttributes'     => array(
-            'version' => '2.0',
-            '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',
-            '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',
-        ),               // attributes of the root tag
-        'attributesArray'    => 'attribs',                  // all values in this key will be treated as attributes
-        'contentName'        => '_content',                   // this value will be used directly as content, instead of creating a new tag, may only be used in conjuction with attributesArray
-        'beautifyFilelist'   => false,
-        'encoding' => 'UTF-8',
-    );
-
-   /**
-    * options for the serialization
-    * @access private
-    * @var array $options
-    */
-    var $options = array();
-
-   /**
-    * current tag depth
-    * @var integer $_tagDepth
-    */
-    var $_tagDepth = 0;
-
-   /**
-    * serilialized representation of the data
-    * @var string $_serializedData
-    */
-    var $_serializedData = null;
-    /**
-     * @var PEAR_PackageFile_v2
-     */
-    var $_packagefile;
-    /**
-     * @param PEAR_PackageFile_v2
-     */
-    function PEAR_PackageFile_Generator_v2(&$packagefile)
-    {
-        $this->_packagefile = &$packagefile;
-        if (isset($this->_packagefile->encoding)) {
-            $this->_defaultOptions['encoding'] = $this->_packagefile->encoding;
-        }
-    }
-
-    /**
-     * @return string
-     */
-    function getPackagerVersion()
-    {
-        return '1.9.0';
-    }
-
-    /**
-     * @param PEAR_Packager
-     * @param bool generate a .tgz or a .tar
-     * @param string|null temporary directory to package in
-     */
-    function toTgz(&$packager, $compress = true, $where = null)
-    {
-        $a = null;
-        return $this->toTgz2($packager, $a, $compress, $where);
-    }
-
-    /**
-     * Package up both a package.xml and package2.xml for the same release
-     * @param PEAR_Packager
-     * @param PEAR_PackageFile_v1
-     * @param bool generate a .tgz or a .tar
-     * @param string|null temporary directory to package in
-     */
-    function toTgz2(&$packager, &$pf1, $compress = true, $where = null)
-    {
-        require_once 'Archive/Tar.php';
-        if (!$this->_packagefile->isEquivalent($pf1)) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' .
-                basename($pf1->getPackageFile()) .
-                '" is not equivalent to "' . basename($this->_packagefile->getPackageFile())
-                . '"');
-        }
-
-        if ($where === null) {
-            if (!($where = System::mktemp(array('-d')))) {
-                return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: mktemp failed');
-            }
-        } elseif (!@System::mkDir(array('-p', $where))) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' . $where . '" could' .
-                ' not be created');
-        }
-
-        $file = $where . DIRECTORY_SEPARATOR . 'package.xml';
-        if (file_exists($file) && !is_file($file)) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: unable to save package.xml as' .
-                ' "' . $file  .'"');
-        }
-
-        if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: invalid package.xml');
-        }
-
-        $ext = $compress ? '.tgz' : '.tar';
-        $pkgver = $this->_packagefile->getPackage() . '-' . $this->_packagefile->getVersion();
-        $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext;
-        if (file_exists($dest_package) && !is_file($dest_package)) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: cannot create tgz file "' .
-                $dest_package . '"');
-        }
-
-        $pkgfile = $this->_packagefile->getPackageFile();
-        if (!$pkgfile) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: package file object must ' .
-                'be created from a real file');
-        }
-
-        $pkgdir  = dirname(realpath($pkgfile));
-        $pkgfile = basename($pkgfile);
-
-        // {{{ Create the package file list
-        $filelist = array();
-        $i = 0;
-        $this->_packagefile->flattenFilelist();
-        $contents = $this->_packagefile->getContents();
-        if (isset($contents['bundledpackage'])) { // bundles of packages
-            $contents = $contents['bundledpackage'];
-            if (!isset($contents[0])) {
-                $contents = array($contents);
-            }
-
-            $packageDir = $where;
-            foreach ($contents as $i => $package) {
-                $fname = $package;
-                $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
-                if (!file_exists($file)) {
-                    return $packager->raiseError("File does not exist: $fname");
-                }
-
-                $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname;
-                System::mkdir(array('-p', dirname($tfile)));
-                copy($file, $tfile);
-                $filelist[$i++] = $tfile;
-                $packager->log(2, "Adding package $fname");
-            }
-        } else { // normal packages
-            $contents = $contents['dir']['file'];
-            if (!isset($contents[0])) {
-                $contents = array($contents);
-            }
-
-            $packageDir = $where;
-            foreach ($contents as $i => $file) {
-                $fname = $file['attribs']['name'];
-                $atts = $file['attribs'];
-                $orig = $file;
-                $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
-                if (!file_exists($file)) {
-                    return $packager->raiseError("File does not exist: $fname");
-                }
-
-                $origperms = fileperms($file);
-                $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname;
-                unset($orig['attribs']);
-                if (count($orig)) { // file with tasks
-                    // run any package-time tasks
-                    $contents = file_get_contents($file);
-                    foreach ($orig as $tag => $raw) {
-                        $tag = str_replace(
-                            array($this->_packagefile->getTasksNs() . ':', '-'),
-                            array('', '_'), $tag);
-                        $task = "PEAR_Task_$tag";
-                        $task = &new $task($this->_packagefile->_config,
-                            $this->_packagefile->_logger,
-                            PEAR_TASK_PACKAGE);
-                        $task->init($raw, $atts, null);
-                        $res = $task->startSession($this->_packagefile, $contents, $tfile);
-                        if (!$res) {
-                            continue; // skip this task
-                        }
-
-                        if (PEAR::isError($res)) {
-                            return $res;
-                        }
-
-                        $contents = $res; // save changes
-                        System::mkdir(array('-p', dirname($tfile)));
-                        $wp = fopen($tfile, "wb");
-                        fwrite($wp, $contents);
-                        fclose($wp);
-                    }
-                }
-
-                if (!file_exists($tfile)) {
-                    System::mkdir(array('-p', dirname($tfile)));
-                    copy($file, $tfile);
-                }
-
-                chmod($tfile, $origperms);
-                $filelist[$i++] = $tfile;
-                $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($tfile), $i - 1);
-                $packager->log(2, "Adding file $fname");
-            }
-        }
-            // }}}
-
-        $name       = $pf1 !== null ? 'package2.xml' : 'package.xml';
-        $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, $name);
-        if ($packagexml) {
-            $tar =& new Archive_Tar($dest_package, $compress);
-            $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
-            // ----- Creates with the package.xml file
-            $ok = $tar->createModify(array($packagexml), '', $where);
-            if (PEAR::isError($ok)) {
-                return $packager->raiseError($ok);
-            } elseif (!$ok) {
-                return $packager->raiseError('PEAR_Packagefile_v2::toTgz(): adding ' . $name .
-                    ' failed');
-            }
-
-            // ----- Add the content of the package
-            if (!$tar->addModify($filelist, $pkgver, $where)) {
-                return $packager->raiseError(
-                    'PEAR_Packagefile_v2::toTgz(): tarball creation failed');
-            }
-
-            // add the package.xml version 1.0
-            if ($pf1 !== null) {
-                $pfgen = &$pf1->getDefaultGenerator();
-                $packagexml1 = $pfgen->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
-                if (!$tar->addModify(array($packagexml1), '', $where)) {
-                    return $packager->raiseError(
-                        'PEAR_Packagefile_v2::toTgz(): adding package.xml failed');
-                }
-            }
-
-            return $dest_package;
-        }
-    }
-
-    function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml')
-    {
-        if (!$this->_packagefile->validate($state)) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: invalid package.xml',
-                null, null, null, $this->_packagefile->getValidationWarnings());
-        }
-
-        if ($where === null) {
-            if (!($where = System::mktemp(array('-d')))) {
-                return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: mktemp failed');
-            }
-        } elseif (!@System::mkDir(array('-p', $where))) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: "' . $where . '" could' .
-                ' not be created');
-        }
-
-        $newpkgfile = $where . DIRECTORY_SEPARATOR . $name;
-        $np = @fopen($newpkgfile, 'wb');
-        if (!$np) {
-            return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: unable to save ' .
-               "$name as $newpkgfile");
-        }
-        fwrite($np, $this->toXml($state));
-        fclose($np);
-        return $newpkgfile;
-    }
-
-    function &toV2()
-    {
-        return $this->_packagefile;
-    }
-
-    /**
-     * Return an XML document based on the package info (as returned
-     * by the PEAR_Common::infoFrom* methods).
-     *
-     * @return string XML data
-     */
-    function toXml($state = PEAR_VALIDATE_NORMAL, $options = array())
-    {
-        $this->_packagefile->setDate(date('Y-m-d'));
-        $this->_packagefile->setTime(date('H:i:s'));
-        if (!$this->_packagefile->validate($state)) {
-            return false;
-        }
-
-        if (is_array($options)) {
-            $this->options = array_merge($this->_defaultOptions, $options);
-        } else {
-            $this->options = $this->_defaultOptions;
-        }
-
-        $arr = $this->_packagefile->getArray();
-        if (isset($arr['filelist'])) {
-            unset($arr['filelist']);
-        }
-
-        if (isset($arr['_lastversion'])) {
-            unset($arr['_lastversion']);
-        }
-
-        // Fix the notes a little bit
-        if (isset($arr['notes'])) {
-            // This trims out the indenting, needs fixing
-            $arr['notes'] = "\n" . trim($arr['notes']) . "\n";
-        }
-
-        if (isset($arr['changelog']) && !empty($arr['changelog'])) {
-            // Fix for inconsistency how the array is filled depending on the changelog release amount
-            if (!isset($arr['changelog']['release'][0])) {
-                $release = $arr['changelog']['release'];
-                unset($arr['changelog']['release']);
-
-                $arr['changelog']['release']    = array();
-                $arr['changelog']['release'][0] = $release;
-            }
-
-            foreach (array_keys($arr['changelog']['release']) as $key) {
-                $c =& $arr['changelog']['release'][$key];
-                if (isset($c['notes'])) {
-                    // This trims out the indenting, needs fixing
-                    $c['notes'] = "\n" . trim($c['notes']) . "\n";
-                }
-            }
-        }
-
-        if ($state ^ PEAR_VALIDATE_PACKAGING && !isset($arr['bundle'])) {
-            $use = $this->_recursiveXmlFilelist($arr['contents']['dir']['file']);
-            unset($arr['contents']['dir']['file']);
-            if (isset($use['dir'])) {
-                $arr['contents']['dir']['dir'] = $use['dir'];
-            }
-            if (isset($use['file'])) {
-                $arr['contents']['dir']['file'] = $use['file'];
-            }
-            $this->options['beautifyFilelist'] = true;
-        }
-
-        $arr['attribs']['packagerversion'] = '1.9.0';
-        if ($this->serialize($arr, $options)) {
-            return $this->_serializedData . "\n";
-        }
-
-        return false;
-    }
-
-
-    function _recursiveXmlFilelist($list)
-    {
-        $dirs = array();
-        if (isset($list['attribs'])) {
-            $file = $list['attribs']['name'];
-            unset($list['attribs']['name']);
-            $attributes = $list['attribs'];
-            $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes);
-        } else {
-            foreach ($list as $a) {
-                $file = $a['attribs']['name'];
-                $attributes = $a['attribs'];
-                unset($a['attribs']);
-                $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes, $a);
-            }
-        }
-        $this->_formatDir($dirs);
-        $this->_deFormat($dirs);
-        return $dirs;
-    }
-
-    function _addDir(&$dirs, $dir, $file = null, $attributes = null, $tasks = null)
-    {
-        if (!$tasks) {
-            $tasks = array();
-        }
-        if ($dir == array() || $dir == array('.')) {
-            $dirs['file'][basename($file)] = $tasks;
-            $attributes['name'] = basename($file);
-            $dirs['file'][basename($file)]['attribs'] = $attributes;
-            return;
-        }
-        $curdir = array_shift($dir);
-        if (!isset($dirs['dir'][$curdir])) {
-            $dirs['dir'][$curdir] = array();
-        }
-        $this->_addDir($dirs['dir'][$curdir], $dir, $file, $attributes, $tasks);
-    }
-
-    function _formatDir(&$dirs)
-    {
-        if (!count($dirs)) {
-            return array();
-        }
-        $newdirs = array();
-        if (isset($dirs['dir'])) {
-            $newdirs['dir'] = $dirs['dir'];
-        }
-        if (isset($dirs['file'])) {
-            $newdirs['file'] = $dirs['file'];
-        }
-        $dirs = $newdirs;
-        if (isset($dirs['dir'])) {
-            uksort($dirs['dir'], 'strnatcasecmp');
-            foreach ($dirs['dir'] as $dir => $contents) {
-                $this->_formatDir($dirs['dir'][$dir]);
-            }
-        }
-        if (isset($dirs['file'])) {
-            uksort($dirs['file'], 'strnatcasecmp');
-        };
-    }
-
-    function _deFormat(&$dirs)
-    {
-        if (!count($dirs)) {
-            return array();
-        }
-        $newdirs = array();
-        if (isset($dirs['dir'])) {
-            foreach ($dirs['dir'] as $dir => $contents) {
-                $newdir = array();
-                $newdir['attribs']['name'] = $dir;
-                $this->_deFormat($contents);
-                foreach ($contents as $tag => $val) {
-                    $newdir[$tag] = $val;
-                }
-                $newdirs['dir'][] = $newdir;
-            }
-            if (count($newdirs['dir']) == 1) {
-                $newdirs['dir'] = $newdirs['dir'][0];
-            }
-        }
-        if (isset($dirs['file'])) {
-            foreach ($dirs['file'] as $name => $file) {
-                $newdirs['file'][] = $file;
-            }
-            if (count($newdirs['file']) == 1) {
-                $newdirs['file'] = $newdirs['file'][0];
-            }
-        }
-        $dirs = $newdirs;
-    }
-
-    /**
-    * reset all options to default options
-    *
-    * @access   public
-    * @see      setOption(), XML_Unserializer()
-    */
-    function resetOptions()
-    {
-        $this->options = $this->_defaultOptions;
-    }
-
-   /**
-    * set an option
-    *
-    * You can use this method if you do not want to set all options in the constructor
-    *
-    * @access   public
-    * @see      resetOption(), XML_Serializer()
-    */
-    function setOption($name, $value)
-    {
-        $this->options[$name] = $value;
-    }
-
-   /**
-    * sets several options at once
-    *
-    * You can use this method if you do not want to set all options in the constructor
-    *
-    * @access   public
-    * @see      resetOption(), XML_Unserializer(), setOption()
-    */
-    function setOptions($options)
-    {
-        $this->options = array_merge($this->options, $options);
-    }
-
-   /**
-    * serialize data
-    *
-    * @access   public
-    * @param    mixed    $data data to serialize
-    * @return   boolean  true on success, pear error on failure
-    */
-    function serialize($data, $options = null)
-    {
-        // if options have been specified, use them instead
-        // of the previously defined ones
-        if (is_array($options)) {
-            $optionsBak = $this->options;
-            if (isset($options['overrideOptions']) && $options['overrideOptions'] == true) {
-                $this->options = array_merge($this->_defaultOptions, $options);
-            } else {
-                $this->options = array_merge($this->options, $options);
-            }
-        } else {
-            $optionsBak = null;
-        }
-
-        //  start depth is zero
-        $this->_tagDepth = 0;
-        $this->_serializedData = '';
-        // serialize an array
-        if (is_array($data)) {
-            $tagName = isset($this->options['rootName']) ? $this->options['rootName'] : 'array';
-            $this->_serializedData .= $this->_serializeArray($data, $tagName, $this->options['rootAttributes']);
-        }
-
-        // add doctype declaration
-        if ($this->options['addDoctype'] === true) {
-            $this->_serializedData = XML_Util::getDoctypeDeclaration($tagName, $this->options['doctype'])
-                                   . $this->options['linebreak']
-                                   . $this->_serializedData;
-        }
-
-        //  build xml declaration
-        if ($this->options['addDecl']) {
-            $atts = array();
-            $encoding = isset($this->options['encoding']) ? $this->options['encoding'] : null;
-            $this->_serializedData = XML_Util::getXMLDeclaration('1.0', $encoding)
-                                   . $this->options['linebreak']
-                                   . $this->_serializedData;
-        }
-
-
-        if ($optionsBak !== null) {
-            $this->options = $optionsBak;
-        }
-
-        return  true;
-    }
-
-   /**
-    * get the result of the serialization
-    *
-    * @access public
-    * @return string serialized XML
-    */
-    function getSerializedData()
-    {
-        if ($this->_serializedData === null) {
-            return  $this->raiseError('No serialized data available. Use XML_Serializer::serialize() first.', XML_SERIALIZER_ERROR_NO_SERIALIZATION);
-        }
-        return $this->_serializedData;
-    }
-
-   /**
-    * serialize any value
-    *
-    * This method checks for the type of the value and calls the appropriate method
-    *
-    * @access private
-    * @param  mixed     $value
-    * @param  string    $tagName
-    * @param  array     $attributes
-    * @return string
-    */
-    function _serializeValue($value, $tagName = null, $attributes = array())
-    {
-        if (is_array($value)) {
-            $xml = $this->_serializeArray($value, $tagName, $attributes);
-        } elseif (is_object($value)) {
-            $xml = $this->_serializeObject($value, $tagName);
-        } else {
-            $tag = array(
-                          'qname'      => $tagName,
-                          'attributes' => $attributes,
-                          'content'    => $value
-                        );
-            $xml = $this->_createXMLTag($tag);
-        }
-        return $xml;
-    }
-
-   /**
-    * serialize an array
-    *
-    * @access   private
-    * @param    array   $array       array to serialize
-    * @param    string  $tagName     name of the root tag
-    * @param    array   $attributes  attributes for the root tag
-    * @return   string  $string      serialized data
-    * @uses     XML_Util::isValidName() to check, whether key has to be substituted
-    */
-    function _serializeArray(&$array, $tagName = null, $attributes = array())
-    {
-        $_content = null;
-
-        /**
-         * check for special attributes
-         */
-        if ($this->options['attributesArray'] !== null) {
-            if (isset($array[$this->options['attributesArray']])) {
-                $attributes = $array[$this->options['attributesArray']];
-                unset($array[$this->options['attributesArray']]);
-            }
-            /**
-             * check for special content
-             */
-            if ($this->options['contentName'] !== null) {
-                if (isset($array[$this->options['contentName']])) {
-                    $_content = $array[$this->options['contentName']];
-                    unset($array[$this->options['contentName']]);
-                }
-            }
-        }
-
-        /*
-        * if mode is set to simpleXML, check whether
-        * the array is associative or indexed
-        */
-        if (is_array($array) && $this->options['mode'] == 'simplexml') {
-            $indexed = true;
-            if (!count($array)) {
-                $indexed = false;
-            }
-            foreach ($array as $key => $val) {
-                if (!is_int($key)) {
-                    $indexed = false;
-                    break;
-                }
-            }
-
-            if ($indexed && $this->options['mode'] == 'simplexml') {
-                $string = '';
-                foreach ($array as $key => $val) {
-                    if ($this->options['beautifyFilelist'] && $tagName == 'dir') {
-                        if (!isset($this->_curdir)) {
-                            $this->_curdir = '';
-                        }
-                        $savedir = $this->_curdir;
-                        if (isset($val['attribs'])) {
-                            if ($val['attribs']['name'] == '/') {
-                                $this->_curdir = '/';
-                            } else {
-                                if ($this->_curdir == '/') {
-                                    $this->_curdir = '';
-                                }
-                                $this->_curdir .= '/' . $val['attribs']['name'];
-                            }
-                        }
-                    }
-                    $string .= $this->_serializeValue( $val, $tagName, $attributes);
-                    if ($this->options['beautifyFilelist'] && $tagName == 'dir') {
-                        $string .= ' <!-- ' . $this->_curdir . ' -->';
-                        if (empty($savedir)) {
-                            unset($this->_curdir);
-                        } else {
-                            $this->_curdir = $savedir;
-                        }
-                    }
-
-                    $string .= $this->options['linebreak'];
-                    // do indentation
-                    if ($this->options['indent'] !== null && $this->_tagDepth > 0) {
-                        $string .= str_repeat($this->options['indent'], $this->_tagDepth);
-                    }
-                }
-                return rtrim($string);
-            }
-        }
-
-        if ($this->options['scalarAsAttributes'] === true) {
-            foreach ($array as $key => $value) {
-                if (is_scalar($value) && (XML_Util::isValidName($key) === true)) {
-                    unset($array[$key]);
-                    $attributes[$this->options['prependAttributes'].$key] = $value;
-                }
-            }
-        }
-
-        // check for empty array => create empty tag
-        if (empty($array)) {
-            $tag = array(
-                            'qname'      => $tagName,
-                            'content'    => $_content,
-                            'attributes' => $attributes
-                        );
-
-        } else {
-            $this->_tagDepth++;
-            $tmp = $this->options['linebreak'];
-            foreach ($array as $key => $value) {
-                // do indentation
-                if ($this->options['indent'] !== null && $this->_tagDepth > 0) {
-                    $tmp .= str_repeat($this->options['indent'], $this->_tagDepth);
-                }
-
-                // copy key
-                $origKey = $key;
-                // key cannot be used as tagname => use default tag
-                $valid = XML_Util::isValidName($key);
-                if (PEAR::isError($valid)) {
-                    if ($this->options['classAsTagName'] && is_object($value)) {
-                        $key = get_class($value);
-                    } else {
-                        $key = $this->options['defaultTagName'];
-                    }
-                }
-                $atts = array();
-                if ($this->options['typeHints'] === true) {
-                    $atts[$this->options['typeAttribute']] = gettype($value);
-                    if ($key !== $origKey) {
-                        $atts[$this->options['keyAttribute']] = (string)$origKey;
-                    }
-
-                }
-                if ($this->options['beautifyFilelist'] && $key == 'dir') {
-                    if (!isset($this->_curdir)) {
-                        $this->_curdir = '';
-                    }
-                    $savedir = $this->_curdir;
-                    if (isset($value['attribs'])) {
-                        if ($value['attribs']['name'] == '/') {
-                            $this->_curdir = '/';
-                        } else {
-                            $this->_curdir .= '/' . $value['attribs']['name'];
-                        }
-                    }
-                }
-
-                if (is_string($value) && $value && ($value{strlen($value) - 1} == "\n")) {
-                    $value .= str_repeat($this->options['indent'], $this->_tagDepth);
-                }
-                $tmp .= $this->_createXMLTag(array(
-                                                    'qname'      => $key,
-                                                    'attributes' => $atts,
-                                                    'content'    => $value )
-                                            );
-                if ($this->options['beautifyFilelist'] && $key == 'dir') {
-                    if (isset($value['attribs'])) {
-                        $tmp .= ' <!-- ' . $this->_curdir . ' -->';
-                        if (empty($savedir)) {
-                            unset($this->_curdir);
-                        } else {
-                            $this->_curdir = $savedir;
-                        }
-                    }
-                }
-                $tmp .= $this->options['linebreak'];
-            }
-
-            $this->_tagDepth--;
-            if ($this->options['indent']!==null && $this->_tagDepth>0) {
-                $tmp .= str_repeat($this->options['indent'], $this->_tagDepth);
-            }
-
-            if (trim($tmp) === '') {
-                $tmp = null;
-            }
-
-            $tag = array(
-                'qname'      => $tagName,
-                'content'    => $tmp,
-                'attributes' => $attributes
-            );
-        }
-        if ($this->options['typeHints'] === true) {
-            if (!isset($tag['attributes'][$this->options['typeAttribute']])) {
-                $tag['attributes'][$this->options['typeAttribute']] = 'array';
-            }
-        }
-
-        $string = $this->_createXMLTag($tag, false);
-        return $string;
-    }
-
-   /**
-    * create a tag from an array
-    * this method awaits an array in the following format
-    * array(
-    *       'qname'        => $tagName,
-    *       'attributes'   => array(),
-    *       'content'      => $content,      // optional
-    *       'namespace'    => $namespace     // optional
-    *       'namespaceUri' => $namespaceUri  // optional
-    *   )
-    *
-    * @access   private
-    * @param    array   $tag tag definition
-    * @param    boolean $replaceEntities whether to replace XML entities in content or not
-    * @return   string  $string XML tag
-    */
-    function _createXMLTag($tag, $replaceEntities = true)
-    {
-        if ($this->options['indentAttributes'] !== false) {
-            $multiline = true;
-            $indent    = str_repeat($this->options['indent'], $this->_tagDepth);
-
-            if ($this->options['indentAttributes'] == '_auto') {
-                $indent .= str_repeat(' ', (strlen($tag['qname'])+2));
-
-            } else {
-                $indent .= $this->options['indentAttributes'];
-            }
-        } else {
-            $indent = $multiline = false;
-        }
-
-        if (is_array($tag['content'])) {
-            if (empty($tag['content'])) {
-                $tag['content'] = '';
-            }
-        } elseif(is_scalar($tag['content']) && (string)$tag['content'] == '') {
-            $tag['content'] = '';
-        }
-
-        if (is_scalar($tag['content']) || is_null($tag['content'])) {
-            if ($this->options['encoding'] == 'UTF-8' &&
-                  version_compare(phpversion(), '5.0.0', 'lt')
-            ) {
-                $tag['content'] = utf8_encode($tag['content']);
-            }
-
-            if ($replaceEntities === true) {
-                $replaceEntities = XML_UTIL_ENTITIES_XML;
-            }
-
-            $tag = XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $this->options['linebreak']);
-        } elseif (is_array($tag['content'])) {
-            $tag = $this->_serializeArray($tag['content'], $tag['qname'], $tag['attributes']);
-        } elseif (is_object($tag['content'])) {
-            $tag = $this->_serializeObject($tag['content'], $tag['qname'], $tag['attributes']);
-        } elseif (is_resource($tag['content'])) {
-            settype($tag['content'], 'string');
-            $tag = XML_Util::createTagFromArray($tag, $replaceEntities);
-        }
-        return  $tag;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/Parser/v1.php b/lib/php/PEAR/PackageFile/Parser/v1.php
deleted file mode 100644
index 294d2a764c4d1a1991570a9ecfe1514f329dd4ae..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/Parser/v1.php
+++ /dev/null
@@ -1,459 +0,0 @@
-<?php
-/**
- * package.xml parsing class, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: v1.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * package.xml abstraction class
- */
-require_once 'PEAR/PackageFile/v1.php';
-/**
- * Parser for package.xml version 1.0
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: @PEAR-VER@
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Parser_v1
-{
-    var $_registry;
-    var $_config;
-    var $_logger;
-    /**
-     * BC hack to allow PEAR_Common::infoFromString() to sort of
-     * work with the version 2.0 format - there's no filelist though
-     * @param PEAR_PackageFile_v2
-     */
-    function fromV2($packagefile)
-    {
-        $info = $packagefile->getArray(true);
-        $ret = new PEAR_PackageFile_v1;
-        $ret->fromArray($info['old']);
-    }
-
-    function setConfig(&$c)
-    {
-        $this->_config = &$c;
-        $this->_registry = &$c->getRegistry();
-    }
-
-    function setLogger(&$l)
-    {
-        $this->_logger = &$l;
-    }
-
-    /**
-     * @param string contents of package.xml file, version 1.0
-     * @return bool success of parsing
-     */
-    function &parse($data, $file, $archive = false)
-    {
-        if (!extension_loaded('xml')) {
-            return PEAR::raiseError('Cannot create xml parser for parsing package.xml, no xml extension');
-        }
-        $xp = xml_parser_create();
-        if (!$xp) {
-            $a = &PEAR::raiseError('Cannot create xml parser for parsing package.xml');
-            return $a;
-        }
-        xml_set_object($xp, $this);
-        xml_set_element_handler($xp, '_element_start_1_0', '_element_end_1_0');
-        xml_set_character_data_handler($xp, '_pkginfo_cdata_1_0');
-        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
-        $this->element_stack = array();
-        $this->_packageInfo = array('provides' => array());
-        $this->current_element = false;
-        unset($this->dir_install);
-        $this->_packageInfo['filelist'] = array();
-        $this->filelist =& $this->_packageInfo['filelist'];
-        $this->dir_names = array();
-        $this->in_changelog = false;
-        $this->d_i = 0;
-        $this->cdata = '';
-        $this->_isValid = true;
-
-        if (!xml_parse($xp, $data, 1)) {
-            $code = xml_get_error_code($xp);
-            $line = xml_get_current_line_number($xp);
-            xml_parser_free($xp);
-            $a = &PEAR::raiseError(sprintf("XML error: %s at line %d",
-                           $str = xml_error_string($code), $line), 2);
-            return $a;
-        }
-
-        xml_parser_free($xp);
-
-        $pf = new PEAR_PackageFile_v1;
-        $pf->setConfig($this->_config);
-        if (isset($this->_logger)) {
-            $pf->setLogger($this->_logger);
-        }
-        $pf->setPackagefile($file, $archive);
-        $pf->fromArray($this->_packageInfo);
-        return $pf;
-    }
-    // {{{ _unIndent()
-
-    /**
-     * Unindent given string
-     *
-     * @param string $str The string that has to be unindented.
-     * @return string
-     * @access private
-     */
-    function _unIndent($str)
-    {
-        // remove leading newlines
-        $str = preg_replace('/^[\r\n]+/', '', $str);
-        // find whitespace at the beginning of the first line
-        $indent_len = strspn($str, " \t");
-        $indent = substr($str, 0, $indent_len);
-        $data = '';
-        // remove the same amount of whitespace from following lines
-        foreach (explode("\n", $str) as $line) {
-            if (substr($line, 0, $indent_len) == $indent) {
-                $data .= substr($line, $indent_len) . "\n";
-            } elseif (trim(substr($line, 0, $indent_len))) {
-                $data .= ltrim($line);
-            }
-        }
-        return $data;
-    }
-
-    // Support for package DTD v1.0:
-    // {{{ _element_start_1_0()
-
-    /**
-     * XML parser callback for ending elements.  Used for version 1.0
-     * packages.
-     *
-     * @param resource  $xp    XML parser resource
-     * @param string    $name  name of ending element
-     *
-     * @return void
-     *
-     * @access private
-     */
-    function _element_start_1_0($xp, $name, $attribs)
-    {
-        array_push($this->element_stack, $name);
-        $this->current_element = $name;
-        $spos = sizeof($this->element_stack) - 2;
-        $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
-        $this->current_attributes = $attribs;
-        $this->cdata = '';
-        switch ($name) {
-            case 'dir':
-                if ($this->in_changelog) {
-                    break;
-                }
-                if (array_key_exists('name', $attribs) && $attribs['name'] != '/') {
-                    $attribs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
-                        $attribs['name']);
-                    if (strrpos($attribs['name'], '/') === strlen($attribs['name']) - 1) {
-                        $attribs['name'] = substr($attribs['name'], 0,
-                            strlen($attribs['name']) - 1);
-                    }
-                    if (strpos($attribs['name'], '/') === 0) {
-                        $attribs['name'] = substr($attribs['name'], 1);
-                    }
-                    $this->dir_names[] = $attribs['name'];
-                }
-                if (isset($attribs['baseinstalldir'])) {
-                    $this->dir_install = $attribs['baseinstalldir'];
-                }
-                if (isset($attribs['role'])) {
-                    $this->dir_role = $attribs['role'];
-                }
-                break;
-            case 'file':
-                if ($this->in_changelog) {
-                    break;
-                }
-                if (isset($attribs['name'])) {
-                    $path = '';
-                    if (count($this->dir_names)) {
-                        foreach ($this->dir_names as $dir) {
-                            $path .= $dir . '/';
-                        }
-                    }
-                    $path .= preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
-                        $attribs['name']);
-                    unset($attribs['name']);
-                    $this->current_path = $path;
-                    $this->filelist[$path] = $attribs;
-                    // Set the baseinstalldir only if the file don't have this attrib
-                    if (!isset($this->filelist[$path]['baseinstalldir']) &&
-                        isset($this->dir_install))
-                    {
-                        $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
-                    }
-                    // Set the Role
-                    if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
-                        $this->filelist[$path]['role'] = $this->dir_role;
-                    }
-                }
-                break;
-            case 'replace':
-                if (!$this->in_changelog) {
-                    $this->filelist[$this->current_path]['replacements'][] = $attribs;
-                }
-                break;
-            case 'maintainers':
-                $this->_packageInfo['maintainers'] = array();
-                $this->m_i = 0; // maintainers array index
-                break;
-            case 'maintainer':
-                // compatibility check
-                if (!isset($this->_packageInfo['maintainers'])) {
-                    $this->_packageInfo['maintainers'] = array();
-                    $this->m_i = 0;
-                }
-                $this->_packageInfo['maintainers'][$this->m_i] = array();
-                $this->current_maintainer =& $this->_packageInfo['maintainers'][$this->m_i];
-                break;
-            case 'changelog':
-                $this->_packageInfo['changelog'] = array();
-                $this->c_i = 0; // changelog array index
-                $this->in_changelog = true;
-                break;
-            case 'release':
-                if ($this->in_changelog) {
-                    $this->_packageInfo['changelog'][$this->c_i] = array();
-                    $this->current_release = &$this->_packageInfo['changelog'][$this->c_i];
-                } else {
-                    $this->current_release = &$this->_packageInfo;
-                }
-                break;
-            case 'deps':
-                if (!$this->in_changelog) {
-                    $this->_packageInfo['release_deps'] = array();
-                }
-                break;
-            case 'dep':
-                // dependencies array index
-                if (!$this->in_changelog) {
-                    $this->d_i++;
-                    isset($attribs['type']) ? ($attribs['type'] = strtolower($attribs['type'])) : false;
-                    $this->_packageInfo['release_deps'][$this->d_i] = $attribs;
-                }
-                break;
-            case 'configureoptions':
-                if (!$this->in_changelog) {
-                    $this->_packageInfo['configure_options'] = array();
-                }
-                break;
-            case 'configureoption':
-                if (!$this->in_changelog) {
-                    $this->_packageInfo['configure_options'][] = $attribs;
-                }
-                break;
-            case 'provides':
-                if (empty($attribs['type']) || empty($attribs['name'])) {
-                    break;
-                }
-                $attribs['explicit'] = true;
-                $this->_packageInfo['provides']["$attribs[type];$attribs[name]"] = $attribs;
-                break;
-            case 'package' :
-                if (isset($attribs['version'])) {
-                    $this->_packageInfo['xsdversion'] = trim($attribs['version']);
-                } else {
-                    $this->_packageInfo['xsdversion'] = '1.0';
-                }
-                if (isset($attribs['packagerversion'])) {
-                    $this->_packageInfo['packagerversion'] = $attribs['packagerversion'];
-                }
-                break;
-        }
-    }
-
-    // }}}
-    // {{{ _element_end_1_0()
-
-    /**
-     * XML parser callback for ending elements.  Used for version 1.0
-     * packages.
-     *
-     * @param resource  $xp    XML parser resource
-     * @param string    $name  name of ending element
-     *
-     * @return void
-     *
-     * @access private
-     */
-    function _element_end_1_0($xp, $name)
-    {
-        $data = trim($this->cdata);
-        switch ($name) {
-            case 'name':
-                switch ($this->prev_element) {
-                    case 'package':
-                        $this->_packageInfo['package'] = $data;
-                        break;
-                    case 'maintainer':
-                        $this->current_maintainer['name'] = $data;
-                        break;
-                }
-                break;
-            case 'extends' :
-                $this->_packageInfo['extends'] = $data;
-                break;
-            case 'summary':
-                $this->_packageInfo['summary'] = $data;
-                break;
-            case 'description':
-                $data = $this->_unIndent($this->cdata);
-                $this->_packageInfo['description'] = $data;
-                break;
-            case 'user':
-                $this->current_maintainer['handle'] = $data;
-                break;
-            case 'email':
-                $this->current_maintainer['email'] = $data;
-                break;
-            case 'role':
-                $this->current_maintainer['role'] = $data;
-                break;
-            case 'version':
-                if ($this->in_changelog) {
-                    $this->current_release['version'] = $data;
-                } else {
-                    $this->_packageInfo['version'] = $data;
-                }
-                break;
-            case 'date':
-                if ($this->in_changelog) {
-                    $this->current_release['release_date'] = $data;
-                } else {
-                    $this->_packageInfo['release_date'] = $data;
-                }
-                break;
-            case 'notes':
-                // try to "de-indent" release notes in case someone
-                // has been over-indenting their xml ;-)
-                // Trim only on the right side
-                $data = rtrim($this->_unIndent($this->cdata));
-                if ($this->in_changelog) {
-                    $this->current_release['release_notes'] = $data;
-                } else {
-                    $this->_packageInfo['release_notes'] = $data;
-                }
-                break;
-            case 'warnings':
-                if ($this->in_changelog) {
-                    $this->current_release['release_warnings'] = $data;
-                } else {
-                    $this->_packageInfo['release_warnings'] = $data;
-                }
-                break;
-            case 'state':
-                if ($this->in_changelog) {
-                    $this->current_release['release_state'] = $data;
-                } else {
-                    $this->_packageInfo['release_state'] = $data;
-                }
-                break;
-            case 'license':
-                if ($this->in_changelog) {
-                    $this->current_release['release_license'] = $data;
-                } else {
-                    $this->_packageInfo['release_license'] = $data;
-                }
-                break;
-            case 'dep':
-                if ($data && !$this->in_changelog) {
-                    $this->_packageInfo['release_deps'][$this->d_i]['name'] = $data;
-                }
-                break;
-            case 'dir':
-                if ($this->in_changelog) {
-                    break;
-                }
-                array_pop($this->dir_names);
-                break;
-            case 'file':
-                if ($this->in_changelog) {
-                    break;
-                }
-                if ($data) {
-                    $path = '';
-                    if (count($this->dir_names)) {
-                        foreach ($this->dir_names as $dir) {
-                            $path .= $dir . '/';
-                        }
-                    }
-                    $path .= $data;
-                    $this->filelist[$path] = $this->current_attributes;
-                    // Set the baseinstalldir only if the file don't have this attrib
-                    if (!isset($this->filelist[$path]['baseinstalldir']) &&
-                        isset($this->dir_install))
-                    {
-                        $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
-                    }
-                    // Set the Role
-                    if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
-                        $this->filelist[$path]['role'] = $this->dir_role;
-                    }
-                }
-                break;
-            case 'maintainer':
-                if (empty($this->_packageInfo['maintainers'][$this->m_i]['role'])) {
-                    $this->_packageInfo['maintainers'][$this->m_i]['role'] = 'lead';
-                }
-                $this->m_i++;
-                break;
-            case 'release':
-                if ($this->in_changelog) {
-                    $this->c_i++;
-                }
-                break;
-            case 'changelog':
-                $this->in_changelog = false;
-                break;
-        }
-        array_pop($this->element_stack);
-        $spos = sizeof($this->element_stack) - 1;
-        $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';
-        $this->cdata = '';
-    }
-
-    // }}}
-    // {{{ _pkginfo_cdata_1_0()
-
-    /**
-     * XML parser callback for character data.  Used for version 1.0
-     * packages.
-     *
-     * @param resource  $xp    XML parser resource
-     * @param string    $name  character data
-     *
-     * @return void
-     *
-     * @access private
-     */
-    function _pkginfo_cdata_1_0($xp, $data)
-    {
-        if (isset($this->cdata)) {
-            $this->cdata .= $data;
-        }
-    }
-
-    // }}}
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/Parser/v2.php b/lib/php/PEAR/PackageFile/Parser/v2.php
deleted file mode 100644
index 989923402bac8856703977b8c2a9984fbeba1ee4..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/Parser/v2.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/**
- * package.xml parsing class, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: v2.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * base xml parser class
- */
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * Parser for package.xml version 2.0
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: @PEAR-VER@
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser
-{
-    var $_config;
-    var $_logger;
-    var $_registry;
-
-    function setConfig(&$c)
-    {
-        $this->_config = &$c;
-        $this->_registry = &$c->getRegistry();
-    }
-
-    function setLogger(&$l)
-    {
-        $this->_logger = &$l;
-    }
-    /**
-     * Unindent given string
-     *
-     * @param string $str The string that has to be unindented.
-     * @return string
-     * @access private
-     */
-    function _unIndent($str)
-    {
-        // remove leading newlines
-        $str = preg_replace('/^[\r\n]+/', '', $str);
-        // find whitespace at the beginning of the first line
-        $indent_len = strspn($str, " \t");
-        $indent = substr($str, 0, $indent_len);
-        $data = '';
-        // remove the same amount of whitespace from following lines
-        foreach (explode("\n", $str) as $line) {
-            if (substr($line, 0, $indent_len) == $indent) {
-                $data .= substr($line, $indent_len) . "\n";
-            } else {
-                $data .= $line . "\n";
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * post-process data
-     *
-     * @param string $data
-     * @param string $element element name
-     */
-    function postProcess($data, $element)
-    {
-        if ($element == 'notes') {
-            return trim($this->_unIndent($data));
-        }
-        return trim($data);
-    }
-
-    /**
-     * @param string
-     * @param string file name of the package.xml
-     * @param string|false name of the archive this package.xml came from, if any
-     * @param string class name to instantiate and return.  This must be PEAR_PackageFile_v2 or
-     *               a subclass
-     * @return PEAR_PackageFile_v2
-     */
-    function &parse($data, $file, $archive = false, $class = 'PEAR_PackageFile_v2')
-    {
-        if (PEAR::isError($err = parent::parse($data, $file))) {
-            return $err;
-        }
-
-        $ret = new $class;
-        $ret->encoding = $this->encoding;
-        $ret->setConfig($this->_config);
-        if (isset($this->_logger)) {
-            $ret->setLogger($this->_logger);
-        }
-
-        $ret->fromArray($this->_unserializedData);
-        $ret->setPackagefile($file, $archive);
-        return $ret;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/v1.php b/lib/php/PEAR/PackageFile/v1.php
deleted file mode 100644
index 80f71faba1d6ee7a9ed9d48be44056fa7b04ae7f..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/v1.php
+++ /dev/null
@@ -1,1612 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v1, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: v1.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * For error handling
- */
-require_once 'PEAR/ErrorStack.php';
-
-/**
- * Error code if parsing is attempted with no xml extension
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_XML_EXT', 3);
-
-/**
- * Error code if creating the xml parser resource fails
- */
-define('PEAR_PACKAGEFILE_ERROR_CANT_MAKE_PARSER', 4);
-
-/**
- * Error code used for all sax xml parsing errors
- */
-define('PEAR_PACKAGEFILE_ERROR_PARSER_ERROR', 5);
-
-/**
- * Error code used when there is no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_NAME', 6);
-
-/**
- * Error code when a package name is not valid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_NAME', 7);
-
-/**
- * Error code used when no summary is parsed
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_SUMMARY', 8);
-
-/**
- * Error code for summaries that are more than 1 line
- */
-define('PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY', 9);
-
-/**
- * Error code used when no description is present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION', 10);
-
-/**
- * Error code used when no license is present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_LICENSE', 11);
-
-/**
- * Error code used when a <version> version number is not present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_VERSION', 12);
-
-/**
- * Error code used when a <version> version number is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_VERSION', 13);
-
-/**
- * Error code when release state is missing
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_STATE', 14);
-
-/**
- * Error code when release state is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_STATE', 15);
-
-/**
- * Error code when release state is missing
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DATE', 16);
-
-/**
- * Error code when release state is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DATE', 17);
-
-/**
- * Error code when no release notes are found
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_NOTES', 18);
-
-/**
- * Error code when no maintainers are found
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS', 19);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE', 20);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE', 21);
-
-/**
- * Error code when a maintainer has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME', 22);
-
-/**
- * Error code when a maintainer has no email
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL', 23);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_MAINTROLE', 24);
-
-/**
- * Error code when a dependency is not a PHP dependency, but has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPNAME', 25);
-
-/**
- * Error code when a dependency has no type (pkg, php, etc.)
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE', 26);
-
-/**
- * Error code when a dependency has no relation (lt, ge, has, etc.)
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPREL', 27);
-
-/**
- * Error code when a dependency is not a 'has' relation, but has no version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION', 28);
-
-/**
- * Error code when a dependency has an invalid relation
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPREL', 29);
-
-/**
- * Error code when a dependency has an invalid type
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPTYPE', 30);
-
-/**
- * Error code when a dependency has an invalid optional option
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL', 31);
-
-/**
- * Error code when a dependency is a pkg dependency, and has an invalid package name
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPNAME', 32);
-
-/**
- * Error code when a dependency has a channel="foo" attribute, and foo is not a registered channel
- */
-define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_DEPCHANNEL', 33);
-
-/**
- * Error code when rel="has" and version attribute is present.
- */
-define('PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED', 34);
-
-/**
- * Error code when type="php" and dependency name is present
- */
-define('PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED', 35);
-
-/**
- * Error code when a configure option has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_CONFNAME', 36);
-
-/**
- * Error code when a configure option has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT', 37);
-
-/**
- * Error code when a file in the filelist has an invalid role
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE', 38);
-
-/**
- * Error code when a file in the filelist has no role
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_FILEROLE', 39);
-
-/**
- * Error code when analyzing a php source file that has parse errors
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE', 40);
-
-/**
- * Error code when analyzing a php source file reveals a source element
- * without a package name prefix
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX', 41);
-
-/**
- * Error code when an unknown channel is specified
- */
-define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_CHANNEL', 42);
-
-/**
- * Error code when no files are found in the filelist
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_FILES', 43);
-
-/**
- * Error code when a file is not valid php according to _analyzeSourceCode()
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILE', 44);
-
-/**
- * Error code when the channel validator returns an error or warning
- */
-define('PEAR_PACKAGEFILE_ERROR_CHANNELVAL', 45);
-
-/**
- * Error code when a php5 package is packaged in php4 (analysis doesn't work)
- */
-define('PEAR_PACKAGEFILE_ERROR_PHP5', 46);
-
-/**
- * Error code when a file is listed in package.xml but does not exist
- */
-define('PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND', 47);
-
-/**
- * Error code when a <dep type="php" rel="not"... is encountered (use rel="ne")
- */
-define('PEAR_PACKAGEFILE_PHP_NO_NOT', 48);
-
-/**
- * Error code when a package.xml contains non-ISO-8859-1 characters
- */
-define('PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS', 49);
-
-/**
- * Error code when a dependency is not a 'has' relation, but has no version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION', 50);
-
-/**
- * Error code when a package has no lead developer
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_LEAD', 51);
-
-/**
- * Error code when a filename begins with "."
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52);
-/**
- * package.xml encapsulator
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_v1
-{
-    /**
-     * @access private
-     * @var PEAR_ErrorStack
-     * @access private
-     */
-    var $_stack;
-
-    /**
-     * A registry object, used to access the package name validation regex for non-standard channels
-     * @var PEAR_Registry
-     * @access private
-     */
-    var $_registry;
-
-    /**
-     * An object that contains a log method that matches PEAR_Common::log's signature
-     * @var object
-     * @access private
-     */
-    var $_logger;
-
-    /**
-     * Parsed package information
-     * @var array
-     * @access private
-     */
-    var $_packageInfo;
-
-    /**
-     * path to package.xml
-     * @var string
-     * @access private
-     */
-    var $_packageFile;
-
-    /**
-     * path to package .tgz or false if this is a local/extracted package.xml
-     * @var string
-     * @access private
-     */
-    var $_archiveFile;
-
-    /**
-     * @var int
-     * @access private
-     */
-    var $_isValid = 0;
-
-    /**
-     * Determines whether this packagefile was initialized only with partial package info
-     *
-     * If this package file was constructed via parsing REST, it will only contain
-     *
-     * - package name
-     * - channel name
-     * - dependencies 
-     * @var boolean
-     * @access private
-     */
-    var $_incomplete = true;
-
-    /**
-     * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack
-     * @param string Name of Error Stack class to use.
-     */
-    function PEAR_PackageFile_v1()
-    {
-        $this->_stack = &new PEAR_ErrorStack('PEAR_PackageFile_v1');
-        $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
-        $this->_isValid = 0;
-    }
-
-    function installBinary($installer)
-    {
-        return false;
-    }
-
-    function isExtension($name)
-    {
-        return false;
-    }
-
-    function setConfig(&$config)
-    {
-        $this->_config = &$config;
-        $this->_registry = &$config->getRegistry();
-    }
-
-    function setRequestedGroup()
-    {
-        // placeholder
-    }
-
-    /**
-     * For saving in the registry.
-     *
-     * Set the last version that was installed
-     * @param string
-     */
-    function setLastInstalledVersion($version)
-    {
-        $this->_packageInfo['_lastversion'] = $version;
-    }
-
-    /**
-     * @return string|false
-     */
-    function getLastInstalledVersion()
-    {
-        if (isset($this->_packageInfo['_lastversion'])) {
-            return $this->_packageInfo['_lastversion'];
-        }
-        return false;
-    }
-
-    function getInstalledBinary()
-    {
-        return false;
-    }
-
-    function listPostinstallScripts()
-    {
-        return false;
-    }
-
-    function initPostinstallScripts()
-    {
-        return false;
-    }
-
-    function setLogger(&$logger)
-    {
-        if ($logger && (!is_object($logger) || !method_exists($logger, 'log'))) {
-            return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
-        }
-        $this->_logger = &$logger;
-    }
-
-    function setPackagefile($file, $archive = false)
-    {
-        $this->_packageFile = $file;
-        $this->_archiveFile = $archive ? $archive : $file;
-    }
-
-    function getPackageFile()
-    {
-        return isset($this->_packageFile) ? $this->_packageFile : false;
-    }
-
-    function getPackageType()
-    {
-        return 'php';
-    }
-
-    function getArchiveFile()
-    {
-        return $this->_archiveFile;
-    }
-
-    function packageInfo($field)
-    {
-        if (!is_string($field) || empty($field) ||
-            !isset($this->_packageInfo[$field])) {
-            return false;
-        }
-        return $this->_packageInfo[$field];
-    }
-
-    function setDirtree($path)
-    {
-        if (!isset($this->_packageInfo['dirtree'])) {
-            $this->_packageInfo['dirtree'] = array();
-        }
-        $this->_packageInfo['dirtree'][$path] = true;
-    }
-
-    function getDirtree()
-    {
-        if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
-            return $this->_packageInfo['dirtree'];
-        }
-        return false;
-    }
-
-    function resetDirtree()
-    {
-        unset($this->_packageInfo['dirtree']);
-    }
-
-    function fromArray($pinfo)
-    {
-        $this->_incomplete = false;
-        $this->_packageInfo = $pinfo;
-    }
-
-    function isIncomplete()
-    {
-        return $this->_incomplete;
-    }
-
-    function getChannel()
-    {
-        return 'pear.php.net';
-    }
-
-    function getUri()
-    {
-        return false;
-    }
-
-    function getTime()
-    {
-        return false;
-    }
-
-    function getExtends()
-    {
-        if (isset($this->_packageInfo['extends'])) {
-            return $this->_packageInfo['extends'];
-        }
-        return false;
-    }
-
-    /**
-     * @return array
-     */
-    function toArray()
-    {
-        if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
-            return false;
-        }
-        return $this->getArray();
-    }
-
-    function getArray()
-    {
-        return $this->_packageInfo;
-    }
-
-    function getName()
-    {
-        return $this->getPackage();
-    }
-
-    function getPackage()
-    {
-        if (isset($this->_packageInfo['package'])) {
-            return $this->_packageInfo['package'];
-        }
-        return false;
-    }
-
-    /**
-     * WARNING - don't use this unless you know what you are doing
-     */
-    function setRawPackage($package)
-    {
-        $this->_packageInfo['package'] = $package;
-    }
-
-    function setPackage($package)
-    {
-        $this->_packageInfo['package'] = $package;
-        $this->_isValid = false;
-    }
-
-    function getVersion()
-    {
-        if (isset($this->_packageInfo['version'])) {
-            return $this->_packageInfo['version'];
-        }
-        return false;
-    }
-
-    function setVersion($version)
-    {
-        $this->_packageInfo['version'] = $version;
-        $this->_isValid = false;
-    }
-
-    function clearMaintainers()
-    {
-        unset($this->_packageInfo['maintainers']);
-    }
-
-    function getMaintainers()
-    {
-        if (isset($this->_packageInfo['maintainers'])) {
-            return $this->_packageInfo['maintainers'];
-        }
-        return false;
-    }
-
-    /**
-     * Adds a new maintainer - no checking of duplicates is performed, use
-     * updatemaintainer for that purpose.
-     */
-    function addMaintainer($role, $handle, $name, $email)
-    {
-        $this->_packageInfo['maintainers'][] =
-            array('handle' => $handle, 'role' => $role, 'email' => $email, 'name' => $name);
-        $this->_isValid = false;
-    }
-
-    function updateMaintainer($role, $handle, $name, $email)
-    {
-        $found = false;
-        if (!isset($this->_packageInfo['maintainers']) ||
-              !is_array($this->_packageInfo['maintainers'])) {
-            return $this->addMaintainer($role, $handle, $name, $email);
-        }
-        foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
-            if ($maintainer['handle'] == $handle) {
-                $found = $i;
-                break;
-            }
-        }
-        if ($found !== false) {
-            unset($this->_packageInfo['maintainers'][$found]);
-            $this->_packageInfo['maintainers'] =
-                array_values($this->_packageInfo['maintainers']);
-        }
-        $this->addMaintainer($role, $handle, $name, $email);
-    }
-
-    function deleteMaintainer($handle)
-    {
-        $found = false;
-        foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
-            if ($maintainer['handle'] == $handle) {
-                $found = $i;
-                break;
-            }
-        }
-        if ($found !== false) {
-            unset($this->_packageInfo['maintainers'][$found]);
-            $this->_packageInfo['maintainers'] =
-                array_values($this->_packageInfo['maintainers']);
-            return true;
-        }
-        return false;
-    }
-
-    function getState()
-    {
-        if (isset($this->_packageInfo['release_state'])) {
-            return $this->_packageInfo['release_state'];
-        }
-        return false;
-    }
-
-    function setRawState($state)
-    {
-        $this->_packageInfo['release_state'] = $state;
-    }
-
-    function setState($state)
-    {
-        $this->_packageInfo['release_state'] = $state;
-        $this->_isValid = false;
-    }
-
-    function getDate()
-    {
-        if (isset($this->_packageInfo['release_date'])) {
-            return $this->_packageInfo['release_date'];
-        }
-        return false;
-    }
-
-    function setDate($date)
-    {
-        $this->_packageInfo['release_date'] = $date;
-        $this->_isValid = false;
-    }
-
-    function getLicense()
-    {
-        if (isset($this->_packageInfo['release_license'])) {
-            return $this->_packageInfo['release_license'];
-        }
-        return false;
-    }
-
-    function setLicense($date)
-    {
-        $this->_packageInfo['release_license'] = $date;
-        $this->_isValid = false;
-    }
-
-    function getSummary()
-    {
-        if (isset($this->_packageInfo['summary'])) {
-            return $this->_packageInfo['summary'];
-        }
-        return false;
-    }
-
-    function setSummary($summary)
-    {
-        $this->_packageInfo['summary'] = $summary;
-        $this->_isValid = false;
-    }
-
-    function getDescription()
-    {
-        if (isset($this->_packageInfo['description'])) {
-            return $this->_packageInfo['description'];
-        }
-        return false;
-    }
-
-    function setDescription($desc)
-    {
-        $this->_packageInfo['description'] = $desc;
-        $this->_isValid = false;
-    }
-
-    function getNotes()
-    {
-        if (isset($this->_packageInfo['release_notes'])) {
-            return $this->_packageInfo['release_notes'];
-        }
-        return false;
-    }
-
-    function setNotes($notes)
-    {
-        $this->_packageInfo['release_notes'] = $notes;
-        $this->_isValid = false;
-    }
-
-    function getDeps()
-    {
-        if (isset($this->_packageInfo['release_deps'])) {
-            return $this->_packageInfo['release_deps'];
-        }
-        return false;
-    }
-
-    /**
-     * Reset dependencies prior to adding new ones
-     */
-    function clearDeps()
-    {
-        unset($this->_packageInfo['release_deps']);
-    }
-
-    function addPhpDep($version, $rel)
-    {
-        $this->_isValid = false;
-        $this->_packageInfo['release_deps'][] =
-            array('type' => 'php',
-                  'rel' => $rel,
-                  'version' => $version);
-    }
-
-    function addPackageDep($name, $version, $rel, $optional = 'no')
-    {
-        $this->_isValid = false;
-        $dep =
-            array('type' => 'pkg',
-                  'name' => $name,
-                  'rel' => $rel,
-                  'optional' => $optional);
-        if ($rel != 'has' && $rel != 'not') {
-            $dep['version'] = $version;
-        }
-        $this->_packageInfo['release_deps'][] = $dep;
-    }
-
-    function addExtensionDep($name, $version, $rel, $optional = 'no')
-    {
-        $this->_isValid = false;
-        $this->_packageInfo['release_deps'][] =
-            array('type' => 'ext',
-                  'name' => $name,
-                  'rel' => $rel,
-                  'version' => $version,
-                  'optional' => $optional);
-    }
-
-    /**
-     * WARNING - do not use this function directly unless you know what you're doing
-     */
-    function setDeps($deps)
-    {
-        $this->_packageInfo['release_deps'] = $deps;
-    }
-
-    function hasDeps()
-    {
-        return isset($this->_packageInfo['release_deps']) &&
-            count($this->_packageInfo['release_deps']);
-    }
-
-    function getDependencyGroup($group)
-    {
-        return false;
-    }
-
-    function isCompatible($pf)
-    {
-        return false;
-    }
-
-    function isSubpackageOf($p)
-    {
-        return $p->isSubpackage($this);
-    }
-
-    function isSubpackage($p)
-    {
-        return false;
-    }
-
-    function dependsOn($package, $channel)
-    {
-        if (strtolower($channel) != 'pear.php.net') {
-            return false;
-        }
-        if (!($deps = $this->getDeps())) {
-            return false;
-        }
-        foreach ($deps as $dep) {
-            if ($dep['type'] != 'pkg') {
-                continue;
-            }
-            if (strtolower($dep['name']) == strtolower($package)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    function getConfigureOptions()
-    {
-        if (isset($this->_packageInfo['configure_options'])) {
-            return $this->_packageInfo['configure_options'];
-        }
-        return false;
-    }
-
-    function hasConfigureOptions()
-    {
-        return isset($this->_packageInfo['configure_options']) &&
-            count($this->_packageInfo['configure_options']);
-    }
-
-    function addConfigureOption($name, $prompt, $default = false)
-    {
-        $o = array('name' => $name, 'prompt' => $prompt);
-        if ($default !== false) {
-            $o['default'] = $default;
-        }
-        if (!isset($this->_packageInfo['configure_options'])) {
-            $this->_packageInfo['configure_options'] = array();
-        }
-        $this->_packageInfo['configure_options'][] = $o;
-    }
-
-    function clearConfigureOptions()
-    {
-        unset($this->_packageInfo['configure_options']);
-    }
-
-    function getProvides()
-    {
-        if (isset($this->_packageInfo['provides'])) {
-            return $this->_packageInfo['provides'];
-        }
-        return false;
-    }
-
-    function getProvidesExtension()
-    {
-        return false;
-    }
-
-    function addFile($dir, $file, $attrs)
-    {
-        $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
-        if ($dir == '/' || $dir == '') {
-            $dir = '';
-        } else {
-            $dir .= '/';
-        }
-        $file = $dir . $file;
-        $file = preg_replace('![\\/]+!', '/', $file);
-        $this->_packageInfo['filelist'][$file] = $attrs;
-    }
-
-    function getInstallationFilelist()
-    {
-        return $this->getFilelist();
-    }
-
-    function getFilelist()
-    {
-        if (isset($this->_packageInfo['filelist'])) {
-            return $this->_packageInfo['filelist'];
-        }
-        return false;
-    }
-
-    function setFileAttribute($file, $attr, $value)
-    {
-        $this->_packageInfo['filelist'][$file][$attr] = $value;
-    }
-
-    function resetFilelist()
-    {
-        $this->_packageInfo['filelist'] = array();
-    }
-
-    function setInstalledAs($file, $path)
-    {
-        if ($path) {
-            return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
-        }
-        unset($this->_packageInfo['filelist'][$file]['installed_as']);
-    }
-
-    function installedFile($file, $atts)
-    {
-        if (isset($this->_packageInfo['filelist'][$file])) {
-            $this->_packageInfo['filelist'][$file] =
-                array_merge($this->_packageInfo['filelist'][$file], $atts);
-        } else {
-            $this->_packageInfo['filelist'][$file] = $atts;
-        }
-    }
-
-    function getChangelog()
-    {
-        if (isset($this->_packageInfo['changelog'])) {
-            return $this->_packageInfo['changelog'];
-        }
-        return false;
-    }
-
-    function getPackagexmlVersion()
-    {
-        return '1.0';
-    }
-
-    /**
-     * Wrapper to {@link PEAR_ErrorStack::getErrors()}
-     * @param boolean determines whether to purge the error stack after retrieving
-     * @return array
-     */
-    function getValidationWarnings($purge = true)
-    {
-        return $this->_stack->getErrors($purge);
-    }
-
-    // }}}
-    /**
-     * Validation error.  Also marks the object contents as invalid
-     * @param error code
-     * @param array error information
-     * @access private
-     */
-    function _validateError($code, $params = array())
-    {
-        $this->_stack->push($code, 'error', $params, false, false, debug_backtrace());
-        $this->_isValid = false;
-    }
-
-    /**
-     * Validation warning.  Does not mark the object contents invalid.
-     * @param error code
-     * @param array error information
-     * @access private
-     */
-    function _validateWarning($code, $params = array())
-    {
-        $this->_stack->push($code, 'warning', $params, false, false, debug_backtrace());
-    }
-
-    /**
-     * @param integer error code
-     * @access protected
-     */
-    function _getErrorMessage()
-    {
-        return array(
-                PEAR_PACKAGEFILE_ERROR_NO_NAME =>
-                    'Missing Package Name',
-                PEAR_PACKAGEFILE_ERROR_NO_SUMMARY =>
-                    'No summary found',
-                PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY =>
-                    'Summary should be on one line',
-                PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION =>
-                    'Missing description',
-                PEAR_PACKAGEFILE_ERROR_NO_LICENSE =>
-                    'Missing license',
-                PEAR_PACKAGEFILE_ERROR_NO_VERSION =>
-                    'No release version found',
-                PEAR_PACKAGEFILE_ERROR_NO_STATE =>
-                    'No release state found',
-                PEAR_PACKAGEFILE_ERROR_NO_DATE =>
-                    'No release date found',
-                PEAR_PACKAGEFILE_ERROR_NO_NOTES =>
-                    'No release notes found',
-                PEAR_PACKAGEFILE_ERROR_NO_LEAD =>
-                    'Package must have at least one lead maintainer',
-                PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS =>
-                    'No maintainers found, at least one must be defined',
-                PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE =>
-                    'Maintainer %index% has no handle (user ID at channel server)',
-                PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE =>
-                    'Maintainer %index% has no role',
-                PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME =>
-                    'Maintainer %index% has no name',
-                PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL =>
-                    'Maintainer %index% has no email',
-                PEAR_PACKAGEFILE_ERROR_NO_DEPNAME =>
-                    'Dependency %index% is not a php dependency, and has no name',
-                PEAR_PACKAGEFILE_ERROR_NO_DEPREL =>
-                    'Dependency %index% has no relation (rel)',
-                PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE =>
-                    'Dependency %index% has no type',
-                PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED =>
-                    'PHP Dependency %index% has a name attribute of "%name%" which will be' .
-                        ' ignored!',
-                PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION =>
-                    'Dependency %index% is not a rel="has" or rel="not" dependency, ' .
-                        'and has no version',
-                PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION =>
-                    'Dependency %index% is a type="php" dependency, ' .
-                        'and has no version',
-                PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED =>
-                    'Dependency %index% is a rel="%rel%" dependency, versioning is ignored',
-                PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL =>
-                    'Dependency %index% has invalid optional value "%opt%", should be yes or no',
-                PEAR_PACKAGEFILE_PHP_NO_NOT =>
-                    'Dependency %index%: php dependencies cannot use "not" rel, use "ne"' .
-                        ' to exclude specific versions',
-                PEAR_PACKAGEFILE_ERROR_NO_CONFNAME =>
-                    'Configure Option %index% has no name',
-                PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT =>
-                    'Configure Option %index% has no prompt',
-                PEAR_PACKAGEFILE_ERROR_NO_FILES =>
-                    'No files in <filelist> section of package.xml',
-                PEAR_PACKAGEFILE_ERROR_NO_FILEROLE =>
-                    'File "%file%" has no role, expecting one of "%roles%"',
-                PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE =>
-                    'File "%file%" has invalid role "%role%", expecting one of "%roles%"',
-                PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME =>
-                    'File "%file%" cannot start with ".", cannot package or install',
-                PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE =>
-                    'Parser error: invalid PHP found in file "%file%"',
-                PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX =>
-                    'in %file%: %type% "%name%" not prefixed with package name "%package%"',
-                PEAR_PACKAGEFILE_ERROR_INVALID_FILE =>
-                    'Parser error: invalid PHP file "%file%"',
-                PEAR_PACKAGEFILE_ERROR_CHANNELVAL =>
-                    'Channel validator error: field "%field%" - %reason%',
-                PEAR_PACKAGEFILE_ERROR_PHP5 =>
-                    'Error, PHP5 token encountered in %file%, analysis should be in PHP5',
-                PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND =>
-                    'File "%file%" in package.xml does not exist',
-                PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS =>
-                    'Package.xml contains non-ISO-8859-1 characters, and may not validate',
-            );
-    }
-
-    /**
-     * Validate XML package definition file.
-     *
-     * @access public
-     * @return boolean
-     */
-    function validate($state = PEAR_VALIDATE_NORMAL, $nofilechecking = false)
-    {
-        if (($this->_isValid & $state) == $state) {
-            return true;
-        }
-        $this->_isValid = true;
-        $info = $this->_packageInfo;
-        if (empty($info['package'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NAME);
-            $this->_packageName = $pn = 'unknown';
-        } else {
-            $this->_packageName = $pn = $info['package'];
-        }
-
-        if (empty($info['summary'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_SUMMARY);
-        } elseif (strpos(trim($info['summary']), "\n") !== false) {
-            $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY,
-                array('summary' => $info['summary']));
-        }
-        if (empty($info['description'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION);
-        }
-        if (empty($info['release_license'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LICENSE);
-        }
-        if (empty($info['version'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_VERSION);
-        }
-        if (empty($info['release_state'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_STATE);
-        }
-        if (empty($info['release_date'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DATE);
-        }
-        if (empty($info['release_notes'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NOTES);
-        }
-        if (empty($info['maintainers'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS);
-        } else {
-            $haslead = false;
-            $i = 1;
-            foreach ($info['maintainers'] as $m) {
-                if (empty($m['handle'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE,
-                        array('index' => $i));
-                }
-                if (empty($m['role'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE,
-                        array('index' => $i, 'roles' => PEAR_Common::getUserRoles()));
-                } elseif ($m['role'] == 'lead') {
-                    $haslead = true;
-                }
-                if (empty($m['name'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME,
-                        array('index' => $i));
-                }
-                if (empty($m['email'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL,
-                        array('index' => $i));
-                }
-                $i++;
-            }
-            if (!$haslead) {
-                $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LEAD);
-            }
-        }
-        if (!empty($info['release_deps'])) {
-            $i = 1;
-            foreach ($info['release_deps'] as $d) {
-                if (!isset($d['type']) || empty($d['type'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE,
-                        array('index' => $i, 'types' => PEAR_Common::getDependencyTypes()));
-                    continue;
-                }
-                if (!isset($d['rel']) || empty($d['rel'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPREL,
-                        array('index' => $i, 'rels' => PEAR_Common::getDependencyRelations()));
-                    continue;
-                }
-                if (!empty($d['optional'])) {
-                    if (!in_array($d['optional'], array('yes', 'no'))) {
-                        $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL,
-                            array('index' => $i, 'opt' => $d['optional']));
-                    }
-                }
-                if ($d['rel'] != 'has' && $d['rel'] != 'not' && empty($d['version'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION,
-                        array('index' => $i));
-                } elseif (($d['rel'] == 'has' || $d['rel'] == 'not') && !empty($d['version'])) {
-                    $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED,
-                        array('index' => $i, 'rel' => $d['rel']));
-                }
-                if ($d['type'] == 'php' && !empty($d['name'])) {
-                    $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED,
-                        array('index' => $i, 'name' => $d['name']));
-                } elseif ($d['type'] != 'php' && empty($d['name'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPNAME,
-                        array('index' => $i));
-                }
-                if ($d['type'] == 'php' && empty($d['version'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION,
-                        array('index' => $i));
-                }
-                if (($d['rel'] == 'not') && ($d['type'] == 'php')) {
-                    $this->_validateError(PEAR_PACKAGEFILE_PHP_NO_NOT,
-                        array('index' => $i));
-                }
-                $i++;
-            }
-        }
-        if (!empty($info['configure_options'])) {
-            $i = 1;
-            foreach ($info['configure_options'] as $c) {
-                if (empty($c['name'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFNAME,
-                        array('index' => $i));
-                }
-                if (empty($c['prompt'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT,
-                        array('index' => $i));
-                }
-                $i++;
-            }
-        }
-        if (empty($info['filelist'])) {
-            $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILES);
-            $errors[] = 'no files';
-        } else {
-            foreach ($info['filelist'] as $file => $fa) {
-                if (empty($fa['role'])) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILEROLE,
-                        array('file' => $file, 'roles' => PEAR_Common::getFileRoles()));
-                    continue;
-                } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) {
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
-                        array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
-                }
-                if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file))) {
-                    // file contains .. parent directory or . cur directory references
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
-                        array('file' => $file));
-                }
-                if (isset($fa['install-as']) &&
-                      preg_match('~/\.\.?(/|\\z)|^\.\.?/~', 
-                                 str_replace('\\', '/', $fa['install-as']))) {
-                    // install-as contains .. parent directory or . cur directory references
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
-                        array('file' => $file . ' [installed as ' . $fa['install-as'] . ']'));
-                }
-                if (isset($fa['baseinstalldir']) &&
-                      preg_match('~/\.\.?(/|\\z)|^\.\.?/~', 
-                                 str_replace('\\', '/', $fa['baseinstalldir']))) {
-                    // install-as contains .. parent directory or . cur directory references
-                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
-                        array('file' => $file . ' [baseinstalldir ' . $fa['baseinstalldir'] . ']'));
-                }
-            }
-        }
-        if (isset($this->_registry) && $this->_isValid) {
-            $chan = $this->_registry->getChannel('pear.php.net');
-            if (PEAR::isError($chan)) {
-                $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $chan->getMessage());
-                return $this->_isValid = 0;
-            }
-            $validator = $chan->getValidationObject();
-            $validator->setPackageFile($this);
-            $validator->validate($state);
-            $failures = $validator->getFailures();
-            foreach ($failures['errors'] as $error) {
-                $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $error);
-            }
-            foreach ($failures['warnings'] as $warning) {
-                $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $warning);
-            }
-        }
-        if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$nofilechecking) {
-            if ($this->_analyzePhpFiles()) {
-                $this->_isValid = true;
-            }
-        }
-        if ($this->_isValid) {
-            return $this->_isValid = $state;
-        }
-        return $this->_isValid = 0;
-    }
-
-    function _analyzePhpFiles()
-    {
-        if (!$this->_isValid) {
-            return false;
-        }
-        if (!isset($this->_packageFile)) {
-            return false;
-        }
-        $dir_prefix = dirname($this->_packageFile);
-        $common = new PEAR_Common;
-        $log = isset($this->_logger) ? array(&$this->_logger, 'log') :
-            array($common, 'log');
-        $info = $this->getFilelist();
-        foreach ($info as $file => $fa) {
-            if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
-                $this->_validateError(PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND,
-                    array('file' => realpath($dir_prefix) . DIRECTORY_SEPARATOR . $file));
-                continue;
-            }
-            if ($fa['role'] == 'php' && $dir_prefix) {
-                call_user_func_array($log, array(1, "Analyzing $file"));
-                $srcinfo = $this->_analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
-                if ($srcinfo) {
-                    $this->_buildProvidesArray($srcinfo);
-                }
-            }
-        }
-        $this->_packageName = $pn = $this->getPackage();
-        $pnl = strlen($pn);
-        if (isset($this->_packageInfo['provides'])) {
-            foreach ((array) $this->_packageInfo['provides'] as $key => $what) {
-                if (isset($what['explicit'])) {
-                    // skip conformance checks if the provides entry is
-                    // specified in the package.xml file
-                    continue;
-                }
-                extract($what);
-                if ($type == 'class') {
-                    if (!strncasecmp($name, $pn, $pnl)) {
-                        continue;
-                    }
-                    $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX,
-                        array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
-                } elseif ($type == 'function') {
-                    if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
-                        continue;
-                    }
-                    $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX,
-                        array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
-                }
-            }
-        }
-        return $this->_isValid;
-    }
-
-    /**
-     * Get the default xml generator object
-     *
-     * @return PEAR_PackageFile_Generator_v1
-     */
-    function &getDefaultGenerator()
-    {
-        if (!class_exists('PEAR_PackageFile_Generator_v1')) {
-            require_once 'PEAR/PackageFile/Generator/v1.php';
-        }
-        $a = &new PEAR_PackageFile_Generator_v1($this);
-        return $a;
-    }
-
-    /**
-     * Get the contents of a file listed within the package.xml
-     * @param string
-     * @return string
-     */
-    function getFileContents($file)
-    {
-        if ($this->_archiveFile == $this->_packageFile) { // unpacked
-            $dir = dirname($this->_packageFile);
-            $file = $dir . DIRECTORY_SEPARATOR . $file;
-            $file = str_replace(array('/', '\\'),
-                array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
-            if (file_exists($file) && is_readable($file)) {
-                return implode('', file($file));
-            }
-        } else { // tgz
-            if (!class_exists('Archive_Tar')) {
-                require_once 'Archive/Tar.php';
-            }
-            $tar = &new Archive_Tar($this->_archiveFile);
-            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
-            if ($file != 'package.xml' && $file != 'package2.xml') {
-                $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
-            }
-            $file = $tar->extractInString($file);
-            $tar->popErrorHandling();
-            if (PEAR::isError($file)) {
-                return PEAR::raiseError("Cannot locate file '$file' in archive");
-            }
-            return $file;
-        }
-    }
-
-    // {{{ analyzeSourceCode()
-    /**
-     * Analyze the source code of the given PHP file
-     *
-     * @param  string Filename of the PHP file
-     * @return mixed
-     * @access private
-     */
-    function _analyzeSourceCode($file)
-    {
-        if (!function_exists("token_get_all")) {
-            return false;
-        }
-        if (!defined('T_DOC_COMMENT')) {
-            define('T_DOC_COMMENT', T_COMMENT);
-        }
-        if (!defined('T_INTERFACE')) {
-            define('T_INTERFACE', -1);
-        }
-        if (!defined('T_IMPLEMENTS')) {
-            define('T_IMPLEMENTS', -1);
-        }
-        if (!$fp = @fopen($file, "r")) {
-            return false;
-        }
-        fclose($fp);
-        $contents = file_get_contents($file);
-        $tokens = token_get_all($contents);
-/*
-        for ($i = 0; $i < sizeof($tokens); $i++) {
-            @list($token, $data) = $tokens[$i];
-            if (is_string($token)) {
-                var_dump($token);
-            } else {
-                print token_name($token) . ' ';
-                var_dump(rtrim($data));
-            }
-        }
-*/
-        $look_for = 0;
-        $paren_level = 0;
-        $bracket_level = 0;
-        $brace_level = 0;
-        $lastphpdoc = '';
-        $current_class = '';
-        $current_interface = '';
-        $current_class_level = -1;
-        $current_function = '';
-        $current_function_level = -1;
-        $declared_classes = array();
-        $declared_interfaces = array();
-        $declared_functions = array();
-        $declared_methods = array();
-        $used_classes = array();
-        $used_functions = array();
-        $extends = array();
-        $implements = array();
-        $nodeps = array();
-        $inquote = false;
-        $interface = false;
-        for ($i = 0; $i < sizeof($tokens); $i++) {
-            if (is_array($tokens[$i])) {
-                list($token, $data) = $tokens[$i];
-            } else {
-                $token = $tokens[$i];
-                $data = '';
-            }
-            if ($inquote) {
-                if ($token != '"' && $token != T_END_HEREDOC) {
-                    continue;
-                } else {
-                    $inquote = false;
-                    continue;
-                }
-            }
-            switch ($token) {
-                case T_WHITESPACE :
-                    continue;
-                case ';':
-                    if ($interface) {
-                        $current_function = '';
-                        $current_function_level = -1;
-                    }
-                    break;
-                case '"':
-                case T_START_HEREDOC:
-                    $inquote = true;
-                    break;
-                case T_CURLY_OPEN:
-                case T_DOLLAR_OPEN_CURLY_BRACES:
-                case '{': $brace_level++; continue 2;
-                case '}':
-                    $brace_level--;
-                    if ($current_class_level == $brace_level) {
-                        $current_class = '';
-                        $current_class_level = -1;
-                    }
-                    if ($current_function_level == $brace_level) {
-                        $current_function = '';
-                        $current_function_level = -1;
-                    }
-                    continue 2;
-                case '[': $bracket_level++; continue 2;
-                case ']': $bracket_level--; continue 2;
-                case '(': $paren_level++;   continue 2;
-                case ')': $paren_level--;   continue 2;
-                case T_INTERFACE:
-                    $interface = true;
-                case T_CLASS:
-                    if (($current_class_level != -1) || ($current_function_level != -1)) {
-                        $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE,
-                            array('file' => $file));
-                        return false;
-                    }
-                case T_FUNCTION:
-                case T_NEW:
-                case T_EXTENDS:
-                case T_IMPLEMENTS:
-                    $look_for = $token;
-                    continue 2;
-                case T_STRING:
-                    if (version_compare(zend_version(), '2.0', '<')) {
-                        if (in_array(strtolower($data),
-                            array('public', 'private', 'protected', 'abstract',
-                                  'interface', 'implements', 'throw') 
-                                 )) {
-                            $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_PHP5,
-                                array($file));
-                        }
-                    }
-                    if ($look_for == T_CLASS) {
-                        $current_class = $data;
-                        $current_class_level = $brace_level;
-                        $declared_classes[] = $current_class;
-                    } elseif ($look_for == T_INTERFACE) {
-                        $current_interface = $data;
-                        $current_class_level = $brace_level;
-                        $declared_interfaces[] = $current_interface;
-                    } elseif ($look_for == T_IMPLEMENTS) {
-                        $implements[$current_class] = $data;
-                    } elseif ($look_for == T_EXTENDS) {
-                        $extends[$current_class] = $data;
-                    } elseif ($look_for == T_FUNCTION) {
-                        if ($current_class) {
-                            $current_function = "$current_class::$data";
-                            $declared_methods[$current_class][] = $data;
-                        } elseif ($current_interface) {
-                            $current_function = "$current_interface::$data";
-                            $declared_methods[$current_interface][] = $data;
-                        } else {
-                            $current_function = $data;
-                            $declared_functions[] = $current_function;
-                        }
-                        $current_function_level = $brace_level;
-                        $m = array();
-                    } elseif ($look_for == T_NEW) {
-                        $used_classes[$data] = true;
-                    }
-                    $look_for = 0;
-                    continue 2;
-                case T_VARIABLE:
-                    $look_for = 0;
-                    continue 2;
-                case T_DOC_COMMENT:
-                case T_COMMENT:
-                    if (preg_match('!^/\*\*\s!', $data)) {
-                        $lastphpdoc = $data;
-                        if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
-                            $nodeps = array_merge($nodeps, $m[1]);
-                        }
-                    }
-                    continue 2;
-                case T_DOUBLE_COLON:
-                    if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) {
-                        $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE,
-                            array('file' => $file));
-                        return false;
-                    }
-                    $class = $tokens[$i - 1][1];
-                    if (strtolower($class) != 'parent') {
-                        $used_classes[$class] = true;
-                    }
-                    continue 2;
-            }
-        }
-        return array(
-            "source_file" => $file,
-            "declared_classes" => $declared_classes,
-            "declared_interfaces" => $declared_interfaces,
-            "declared_methods" => $declared_methods,
-            "declared_functions" => $declared_functions,
-            "used_classes" => array_diff(array_keys($used_classes), $nodeps),
-            "inheritance" => $extends,
-            "implements" => $implements,
-            );
-    }
-
-    /**
-     * Build a "provides" array from data returned by
-     * analyzeSourceCode().  The format of the built array is like
-     * this:
-     *
-     *  array(
-     *    'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
-     *    ...
-     *  )
-     *
-     *
-     * @param array $srcinfo array with information about a source file
-     * as returned by the analyzeSourceCode() method.
-     *
-     * @return void
-     *
-     * @access private
-     *
-     */
-    function _buildProvidesArray($srcinfo)
-    {
-        if (!$this->_isValid) {
-            return false;
-        }
-        $file = basename($srcinfo['source_file']);
-        $pn = $this->getPackage();
-        $pnl = strlen($pn);
-        foreach ($srcinfo['declared_classes'] as $class) {
-            $key = "class;$class";
-            if (isset($this->_packageInfo['provides'][$key])) {
-                continue;
-            }
-            $this->_packageInfo['provides'][$key] =
-                array('file'=> $file, 'type' => 'class', 'name' => $class);
-            if (isset($srcinfo['inheritance'][$class])) {
-                $this->_packageInfo['provides'][$key]['extends'] =
-                    $srcinfo['inheritance'][$class];
-            }
-        }
-        foreach ($srcinfo['declared_methods'] as $class => $methods) {
-            foreach ($methods as $method) {
-                $function = "$class::$method";
-                $key = "function;$function";
-                if ($method{0} == '_' || !strcasecmp($method, $class) ||
-                    isset($this->_packageInfo['provides'][$key])) {
-                    continue;
-                }
-                $this->_packageInfo['provides'][$key] =
-                    array('file'=> $file, 'type' => 'function', 'name' => $function);
-            }
-        }
-
-        foreach ($srcinfo['declared_functions'] as $function) {
-            $key = "function;$function";
-            if ($function{0} == '_' || isset($this->_packageInfo['provides'][$key])) {
-                continue;
-            }
-            if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
-                $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
-            }
-            $this->_packageInfo['provides'][$key] =
-                array('file'=> $file, 'type' => 'function', 'name' => $function);
-        }
-    }
-
-    // }}}
-}
-?>
diff --git a/lib/php/PEAR/PackageFile/v2.php b/lib/php/PEAR/PackageFile/v2.php
deleted file mode 100644
index 78932a57b814ba2bb13b8dc2c782ac8fbf1b91c7..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/v2.php
+++ /dev/null
@@ -1,2045 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: v2.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * For error handling
- */
-require_once 'PEAR/ErrorStack.php';
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_v2
-{
-
-    /**
-     * Parsed package information
-     * @var array
-     * @access private
-     */
-    var $_packageInfo = array();
-
-    /**
-     * path to package .tgz or false if this is a local/extracted package.xml
-     * @var string|false
-     * @access private
-     */
-    var $_archiveFile;
-
-    /**
-     * path to package .xml or false if this is an abstract parsed-from-string xml
-     * @var string|false
-     * @access private
-     */
-    var $_packageFile;
-
-    /**
-     * This is used by file analysis routines to log progress information
-     * @var PEAR_Common
-     * @access protected
-     */
-    var $_logger;
-
-    /**
-     * This is set to the highest validation level that has been validated
-     *
-     * If the package.xml is invalid or unknown, this is set to 0.  If
-     * normal validation has occurred, this is set to PEAR_VALIDATE_NORMAL.  If
-     * downloading/installation validation has occurred it is set to PEAR_VALIDATE_DOWNLOADING
-     * or INSTALLING, and so on up to PEAR_VALIDATE_PACKAGING.  This allows validation
-     * "caching" to occur, which is particularly important for package validation, so
-     * that PHP files are not validated twice
-     * @var int
-     * @access private
-     */
-    var $_isValid = 0;
-
-    /**
-     * True if the filelist has been validated
-     * @param bool
-     */
-    var $_filesValid = false;
-
-    /**
-     * @var PEAR_Registry
-     * @access protected
-     */
-    var $_registry;
-
-    /**
-     * @var PEAR_Config
-     * @access protected
-     */
-    var $_config;
-
-    /**
-     * Optional Dependency group requested for installation
-     * @var string
-     * @access private
-     */
-    var $_requestedGroup = false;
-
-    /**
-     * @var PEAR_ErrorStack
-     * @access protected
-     */
-    var $_stack;
-
-    /**
-     * Namespace prefix used for tasks in this package.xml - use tasks: whenever possible
-     */
-    var $_tasksNs;
-
-    /**
-     * Determines whether this packagefile was initialized only with partial package info
-     *
-     * If this package file was constructed via parsing REST, it will only contain
-     *
-     * - package name
-     * - channel name
-     * - dependencies
-     * @var boolean
-     * @access private
-     */
-    var $_incomplete = true;
-
-    /**
-     * @var PEAR_PackageFile_v2_Validator
-     */
-    var $_v2Validator;
-
-    /**
-     * The constructor merely sets up the private error stack
-     */
-    function PEAR_PackageFile_v2()
-    {
-        $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null);
-        $this->_isValid = false;
-    }
-
-    /**
-     * To make unit-testing easier
-     * @param PEAR_Frontend_*
-     * @param array options
-     * @param PEAR_Config
-     * @return PEAR_Downloader
-     * @access protected
-     */
-    function &getPEARDownloader(&$i, $o, &$c)
-    {
-        $z = &new PEAR_Downloader($i, $o, $c);
-        return $z;
-    }
-
-    /**
-     * To make unit-testing easier
-     * @param PEAR_Config
-     * @param array options
-     * @param array package name as returned from {@link PEAR_Registry::parsePackageName()}
-     * @param int PEAR_VALIDATE_* constant
-     * @return PEAR_Dependency2
-     * @access protected
-     */
-    function &getPEARDependency2(&$c, $o, $p, $s = PEAR_VALIDATE_INSTALLING)
-    {
-        if (!class_exists('PEAR_Dependency2')) {
-            require_once 'PEAR/Dependency2.php';
-        }
-        $z = &new PEAR_Dependency2($c, $o, $p, $s);
-        return $z;
-    }
-
-    function getInstalledBinary()
-    {
-        return isset($this->_packageInfo['#binarypackage']) ? $this->_packageInfo['#binarypackage'] :
-            false;
-    }
-
-    /**
-     * Installation of source package has failed, attempt to download and install the
-     * binary version of this package.
-     * @param PEAR_Installer
-     * @return array|false
-     */
-    function installBinary(&$installer)
-    {
-        if (!OS_WINDOWS) {
-            $a = false;
-            return $a;
-        }
-        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
-            $releasetype = $this->getPackageType() . 'release';
-            if (!is_array($installer->getInstallPackages())) {
-                $a = false;
-                return $a;
-            }
-            foreach ($installer->getInstallPackages() as $p) {
-                if ($p->isExtension($this->_packageInfo['providesextension'])) {
-                    if ($p->getPackageType() != 'extsrc' && $p->getPackageType() != 'zendextsrc') {
-                        $a = false;
-                        return $a; // the user probably downloaded it separately
-                    }
-                }
-            }
-            if (isset($this->_packageInfo[$releasetype]['binarypackage'])) {
-                $installer->log(0, 'Attempting to download binary version of extension "' .
-                    $this->_packageInfo['providesextension'] . '"');
-                $params = $this->_packageInfo[$releasetype]['binarypackage'];
-                if (!is_array($params) || !isset($params[0])) {
-                    $params = array($params);
-                }
-                if (isset($this->_packageInfo['channel'])) {
-                    foreach ($params as $i => $param) {
-                        $params[$i] = array('channel' => $this->_packageInfo['channel'],
-                            'package' => $param, 'version' => $this->getVersion());
-                    }
-                }
-                $dl = &$this->getPEARDownloader($installer->ui, $installer->getOptions(),
-                    $installer->config);
-                $verbose = $dl->config->get('verbose');
-                $dl->config->set('verbose', -1);
-                foreach ($params as $param) {
-                    PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                    $ret = $dl->download(array($param));
-                    PEAR::popErrorHandling();
-                    if (is_array($ret) && count($ret)) {
-                        break;
-                    }
-                }
-                $dl->config->set('verbose', $verbose);
-                if (is_array($ret)) {
-                    if (count($ret) == 1) {
-                        $pf = $ret[0]->getPackageFile();
-                        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                        $err = $installer->install($ret[0]);
-                        PEAR::popErrorHandling();
-                        if (is_array($err)) {
-                            $this->_packageInfo['#binarypackage'] = $ret[0]->getPackage();
-                            // "install" self, so all dependencies will work transparently
-                            $this->_registry->addPackage2($this);
-                            $installer->log(0, 'Download and install of binary extension "' .
-                                $this->_registry->parsedPackageNameToString(
-                                    array('channel' => $pf->getChannel(),
-                                          'package' => $pf->getPackage()), true) . '" successful');
-                            $a = array($ret[0], $err);
-                            return $a;
-                        }
-                        $installer->log(0, 'Download and install of binary extension "' .
-                            $this->_registry->parsedPackageNameToString(
-                                    array('channel' => $pf->getChannel(),
-                                          'package' => $pf->getPackage()), true) . '" failed');
-                    }
-                }
-            }
-        }
-        $a = false;
-        return $a;
-    }
-
-    /**
-     * @return string|false Extension name
-     */
-    function getProvidesExtension()
-    {
-        if (in_array($this->getPackageType(),
-              array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
-            if (isset($this->_packageInfo['providesextension'])) {
-                return $this->_packageInfo['providesextension'];
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @param string Extension name
-     * @return bool
-     */
-    function isExtension($extension)
-    {
-        if (in_array($this->getPackageType(),
-              array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
-            return $this->_packageInfo['providesextension'] == $extension;
-        }
-        return false;
-    }
-
-    /**
-     * Tests whether every part of the package.xml 1.0 is represented in
-     * this package.xml 2.0
-     * @param PEAR_PackageFile_v1
-     * @return bool
-     */
-    function isEquivalent($pf1)
-    {
-        if (!$pf1) {
-            return true;
-        }
-        if ($this->getPackageType() == 'bundle') {
-            return false;
-        }
-        $this->_stack->getErrors(true);
-        if (!$pf1->validate(PEAR_VALIDATE_NORMAL)) {
-            return false;
-        }
-        $pass = true;
-        if ($pf1->getPackage() != $this->getPackage()) {
-            $this->_differentPackage($pf1->getPackage());
-            $pass = false;
-        }
-        if ($pf1->getVersion() != $this->getVersion()) {
-            $this->_differentVersion($pf1->getVersion());
-            $pass = false;
-        }
-        if (trim($pf1->getSummary()) != $this->getSummary()) {
-            $this->_differentSummary($pf1->getSummary());
-            $pass = false;
-        }
-        if (preg_replace('/\s+/', '', $pf1->getDescription()) !=
-              preg_replace('/\s+/', '', $this->getDescription())) {
-            $this->_differentDescription($pf1->getDescription());
-            $pass = false;
-        }
-        if ($pf1->getState() != $this->getState()) {
-            $this->_differentState($pf1->getState());
-            $pass = false;
-        }
-        if (!strstr(preg_replace('/\s+/', '', $this->getNotes()),
-              preg_replace('/\s+/', '', $pf1->getNotes()))) {
-            $this->_differentNotes($pf1->getNotes());
-            $pass = false;
-        }
-        $mymaintainers = $this->getMaintainers();
-        $yourmaintainers = $pf1->getMaintainers();
-        for ($i1 = 0; $i1 < count($yourmaintainers); $i1++) {
-            $reset = false;
-            for ($i2 = 0; $i2 < count($mymaintainers); $i2++) {
-                if ($mymaintainers[$i2]['handle'] == $yourmaintainers[$i1]['handle']) {
-                    if ($mymaintainers[$i2]['role'] != $yourmaintainers[$i1]['role']) {
-                        $this->_differentRole($mymaintainers[$i2]['handle'],
-                            $yourmaintainers[$i1]['role'], $mymaintainers[$i2]['role']);
-                        $pass = false;
-                    }
-                    if ($mymaintainers[$i2]['email'] != $yourmaintainers[$i1]['email']) {
-                        $this->_differentEmail($mymaintainers[$i2]['handle'],
-                            $yourmaintainers[$i1]['email'], $mymaintainers[$i2]['email']);
-                        $pass = false;
-                    }
-                    if ($mymaintainers[$i2]['name'] != $yourmaintainers[$i1]['name']) {
-                        $this->_differentName($mymaintainers[$i2]['handle'],
-                            $yourmaintainers[$i1]['name'], $mymaintainers[$i2]['name']);
-                        $pass = false;
-                    }
-                    unset($mymaintainers[$i2]);
-                    $mymaintainers = array_values($mymaintainers);
-                    unset($yourmaintainers[$i1]);
-                    $yourmaintainers = array_values($yourmaintainers);
-                    $reset = true;
-                    break;
-                }
-            }
-            if ($reset) {
-                $i1 = -1;
-            }
-        }
-        $this->_unmatchedMaintainers($mymaintainers, $yourmaintainers);
-        $filelist = $this->getFilelist();
-        foreach ($pf1->getFilelist() as $file => $atts) {
-            if (!isset($filelist[$file])) {
-                $this->_missingFile($file);
-                $pass = false;
-            }
-        }
-        return $pass;
-    }
-
-    function _differentPackage($package)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('package' => $package,
-            'self' => $this->getPackage()),
-            'package.xml 1.0 package "%package%" does not match "%self%"');
-    }
-
-    function _differentVersion($version)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('version' => $version,
-            'self' => $this->getVersion()),
-            'package.xml 1.0 version "%version%" does not match "%self%"');
-    }
-
-    function _differentState($state)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('state' => $state,
-            'self' => $this->getState()),
-            'package.xml 1.0 state "%state%" does not match "%self%"');
-    }
-
-    function _differentRole($handle, $role, $selfrole)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
-            'role' => $role, 'self' => $selfrole),
-            'package.xml 1.0 maintainer "%handle%" role "%role%" does not match "%self%"');
-    }
-
-    function _differentEmail($handle, $email, $selfemail)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
-            'email' => $email, 'self' => $selfemail),
-            'package.xml 1.0 maintainer "%handle%" email "%email%" does not match "%self%"');
-    }
-
-    function _differentName($handle, $name, $selfname)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
-            'name' => $name, 'self' => $selfname),
-            'package.xml 1.0 maintainer "%handle%" name "%name%" does not match "%self%"');
-    }
-
-    function _unmatchedMaintainers($my, $yours)
-    {
-        if ($my) {
-            array_walk($my, create_function('&$i, $k', '$i = $i["handle"];'));
-            $this->_stack->push(__FUNCTION__, 'error', array('handles' => $my),
-                'package.xml 2.0 has unmatched extra maintainers "%handles%"');
-        }
-        if ($yours) {
-            array_walk($yours, create_function('&$i, $k', '$i = $i["handle"];'));
-            $this->_stack->push(__FUNCTION__, 'error', array('handles' => $yours),
-                'package.xml 1.0 has unmatched extra maintainers "%handles%"');
-        }
-    }
-
-    function _differentNotes($notes)
-    {
-        $truncnotes = strlen($notes) < 25 ? $notes : substr($notes, 0, 24) . '...';
-        $truncmynotes = strlen($this->getNotes()) < 25 ? $this->getNotes() :
-            substr($this->getNotes(), 0, 24) . '...';
-        $this->_stack->push(__FUNCTION__, 'error', array('notes' => $truncnotes,
-            'self' => $truncmynotes),
-            'package.xml 1.0 release notes "%notes%" do not match "%self%"');
-    }
-
-    function _differentSummary($summary)
-    {
-        $truncsummary = strlen($summary) < 25 ? $summary : substr($summary, 0, 24) . '...';
-        $truncmysummary = strlen($this->getsummary()) < 25 ? $this->getSummary() :
-            substr($this->getsummary(), 0, 24) . '...';
-        $this->_stack->push(__FUNCTION__, 'error', array('summary' => $truncsummary,
-            'self' => $truncmysummary),
-            'package.xml 1.0 summary "%summary%" does not match "%self%"');
-    }
-
-    function _differentDescription($description)
-    {
-        $truncdescription = trim(strlen($description) < 25 ? $description : substr($description, 0, 24) . '...');
-        $truncmydescription = trim(strlen($this->getDescription()) < 25 ? $this->getDescription() :
-            substr($this->getdescription(), 0, 24) . '...');
-        $this->_stack->push(__FUNCTION__, 'error', array('description' => $truncdescription,
-            'self' => $truncmydescription),
-            'package.xml 1.0 description "%description%" does not match "%self%"');
-    }
-
-    function _missingFile($file)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-            'package.xml 1.0 file "%file%" is not present in <contents>');
-    }
-
-    /**
-     * WARNING - do not use this function unless you know what you're doing
-     */
-    function setRawState($state)
-    {
-        if (!isset($this->_packageInfo['stability'])) {
-            $this->_packageInfo['stability'] = array();
-        }
-        $this->_packageInfo['stability']['release'] = $state;
-    }
-
-    /**
-     * WARNING - do not use this function unless you know what you're doing
-     */
-    function setRawCompatible($compatible)
-    {
-        $this->_packageInfo['compatible'] = $compatible;
-    }
-
-    /**
-     * WARNING - do not use this function unless you know what you're doing
-     */
-    function setRawPackage($package)
-    {
-        $this->_packageInfo['name'] = $package;
-    }
-
-    /**
-     * WARNING - do not use this function unless you know what you're doing
-     */
-    function setRawChannel($channel)
-    {
-        $this->_packageInfo['channel'] = $channel;
-    }
-
-    function setRequestedGroup($group)
-    {
-        $this->_requestedGroup = $group;
-    }
-
-    function getRequestedGroup()
-    {
-        if (isset($this->_requestedGroup)) {
-            return $this->_requestedGroup;
-        }
-        return false;
-    }
-
-    /**
-     * For saving in the registry.
-     *
-     * Set the last version that was installed
-     * @param string
-     */
-    function setLastInstalledVersion($version)
-    {
-        $this->_packageInfo['_lastversion'] = $version;
-    }
-
-    /**
-     * @return string|false
-     */
-    function getLastInstalledVersion()
-    {
-        if (isset($this->_packageInfo['_lastversion'])) {
-            return $this->_packageInfo['_lastversion'];
-        }
-        return false;
-    }
-
-    /**
-     * Determines whether this package.xml has post-install scripts or not
-     * @return array|false
-     */
-    function listPostinstallScripts()
-    {
-        $filelist = $this->getFilelist();
-        $contents = $this->getContents();
-        $contents = $contents['dir']['file'];
-        if (!is_array($contents) || !isset($contents[0])) {
-            $contents = array($contents);
-        }
-        $taskfiles = array();
-        foreach ($contents as $file) {
-            $atts = $file['attribs'];
-            unset($file['attribs']);
-            if (count($file)) {
-                $taskfiles[$atts['name']] = $file;
-            }
-        }
-        $common = new PEAR_Common;
-        $common->debug = $this->_config->get('verbose');
-        $this->_scripts = array();
-        $ret = array();
-        foreach ($taskfiles as $name => $tasks) {
-            if (!isset($filelist[$name])) {
-                // ignored files will not be in the filelist
-                continue;
-            }
-            $atts = $filelist[$name];
-            foreach ($tasks as $tag => $raw) {
-                $task = $this->getTask($tag);
-                $task = &new $task($this->_config, $common, PEAR_TASK_INSTALL);
-                if ($task->isScript()) {
-                    $ret[] = $filelist[$name]['installed_as'];
-                }
-            }
-        }
-        if (count($ret)) {
-            return $ret;
-        }
-        return false;
-    }
-
-    /**
-     * Initialize post-install scripts for running
-     *
-     * This method can be used to detect post-install scripts, as the return value
-     * indicates whether any exist
-     * @return bool
-     */
-    function initPostinstallScripts()
-    {
-        $filelist = $this->getFilelist();
-        $contents = $this->getContents();
-        $contents = $contents['dir']['file'];
-        if (!is_array($contents) || !isset($contents[0])) {
-            $contents = array($contents);
-        }
-        $taskfiles = array();
-        foreach ($contents as $file) {
-            $atts = $file['attribs'];
-            unset($file['attribs']);
-            if (count($file)) {
-                $taskfiles[$atts['name']] = $file;
-            }
-        }
-        $common = new PEAR_Common;
-        $common->debug = $this->_config->get('verbose');
-        $this->_scripts = array();
-        foreach ($taskfiles as $name => $tasks) {
-            if (!isset($filelist[$name])) {
-                // file was not installed due to installconditions
-                continue;
-            }
-            $atts = $filelist[$name];
-            foreach ($tasks as $tag => $raw) {
-                $taskname = $this->getTask($tag);
-                $task = &new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
-                if (!$task->isScript()) {
-                    continue; // scripts are only handled after installation
-                }
-                $lastversion = isset($this->_packageInfo['_lastversion']) ?
-                    $this->_packageInfo['_lastversion'] : null;
-                $task->init($raw, $atts, $lastversion);
-                $res = $task->startSession($this, $atts['installed_as']);
-                if (!$res) {
-                    continue; // skip this file
-                }
-                if (PEAR::isError($res)) {
-                    return $res;
-                }
-                $assign = &$task;
-                $this->_scripts[] = &$assign;
-            }
-        }
-        if (count($this->_scripts)) {
-            return true;
-        }
-        return false;
-    }
-
-    function runPostinstallScripts()
-    {
-        if ($this->initPostinstallScripts()) {
-            $ui = &PEAR_Frontend::singleton();
-            if ($ui) {
-                $ui->runPostinstallScripts($this->_scripts, $this);
-            }
-        }
-    }
-
-
-    /**
-     * Convert a recursive set of <dir> and <file> tags into a single <dir> tag with
-     * <file> tags.
-     */
-    function flattenFilelist()
-    {
-        if (isset($this->_packageInfo['bundle'])) {
-            return;
-        }
-        $filelist = array();
-        if (isset($this->_packageInfo['contents']['dir']['dir'])) {
-            $this->_getFlattenedFilelist($filelist, $this->_packageInfo['contents']['dir']);
-            if (!isset($filelist[1])) {
-                $filelist = $filelist[0];
-            }
-            $this->_packageInfo['contents']['dir']['file'] = $filelist;
-            unset($this->_packageInfo['contents']['dir']['dir']);
-        } else {
-            // else already flattened but check for baseinstalldir propagation
-            if (isset($this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'])) {
-                if (isset($this->_packageInfo['contents']['dir']['file'][0])) {
-                    foreach ($this->_packageInfo['contents']['dir']['file'] as $i => $file) {
-                        if (isset($file['attribs']['baseinstalldir'])) {
-                            continue;
-                        }
-                        $this->_packageInfo['contents']['dir']['file'][$i]['attribs']['baseinstalldir']
-                            = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
-                    }
-                } else {
-                    if (!isset($this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir'])) {
-                       $this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir']
-                            = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @param array the final flattened file list
-     * @param array the current directory being processed
-     * @param string|false any recursively inherited baeinstalldir attribute
-     * @param string private recursion variable
-     * @return array
-     * @access protected
-     */
-    function _getFlattenedFilelist(&$files, $dir, $baseinstall = false, $path = '')
-    {
-        if (isset($dir['attribs']) && isset($dir['attribs']['baseinstalldir'])) {
-            $baseinstall = $dir['attribs']['baseinstalldir'];
-        }
-        if (isset($dir['dir'])) {
-            if (!isset($dir['dir'][0])) {
-                $dir['dir'] = array($dir['dir']);
-            }
-            foreach ($dir['dir'] as $subdir) {
-                if (!isset($subdir['attribs']) || !isset($subdir['attribs']['name'])) {
-                    $name = '*unknown*';
-                } else {
-                    $name = $subdir['attribs']['name'];
-                }
-                $newpath = empty($path) ? $name :
-                    $path . '/' . $name;
-                $this->_getFlattenedFilelist($files, $subdir,
-                    $baseinstall, $newpath);
-            }
-        }
-        if (isset($dir['file'])) {
-            if (!isset($dir['file'][0])) {
-                $dir['file'] = array($dir['file']);
-            }
-            foreach ($dir['file'] as $file) {
-                $attrs = $file['attribs'];
-                $name = $attrs['name'];
-                if ($baseinstall && !isset($attrs['baseinstalldir'])) {
-                    $attrs['baseinstalldir'] = $baseinstall;
-                }
-                $attrs['name'] = empty($path) ? $name : $path . '/' . $name;
-                $attrs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
-                    $attrs['name']);
-                $file['attribs'] = $attrs;
-                $files[] = $file;
-            }
-        }
-    }
-
-    function setConfig(&$config)
-    {
-        $this->_config = &$config;
-        $this->_registry = &$config->getRegistry();
-    }
-
-    function setLogger(&$logger)
-    {
-        if (!is_object($logger) || !method_exists($logger, 'log')) {
-            return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
-        }
-        $this->_logger = &$logger;
-    }
-
-    /**
-     * WARNING - do not use this function directly unless you know what you're doing
-     */
-    function setDeps($deps)
-    {
-        $this->_packageInfo['dependencies'] = $deps;
-    }
-
-    /**
-     * WARNING - do not use this function directly unless you know what you're doing
-     */
-    function setCompatible($compat)
-    {
-        $this->_packageInfo['compatible'] = $compat;
-    }
-
-    function setPackagefile($file, $archive = false)
-    {
-        $this->_packageFile = $file;
-        $this->_archiveFile = $archive ? $archive : $file;
-    }
-
-    /**
-     * Wrapper to {@link PEAR_ErrorStack::getErrors()}
-     * @param boolean determines whether to purge the error stack after retrieving
-     * @return array
-     */
-    function getValidationWarnings($purge = true)
-    {
-        return $this->_stack->getErrors($purge);
-    }
-
-    function getPackageFile()
-    {
-        return $this->_packageFile;
-    }
-
-    function getArchiveFile()
-    {
-        return $this->_archiveFile;
-    }
-
-
-    /**
-     * Directly set the array that defines this packagefile
-     *
-     * WARNING: no validation.  This should only be performed by internal methods
-     * inside PEAR or by inputting an array saved from an existing PEAR_PackageFile_v2
-     * @param array
-     */
-    function fromArray($pinfo)
-    {
-        unset($pinfo['old']);
-        unset($pinfo['xsdversion']);
-        $this->_incomplete = false;
-        $this->_packageInfo = $pinfo;
-    }
-
-    function isIncomplete()
-    {
-        return $this->_incomplete;
-    }
-
-    /**
-     * @return array
-     */
-    function toArray($forreg = false)
-    {
-        if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
-            return false;
-        }
-        return $this->getArray($forreg);
-    }
-
-    function getArray($forReg = false)
-    {
-        if ($forReg) {
-            $arr = $this->_packageInfo;
-            $arr['old'] = array();
-            $arr['old']['version'] = $this->getVersion();
-            $arr['old']['release_date'] = $this->getDate();
-            $arr['old']['release_state'] = $this->getState();
-            $arr['old']['release_license'] = $this->getLicense();
-            $arr['old']['release_notes'] = $this->getNotes();
-            $arr['old']['release_deps'] = $this->getDeps();
-            $arr['old']['maintainers'] = $this->getMaintainers();
-            $arr['xsdversion'] = '2.0';
-            return $arr;
-        } else {
-            $info = $this->_packageInfo;
-            unset($info['dirtree']);
-            if (isset($info['_lastversion'])) {
-                unset($info['_lastversion']);
-            }
-            if (isset($info['#binarypackage'])) {
-                unset($info['#binarypackage']);
-            }
-            return $info;
-        }
-    }
-
-    function packageInfo($field)
-    {
-        $arr = $this->getArray(true);
-        if ($field == 'state') {
-            return $arr['stability']['release'];
-        }
-        if ($field == 'api-version') {
-            return $arr['version']['api'];
-        }
-        if ($field == 'api-state') {
-            return $arr['stability']['api'];
-        }
-        if (isset($arr['old'][$field])) {
-            if (!is_string($arr['old'][$field])) {
-                return null;
-            }
-            return $arr['old'][$field];
-        }
-        if (isset($arr[$field])) {
-            if (!is_string($arr[$field])) {
-                return null;
-            }
-            return $arr[$field];
-        }
-        return null;
-    }
-
-    function getName()
-    {
-        return $this->getPackage();
-    }
-
-    function getPackage()
-    {
-        if (isset($this->_packageInfo['name'])) {
-            return $this->_packageInfo['name'];
-        }
-        return false;
-    }
-
-    function getChannel()
-    {
-        if (isset($this->_packageInfo['uri'])) {
-            return '__uri';
-        }
-        if (isset($this->_packageInfo['channel'])) {
-            return strtolower($this->_packageInfo['channel']);
-        }
-        return false;
-    }
-
-    function getUri()
-    {
-        if (isset($this->_packageInfo['uri'])) {
-            return $this->_packageInfo['uri'];
-        }
-        return false;
-    }
-
-    function getExtends()
-    {
-        if (isset($this->_packageInfo['extends'])) {
-            return $this->_packageInfo['extends'];
-        }
-        return false;
-    }
-
-    function getSummary()
-    {
-        if (isset($this->_packageInfo['summary'])) {
-            return $this->_packageInfo['summary'];
-        }
-        return false;
-    }
-
-    function getDescription()
-    {
-        if (isset($this->_packageInfo['description'])) {
-            return $this->_packageInfo['description'];
-        }
-        return false;
-    }
-
-    function getMaintainers($raw = false)
-    {
-        if (!isset($this->_packageInfo['lead'])) {
-            return false;
-        }
-        if ($raw) {
-            $ret = array('lead' => $this->_packageInfo['lead']);
-            (isset($this->_packageInfo['developer'])) ?
-                $ret['developer'] = $this->_packageInfo['developer'] :null;
-            (isset($this->_packageInfo['contributor'])) ?
-                $ret['contributor'] = $this->_packageInfo['contributor'] :null;
-            (isset($this->_packageInfo['helper'])) ?
-                $ret['helper'] = $this->_packageInfo['helper'] :null;
-            return $ret;
-        } else {
-            $ret = array();
-            $leads = isset($this->_packageInfo['lead'][0]) ? $this->_packageInfo['lead'] :
-                array($this->_packageInfo['lead']);
-            foreach ($leads as $lead) {
-                $s = $lead;
-                $s['handle'] = $s['user'];
-                unset($s['user']);
-                $s['role'] = 'lead';
-                $ret[] = $s;
-            }
-            if (isset($this->_packageInfo['developer'])) {
-                $leads = isset($this->_packageInfo['developer'][0]) ?
-                    $this->_packageInfo['developer'] :
-                    array($this->_packageInfo['developer']);
-                foreach ($leads as $maintainer) {
-                    $s = $maintainer;
-                    $s['handle'] = $s['user'];
-                    unset($s['user']);
-                    $s['role'] = 'developer';
-                    $ret[] = $s;
-                }
-            }
-            if (isset($this->_packageInfo['contributor'])) {
-                $leads = isset($this->_packageInfo['contributor'][0]) ?
-                    $this->_packageInfo['contributor'] :
-                    array($this->_packageInfo['contributor']);
-                foreach ($leads as $maintainer) {
-                    $s = $maintainer;
-                    $s['handle'] = $s['user'];
-                    unset($s['user']);
-                    $s['role'] = 'contributor';
-                    $ret[] = $s;
-                }
-            }
-            if (isset($this->_packageInfo['helper'])) {
-                $leads = isset($this->_packageInfo['helper'][0]) ?
-                    $this->_packageInfo['helper'] :
-                    array($this->_packageInfo['helper']);
-                foreach ($leads as $maintainer) {
-                    $s = $maintainer;
-                    $s['handle'] = $s['user'];
-                    unset($s['user']);
-                    $s['role'] = 'helper';
-                    $ret[] = $s;
-                }
-            }
-            return $ret;
-        }
-        return false;
-    }
-
-    function getLeads()
-    {
-        if (isset($this->_packageInfo['lead'])) {
-            return $this->_packageInfo['lead'];
-        }
-        return false;
-    }
-
-    function getDevelopers()
-    {
-        if (isset($this->_packageInfo['developer'])) {
-            return $this->_packageInfo['developer'];
-        }
-        return false;
-    }
-
-    function getContributors()
-    {
-        if (isset($this->_packageInfo['contributor'])) {
-            return $this->_packageInfo['contributor'];
-        }
-        return false;
-    }
-
-    function getHelpers()
-    {
-        if (isset($this->_packageInfo['helper'])) {
-            return $this->_packageInfo['helper'];
-        }
-        return false;
-    }
-
-    function setDate($date)
-    {
-        if (!isset($this->_packageInfo['date'])) {
-            // ensure that the extends tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('time', 'version',
-                    'stability', 'license', 'notes', 'contents', 'compatible',
-                    'dependencies', 'providesextension', 'srcpackage', 'srcuri',
-                    'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
-                    'zendextbinrelease', 'bundle', 'changelog'), array(), 'date');
-        }
-        $this->_packageInfo['date'] = $date;
-        $this->_isValid = 0;
-    }
-
-    function setTime($time)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['time'])) {
-            // ensure that the time tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                    array('version',
-                    'stability', 'license', 'notes', 'contents', 'compatible',
-                    'dependencies', 'providesextension', 'srcpackage', 'srcuri',
-                    'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
-                    'zendextbinrelease', 'bundle', 'changelog'), $time, 'time');
-        }
-        $this->_packageInfo['time'] = $time;
-    }
-
-    function getDate()
-    {
-        if (isset($this->_packageInfo['date'])) {
-            return $this->_packageInfo['date'];
-        }
-        return false;
-    }
-
-    function getTime()
-    {
-        if (isset($this->_packageInfo['time'])) {
-            return $this->_packageInfo['time'];
-        }
-        return false;
-    }
-
-    /**
-     * @param package|api version category to return
-     */
-    function getVersion($key = 'release')
-    {
-        if (isset($this->_packageInfo['version'][$key])) {
-            return $this->_packageInfo['version'][$key];
-        }
-        return false;
-    }
-
-    function getStability()
-    {
-        if (isset($this->_packageInfo['stability'])) {
-            return $this->_packageInfo['stability'];
-        }
-        return false;
-    }
-
-    function getState($key = 'release')
-    {
-        if (isset($this->_packageInfo['stability'][$key])) {
-            return $this->_packageInfo['stability'][$key];
-        }
-        return false;
-    }
-
-    function getLicense($raw = false)
-    {
-        if (isset($this->_packageInfo['license'])) {
-            if ($raw) {
-                return $this->_packageInfo['license'];
-            }
-            if (is_array($this->_packageInfo['license'])) {
-                return $this->_packageInfo['license']['_content'];
-            } else {
-                return $this->_packageInfo['license'];
-            }
-        }
-        return false;
-    }
-
-    function getLicenseLocation()
-    {
-        if (!isset($this->_packageInfo['license']) || !is_array($this->_packageInfo['license'])) {
-            return false;
-        }
-        return $this->_packageInfo['license']['attribs'];
-    }
-
-    function getNotes()
-    {
-        if (isset($this->_packageInfo['notes'])) {
-            return $this->_packageInfo['notes'];
-        }
-        return false;
-    }
-
-    /**
-     * Return the <usesrole> tag contents, if any
-     * @return array|false
-     */
-    function getUsesrole()
-    {
-        if (isset($this->_packageInfo['usesrole'])) {
-            return $this->_packageInfo['usesrole'];
-        }
-        return false;
-    }
-
-    /**
-     * Return the <usestask> tag contents, if any
-     * @return array|false
-     */
-    function getUsestask()
-    {
-        if (isset($this->_packageInfo['usestask'])) {
-            return $this->_packageInfo['usestask'];
-        }
-        return false;
-    }
-
-    /**
-     * This should only be used to retrieve filenames and install attributes
-     */
-    function getFilelist($preserve = false)
-    {
-        if (isset($this->_packageInfo['filelist']) && !$preserve) {
-            return $this->_packageInfo['filelist'];
-        }
-        $this->flattenFilelist();
-        if ($contents = $this->getContents()) {
-            $ret = array();
-            if (!isset($contents['dir'])) {
-                return false;
-            }
-            if (!isset($contents['dir']['file'][0])) {
-                $contents['dir']['file'] = array($contents['dir']['file']);
-            }
-            foreach ($contents['dir']['file'] as $file) {
-                $name = $file['attribs']['name'];
-                if (!$preserve) {
-                    $file = $file['attribs'];
-                }
-                $ret[$name] = $file;
-            }
-            if (!$preserve) {
-                $this->_packageInfo['filelist'] = $ret;
-            }
-            return $ret;
-        }
-        return false;
-    }
-
-    /**
-     * Return configure options array, if any
-     *
-     * @return array|false
-     */
-    function getConfigureOptions()
-    {
-        if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
-            return false;
-        }
-
-        $releases = $this->getReleases();
-        if (isset($releases[0])) {
-            $releases = $releases[0];
-        }
-
-        if (isset($releases['configureoption'])) {
-            if (!isset($releases['configureoption'][0])) {
-                $releases['configureoption'] = array($releases['configureoption']);
-            }
-
-            for ($i = 0; $i < count($releases['configureoption']); $i++) {
-                $releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs'];
-            }
-
-            return $releases['configureoption'];
-        }
-
-        return false;
-    }
-
-    /**
-     * This is only used at install-time, after all serialization
-     * is over.
-     */
-    function resetFilelist()
-    {
-        $this->_packageInfo['filelist'] = array();
-    }
-
-    /**
-     * Retrieve a list of files that should be installed on this computer
-     * @return array
-     */
-    function getInstallationFilelist($forfilecheck = false)
-    {
-        $contents = $this->getFilelist(true);
-        if (isset($contents['dir']['attribs']['baseinstalldir'])) {
-            $base = $contents['dir']['attribs']['baseinstalldir'];
-        }
-        if (isset($this->_packageInfo['bundle'])) {
-            return PEAR::raiseError(
-                'Exception: bundles should be handled in download code only');
-        }
-        $release = $this->getReleases();
-        if ($release) {
-            if (!isset($release[0])) {
-                if (!isset($release['installconditions']) && !isset($release['filelist'])) {
-                    if ($forfilecheck) {
-                        return $this->getFilelist();
-                    }
-                    return $contents;
-                }
-                $release = array($release);
-            }
-            $depchecker = &$this->getPEARDependency2($this->_config, array(),
-                array('channel' => $this->getChannel(), 'package' => $this->getPackage()),
-                PEAR_VALIDATE_INSTALLING);
-            foreach ($release as $instance) {
-                if (isset($instance['installconditions'])) {
-                    $installconditions = $instance['installconditions'];
-                    if (is_array($installconditions)) {
-                        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                        foreach ($installconditions as $type => $conditions) {
-                            if (!isset($conditions[0])) {
-                                $conditions = array($conditions);
-                            }
-                            foreach ($conditions as $condition) {
-                                $ret = $depchecker->{"validate{$type}Dependency"}($condition);
-                                if (PEAR::isError($ret)) {
-                                    PEAR::popErrorHandling();
-                                    continue 3; // skip this release
-                                }
-                            }
-                        }
-                        PEAR::popErrorHandling();
-                    }
-                }
-                // this is the release to use
-                if (isset($instance['filelist'])) {
-                    // ignore files
-                    if (isset($instance['filelist']['ignore'])) {
-                        $ignore = isset($instance['filelist']['ignore'][0]) ?
-                            $instance['filelist']['ignore'] :
-                            array($instance['filelist']['ignore']);
-                        foreach ($ignore as $ig) {
-                            unset ($contents[$ig['attribs']['name']]);
-                        }
-                    }
-                    // install files as this name
-                    if (isset($instance['filelist']['install'])) {
-                        $installas = isset($instance['filelist']['install'][0]) ?
-                            $instance['filelist']['install'] :
-                            array($instance['filelist']['install']);
-                        foreach ($installas as $as) {
-                            $contents[$as['attribs']['name']]['attribs']['install-as'] =
-                                $as['attribs']['as'];
-                        }
-                    }
-                }
-                if ($forfilecheck) {
-                    foreach ($contents as $file => $attrs) {
-                        $contents[$file] = $attrs['attribs'];
-                    }
-                }
-                return $contents;
-            }
-        } else { // simple release - no installconditions or install-as
-            if ($forfilecheck) {
-                return $this->getFilelist();
-            }
-            return $contents;
-        }
-        // no releases matched
-        return PEAR::raiseError('No releases in package.xml matched the existing operating ' .
-            'system, extensions installed, or architecture, cannot install');
-    }
-
-    /**
-     * This is only used at install-time, after all serialization
-     * is over.
-     * @param string file name
-     * @param string installed path
-     */
-    function setInstalledAs($file, $path)
-    {
-        if ($path) {
-            return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
-        }
-        unset($this->_packageInfo['filelist'][$file]['installed_as']);
-    }
-
-    function getInstalledLocation($file)
-    {
-        if (isset($this->_packageInfo['filelist'][$file]['installed_as'])) {
-            return $this->_packageInfo['filelist'][$file]['installed_as'];
-        }
-        return false;
-    }
-
-    /**
-     * This is only used at install-time, after all serialization
-     * is over.
-     */
-    function installedFile($file, $atts)
-    {
-        if (isset($this->_packageInfo['filelist'][$file])) {
-            $this->_packageInfo['filelist'][$file] =
-                array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
-        } else {
-            $this->_packageInfo['filelist'][$file] = $atts['attribs'];
-        }
-    }
-
-    /**
-     * Retrieve the contents tag
-     */
-    function getContents()
-    {
-        if (isset($this->_packageInfo['contents'])) {
-            return $this->_packageInfo['contents'];
-        }
-        return false;
-    }
-
-    /**
-     * @param string full path to file
-     * @param string attribute name
-     * @param string attribute value
-     * @param int risky but fast - use this to choose a file based on its position in the list
-     *            of files.  Index is zero-based like PHP arrays.
-     * @return bool success of operation
-     */
-    function setFileAttribute($filename, $attr, $value, $index = false)
-    {
-        $this->_isValid = 0;
-        if (in_array($attr, array('role', 'name', 'baseinstalldir'))) {
-            $this->_filesValid = false;
-        }
-        if ($index !== false &&
-              isset($this->_packageInfo['contents']['dir']['file'][$index]['attribs'])) {
-            $this->_packageInfo['contents']['dir']['file'][$index]['attribs'][$attr] = $value;
-            return true;
-        }
-        if (!isset($this->_packageInfo['contents']['dir']['file'])) {
-            return false;
-        }
-        $files = $this->_packageInfo['contents']['dir']['file'];
-        if (!isset($files[0])) {
-            $files = array($files);
-            $ind = false;
-        } else {
-            $ind = true;
-        }
-        foreach ($files as $i => $file) {
-            if (isset($file['attribs'])) {
-                if ($file['attribs']['name'] == $filename) {
-                    if ($ind) {
-                        $this->_packageInfo['contents']['dir']['file'][$i]['attribs'][$attr] = $value;
-                    } else {
-                        $this->_packageInfo['contents']['dir']['file']['attribs'][$attr] = $value;
-                    }
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    function setDirtree($path)
-    {
-        if (!isset($this->_packageInfo['dirtree'])) {
-            $this->_packageInfo['dirtree'] = array();
-        }
-        $this->_packageInfo['dirtree'][$path] = true;
-    }
-
-    function getDirtree()
-    {
-        if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
-            return $this->_packageInfo['dirtree'];
-        }
-        return false;
-    }
-
-    function resetDirtree()
-    {
-        unset($this->_packageInfo['dirtree']);
-    }
-
-    /**
-     * Determines whether this package claims it is compatible with the version of
-     * the package that has a recommended version dependency
-     * @param PEAR_PackageFile_v2|PEAR_PackageFile_v1|PEAR_Downloader_Package
-     * @return boolean
-     */
-    function isCompatible($pf)
-    {
-        if (!isset($this->_packageInfo['compatible'])) {
-            return false;
-        }
-        if (!isset($this->_packageInfo['channel'])) {
-            return false;
-        }
-        $me = $pf->getVersion();
-        $compatible = $this->_packageInfo['compatible'];
-        if (!isset($compatible[0])) {
-            $compatible = array($compatible);
-        }
-        $found = false;
-        foreach ($compatible as $info) {
-            if (strtolower($info['name']) == strtolower($pf->getPackage())) {
-                if (strtolower($info['channel']) == strtolower($pf->getChannel())) {
-                    $found = true;
-                    break;
-                }
-            }
-        }
-        if (!$found) {
-            return false;
-        }
-        if (isset($info['exclude'])) {
-            if (!isset($info['exclude'][0])) {
-                $info['exclude'] = array($info['exclude']);
-            }
-            foreach ($info['exclude'] as $exclude) {
-                if (version_compare($me, $exclude, '==')) {
-                    return false;
-                }
-            }
-        }
-        if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * @return array|false
-     */
-    function getCompatible()
-    {
-        if (isset($this->_packageInfo['compatible'])) {
-            return $this->_packageInfo['compatible'];
-        }
-        return false;
-    }
-
-    function getDependencies()
-    {
-        if (isset($this->_packageInfo['dependencies'])) {
-            return $this->_packageInfo['dependencies'];
-        }
-        return false;
-    }
-
-    function isSubpackageOf($p)
-    {
-        return $p->isSubpackage($this);
-    }
-
-    /**
-     * Determines whether the passed in package is a subpackage of this package.
-     *
-     * No version checking is done, only name verification.
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @return bool
-     */
-    function isSubpackage($p)
-    {
-        $sub = array();
-        if (isset($this->_packageInfo['dependencies']['required']['subpackage'])) {
-            $sub = $this->_packageInfo['dependencies']['required']['subpackage'];
-            if (!isset($sub[0])) {
-                $sub = array($sub);
-            }
-        }
-        if (isset($this->_packageInfo['dependencies']['optional']['subpackage'])) {
-            $sub1 = $this->_packageInfo['dependencies']['optional']['subpackage'];
-            if (!isset($sub1[0])) {
-                $sub1 = array($sub1);
-            }
-            $sub = array_merge($sub, $sub1);
-        }
-        if (isset($this->_packageInfo['dependencies']['group'])) {
-            $group = $this->_packageInfo['dependencies']['group'];
-            if (!isset($group[0])) {
-                $group = array($group);
-            }
-            foreach ($group as $deps) {
-                if (isset($deps['subpackage'])) {
-                    $sub2 = $deps['subpackage'];
-                    if (!isset($sub2[0])) {
-                        $sub2 = array($sub2);
-                    }
-                    $sub = array_merge($sub, $sub2);
-                }
-            }
-        }
-        foreach ($sub as $dep) {
-            if (strtolower($dep['name']) == strtolower($p->getPackage())) {
-                if (isset($dep['channel'])) {
-                    if (strtolower($dep['channel']) == strtolower($p->getChannel())) {
-                        return true;
-                    }
-                } else {
-                    if ($dep['uri'] == $p->getURI()) {
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    function dependsOn($package, $channel)
-    {
-        if (!($deps = $this->getDependencies())) {
-            return false;
-        }
-        foreach (array('package', 'subpackage') as $type) {
-            foreach (array('required', 'optional') as $needed) {
-                if (isset($deps[$needed][$type])) {
-                    if (!isset($deps[$needed][$type][0])) {
-                        $deps[$needed][$type] = array($deps[$needed][$type]);
-                    }
-                    foreach ($deps[$needed][$type] as $dep) {
-                        $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
-                        if (strtolower($dep['name']) == strtolower($package) &&
-                              $depchannel == $channel) {
-                            return true;
-                        }
-                    }
-                }
-            }
-            if (isset($deps['group'])) {
-                if (!isset($deps['group'][0])) {
-                    $dep['group'] = array($deps['group']);
-                }
-                foreach ($deps['group'] as $group) {
-                    if (isset($group[$type])) {
-                        if (!is_array($group[$type])) {
-                            $group[$type] = array($group[$type]);
-                        }
-                        foreach ($group[$type] as $dep) {
-                            $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
-                            if (strtolower($dep['name']) == strtolower($package) &&
-                                  $depchannel == $channel) {
-                                return true;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Get the contents of a dependency group
-     * @param string
-     * @return array|false
-     */
-    function getDependencyGroup($name)
-    {
-        $name = strtolower($name);
-        if (!isset($this->_packageInfo['dependencies']['group'])) {
-            return false;
-        }
-        $groups = $this->_packageInfo['dependencies']['group'];
-        if (!isset($groups[0])) {
-            $groups = array($groups);
-        }
-        foreach ($groups as $group) {
-            if (strtolower($group['attribs']['name']) == $name) {
-                return $group;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Retrieve a partial package.xml 1.0 representation of dependencies
-     *
-     * a very limited representation of dependencies is returned by this method.
-     * The <exclude> tag for excluding certain versions of a dependency is
-     * completely ignored.  In addition, dependency groups are ignored, with the
-     * assumption that all dependencies in dependency groups are also listed in
-     * the optional group that work with all dependency groups
-     * @param boolean return package.xml 2.0 <dependencies> tag
-     * @return array|false
-     */
-    function getDeps($raw = false, $nopearinstaller = false)
-    {
-        if (isset($this->_packageInfo['dependencies'])) {
-            if ($raw) {
-                return $this->_packageInfo['dependencies'];
-            }
-            $ret = array();
-            $map = array(
-                'php' => 'php',
-                'package' => 'pkg',
-                'subpackage' => 'pkg',
-                'extension' => 'ext',
-                'os' => 'os',
-                'pearinstaller' => 'pkg',
-                );
-            foreach (array('required', 'optional') as $type) {
-                $optional = ($type == 'optional') ? 'yes' : 'no';
-                if (!isset($this->_packageInfo['dependencies'][$type])
-                    || empty($this->_packageInfo['dependencies'][$type])) {
-                    continue;
-                }
-                foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) {
-                    if ($dtype == 'pearinstaller' && $nopearinstaller) {
-                        continue;
-                    }
-                    if (!isset($deps[0])) {
-                        $deps = array($deps);
-                    }
-                    foreach ($deps as $dep) {
-                        if (!isset($map[$dtype])) {
-                            // no support for arch type
-                            continue;
-                        }
-                        if ($dtype == 'pearinstaller') {
-                            $dep['name'] = 'PEAR';
-                            $dep['channel'] = 'pear.php.net';
-                        }
-                        $s = array('type' => $map[$dtype]);
-                        if (isset($dep['channel'])) {
-                            $s['channel'] = $dep['channel'];
-                        }
-                        if (isset($dep['uri'])) {
-                            $s['uri'] = $dep['uri'];
-                        }
-                        if (isset($dep['name'])) {
-                            $s['name'] = $dep['name'];
-                        }
-                        if (isset($dep['conflicts'])) {
-                            $s['rel'] = 'not';
-                        } else {
-                            if (!isset($dep['min']) &&
-                                  !isset($dep['max'])) {
-                                $s['rel'] = 'has';
-                                $s['optional'] = $optional;
-                            } elseif (isset($dep['min']) &&
-                                  isset($dep['max'])) {
-                                $s['rel'] = 'ge';
-                                $s1 = $s;
-                                $s1['rel'] = 'le';
-                                $s['version'] = $dep['min'];
-                                $s1['version'] = $dep['max'];
-                                if (isset($dep['channel'])) {
-                                    $s1['channel'] = $dep['channel'];
-                                }
-                                if ($dtype != 'php') {
-                                    $s['name'] = $dep['name'];
-                                    $s1['name'] = $dep['name'];
-                                }
-                                $s['optional'] = $optional;
-                                $s1['optional'] = $optional;
-                                $ret[] = $s1;
-                            } elseif (isset($dep['min'])) {
-                                if (isset($dep['exclude']) &&
-                                      $dep['exclude'] == $dep['min']) {
-                                    $s['rel'] = 'gt';
-                                } else {
-                                    $s['rel'] = 'ge';
-                                }
-                                $s['version'] = $dep['min'];
-                                $s['optional'] = $optional;
-                                if ($dtype != 'php') {
-                                    $s['name'] = $dep['name'];
-                                }
-                            } elseif (isset($dep['max'])) {
-                                if (isset($dep['exclude']) &&
-                                      $dep['exclude'] == $dep['max']) {
-                                    $s['rel'] = 'lt';
-                                } else {
-                                    $s['rel'] = 'le';
-                                }
-                                $s['version'] = $dep['max'];
-                                $s['optional'] = $optional;
-                                if ($dtype != 'php') {
-                                    $s['name'] = $dep['name'];
-                                }
-                            }
-                        }
-                        $ret[] = $s;
-                    }
-                }
-            }
-            if (count($ret)) {
-                return $ret;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @return php|extsrc|extbin|zendextsrc|zendextbin|bundle|false
-     */
-    function getPackageType()
-    {
-        if (isset($this->_packageInfo['phprelease'])) {
-            return 'php';
-        }
-        if (isset($this->_packageInfo['extsrcrelease'])) {
-            return 'extsrc';
-        }
-        if (isset($this->_packageInfo['extbinrelease'])) {
-            return 'extbin';
-        }
-        if (isset($this->_packageInfo['zendextsrcrelease'])) {
-            return 'zendextsrc';
-        }
-        if (isset($this->_packageInfo['zendextbinrelease'])) {
-            return 'zendextbin';
-        }
-        if (isset($this->_packageInfo['bundle'])) {
-            return 'bundle';
-        }
-        return false;
-    }
-
-    /**
-     * @return array|false
-     */
-    function getReleases()
-    {
-        $type = $this->getPackageType();
-        if ($type != 'bundle') {
-            $type .= 'release';
-        }
-        if ($this->getPackageType() && isset($this->_packageInfo[$type])) {
-            return $this->_packageInfo[$type];
-        }
-        return false;
-    }
-
-    /**
-     * @return array
-     */
-    function getChangelog()
-    {
-        if (isset($this->_packageInfo['changelog'])) {
-            return $this->_packageInfo['changelog'];
-        }
-        return false;
-    }
-
-    function hasDeps()
-    {
-        return isset($this->_packageInfo['dependencies']);
-    }
-
-    function getPackagexmlVersion()
-    {
-        if (isset($this->_packageInfo['zendextsrcrelease'])) {
-            return '2.1';
-        }
-        if (isset($this->_packageInfo['zendextbinrelease'])) {
-            return '2.1';
-        }
-        return '2.0';
-    }
-
-    /**
-     * @return array|false
-     */
-    function getSourcePackage()
-    {
-        if (isset($this->_packageInfo['extbinrelease']) ||
-              isset($this->_packageInfo['zendextbinrelease'])) {
-            return array('channel' => $this->_packageInfo['srcchannel'],
-                         'package' => $this->_packageInfo['srcpackage']);
-        }
-        return false;
-    }
-
-    function getBundledPackages()
-    {
-        if (isset($this->_packageInfo['bundle'])) {
-            return $this->_packageInfo['contents']['bundledpackage'];
-        }
-        return false;
-    }
-
-    function getLastModified()
-    {
-        if (isset($this->_packageInfo['_lastmodified'])) {
-            return $this->_packageInfo['_lastmodified'];
-        }
-        return false;
-    }
-
-    /**
-     * Get the contents of a file listed within the package.xml
-     * @param string
-     * @return string
-     */
-    function getFileContents($file)
-    {
-        if ($this->_archiveFile == $this->_packageFile) { // unpacked
-            $dir = dirname($this->_packageFile);
-            $file = $dir . DIRECTORY_SEPARATOR . $file;
-            $file = str_replace(array('/', '\\'),
-                array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
-            if (file_exists($file) && is_readable($file)) {
-                return implode('', file($file));
-            }
-        } else { // tgz
-            $tar = &new Archive_Tar($this->_archiveFile);
-            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
-            if ($file != 'package.xml' && $file != 'package2.xml') {
-                $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
-            }
-            $file = $tar->extractInString($file);
-            $tar->popErrorHandling();
-            if (PEAR::isError($file)) {
-                return PEAR::raiseError("Cannot locate file '$file' in archive");
-            }
-            return $file;
-        }
-    }
-
-    function &getRW()
-    {
-        if (!class_exists('PEAR_PackageFile_v2_rw')) {
-            require_once 'PEAR/PackageFile/v2/rw.php';
-        }
-        $a = new PEAR_PackageFile_v2_rw;
-        foreach (get_object_vars($this) as $name => $unused) {
-            if (!isset($this->$name)) {
-                continue;
-            }
-            if ($name == '_config' || $name == '_logger'|| $name == '_registry' ||
-                  $name == '_stack') {
-                $a->$name = &$this->$name;
-            } else {
-                $a->$name = $this->$name;
-            }
-        }
-        return $a;
-    }
-
-    function &getDefaultGenerator()
-    {
-        if (!class_exists('PEAR_PackageFile_Generator_v2')) {
-            require_once 'PEAR/PackageFile/Generator/v2.php';
-        }
-        $a = &new PEAR_PackageFile_Generator_v2($this);
-        return $a;
-    }
-
-    function analyzeSourceCode($file, $string = false)
-    {
-        if (!isset($this->_v2Validator) ||
-              !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
-            if (!class_exists('PEAR_PackageFile_v2_Validator')) {
-                require_once 'PEAR/PackageFile/v2/Validator.php';
-            }
-            $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
-        }
-        return $this->_v2Validator->analyzeSourceCode($file, $string);
-    }
-
-    function validate($state = PEAR_VALIDATE_NORMAL)
-    {
-        if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
-            return false;
-        }
-        if (!isset($this->_v2Validator) ||
-              !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
-            if (!class_exists('PEAR_PackageFile_v2_Validator')) {
-                require_once 'PEAR/PackageFile/v2/Validator.php';
-            }
-            $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
-        }
-        if (isset($this->_packageInfo['xsdversion'])) {
-            unset($this->_packageInfo['xsdversion']);
-        }
-        return $this->_v2Validator->validate($this, $state);
-    }
-
-    function getTasksNs()
-    {
-        if (!isset($this->_tasksNs)) {
-            if (isset($this->_packageInfo['attribs'])) {
-                foreach ($this->_packageInfo['attribs'] as $name => $value) {
-                    if ($value == 'http://pear.php.net/dtd/tasks-1.0') {
-                        $this->_tasksNs = str_replace('xmlns:', '', $name);
-                        break;
-                    }
-                }
-            }
-        }
-        return $this->_tasksNs;
-    }
-
-    /**
-     * Determine whether a task name is a valid task.  Custom tasks may be defined
-     * using subdirectories by putting a "-" in the name, as in <tasks:mycustom-task>
-     *
-     * Note that this method will auto-load the task class file and test for the existence
-     * of the name with "-" replaced by "_" as in PEAR/Task/mycustom/task.php makes class
-     * PEAR_Task_mycustom_task
-     * @param string
-     * @return boolean
-     */
-    function getTask($task)
-    {
-        $this->getTasksNs();
-        // transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace
-        $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task);
-        $taskfile = str_replace(' ', '/', ucwords($task));
-        $task = str_replace(array(' ', '/'), '_', ucwords($task));
-        if (class_exists("PEAR_Task_$task")) {
-            return "PEAR_Task_$task";
-        }
-        $fp = @fopen("PEAR/Task/$taskfile.php", 'r', true);
-        if ($fp) {
-            fclose($fp);
-            require_once "PEAR/Task/$taskfile.php";
-            return "PEAR_Task_$task";
-        }
-        return false;
-    }
-
-    /**
-     * Key-friendly array_splice
-     * @param tagname to splice a value in before
-     * @param mixed the value to splice in
-     * @param string the new tag name
-     */
-    function _ksplice($array, $key, $value, $newkey)
-    {
-        $offset = array_search($key, array_keys($array));
-        $after = array_slice($array, $offset);
-        $before = array_slice($array, 0, $offset);
-        $before[$newkey] = $value;
-        return array_merge($before, $after);
-    }
-
-    /**
-     * @param array a list of possible keys, in the order they may occur
-     * @param mixed contents of the new package.xml tag
-     * @param string tag name
-     * @access private
-     */
-    function _insertBefore($array, $keys, $contents, $newkey)
-    {
-        foreach ($keys as $key) {
-            if (isset($array[$key])) {
-                return $array = $this->_ksplice($array, $key, $contents, $newkey);
-            }
-        }
-        $array[$newkey] = $contents;
-        return $array;
-    }
-
-    /**
-     * @param subsection of {@link $_packageInfo}
-     * @param array|string tag contents
-     * @param array format:
-     * <pre>
-     * array(
-     *   tagname => array(list of tag names that follow this one),
-     *   childtagname => array(list of child tag names that follow this one),
-     * )
-     * </pre>
-     *
-     * This allows construction of nested tags
-     * @access private
-     */
-    function _mergeTag($manip, $contents, $order)
-    {
-        if (count($order)) {
-            foreach ($order as $tag => $curorder) {
-                if (!isset($manip[$tag])) {
-                    // ensure that the tag is set up
-                    $manip = $this->_insertBefore($manip, $curorder, array(), $tag);
-                }
-                if (count($order) > 1) {
-                    $manip[$tag] = $this->_mergeTag($manip[$tag], $contents, array_slice($order, 1));
-                    return $manip;
-                }
-            }
-        } else {
-            return $manip;
-        }
-        if (is_array($manip[$tag]) && !empty($manip[$tag]) && isset($manip[$tag][0])) {
-            $manip[$tag][] = $contents;
-        } else {
-            if (!count($manip[$tag])) {
-                $manip[$tag] = $contents;
-            } else {
-                $manip[$tag] = array($manip[$tag]);
-                $manip[$tag][] = $contents;
-            }
-        }
-        return $manip;
-    }
-}
-?>
diff --git a/lib/php/PEAR/PackageFile/v2/Validator.php b/lib/php/PEAR/PackageFile/v2/Validator.php
deleted file mode 100644
index 616b7e7ef16cc5f2106d78412d9d06f098178afd..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/v2/Validator.php
+++ /dev/null
@@ -1,2154 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0, read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Validator.php 277885 2009-03-27 19:29:31Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a8
- */
-/**
- * Private validation class used by PEAR_PackageFile_v2 - do not use directly, its
- * sole purpose is to split up the PEAR/PackageFile/v2.php file to make it smaller
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a8
- * @access private
- */
-class PEAR_PackageFile_v2_Validator
-{
-    /**
-     * @var array
-     */
-    var $_packageInfo;
-    /**
-     * @var PEAR_PackageFile_v2
-     */
-    var $_pf;
-    /**
-     * @var PEAR_ErrorStack
-     */
-    var $_stack;
-    /**
-     * @var int
-     */
-    var $_isValid = 0;
-    /**
-     * @var int
-     */
-    var $_filesValid = 0;
-    /**
-     * @var int
-     */
-    var $_curState = 0;
-    /**
-     * @param PEAR_PackageFile_v2
-     * @param int
-     */
-    function validate(&$pf, $state = PEAR_VALIDATE_NORMAL)
-    {
-        $this->_pf = &$pf;
-        $this->_curState = $state;
-        $this->_packageInfo = $this->_pf->getArray();
-        $this->_isValid = $this->_pf->_isValid;
-        $this->_filesValid = $this->_pf->_filesValid;
-        $this->_stack = &$pf->_stack;
-        $this->_stack->getErrors(true);
-        if (($this->_isValid & $state) == $state) {
-            return true;
-        }
-        if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
-            return false;
-        }
-        if (!isset($this->_packageInfo['attribs']['version']) ||
-              ($this->_packageInfo['attribs']['version'] != '2.0' &&
-               $this->_packageInfo['attribs']['version'] != '2.1')
-        ) {
-            $this->_noPackageVersion();
-        }
-        $structure =
-        array(
-            'name',
-            'channel|uri',
-            '*extends', // can't be multiple, but this works fine
-            'summary',
-            'description',
-            '+lead', // these all need content checks
-            '*developer',
-            '*contributor',
-            '*helper',
-            'date',
-            '*time',
-            'version',
-            'stability',
-            'license->?uri->?filesource',
-            'notes',
-            'contents', //special validation needed
-            '*compatible',
-            'dependencies', //special validation needed
-            '*usesrole',
-            '*usestask', // reserve these for 1.4.0a1 to implement
-                         // this will allow a package.xml to gracefully say it
-                         // needs a certain package installed in order to implement a role or task
-            '*providesextension',
-            '*srcpackage|*srcuri',
-            '+phprelease|+extsrcrelease|+extbinrelease|' .
-                '+zendextsrcrelease|+zendextbinrelease|bundle', //special validation needed
-            '*changelog',
-        );
-        $test = $this->_packageInfo;
-        if (isset($test['dependencies']) &&
-              isset($test['dependencies']['required']) &&
-              isset($test['dependencies']['required']['pearinstaller']) &&
-              isset($test['dependencies']['required']['pearinstaller']['min']) &&
-              version_compare('1.9.0',
-                $test['dependencies']['required']['pearinstaller']['min'], '<')
-        ) {
-            $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']);
-            return false;
-        }
-        // ignore post-installation array fields
-        if (array_key_exists('filelist', $test)) {
-            unset($test['filelist']);
-        }
-        if (array_key_exists('_lastmodified', $test)) {
-            unset($test['_lastmodified']);
-        }
-        if (array_key_exists('#binarypackage', $test)) {
-            unset($test['#binarypackage']);
-        }
-        if (array_key_exists('old', $test)) {
-            unset($test['old']);
-        }
-        if (array_key_exists('_lastversion', $test)) {
-            unset($test['_lastversion']);
-        }
-        if (!$this->_stupidSchemaValidate($structure, $test, '<package>')) {
-            return false;
-        }
-        if (empty($this->_packageInfo['name'])) {
-            $this->_tagCannotBeEmpty('name');
-        }
-        $test = isset($this->_packageInfo['uri']) ? 'uri' :'channel';
-        if (empty($this->_packageInfo[$test])) {
-            $this->_tagCannotBeEmpty($test);
-        }
-        if (is_array($this->_packageInfo['license']) &&
-              (!isset($this->_packageInfo['license']['_content']) ||
-              empty($this->_packageInfo['license']['_content']))) {
-            $this->_tagCannotBeEmpty('license');
-        } elseif (empty($this->_packageInfo['license'])) {
-            $this->_tagCannotBeEmpty('license');
-        }
-        if (empty($this->_packageInfo['summary'])) {
-            $this->_tagCannotBeEmpty('summary');
-        }
-        if (empty($this->_packageInfo['description'])) {
-            $this->_tagCannotBeEmpty('description');
-        }
-        if (empty($this->_packageInfo['date'])) {
-            $this->_tagCannotBeEmpty('date');
-        }
-        if (empty($this->_packageInfo['notes'])) {
-            $this->_tagCannotBeEmpty('notes');
-        }
-        if (isset($this->_packageInfo['time']) && empty($this->_packageInfo['time'])) {
-            $this->_tagCannotBeEmpty('time');
-        }
-        if (isset($this->_packageInfo['dependencies'])) {
-            $this->_validateDependencies();
-        }
-        if (isset($this->_packageInfo['compatible'])) {
-            $this->_validateCompatible();
-        }
-        if (!isset($this->_packageInfo['bundle'])) {
-            if (empty($this->_packageInfo['contents'])) {
-                $this->_tagCannotBeEmpty('contents');
-            }
-            if (!isset($this->_packageInfo['contents']['dir'])) {
-                $this->_filelistMustContainDir('contents');
-                return false;
-            }
-            if (isset($this->_packageInfo['contents']['file'])) {
-                $this->_filelistCannotContainFile('contents');
-                return false;
-            }
-        }
-        $this->_validateMaintainers();
-        $this->_validateStabilityVersion();
-        $fail = false;
-        if (array_key_exists('usesrole', $this->_packageInfo)) {
-            $roles = $this->_packageInfo['usesrole'];
-            if (!is_array($roles) || !isset($roles[0])) {
-                $roles = array($roles);
-            }
-            foreach ($roles as $role) {
-                if (!isset($role['role'])) {
-                    $this->_usesroletaskMustHaveRoleTask('usesrole', 'role');
-                    $fail = true;
-                } else {
-                    if (!isset($role['channel'])) {
-                        if (!isset($role['uri'])) {
-                            $this->_usesroletaskMustHaveChannelOrUri($role['role'], 'usesrole');
-                            $fail = true;
-                        }
-                    } elseif (!isset($role['package'])) {
-                        $this->_usesroletaskMustHavePackage($role['role'], 'usesrole');
-                        $fail = true;
-                    }
-                }
-            }
-        }
-        if (array_key_exists('usestask', $this->_packageInfo)) {
-            $roles = $this->_packageInfo['usestask'];
-            if (!is_array($roles) || !isset($roles[0])) {
-                $roles = array($roles);
-            }
-            foreach ($roles as $role) {
-                if (!isset($role['task'])) {
-                    $this->_usesroletaskMustHaveRoleTask('usestask', 'task');
-                    $fail = true;
-                } else {
-                    if (!isset($role['channel'])) {
-                        if (!isset($role['uri'])) {
-                            $this->_usesroletaskMustHaveChannelOrUri($role['task'], 'usestask');
-                            $fail = true;
-                        }
-                    } elseif (!isset($role['package'])) {
-                        $this->_usesroletaskMustHavePackage($role['task'], 'usestask');
-                        $fail = true;
-                    }
-                }
-            }
-        }
-
-        if ($fail) {
-            return false;
-        }
-
-        $list = $this->_packageInfo['contents'];
-        if (isset($list['dir']) && is_array($list['dir']) && isset($list['dir'][0])) {
-            $this->_multipleToplevelDirNotAllowed();
-            return $this->_isValid = 0;
-        }
-
-        $this->_validateFilelist();
-        $this->_validateRelease();
-        if (!$this->_stack->hasErrors()) {
-            $chan = $this->_pf->_registry->getChannel($this->_pf->getChannel(), true);
-            if (PEAR::isError($chan)) {
-                $this->_unknownChannel($this->_pf->getChannel());
-            } else {
-                $valpack = $chan->getValidationPackage();
-                // for channel validator packages, always use the default PEAR validator.
-                // otherwise, they can't be installed or packaged
-                $validator = $chan->getValidationObject($this->_pf->getPackage());
-                if (!$validator) {
-                    $this->_stack->push(__FUNCTION__, 'error',
-                        array_merge(
-                            array('channel' => $chan->getName(),
-                                  'package' => $this->_pf->getPackage()),
-                              $valpack
-                            ),
-                        'package "%channel%/%package%" cannot be properly validated without ' .
-                        'validation package "%channel%/%name%-%version%"');
-                    return $this->_isValid = 0;
-                }
-                $validator->setPackageFile($this->_pf);
-                $validator->validate($state);
-                $failures = $validator->getFailures();
-                foreach ($failures['errors'] as $error) {
-                    $this->_stack->push(__FUNCTION__, 'error', $error,
-                        'Channel validator error: field "%field%" - %reason%');
-                }
-                foreach ($failures['warnings'] as $warning) {
-                    $this->_stack->push(__FUNCTION__, 'warning', $warning,
-                        'Channel validator warning: field "%field%" - %reason%');
-                }
-            }
-        }
-
-        $this->_pf->_isValid = $this->_isValid = !$this->_stack->hasErrors('error');
-        if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$this->_filesValid) {
-            if ($this->_pf->getPackageType() == 'bundle') {
-                if ($this->_analyzeBundledPackages()) {
-                    $this->_filesValid = $this->_pf->_filesValid = true;
-                } else {
-                    $this->_pf->_isValid = $this->_isValid = 0;
-                }
-            } else {
-                if (!$this->_analyzePhpFiles()) {
-                    $this->_pf->_isValid = $this->_isValid = 0;
-                } else {
-                    $this->_filesValid = $this->_pf->_filesValid = true;
-                }
-            }
-        }
-
-        if ($this->_isValid) {
-            return $this->_pf->_isValid = $this->_isValid = $state;
-        }
-
-        return $this->_pf->_isValid = $this->_isValid = 0;
-    }
-
-    function _stupidSchemaValidate($structure, $xml, $root)
-    {
-        if (!is_array($xml)) {
-            $xml = array();
-        }
-        $keys = array_keys($xml);
-        reset($keys);
-        $key = current($keys);
-        while ($key == 'attribs' || $key == '_contents') {
-            $key = next($keys);
-        }
-        $unfoundtags = $optionaltags = array();
-        $ret = true;
-        $mismatch = false;
-        foreach ($structure as $struc) {
-            if ($key) {
-                $tag = $xml[$key];
-            }
-            $test = $this->_processStructure($struc);
-            if (isset($test['choices'])) {
-                $loose = true;
-                foreach ($test['choices'] as $choice) {
-                    if ($key == $choice['tag']) {
-                        $key = next($keys);
-                        while ($key == 'attribs' || $key == '_contents') {
-                            $key = next($keys);
-                        }
-                        $unfoundtags = $optionaltags = array();
-                        $mismatch = false;
-                        if ($key && $key != $choice['tag'] && isset($choice['multiple'])) {
-                            $unfoundtags[] = $choice['tag'];
-                            $optionaltags[] = $choice['tag'];
-                            if ($key) {
-                                $mismatch = true;
-                            }
-                        }
-                        $ret &= $this->_processAttribs($choice, $tag, $root);
-                        continue 2;
-                    } else {
-                        $unfoundtags[] = $choice['tag'];
-                        $mismatch = true;
-                    }
-                    if (!isset($choice['multiple']) || $choice['multiple'] != '*') {
-                        $loose = false;
-                    } else {
-                        $optionaltags[] = $choice['tag'];
-                    }
-                }
-                if (!$loose) {
-                    $this->_invalidTagOrder($unfoundtags, $key, $root);
-                    return false;
-                }
-            } else {
-                if ($key != $test['tag']) {
-                    if (isset($test['multiple']) && $test['multiple'] != '*') {
-                        $unfoundtags[] = $test['tag'];
-                        $this->_invalidTagOrder($unfoundtags, $key, $root);
-                        return false;
-                    } else {
-                        if ($key) {
-                            $mismatch = true;
-                        }
-                        $unfoundtags[] = $test['tag'];
-                        $optionaltags[] = $test['tag'];
-                    }
-                    if (!isset($test['multiple'])) {
-                        $this->_invalidTagOrder($unfoundtags, $key, $root);
-                        return false;
-                    }
-                    continue;
-                } else {
-                    $unfoundtags = $optionaltags = array();
-                    $mismatch = false;
-                }
-                $key = next($keys);
-                while ($key == 'attribs' || $key == '_contents') {
-                    $key = next($keys);
-                }
-                if ($key && $key != $test['tag'] && isset($test['multiple'])) {
-                    $unfoundtags[] = $test['tag'];
-                    $optionaltags[] = $test['tag'];
-                    $mismatch = true;
-                }
-                $ret &= $this->_processAttribs($test, $tag, $root);
-                continue;
-            }
-        }
-        if (!$mismatch && count($optionaltags)) {
-            // don't error out on any optional tags
-            $unfoundtags = array_diff($unfoundtags, $optionaltags);
-        }
-        if (count($unfoundtags)) {
-            $this->_invalidTagOrder($unfoundtags, $key, $root);
-        } elseif ($key) {
-            // unknown tags
-            $this->_invalidTagOrder('*no tags allowed here*', $key, $root);
-            while ($key = next($keys)) {
-                $this->_invalidTagOrder('*no tags allowed here*', $key, $root);
-            }
-        }
-        return $ret;
-    }
-
-    function _processAttribs($choice, $tag, $context)
-    {
-        if (isset($choice['attribs'])) {
-            if (!is_array($tag)) {
-                $tag = array($tag);
-            }
-            $tags = $tag;
-            if (!isset($tags[0])) {
-                $tags = array($tags);
-            }
-            $ret = true;
-            foreach ($tags as $i => $tag) {
-                if (!is_array($tag) || !isset($tag['attribs'])) {
-                    foreach ($choice['attribs'] as $attrib) {
-                        if ($attrib{0} != '?') {
-                            $ret &= $this->_tagHasNoAttribs($choice['tag'],
-                                $context);
-                            continue 2;
-                        }
-                    }
-                }
-                foreach ($choice['attribs'] as $attrib) {
-                    if ($attrib{0} != '?') {
-                        if (!isset($tag['attribs'][$attrib])) {
-                            $ret &= $this->_tagMissingAttribute($choice['tag'],
-                                $attrib, $context);
-                        }
-                    }
-                }
-            }
-            return $ret;
-        }
-        return true;
-    }
-
-    function _processStructure($key)
-    {
-        $ret = array();
-        if (count($pieces = explode('|', $key)) > 1) {
-            $ret['choices'] = array();
-            foreach ($pieces as $piece) {
-                $ret['choices'][] = $this->_processStructure($piece);
-            }
-            return $ret;
-        }
-        $multi = $key{0};
-        if ($multi == '+' || $multi == '*') {
-            $ret['multiple'] = $key{0};
-            $key = substr($key, 1);
-        }
-        if (count($attrs = explode('->', $key)) > 1) {
-            $ret['tag'] = array_shift($attrs);
-            $ret['attribs'] = $attrs;
-        } else {
-            $ret['tag'] = $key;
-        }
-        return $ret;
-    }
-
-    function _validateStabilityVersion()
-    {
-        $structure = array('release', 'api');
-        $a = $this->_stupidSchemaValidate($structure, $this->_packageInfo['version'], '<version>');
-        $a &= $this->_stupidSchemaValidate($structure, $this->_packageInfo['stability'], '<stability>');
-        if ($a) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $this->_packageInfo['version']['release'])) {
-                $this->_invalidVersion('release', $this->_packageInfo['version']['release']);
-            }
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $this->_packageInfo['version']['api'])) {
-                $this->_invalidVersion('api', $this->_packageInfo['version']['api']);
-            }
-            if (!in_array($this->_packageInfo['stability']['release'],
-                  array('snapshot', 'devel', 'alpha', 'beta', 'stable'))) {
-                $this->_invalidState('release', $this->_packageInfo['stability']['release']);
-            }
-            if (!in_array($this->_packageInfo['stability']['api'],
-                  array('devel', 'alpha', 'beta', 'stable'))) {
-                $this->_invalidState('api', $this->_packageInfo['stability']['api']);
-            }
-        }
-    }
-
-    function _validateMaintainers()
-    {
-        $structure =
-            array(
-                'name',
-                'user',
-                'email',
-                'active',
-            );
-        foreach (array('lead', 'developer', 'contributor', 'helper') as $type) {
-            if (!isset($this->_packageInfo[$type])) {
-                continue;
-            }
-            if (isset($this->_packageInfo[$type][0])) {
-                foreach ($this->_packageInfo[$type] as $lead) {
-                    $this->_stupidSchemaValidate($structure, $lead, '<' . $type . '>');
-                }
-            } else {
-                $this->_stupidSchemaValidate($structure, $this->_packageInfo[$type],
-                    '<' . $type . '>');
-            }
-        }
-    }
-
-    function _validatePhpDep($dep, $installcondition = false)
-    {
-        $structure = array(
-            'min',
-            '*max',
-            '*exclude',
-        );
-        $type = $installcondition ? '<installcondition><php>' : '<dependencies><required><php>';
-        $this->_stupidSchemaValidate($structure, $dep, $type);
-        if (isset($dep['min'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
-                  $dep['min'])) {
-                $this->_invalidVersion($type . '<min>', $dep['min']);
-            }
-        }
-        if (isset($dep['max'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
-                  $dep['max'])) {
-                $this->_invalidVersion($type . '<max>', $dep['max']);
-            }
-        }
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-            foreach ($dep['exclude'] as $exclude) {
-                if (!preg_match(
-                     '/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
-                     $exclude)) {
-                    $this->_invalidVersion($type . '<exclude>', $exclude);
-                }
-            }
-        }
-    }
-
-    function _validatePearinstallerDep($dep)
-    {
-        $structure = array(
-            'min',
-            '*max',
-            '*recommended',
-            '*exclude',
-        );
-        $this->_stupidSchemaValidate($structure, $dep, '<dependencies><required><pearinstaller>');
-        if (isset($dep['min'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['min'])) {
-                $this->_invalidVersion('<dependencies><required><pearinstaller><min>',
-                    $dep['min']);
-            }
-        }
-        if (isset($dep['max'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['max'])) {
-                $this->_invalidVersion('<dependencies><required><pearinstaller><max>',
-                    $dep['max']);
-            }
-        }
-        if (isset($dep['recommended'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['recommended'])) {
-                $this->_invalidVersion('<dependencies><required><pearinstaller><recommended>',
-                    $dep['recommended']);
-            }
-        }
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-            foreach ($dep['exclude'] as $exclude) {
-                if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                      $exclude)) {
-                    $this->_invalidVersion('<dependencies><required><pearinstaller><exclude>',
-                        $exclude);
-                }
-            }
-        }
-    }
-
-    function _validatePackageDep($dep, $group, $type = '<package>')
-    {
-        if (isset($dep['uri'])) {
-            if (isset($dep['conflicts'])) {
-                $structure = array(
-                    'name',
-                    'uri',
-                    'conflicts',
-                    '*providesextension',
-                );
-            } else {
-                $structure = array(
-                    'name',
-                    'uri',
-                    '*providesextension',
-                );
-            }
-        } else {
-            if (isset($dep['conflicts'])) {
-                $structure = array(
-                    'name',
-                    'channel',
-                    '*min',
-                    '*max',
-                    '*exclude',
-                    'conflicts',
-                    '*providesextension',
-                );
-            } else {
-                $structure = array(
-                    'name',
-                    'channel',
-                    '*min',
-                    '*max',
-                    '*recommended',
-                    '*exclude',
-                    '*nodefault',
-                    '*providesextension',
-                );
-            }
-        }
-        if (isset($dep['name'])) {
-            $type .= '<name>' . $dep['name'] . '</name>';
-        }
-        $this->_stupidSchemaValidate($structure, $dep, '<dependencies>' . $group . $type);
-        if (isset($dep['uri']) && (isset($dep['min']) || isset($dep['max']) ||
-              isset($dep['recommended']) || isset($dep['exclude']))) {
-            $this->_uriDepsCannotHaveVersioning('<dependencies>' . $group . $type);
-        }
-        if (isset($dep['channel']) && strtolower($dep['channel']) == '__uri') {
-            $this->_DepchannelCannotBeUri('<dependencies>' . $group . $type);
-        }
-        if (isset($dep['min'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['min'])) {
-                $this->_invalidVersion('<dependencies>' . $group . $type . '<min>', $dep['min']);
-            }
-        }
-        if (isset($dep['max'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['max'])) {
-                $this->_invalidVersion('<dependencies>' . $group . $type . '<max>', $dep['max']);
-            }
-        }
-        if (isset($dep['recommended'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['recommended'])) {
-                $this->_invalidVersion('<dependencies>' . $group . $type . '<recommended>',
-                    $dep['recommended']);
-            }
-        }
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-            foreach ($dep['exclude'] as $exclude) {
-                if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                      $exclude)) {
-                    $this->_invalidVersion('<dependencies>' . $group . $type . '<exclude>',
-                        $exclude);
-                }
-            }
-        }
-    }
-
-    function _validateSubpackageDep($dep, $group)
-    {
-        $this->_validatePackageDep($dep, $group, '<subpackage>');
-        if (isset($dep['providesextension'])) {
-            $this->_subpackageCannotProvideExtension(isset($dep['name']) ? $dep['name'] : '');
-        }
-        if (isset($dep['conflicts'])) {
-            $this->_subpackagesCannotConflict(isset($dep['name']) ? $dep['name'] : '');
-        }
-    }
-
-    function _validateExtensionDep($dep, $group = false, $installcondition = false)
-    {
-        if (isset($dep['conflicts'])) {
-            $structure = array(
-                'name',
-                '*min',
-                '*max',
-                '*exclude',
-                'conflicts',
-            );
-        } else {
-            $structure = array(
-                'name',
-                '*min',
-                '*max',
-                '*recommended',
-                '*exclude',
-            );
-        }
-        if ($installcondition) {
-            $type = '<installcondition><extension>';
-        } else {
-            $type = '<dependencies>' . $group . '<extension>';
-        }
-        if (isset($dep['name'])) {
-            $type .= '<name>' . $dep['name'] . '</name>';
-        }
-        $this->_stupidSchemaValidate($structure, $dep, $type);
-        if (isset($dep['min'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['min'])) {
-                $this->_invalidVersion(substr($type, 1) . '<min', $dep['min']);
-            }
-        }
-        if (isset($dep['max'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['max'])) {
-                $this->_invalidVersion(substr($type, 1) . '<max', $dep['max']);
-            }
-        }
-        if (isset($dep['recommended'])) {
-            if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                  $dep['recommended'])) {
-                $this->_invalidVersion(substr($type, 1) . '<recommended', $dep['recommended']);
-            }
-        }
-        if (isset($dep['exclude'])) {
-            if (!is_array($dep['exclude'])) {
-                $dep['exclude'] = array($dep['exclude']);
-            }
-            foreach ($dep['exclude'] as $exclude) {
-                if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                      $exclude)) {
-                    $this->_invalidVersion(substr($type, 1) . '<exclude', $exclude);
-                }
-            }
-        }
-    }
-
-    function _validateOsDep($dep, $installcondition = false)
-    {
-        $structure = array(
-            'name',
-            '*conflicts',
-        );
-        $type = $installcondition ? '<installcondition><os>' : '<dependencies><required><os>';
-        if ($this->_stupidSchemaValidate($structure, $dep, $type)) {
-            if ($dep['name'] == '*') {
-                if (array_key_exists('conflicts', $dep)) {
-                    $this->_cannotConflictWithAllOs($type);
-                }
-            }
-        }
-    }
-
-    function _validateArchDep($dep, $installcondition = false)
-    {
-        $structure = array(
-            'pattern',
-            '*conflicts',
-        );
-        $type = $installcondition ? '<installcondition><arch>' : '<dependencies><required><arch>';
-        $this->_stupidSchemaValidate($structure, $dep, $type);
-    }
-
-    function _validateInstallConditions($cond, $release)
-    {
-        $structure = array(
-            '*php',
-            '*extension',
-            '*os',
-            '*arch',
-        );
-        if (!$this->_stupidSchemaValidate($structure,
-              $cond, $release)) {
-            return false;
-        }
-        foreach (array('php', 'extension', 'os', 'arch') as $type) {
-            if (isset($cond[$type])) {
-                $iter = $cond[$type];
-                if (!is_array($iter) || !isset($iter[0])) {
-                    $iter = array($iter);
-                }
-                foreach ($iter as $package) {
-                    if ($type == 'extension') {
-                        $this->{"_validate{$type}Dep"}($package, false, true);
-                    } else {
-                        $this->{"_validate{$type}Dep"}($package, true);
-                    }
-                }
-            }
-        }
-    }
-
-    function _validateDependencies()
-    {
-        $structure = array(
-            'required',
-            '*optional',
-            '*group->name->hint'
-        );
-        if (!$this->_stupidSchemaValidate($structure,
-              $this->_packageInfo['dependencies'], '<dependencies>')) {
-            return false;
-        }
-        foreach (array('required', 'optional') as $simpledep) {
-            if (isset($this->_packageInfo['dependencies'][$simpledep])) {
-                if ($simpledep == 'optional') {
-                    $structure = array(
-                        '*package',
-                        '*subpackage',
-                        '*extension',
-                    );
-                } else {
-                    $structure = array(
-                        'php',
-                        'pearinstaller',
-                        '*package',
-                        '*subpackage',
-                        '*extension',
-                        '*os',
-                        '*arch',
-                    );
-                }
-                if ($this->_stupidSchemaValidate($structure,
-                      $this->_packageInfo['dependencies'][$simpledep],
-                      "<dependencies><$simpledep>")) {
-                    foreach (array('package', 'subpackage', 'extension') as $type) {
-                        if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) {
-                            $iter = $this->_packageInfo['dependencies'][$simpledep][$type];
-                            if (!isset($iter[0])) {
-                                $iter = array($iter);
-                            }
-                            foreach ($iter as $package) {
-                                if ($type != 'extension') {
-                                    if (isset($package['uri'])) {
-                                        if (isset($package['channel'])) {
-                                            $this->_UrlOrChannel($type,
-                                                $package['name']);
-                                        }
-                                    } else {
-                                        if (!isset($package['channel'])) {
-                                            $this->_NoChannel($type, $package['name']);
-                                        }
-                                    }
-                                }
-                                $this->{"_validate{$type}Dep"}($package, "<$simpledep>");
-                            }
-                        }
-                    }
-                    if ($simpledep == 'optional') {
-                        continue;
-                    }
-                    foreach (array('php', 'pearinstaller', 'os', 'arch') as $type) {
-                        if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) {
-                            $iter = $this->_packageInfo['dependencies'][$simpledep][$type];
-                            if (!isset($iter[0])) {
-                                $iter = array($iter);
-                            }
-                            foreach ($iter as $package) {
-                                $this->{"_validate{$type}Dep"}($package);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        if (isset($this->_packageInfo['dependencies']['group'])) {
-            $groups = $this->_packageInfo['dependencies']['group'];
-            if (!isset($groups[0])) {
-                $groups = array($groups);
-            }
-            $structure = array(
-                '*package',
-                '*subpackage',
-                '*extension',
-            );
-            foreach ($groups as $group) {
-                if ($this->_stupidSchemaValidate($structure, $group, '<group>')) {
-                    if (!PEAR_Validate::validGroupName($group['attribs']['name'])) {
-                        $this->_invalidDepGroupName($group['attribs']['name']);
-                    }
-                    foreach (array('package', 'subpackage', 'extension') as $type) {
-                        if (isset($group[$type])) {
-                            $iter = $group[$type];
-                            if (!isset($iter[0])) {
-                                $iter = array($iter);
-                            }
-                            foreach ($iter as $package) {
-                                if ($type != 'extension') {
-                                    if (isset($package['uri'])) {
-                                        if (isset($package['channel'])) {
-                                            $this->_UrlOrChannelGroup($type,
-                                                $package['name'],
-                                                $group['name']);
-                                        }
-                                    } else {
-                                        if (!isset($package['channel'])) {
-                                            $this->_NoChannelGroup($type,
-                                                $package['name'],
-                                                $group['name']);
-                                        }
-                                    }
-                                }
-                                $this->{"_validate{$type}Dep"}($package, '<group name="' .
-                                    $group['attribs']['name'] . '">');
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    function _validateCompatible()
-    {
-        $compat = $this->_packageInfo['compatible'];
-        if (!isset($compat[0])) {
-            $compat = array($compat);
-        }
-        $required = array('name', 'channel', 'min', 'max', '*exclude');
-        foreach ($compat as $package) {
-            $type = '<compatible>';
-            if (is_array($package) && array_key_exists('name', $package)) {
-                $type .= '<name>' . $package['name'] . '</name>';
-            }
-            $this->_stupidSchemaValidate($required, $package, $type);
-            if (is_array($package) && array_key_exists('min', $package)) {
-                if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                      $package['min'])) {
-                    $this->_invalidVersion(substr($type, 1) . '<min', $package['min']);
-                }
-            }
-            if (is_array($package) && array_key_exists('max', $package)) {
-                if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                      $package['max'])) {
-                    $this->_invalidVersion(substr($type, 1) . '<max', $package['max']);
-                }
-            }
-            if (is_array($package) && array_key_exists('exclude', $package)) {
-                if (!is_array($package['exclude'])) {
-                    $package['exclude'] = array($package['exclude']);
-                }
-                foreach ($package['exclude'] as $exclude) {
-                    if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
-                          $exclude)) {
-                        $this->_invalidVersion(substr($type, 1) . '<exclude', $exclude);
-                    }
-                }
-            }
-        }
-    }
-
-    function _validateBundle($list)
-    {
-        if (!is_array($list) || !isset($list['bundledpackage'])) {
-            return $this->_NoBundledPackages();
-        }
-        if (!is_array($list['bundledpackage']) || !isset($list['bundledpackage'][0])) {
-            return $this->_AtLeast2BundledPackages();
-        }
-        foreach ($list['bundledpackage'] as $package) {
-            if (!is_string($package)) {
-                $this->_bundledPackagesMustBeFilename();
-            }
-        }
-    }
-
-    function _validateFilelist($list = false, $allowignore = false, $dirs = '')
-    {
-        $iscontents = false;
-        if (!$list) {
-            $iscontents = true;
-            $list = $this->_packageInfo['contents'];
-            if (isset($this->_packageInfo['bundle'])) {
-                return $this->_validateBundle($list);
-            }
-        }
-        if ($allowignore) {
-            $struc = array(
-                '*install->name->as',
-                '*ignore->name'
-            );
-        } else {
-            $struc = array(
-                '*dir->name->?baseinstalldir',
-                '*file->name->role->?baseinstalldir->?md5sum'
-            );
-            if (isset($list['dir']) && isset($list['file'])) {
-                // stave off validation errors without requiring a set order.
-                $_old = $list;
-                if (isset($list['attribs'])) {
-                    $list = array('attribs' => $_old['attribs']);
-                }
-                $list['dir'] = $_old['dir'];
-                $list['file'] = $_old['file'];
-            }
-        }
-        if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
-            $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
-            $dirname = $iscontents ? '<contents>' : $unknown;
-        } else {
-            $dirname = '<dir name="' . $list['attribs']['name'] . '">';
-            if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
-                          str_replace('\\', '/', $list['attribs']['name']))) {
-                // file contains .. parent directory or . cur directory
-                $this->_invalidDirName($list['attribs']['name']);
-            }
-        }
-        $res = $this->_stupidSchemaValidate($struc, $list, $dirname);
-        if ($allowignore && $res) {
-            $ignored_or_installed = array();
-            $this->_pf->getFilelist();
-            $fcontents = $this->_pf->getContents();
-            $filelist = array();
-            if (!isset($fcontents['dir']['file'][0])) {
-                $fcontents['dir']['file'] = array($fcontents['dir']['file']);
-            }
-            foreach ($fcontents['dir']['file'] as $file) {
-                $filelist[$file['attribs']['name']] = true;
-            }
-            if (isset($list['install'])) {
-                if (!isset($list['install'][0])) {
-                    $list['install'] = array($list['install']);
-                }
-                foreach ($list['install'] as $file) {
-                    if (!isset($filelist[$file['attribs']['name']])) {
-                        $this->_notInContents($file['attribs']['name'], 'install');
-                        continue;
-                    }
-                    if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
-                        $this->_multipleInstallAs($file['attribs']['name']);
-                    }
-                    if (!isset($ignored_or_installed[$file['attribs']['name']])) {
-                        $ignored_or_installed[$file['attribs']['name']] = array();
-                    }
-                    $ignored_or_installed[$file['attribs']['name']][] = 1;
-                    if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
-                                  str_replace('\\', '/', $file['attribs']['as']))) {
-                        // file contains .. parent directory or . cur directory references
-                        $this->_invalidFileInstallAs($file['attribs']['name'],
-                            $file['attribs']['as']);
-                    }
-                }
-            }
-            if (isset($list['ignore'])) {
-                if (!isset($list['ignore'][0])) {
-                    $list['ignore'] = array($list['ignore']);
-                }
-                foreach ($list['ignore'] as $file) {
-                    if (!isset($filelist[$file['attribs']['name']])) {
-                        $this->_notInContents($file['attribs']['name'], 'ignore');
-                        continue;
-                    }
-                    if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
-                        $this->_ignoreAndInstallAs($file['attribs']['name']);
-                    }
-                }
-            }
-        }
-        if (!$allowignore && isset($list['file'])) {
-            if (is_string($list['file'])) {
-                $this->_oldStyleFileNotAllowed();
-                return false;
-            }
-            if (!isset($list['file'][0])) {
-                // single file
-                $list['file'] = array($list['file']);
-            }
-            foreach ($list['file'] as $i => $file)
-            {
-                if (isset($file['attribs']) && isset($file['attribs']['name'])) {
-                    if ($file['attribs']['name']{0} == '.' &&
-                          $file['attribs']['name']{1} == '/') {
-                        // name is something like "./doc/whatever.txt"
-                        $this->_invalidFileName($file['attribs']['name'], $dirname);
-                    }
-                    if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
-                                  str_replace('\\', '/', $file['attribs']['name']))) {
-                        // file contains .. parent directory or . cur directory
-                        $this->_invalidFileName($file['attribs']['name'], $dirname);
-                    }
-                }
-                if (isset($file['attribs']) && isset($file['attribs']['role'])) {
-                    if (!$this->_validateRole($file['attribs']['role'])) {
-                        if (isset($this->_packageInfo['usesrole'])) {
-                            $roles = $this->_packageInfo['usesrole'];
-                            if (!isset($roles[0])) {
-                                $roles = array($roles);
-                            }
-                            foreach ($roles as $role) {
-                                if ($role['role'] = $file['attribs']['role']) {
-                                    $msg = 'This package contains role "%role%" and requires ' .
-                                        'package "%package%" to be used';
-                                    if (isset($role['uri'])) {
-                                        $params = array('role' => $role['role'],
-                                            'package' => $role['uri']);
-                                    } else {
-                                        $params = array('role' => $role['role'],
-                                            'package' => $this->_pf->_registry->
-                                            parsedPackageNameToString(array('package' =>
-                                                $role['package'], 'channel' => $role['channel']),
-                                                true));
-                                    }
-                                    $this->_stack->push('_mustInstallRole', 'error', $params, $msg);
-                                }
-                            }
-                        }
-                        $this->_invalidFileRole($file['attribs']['name'],
-                            $dirname, $file['attribs']['role']);
-                    }
-                }
-                if (!isset($file['attribs'])) {
-                    continue;
-                }
-                $save = $file['attribs'];
-                if ($dirs) {
-                    $save['name'] = $dirs . '/' . $save['name'];
-                }
-                unset($file['attribs']);
-                if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) { // has tasks
-                    foreach ($file as $task => $value) {
-                        if ($tagClass = $this->_pf->getTask($task)) {
-                            if (!is_array($value) || !isset($value[0])) {
-                                $value = array($value);
-                            }
-                            foreach ($value as $v) {
-                                $ret = call_user_func(array($tagClass, 'validateXml'),
-                                    $this->_pf, $v, $this->_pf->_config, $save);
-                                if (is_array($ret)) {
-                                    $this->_invalidTask($task, $ret, isset($save['name']) ?
-                                        $save['name'] : '');
-                                }
-                            }
-                        } else {
-                            if (isset($this->_packageInfo['usestask'])) {
-                                $roles = $this->_packageInfo['usestask'];
-                                if (!isset($roles[0])) {
-                                    $roles = array($roles);
-                                }
-                                foreach ($roles as $role) {
-                                    if ($role['task'] = $task) {
-                                        $msg = 'This package contains task "%task%" and requires ' .
-                                            'package "%package%" to be used';
-                                        if (isset($role['uri'])) {
-                                            $params = array('task' => $role['task'],
-                                                'package' => $role['uri']);
-                                        } else {
-                                            $params = array('task' => $role['task'],
-                                                'package' => $this->_pf->_registry->
-                                                parsedPackageNameToString(array('package' =>
-                                                    $role['package'], 'channel' => $role['channel']),
-                                                    true));
-                                        }
-                                        $this->_stack->push('_mustInstallTask', 'error',
-                                            $params, $msg);
-                                    }
-                                }
-                            }
-                            $this->_unknownTask($task, $save['name']);
-                        }
-                    }
-                }
-            }
-        }
-        if (isset($list['ignore'])) {
-            if (!$allowignore) {
-                $this->_ignoreNotAllowed('ignore');
-            }
-        }
-        if (isset($list['install'])) {
-            if (!$allowignore) {
-                $this->_ignoreNotAllowed('install');
-            }
-        }
-        if (isset($list['file'])) {
-            if ($allowignore) {
-                $this->_fileNotAllowed('file');
-            }
-        }
-        if (isset($list['dir'])) {
-            if ($allowignore) {
-                $this->_fileNotAllowed('dir');
-            } else {
-                if (!isset($list['dir'][0])) {
-                    $list['dir'] = array($list['dir']);
-                }
-                foreach ($list['dir'] as $dir) {
-                    if (isset($dir['attribs']) && isset($dir['attribs']['name'])) {
-                        if ($dir['attribs']['name'] == '/' ||
-                              !isset($this->_packageInfo['contents']['dir']['dir'])) {
-                            // always use nothing if the filelist has already been flattened
-                            $newdirs = '';
-                        } elseif ($dirs == '') {
-                            $newdirs = $dir['attribs']['name'];
-                        } else {
-                            $newdirs = $dirs . '/' . $dir['attribs']['name'];
-                        }
-                    } else {
-                        $newdirs = $dirs;
-                    }
-                    $this->_validateFilelist($dir, $allowignore, $newdirs);
-                }
-            }
-        }
-    }
-
-    function _validateRelease()
-    {
-        if (isset($this->_packageInfo['phprelease'])) {
-            $release = 'phprelease';
-            if (isset($this->_packageInfo['providesextension'])) {
-                $this->_cannotProvideExtension($release);
-            }
-            if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
-                $this->_cannotHaveSrcpackage($release);
-            }
-            $releases = $this->_packageInfo['phprelease'];
-            if (!is_array($releases)) {
-                return true;
-            }
-            if (!isset($releases[0])) {
-                $releases = array($releases);
-            }
-            foreach ($releases as $rel) {
-                $this->_stupidSchemaValidate(array(
-                    '*installconditions',
-                    '*filelist',
-                ), $rel, '<phprelease>');
-            }
-        }
-        foreach (array('', 'zend') as $prefix) {
-            $releasetype = $prefix . 'extsrcrelease';
-            if (isset($this->_packageInfo[$releasetype])) {
-                $release = $releasetype;
-                if (!isset($this->_packageInfo['providesextension'])) {
-                    $this->_mustProvideExtension($release);
-                }
-                if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
-                    $this->_cannotHaveSrcpackage($release);
-                }
-                $releases = $this->_packageInfo[$releasetype];
-                if (!is_array($releases)) {
-                    return true;
-                }
-                if (!isset($releases[0])) {
-                    $releases = array($releases);
-                }
-                foreach ($releases as $rel) {
-                    $this->_stupidSchemaValidate(array(
-                        '*installconditions',
-                        '*configureoption->name->prompt->?default',
-                        '*binarypackage',
-                        '*filelist',
-                    ), $rel, '<' . $releasetype . '>');
-                    if (isset($rel['binarypackage'])) {
-                        if (!is_array($rel['binarypackage']) || !isset($rel['binarypackage'][0])) {
-                            $rel['binarypackage'] = array($rel['binarypackage']);
-                        }
-                        foreach ($rel['binarypackage'] as $bin) {
-                            if (!is_string($bin)) {
-                                $this->_binaryPackageMustBePackagename();
-                            }
-                        }
-                    }
-                }
-            }
-            $releasetype = 'extbinrelease';
-            if (isset($this->_packageInfo[$releasetype])) {
-                $release = $releasetype;
-                if (!isset($this->_packageInfo['providesextension'])) {
-                    $this->_mustProvideExtension($release);
-                }
-                if (isset($this->_packageInfo['channel']) &&
-                      !isset($this->_packageInfo['srcpackage'])) {
-                    $this->_mustSrcPackage($release);
-                }
-                if (isset($this->_packageInfo['uri']) && !isset($this->_packageInfo['srcuri'])) {
-                    $this->_mustSrcuri($release);
-                }
-                $releases = $this->_packageInfo[$releasetype];
-                if (!is_array($releases)) {
-                    return true;
-                }
-                if (!isset($releases[0])) {
-                    $releases = array($releases);
-                }
-                foreach ($releases as $rel) {
-                    $this->_stupidSchemaValidate(array(
-                        '*installconditions',
-                        '*filelist',
-                    ), $rel, '<' . $releasetype . '>');
-                }
-            }
-        }
-        if (isset($this->_packageInfo['bundle'])) {
-            $release = 'bundle';
-            if (isset($this->_packageInfo['providesextension'])) {
-                $this->_cannotProvideExtension($release);
-            }
-            if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
-                $this->_cannotHaveSrcpackage($release);
-            }
-            $releases = $this->_packageInfo['bundle'];
-            if (!is_array($releases) || !isset($releases[0])) {
-                $releases = array($releases);
-            }
-            foreach ($releases as $rel) {
-                $this->_stupidSchemaValidate(array(
-                    '*installconditions',
-                    '*filelist',
-                ), $rel, '<bundle>');
-            }
-        }
-        foreach ($releases as $rel) {
-            if (is_array($rel) && array_key_exists('installconditions', $rel)) {
-                $this->_validateInstallConditions($rel['installconditions'],
-                    "<$release><installconditions>");
-            }
-            if (is_array($rel) && array_key_exists('filelist', $rel)) {
-                if ($rel['filelist']) {
-
-                    $this->_validateFilelist($rel['filelist'], true);
-                }
-            }
-        }
-    }
-
-    /**
-     * This is here to allow role extension through plugins
-     * @param string
-     */
-    function _validateRole($role)
-    {
-        return in_array($role, PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType()));
-    }
-
-    function _pearVersionTooLow($version)
-    {
-        $this->_stack->push(__FUNCTION__, 'error',
-            array('version' => $version),
-            'This package.xml requires PEAR version %version% to parse properly, we are ' .
-            'version 1.9.0');
-    }
-
-    function _invalidTagOrder($oktags, $actual, $root)
-    {
-        $this->_stack->push(__FUNCTION__, 'error',
-            array('oktags' => $oktags, 'actual' => $actual, 'root' => $root),
-            'Invalid tag order in %root%, found <%actual%> expected one of "%oktags%"');
-    }
-
-    function _ignoreNotAllowed($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
-            '<%type%> is not allowed inside global <contents>, only inside ' .
-            '<phprelease>/<extbinrelease>/<zendextbinrelease>, use <dir> and <file> only');
-    }
-
-    function _fileNotAllowed($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
-            '<%type%> is not allowed inside release <filelist>, only inside ' .
-            '<contents>, use <ignore> and <install> only');
-    }
-
-    function _oldStyleFileNotAllowed()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'Old-style <file>name</file> is not allowed.  Use' .
-            '<file name="name" role="role"/>');
-    }
-
-    function _tagMissingAttribute($tag, $attr, $context)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag,
-            'attribute' => $attr, 'context' => $context),
-            'tag <%tag%> in context "%context%" has no attribute "%attribute%"');
-    }
-
-    function _tagHasNoAttribs($tag, $context)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag,
-            'context' => $context),
-            'tag <%tag%> has no attributes in context "%context%"');
-    }
-
-    function _invalidInternalStructure()
-    {
-        $this->_stack->push(__FUNCTION__, 'exception', array(),
-            'internal array was not generated by compatible parser, or extreme parser error, cannot continue');
-    }
-
-    function _invalidFileRole($file, $dir, $role)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(
-            'file' => $file, 'dir' => $dir, 'role' => $role,
-            'roles' => PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType())),
-            'File "%file%" in directory "%dir%" has invalid role "%role%", should be one of %roles%');
-    }
-
-    function _invalidFileName($file, $dir)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(
-            'file' => $file),
-            'File "%file%" in directory "%dir%" cannot begin with "./" or contain ".."');
-    }
-
-    function _invalidFileInstallAs($file, $as)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(
-            'file' => $file, 'as' => $as),
-            'File "%file%" <install as="%as%"/> cannot contain "./" or contain ".."');
-    }
-
-    function _invalidDirName($dir)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(
-            'dir' => $file),
-            'Directory "%dir%" cannot begin with "./" or contain ".."');
-    }
-
-    function _filelistCannotContainFile($filelist)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist),
-            '<%tag%> can only contain <dir>, contains <file>.  Use ' .
-            '<dir name="/"> as the first dir element');
-    }
-
-    function _filelistMustContainDir($filelist)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist),
-            '<%tag%> must contain <dir>.  Use <dir name="/"> as the ' .
-            'first dir element');
-    }
-
-    function _tagCannotBeEmpty($tag)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag),
-            '<%tag%> cannot be empty (<%tag%/>)');
-    }
-
-    function _UrlOrChannel($type, $name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
-            'name' => $name),
-            'Required dependency <%type%> "%name%" can have either url OR ' .
-            'channel attributes, and not both');
-    }
-
-    function _NoChannel($type, $name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
-            'name' => $name),
-            'Required dependency <%type%> "%name%" must have either url OR ' .
-            'channel attributes');
-    }
-
-    function _UrlOrChannelGroup($type, $name, $group)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
-            'name' => $name, 'group' => $group),
-            'Group "%group%" dependency <%type%> "%name%" can have either url OR ' .
-            'channel attributes, and not both');
-    }
-
-    function _NoChannelGroup($type, $name, $group)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
-            'name' => $name, 'group' => $group),
-            'Group "%group%" dependency <%type%> "%name%" must have either url OR ' .
-            'channel attributes');
-    }
-
-    function _unknownChannel($channel)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('channel' => $channel),
-            'Unknown channel "%channel%"');
-    }
-
-    function _noPackageVersion()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'package.xml <package> tag has no version attribute, or version is not 2.0');
-    }
-
-    function _NoBundledPackages()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'No <bundledpackage> tag was found in <contents>, required for bundle packages');
-    }
-
-    function _AtLeast2BundledPackages()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'At least 2 packages must be bundled in a bundle package');
-    }
-
-    function _ChannelOrUri($name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
-            'Bundled package "%name%" can have either a uri or a channel, not both');
-    }
-
-    function _noChildTag($child, $tag)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('child' => $child, 'tag' => $tag),
-            'Tag <%tag%> is missing child tag <%child%>');
-    }
-
-    function _invalidVersion($type, $value)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value),
-            'Version type <%type%> is not a valid version (%value%)');
-    }
-
-    function _invalidState($type, $value)
-    {
-        $states = array('stable', 'beta', 'alpha', 'devel');
-        if ($type != 'api') {
-            $states[] = 'snapshot';
-        }
-        if (strtolower($value) == 'rc') {
-            $this->_stack->push(__FUNCTION__, 'error',
-                array('version' => $this->_packageInfo['version']['release']),
-                'RC is not a state, it is a version postfix, try %version%RC1, stability beta');
-        }
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value,
-            'types' => $states),
-            'Stability type <%type%> is not a valid stability (%value%), must be one of ' .
-            '%types%');
-    }
-
-    function _invalidTask($task, $ret, $file)
-    {
-        switch ($ret[0]) {
-            case PEAR_TASK_ERROR_MISSING_ATTRIB :
-                $info = array('attrib' => $ret[1], 'task' => $task, 'file' => $file);
-                $msg = 'task <%task%> is missing attribute "%attrib%" in file %file%';
-            break;
-            case PEAR_TASK_ERROR_NOATTRIBS :
-                $info = array('task' => $task, 'file' => $file);
-                $msg = 'task <%task%> has no attributes in file %file%';
-            break;
-            case PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE :
-                $info = array('attrib' => $ret[1], 'values' => $ret[3],
-                    'was' => $ret[2], 'task' => $task, 'file' => $file);
-                $msg = 'task <%task%> attribute "%attrib%" has the wrong value "%was%" '.
-                    'in file %file%, expecting one of "%values%"';
-            break;
-            case PEAR_TASK_ERROR_INVALID :
-                $info = array('reason' => $ret[1], 'task' => $task, 'file' => $file);
-                $msg = 'task <%task%> in file %file% is invalid because of "%reason%"';
-            break;
-        }
-        $this->_stack->push(__FUNCTION__, 'error', $info, $msg);
-    }
-
-    function _unknownTask($task, $file)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('task' => $task, 'file' => $file),
-            'Unknown task "%task%" passed in file <file name="%file%">');
-    }
-
-    function _subpackageCannotProvideExtension($name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
-            'Subpackage dependency "%name%" cannot use <providesextension>, ' .
-            'only package dependencies can use this tag');
-    }
-
-    function _subpackagesCannotConflict($name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
-            'Subpackage dependency "%name%" cannot use <conflicts/>, ' .
-            'only package dependencies can use this tag');
-    }
-
-    function _cannotProvideExtension($release)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
-            '<%release%> packages cannot use <providesextension>, only extbinrelease, extsrcrelease, zendextsrcrelease, and zendextbinrelease can provide a PHP extension');
-    }
-
-    function _mustProvideExtension($release)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
-            '<%release%> packages must use <providesextension> to indicate which PHP extension is provided');
-    }
-
-    function _cannotHaveSrcpackage($release)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
-            '<%release%> packages cannot specify a source code package, only extension binaries may use the <srcpackage> tag');
-    }
-
-    function _mustSrcPackage($release)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
-            '<extbinrelease>/<zendextbinrelease> packages must specify a source code package with <srcpackage>');
-    }
-
-    function _mustSrcuri($release)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
-            '<extbinrelease>/<zendextbinrelease> packages must specify a source code package with <srcuri>');
-    }
-
-    function _uriDepsCannotHaveVersioning($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
-            '%type%: dependencies with a <uri> tag cannot have any versioning information');
-    }
-
-    function _conflictingDepsCannotHaveVersioning($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
-            '%type%: conflicting dependencies cannot have versioning info, use <exclude> to ' .
-            'exclude specific versions of a dependency');
-    }
-
-    function _DepchannelCannotBeUri($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
-            '%type%: channel cannot be __uri, this is a pseudo-channel reserved for uri ' .
-            'dependencies only');
-    }
-
-    function _bundledPackagesMustBeFilename()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            '<bundledpackage> tags must contain only the filename of a package release ' .
-            'in the bundle');
-    }
-
-    function _binaryPackageMustBePackagename()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            '<binarypackage> tags must contain the name of a package that is ' .
-            'a compiled version of this extsrc/zendextsrc package');
-    }
-
-    function _fileNotFound($file)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-            'File "%file%" in package.xml does not exist');
-    }
-
-    function _notInContents($file, $tag)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('file' => $file, 'tag' => $tag),
-            '<%tag% name="%file%"> is invalid, file is not in <contents>');
-    }
-
-    function _cannotValidateNoPathSet()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'Cannot validate files, no path to package file is set (use setPackageFile())');
-    }
-
-    function _usesroletaskMustHaveChannelOrUri($role, $tag)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag),
-            '<%tag%> for role "%role%" must contain either <uri>, or <channel> and <package>');
-    }
-
-    function _usesroletaskMustHavePackage($role, $tag)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag),
-            '<%tag%> for role "%role%" must contain <package>');
-    }
-
-    function _usesroletaskMustHaveRoleTask($tag, $type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag, 'type' => $type),
-            '<%tag%> must contain <%type%> defining the %type% to be used');
-    }
-
-    function _cannotConflictWithAllOs($type)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag),
-            '%tag% cannot conflict with all OSes');
-    }
-
-    function _invalidDepGroupName($name)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
-            'Invalid dependency group name "%name%"');
-    }
-
-    function _multipleToplevelDirNotAllowed()
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array(),
-            'Multiple top-level <dir> tags are not allowed.  Enclose them ' .
-                'in a <dir name="/">');
-    }
-
-    function _multipleInstallAs($file)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-            'Only one <install> tag is allowed for file "%file%"');
-    }
-
-    function _ignoreAndInstallAs($file)
-    {
-        $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-            'Cannot have both <ignore> and <install> tags for file "%file%"');
-    }
-
-    function _analyzeBundledPackages()
-    {
-        if (!$this->_isValid) {
-            return false;
-        }
-        if (!$this->_pf->getPackageType() == 'bundle') {
-            return false;
-        }
-        if (!isset($this->_pf->_packageFile)) {
-            return false;
-        }
-        $dir_prefix = dirname($this->_pf->_packageFile);
-        $common = new PEAR_Common;
-        $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') :
-            array($common, 'log');
-        $info = $this->_pf->getContents();
-        $info = $info['bundledpackage'];
-        if (!is_array($info)) {
-            $info = array($info);
-        }
-        $pkg = &new PEAR_PackageFile($this->_pf->_config);
-        foreach ($info as $package) {
-            if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $package)) {
-                $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $package);
-                $this->_isValid = 0;
-                continue;
-            }
-            call_user_func_array($log, array(1, "Analyzing bundled package $package"));
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $ret = $pkg->fromAnyFile($dir_prefix . DIRECTORY_SEPARATOR . $package,
-                PEAR_VALIDATE_NORMAL);
-            PEAR::popErrorHandling();
-            if (PEAR::isError($ret)) {
-                call_user_func_array($log, array(0, "ERROR: package $package is not a valid " .
-                    'package'));
-                $inf = $ret->getUserInfo();
-                if (is_array($inf)) {
-                    foreach ($inf as $err) {
-                        call_user_func_array($log, array(1, $err['message']));
-                    }
-                }
-                return false;
-            }
-        }
-        return true;
-    }
-
-    function _analyzePhpFiles()
-    {
-        if (!$this->_isValid) {
-            return false;
-        }
-        if (!isset($this->_pf->_packageFile)) {
-            $this->_cannotValidateNoPathSet();
-            return false;
-        }
-        $dir_prefix = dirname($this->_pf->_packageFile);
-        $common = new PEAR_Common;
-        $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') :
-            array(&$common, 'log');
-        $info = $this->_pf->getContents();
-        if (!$info || !isset($info['dir']['file'])) {
-            $this->_tagCannotBeEmpty('contents><dir');
-            return false;
-        }
-        $info = $info['dir']['file'];
-        if (isset($info['attribs'])) {
-            $info = array($info);
-        }
-        $provides = array();
-        foreach ($info as $fa) {
-            $fa = $fa['attribs'];
-            $file = $fa['name'];
-            if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
-                $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $file);
-                $this->_isValid = 0;
-                continue;
-            }
-            if (in_array($fa['role'], PEAR_Installer_Role::getPhpRoles()) && $dir_prefix) {
-                call_user_func_array($log, array(1, "Analyzing $file"));
-                $srcinfo = $this->analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
-                if ($srcinfo) {
-                    $provides = array_merge($provides, $this->_buildProvidesArray($srcinfo));
-                }
-            }
-        }
-        $this->_packageName = $pn = $this->_pf->getPackage();
-        $pnl = strlen($pn);
-        foreach ($provides as $key => $what) {
-            if (isset($what['explicit']) || !$what) {
-                // skip conformance checks if the provides entry is
-                // specified in the package.xml file
-                continue;
-            }
-            extract($what);
-            if ($type == 'class') {
-                if (!strncasecmp($name, $pn, $pnl)) {
-                    continue;
-                }
-                $this->_stack->push(__FUNCTION__, 'warning',
-                    array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn),
-                    'in %file%: %type% "%name%" not prefixed with package name "%package%"');
-            } elseif ($type == 'function') {
-                if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
-                    continue;
-                }
-                $this->_stack->push(__FUNCTION__, 'warning',
-                    array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn),
-                    'in %file%: %type% "%name%" not prefixed with package name "%package%"');
-            }
-        }
-        return $this->_isValid;
-    }
-
-    /**
-     * Analyze the source code of the given PHP file
-     *
-     * @param  string Filename of the PHP file
-     * @param  boolean whether to analyze $file as the file contents
-     * @return mixed
-     */
-    function analyzeSourceCode($file, $string = false)
-    {
-        if (!function_exists("token_get_all")) {
-            $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-                'Parser error: token_get_all() function must exist to analyze source code, PHP may have been compiled with --disable-tokenizer');
-            return false;
-        }
-
-        if (!defined('T_DOC_COMMENT')) {
-            define('T_DOC_COMMENT', T_COMMENT);
-        }
-
-        if (!defined('T_INTERFACE')) {
-            define('T_INTERFACE', -1);
-        }
-
-        if (!defined('T_IMPLEMENTS')) {
-            define('T_IMPLEMENTS', -1);
-        }
-
-        if ($string) {
-            $contents = $file;
-        } else {
-            if (!$fp = @fopen($file, "r")) {
-                return false;
-            }
-            fclose($fp);
-            $contents = file_get_contents($file);
-        }
-
-        // Silence this function so we can catch PHP Warnings and show our own custom message
-        $tokens = @token_get_all($contents);
-        if (isset($php_errormsg)) {
-            if (isset($this->_stack)) {
-                $pn = $this->_pf->getPackage();
-                $this->_stack->push(__FUNCTION__, 'warning',
-                        array('file' => $file, 'package' => $pn),
-                        'in %file%: Could not process file for unkown reasons,' .
-                        ' possibly a PHP parse error in %file% from %package%');
-            }
-        }
-/*
-        for ($i = 0; $i < sizeof($tokens); $i++) {
-            @list($token, $data) = $tokens[$i];
-            if (is_string($token)) {
-                var_dump($token);
-            } else {
-                print token_name($token) . ' ';
-                var_dump(rtrim($data));
-            }
-        }
-*/
-        $look_for = 0;
-        $paren_level = 0;
-        $bracket_level = 0;
-        $brace_level = 0;
-        $lastphpdoc = '';
-        $current_class = '';
-        $current_interface = '';
-        $current_class_level = -1;
-        $current_function = '';
-        $current_function_level = -1;
-        $declared_classes = array();
-        $declared_interfaces = array();
-        $declared_functions = array();
-        $declared_methods = array();
-        $used_classes = array();
-        $used_functions = array();
-        $extends = array();
-        $implements = array();
-        $nodeps = array();
-        $inquote = false;
-        $interface = false;
-        for ($i = 0; $i < sizeof($tokens); $i++) {
-            if (is_array($tokens[$i])) {
-                list($token, $data) = $tokens[$i];
-            } else {
-                $token = $tokens[$i];
-                $data = '';
-            }
-
-            if ($inquote) {
-                if ($token != '"' && $token != T_END_HEREDOC) {
-                    continue;
-                } else {
-                    $inquote = false;
-                    continue;
-                }
-            }
-
-            switch ($token) {
-                case T_WHITESPACE :
-                    continue;
-                case ';':
-                    if ($interface) {
-                        $current_function = '';
-                        $current_function_level = -1;
-                    }
-                    break;
-                case '"':
-                case T_START_HEREDOC:
-                    $inquote = true;
-                    break;
-                case T_CURLY_OPEN:
-                case T_DOLLAR_OPEN_CURLY_BRACES:
-                case '{': $brace_level++; continue 2;
-                case '}':
-                    $brace_level--;
-                    if ($current_class_level == $brace_level) {
-                        $current_class = '';
-                        $current_class_level = -1;
-                    }
-                    if ($current_function_level == $brace_level) {
-                        $current_function = '';
-                        $current_function_level = -1;
-                    }
-                    continue 2;
-                case '[': $bracket_level++; continue 2;
-                case ']': $bracket_level--; continue 2;
-                case '(': $paren_level++;   continue 2;
-                case ')': $paren_level--;   continue 2;
-                case T_INTERFACE:
-                    $interface = true;
-                case T_CLASS:
-                    if (($current_class_level != -1) || ($current_function_level != -1)) {
-                        if (isset($this->_stack)) {
-                            $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
-                            'Parser error: invalid PHP found in file "%file%"');
-                        } else {
-                            PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"",
-                                PEAR_COMMON_ERROR_INVALIDPHP);
-                        }
-
-                        return false;
-                    }
-                case T_FUNCTION:
-                case T_NEW:
-                case T_EXTENDS:
-                case T_IMPLEMENTS:
-                    $look_for = $token;
-                    continue 2;
-                case T_STRING:
-                    if (version_compare(zend_version(), '2.0', '<')) {
-                        if (in_array(strtolower($data),
-                            array('public', 'private', 'protected', 'abstract',
-                                  'interface', 'implements', 'throw')
-                                 )
-                        ) {
-                            if (isset($this->_stack)) {
-                                $this->_stack->push(__FUNCTION__, 'warning', array(
-                                    'file' => $file),
-                                    'Error, PHP5 token encountered in %file%,' .
-                                    ' analysis should be in PHP5');
-                            } else {
-                                PEAR::raiseError('Error: PHP5 token encountered in ' . $file .
-                                    'packaging should be done in PHP 5');
-                                return false;
-                            }
-                        }
-                    }
-
-                    if ($look_for == T_CLASS) {
-                        $current_class = $data;
-                        $current_class_level = $brace_level;
-                        $declared_classes[] = $current_class;
-                    } elseif ($look_for == T_INTERFACE) {
-                        $current_interface = $data;
-                        $current_class_level = $brace_level;
-                        $declared_interfaces[] = $current_interface;
-                    } elseif ($look_for == T_IMPLEMENTS) {
-                        $implements[$current_class] = $data;
-                    } elseif ($look_for == T_EXTENDS) {
-                        $extends[$current_class] = $data;
-                    } elseif ($look_for == T_FUNCTION) {
-                        if ($current_class) {
-                            $current_function = "$current_class::$data";
-                            $declared_methods[$current_class][] = $data;
-                        } elseif ($current_interface) {
-                            $current_function = "$current_interface::$data";
-                            $declared_methods[$current_interface][] = $data;
-                        } else {
-                            $current_function = $data;
-                            $declared_functions[] = $current_function;
-                        }
-
-                        $current_function_level = $brace_level;
-                        $m = array();
-                    } elseif ($look_for == T_NEW) {
-                        $used_classes[$data] = true;
-                    }
-
-                    $look_for = 0;
-                    continue 2;
-                case T_VARIABLE:
-                    $look_for = 0;
-                    continue 2;
-                case T_DOC_COMMENT:
-                case T_COMMENT:
-                    if (preg_match('!^/\*\*\s!', $data)) {
-                        $lastphpdoc = $data;
-                        if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
-                            $nodeps = array_merge($nodeps, $m[1]);
-                        }
-                    }
-                    continue 2;
-                case T_DOUBLE_COLON:
-                    if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) {
-                        if (isset($this->_stack)) {
-                            $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file),
-                                'Parser error: invalid PHP found in file "%file%"');
-                        } else {
-                            PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"",
-                                PEAR_COMMON_ERROR_INVALIDPHP);
-                        }
-
-                        return false;
-                    }
-
-                    $class = $tokens[$i - 1][1];
-                    if (strtolower($class) != 'parent') {
-                        $used_classes[$class] = true;
-                    }
-
-                    continue 2;
-            }
-        }
-
-        return array(
-            "source_file" => $file,
-            "declared_classes" => $declared_classes,
-            "declared_interfaces" => $declared_interfaces,
-            "declared_methods" => $declared_methods,
-            "declared_functions" => $declared_functions,
-            "used_classes" => array_diff(array_keys($used_classes), $nodeps),
-            "inheritance" => $extends,
-            "implements" => $implements,
-        );
-    }
-
-    /**
-     * Build a "provides" array from data returned by
-     * analyzeSourceCode().  The format of the built array is like
-     * this:
-     *
-     *  array(
-     *    'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
-     *    ...
-     *  )
-     *
-     *
-     * @param array $srcinfo array with information about a source file
-     * as returned by the analyzeSourceCode() method.
-     *
-     * @return void
-     *
-     * @access private
-     *
-     */
-    function _buildProvidesArray($srcinfo)
-    {
-        if (!$this->_isValid) {
-            return array();
-        }
-
-        $providesret = array();
-        $file        = basename($srcinfo['source_file']);
-        $pn          = isset($this->_pf) ? $this->_pf->getPackage() : '';
-        $pnl         = strlen($pn);
-        foreach ($srcinfo['declared_classes'] as $class) {
-            $key = "class;$class";
-            if (isset($providesret[$key])) {
-                continue;
-            }
-
-            $providesret[$key] =
-                array('file'=> $file, 'type' => 'class', 'name' => $class);
-            if (isset($srcinfo['inheritance'][$class])) {
-                $providesret[$key]['extends'] =
-                    $srcinfo['inheritance'][$class];
-            }
-        }
-
-        foreach ($srcinfo['declared_methods'] as $class => $methods) {
-            foreach ($methods as $method) {
-                $function = "$class::$method";
-                $key = "function;$function";
-                if ($method{0} == '_' || !strcasecmp($method, $class) ||
-                    isset($providesret[$key])) {
-                    continue;
-                }
-
-                $providesret[$key] =
-                    array('file'=> $file, 'type' => 'function', 'name' => $function);
-            }
-        }
-
-        foreach ($srcinfo['declared_functions'] as $function) {
-            $key = "function;$function";
-            if ($function{0} == '_' || isset($providesret[$key])) {
-                continue;
-            }
-
-            if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
-                $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
-            }
-
-            $providesret[$key] =
-                array('file'=> $file, 'type' => 'function', 'name' => $function);
-        }
-
-        return $providesret;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/PackageFile/v2/rw.php b/lib/php/PEAR/PackageFile/v2/rw.php
deleted file mode 100644
index 5c974921721e50909b9e03f4cf4ceab2cb690f58..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/PackageFile/v2/rw.php
+++ /dev/null
@@ -1,1604 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0, read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: rw.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a8
- */
-/**
- * For base class
- */
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a8
- */
-class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2
-{
-    /**
-     * @param string Extension name
-     * @return bool success of operation
-     */
-    function setProvidesExtension($extension)
-    {
-        if (in_array($this->getPackageType(),
-              array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
-            if (!isset($this->_packageInfo['providesextension'])) {
-                // ensure that the channel tag is set up in the right location
-                $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                    array('usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
-                    'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                    'bundle', 'changelog'),
-                    $extension, 'providesextension');
-            }
-            $this->_packageInfo['providesextension'] = $extension;
-            return true;
-        }
-        return false;
-    }
-
-    function setPackage($package)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['attribs'])) {
-            $this->_packageInfo = array_merge(array('attribs' => array(
-                                 'version' => '2.0',
-                                 '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',
-                                 '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',
-                             )), $this->_packageInfo);
-        }
-        if (!isset($this->_packageInfo['name'])) {
-            return $this->_packageInfo = array_merge(array('name' => $package),
-                $this->_packageInfo);
-        }
-        $this->_packageInfo['name'] = $package;
-    }
-
-    /**
-     * set this as a package.xml version 2.1
-     * @access private
-     */
-    function _setPackageVersion2_1()
-    {
-        $info = array(
-                                 'version' => '2.1',
-                                 'xmlns' => 'http://pear.php.net/dtd/package-2.1',
-                                 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
-                                 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
-                                 '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.1
-    http://pear.php.net/dtd/package-2.1.xsd',
-                             );
-        if (!isset($this->_packageInfo['attribs'])) {
-            $this->_packageInfo = array_merge(array('attribs' => $info), $this->_packageInfo);
-        } else {
-            $this->_packageInfo['attribs'] = $info;
-        }
-    }
-
-    function setUri($uri)
-    {
-        unset($this->_packageInfo['channel']);
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['uri'])) {
-            // ensure that the uri tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('extends', 'summary', 'description', 'lead',
-                'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                'stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $uri, 'uri');
-        }
-        $this->_packageInfo['uri'] = $uri;
-    }
-
-    function setChannel($channel)
-    {
-        unset($this->_packageInfo['uri']);
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['channel'])) {
-            // ensure that the channel tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('extends', 'summary', 'description', 'lead',
-                'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                'stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $channel, 'channel');
-        }
-        $this->_packageInfo['channel'] = $channel;
-    }
-
-    function setExtends($extends)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['extends'])) {
-            // ensure that the extends tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('summary', 'description', 'lead',
-                'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                'stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $extends, 'extends');
-        }
-        $this->_packageInfo['extends'] = $extends;
-    }
-
-    function setSummary($summary)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['summary'])) {
-            // ensure that the summary tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('description', 'lead',
-                'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                'stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $summary, 'summary');
-        }
-        $this->_packageInfo['summary'] = $summary;
-    }
-
-    function setDescription($desc)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['description'])) {
-            // ensure that the description tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('lead',
-                'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                'stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $desc, 'description');
-        }
-        $this->_packageInfo['description'] = $desc;
-    }
-
-    /**
-     * Adds a new maintainer - no checking of duplicates is performed, use
-     * updatemaintainer for that purpose.
-     */
-    function addMaintainer($role, $handle, $name, $email, $active = 'yes')
-    {
-        if (!in_array($role, array('lead', 'developer', 'contributor', 'helper'))) {
-            return false;
-        }
-        if (isset($this->_packageInfo[$role])) {
-            if (!isset($this->_packageInfo[$role][0])) {
-                $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
-            }
-            $this->_packageInfo[$role][] =
-                array(
-                    'name' => $name,
-                    'user' => $handle,
-                    'email' => $email,
-                    'active' => $active,
-                );
-        } else {
-            $testarr = array('lead',
-                    'developer', 'contributor', 'helper', 'date', 'time', 'version',
-                    'stability', 'license', 'notes', 'contents', 'compatible',
-                    'dependencies', 'providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
-                    'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog');
-            foreach (array('lead', 'developer', 'contributor', 'helper') as $testrole) {
-                array_shift($testarr);
-                if ($role == $testrole) {
-                    break;
-                }
-            }
-            if (!isset($this->_packageInfo[$role])) {
-                // ensure that the extends tag is set up in the right location
-                $this->_packageInfo = $this->_insertBefore($this->_packageInfo, $testarr,
-                    array(), $role);
-            }
-            $this->_packageInfo[$role] =
-                array(
-                    'name' => $name,
-                    'user' => $handle,
-                    'email' => $email,
-                    'active' => $active,
-                );
-        }
-        $this->_isValid = 0;
-    }
-
-    function updateMaintainer($newrole, $handle, $name, $email, $active = 'yes')
-    {
-        $found = false;
-        foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
-            if (!isset($this->_packageInfo[$role])) {
-                continue;
-            }
-            $info = $this->_packageInfo[$role];
-            if (!isset($info[0])) {
-                if ($info['user'] == $handle) {
-                    $found = true;
-                    break;
-                }
-            }
-            foreach ($info as $i => $maintainer) {
-                if ($maintainer['user'] == $handle) {
-                    $found = $i;
-                    break 2;
-                }
-            }
-        }
-        if ($found === false) {
-            return $this->addMaintainer($newrole, $handle, $name, $email, $active);
-        }
-        if ($found !== false) {
-            if ($found === true) {
-                unset($this->_packageInfo[$role]);
-            } else {
-                unset($this->_packageInfo[$role][$found]);
-                $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]);
-            }
-        }
-        $this->addMaintainer($newrole, $handle, $name, $email, $active);
-        $this->_isValid = 0;
-    }
-
-    function deleteMaintainer($handle)
-    {
-        $found = false;
-        foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
-            if (!isset($this->_packageInfo[$role])) {
-                continue;
-            }
-            if (!isset($this->_packageInfo[$role][0])) {
-                $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
-            }
-            foreach ($this->_packageInfo[$role] as $i => $maintainer) {
-                if ($maintainer['user'] == $handle) {
-                    $found = $i;
-                    break;
-                }
-            }
-            if ($found !== false) {
-                unset($this->_packageInfo[$role][$found]);
-                if (!count($this->_packageInfo[$role]) && $role == 'lead') {
-                    $this->_isValid = 0;
-                }
-                if (!count($this->_packageInfo[$role])) {
-                    unset($this->_packageInfo[$role]);
-                    return true;
-                }
-                $this->_packageInfo[$role] =
-                    array_values($this->_packageInfo[$role]);
-                if (count($this->_packageInfo[$role]) == 1) {
-                    $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
-                }
-                return true;
-            }
-            if (count($this->_packageInfo[$role]) == 1) {
-                $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
-            }
-        }
-        return false;
-    }
-
-    function setReleaseVersion($version)
-    {
-        if (isset($this->_packageInfo['version']) &&
-              isset($this->_packageInfo['version']['release'])) {
-            unset($this->_packageInfo['version']['release']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
-            'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'),
-            'release' => array('api')));
-        $this->_isValid = 0;
-    }
-
-    function setAPIVersion($version)
-    {
-        if (isset($this->_packageInfo['version']) &&
-              isset($this->_packageInfo['version']['api'])) {
-            unset($this->_packageInfo['version']['api']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
-            'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'),
-            'api' => array()));
-        $this->_isValid = 0;
-    }
-
-    /**
-     * snapshot|devel|alpha|beta|stable
-     */
-    function setReleaseStability($state)
-    {
-        if (isset($this->_packageInfo['stability']) &&
-              isset($this->_packageInfo['stability']['release'])) {
-            unset($this->_packageInfo['stability']['release']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
-            'stability' => array('license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'),
-            'release' => array('api')));
-        $this->_isValid = 0;
-    }
-
-    /**
-     * @param devel|alpha|beta|stable
-     */
-    function setAPIStability($state)
-    {
-        if (isset($this->_packageInfo['stability']) &&
-              isset($this->_packageInfo['stability']['api'])) {
-            unset($this->_packageInfo['stability']['api']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
-            'stability' => array('license', 'notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'),
-            'api' => array()));
-        $this->_isValid = 0;
-    }
-
-    function setLicense($license, $uri = false, $filesource = false)
-    {
-        if (!isset($this->_packageInfo['license'])) {
-            // ensure that the license tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('notes', 'contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), 0, 'license');
-        }
-        if ($uri || $filesource) {
-            $attribs = array();
-            if ($uri) {
-                $attribs['uri'] = $uri;
-            }
-            $uri = true; // for test below
-            if ($filesource) {
-                $attribs['filesource'] = $filesource;
-            }
-        }
-        $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license;
-        $this->_packageInfo['license'] = $license;
-        $this->_isValid = 0;
-    }
-
-    function setNotes($notes)
-    {
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['notes'])) {
-            // ensure that the notes tag is set up in the right location
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('contents', 'compatible',
-                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
-                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'extbinrelease', 'bundle', 'changelog'), $notes, 'notes');
-        }
-        $this->_packageInfo['notes'] = $notes;
-    }
-
-    /**
-     * This is only used at install-time, after all serialization
-     * is over.
-     * @param string file name
-     * @param string installed path
-     */
-    function setInstalledAs($file, $path)
-    {
-        if ($path) {
-            return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
-        }
-        unset($this->_packageInfo['filelist'][$file]['installed_as']);
-    }
-
-    /**
-     * This is only used at install-time, after all serialization
-     * is over.
-     */
-    function installedFile($file, $atts)
-    {
-        if (isset($this->_packageInfo['filelist'][$file])) {
-            $this->_packageInfo['filelist'][$file] =
-                array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
-        } else {
-            $this->_packageInfo['filelist'][$file] = $atts['attribs'];
-        }
-    }
-
-    /**
-     * Reset the listing of package contents
-     * @param string base installation dir for the whole package, if any
-     */
-    function clearContents($baseinstall = false)
-    {
-        $this->_filesValid = false;
-        $this->_isValid = 0;
-        if (!isset($this->_packageInfo['contents'])) {
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('compatible',
-                    'dependencies', 'providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
-                    'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                    'bundle', 'changelog'), array(), 'contents');
-        }
-        if ($this->getPackageType() != 'bundle') {
-            $this->_packageInfo['contents'] =
-                array('dir' => array('attribs' => array('name' => '/')));
-            if ($baseinstall) {
-                $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall;
-            }
-        } else {
-            $this->_packageInfo['contents'] = array('bundledpackage' => array());
-        }
-    }
-
-    /**
-     * @param string relative path of the bundled package.
-     */
-    function addBundledPackage($path)
-    {
-        if ($this->getPackageType() != 'bundle') {
-            return false;
-        }
-        $this->_filesValid = false;
-        $this->_isValid = 0;
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array(
-                'contents' => array('compatible', 'dependencies', 'providesextension',
-                'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
-                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'bundle', 'changelog'),
-                'bundledpackage' => array()));
-    }
-
-    /**
-     * @param string file name
-     * @param PEAR_Task_Common a read/write task
-     */
-    function addTaskToFile($filename, $task)
-    {
-        if (!method_exists($task, 'getXml')) {
-            return false;
-        }
-        if (!method_exists($task, 'getName')) {
-            return false;
-        }
-        if (!method_exists($task, 'validate')) {
-            return false;
-        }
-        if (!$task->validate()) {
-            return false;
-        }
-        if (!isset($this->_packageInfo['contents']['dir']['file'])) {
-            return false;
-        }
-        $this->getTasksNs(); // discover the tasks namespace if not done already
-        $files = $this->_packageInfo['contents']['dir']['file'];
-        if (!isset($files[0])) {
-            $files = array($files);
-            $ind = false;
-        } else {
-            $ind = true;
-        }
-        foreach ($files as $i => $file) {
-            if (isset($file['attribs'])) {
-                if ($file['attribs']['name'] == $filename) {
-                    if ($ind) {
-                        $t = isset($this->_packageInfo['contents']['dir']['file'][$i]
-                              ['attribs'][$this->_tasksNs .
-                              ':' . $task->getName()]) ?
-                              $this->_packageInfo['contents']['dir']['file'][$i]
-                              ['attribs'][$this->_tasksNs .
-                              ':' . $task->getName()] : false;
-                        if ($t && !isset($t[0])) {
-                            $this->_packageInfo['contents']['dir']['file'][$i]
-                                [$this->_tasksNs . ':' . $task->getName()] = array($t);
-                        }
-                        $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs .
-                            ':' . $task->getName()][] = $task->getXml();
-                    } else {
-                        $t = isset($this->_packageInfo['contents']['dir']['file']
-                              ['attribs'][$this->_tasksNs .
-                              ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file']
-                              ['attribs'][$this->_tasksNs .
-                              ':' . $task->getName()] : false;
-                        if ($t && !isset($t[0])) {
-                            $this->_packageInfo['contents']['dir']['file']
-                                [$this->_tasksNs . ':' . $task->getName()] = array($t);
-                        }
-                        $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs .
-                            ':' . $task->getName()][] = $task->getXml();
-                    }
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @param string path to the file
-     * @param string filename
-     * @param array extra attributes
-     */
-    function addFile($dir, $file, $attrs)
-    {
-        if ($this->getPackageType() == 'bundle') {
-            return false;
-        }
-        $this->_filesValid = false;
-        $this->_isValid = 0;
-        $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
-        if ($dir == '/' || $dir == '') {
-            $dir = '';
-        } else {
-            $dir .= '/';
-        }
-        $attrs['name'] = $dir . $file;
-        if (!isset($this->_packageInfo['contents'])) {
-            // ensure that the contents tag is set up
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
-                array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask',
-                'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
-                'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'bundle', 'changelog'), array(), 'contents');
-        }
-        if (isset($this->_packageInfo['contents']['dir']['file'])) {
-            if (!isset($this->_packageInfo['contents']['dir']['file'][0])) {
-                $this->_packageInfo['contents']['dir']['file'] =
-                    array($this->_packageInfo['contents']['dir']['file']);
-            }
-            $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs;
-        } else {
-            $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs;
-        }
-    }
-
-    /**
-     * @param string Dependent package name
-     * @param string Dependent package's channel name
-     * @param string minimum version of specified package that this release is guaranteed to be
-     *               compatible with
-     * @param string maximum version of specified package that this release is guaranteed to be
-     *               compatible with
-     * @param string versions of specified package that this release is not compatible with
-     */
-    function addCompatiblePackage($name, $channel, $min, $max, $exclude = false)
-    {
-        $this->_isValid = 0;
-        $set = array(
-            'name' => $name,
-            'channel' => $channel,
-            'min' => $min,
-            'max' => $max,
-        );
-        if ($exclude) {
-            $set['exclude'] = $exclude;
-        }
-        $this->_isValid = 0;
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
-                'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
-            ));
-    }
-
-    /**
-     * Removes the <usesrole> tag entirely
-     */
-    function resetUsesrole()
-    {
-        if (isset($this->_packageInfo['usesrole'])) {
-            unset($this->_packageInfo['usesrole']);
-        }
-    }
-
-    /**
-     * @param string
-     * @param string package name or uri
-     * @param string channel name if non-uri
-     */
-    function addUsesrole($role, $packageOrUri, $channel = false) {
-        $set = array('role' => $role);
-        if ($channel) {
-            $set['package'] = $packageOrUri;
-            $set['channel'] = $channel;
-        } else {
-            $set['uri'] = $packageOrUri;
-        }
-        $this->_isValid = 0;
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
-                'usesrole' => array('usestask', 'srcpackage', 'srcuri',
-                    'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
-            ));
-    }
-
-    /**
-     * Removes the <usestask> tag entirely
-     */
-    function resetUsestask()
-    {
-        if (isset($this->_packageInfo['usestask'])) {
-            unset($this->_packageInfo['usestask']);
-        }
-    }
-
-
-    /**
-     * @param string
-     * @param string package name or uri
-     * @param string channel name if non-uri
-     */
-    function addUsestask($task, $packageOrUri, $channel = false) {
-        $set = array('task' => $task);
-        if ($channel) {
-            $set['package'] = $packageOrUri;
-            $set['channel'] = $channel;
-        } else {
-            $set['uri'] = $packageOrUri;
-        }
-        $this->_isValid = 0;
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
-                'usestask' => array('srcpackage', 'srcuri',
-                    'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
-            ));
-    }
-
-    /**
-     * Remove all compatible tags
-     */
-    function clearCompatible()
-    {
-        unset($this->_packageInfo['compatible']);
-    }
-
-    /**
-     * Reset dependencies prior to adding new ones
-     */
-    function clearDeps()
-    {
-        if (!isset($this->_packageInfo['dependencies'])) {
-            $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
-                array(
-                    'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                        'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                        'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')));
-        }
-        $this->_packageInfo['dependencies'] = array();
-    }
-
-    /**
-     * @param string minimum PHP version allowed
-     * @param string maximum PHP version allowed
-     * @param array $exclude incompatible PHP versions
-     */
-    function setPhpDep($min, $max = false, $exclude = false)
-    {
-        $this->_isValid = 0;
-        $dep =
-            array(
-                'min' => $min,
-            );
-        if ($max) {
-            $dep['max'] = $max;
-        }
-        if ($exclude) {
-            if (count($exclude) == 1) {
-                $exclude = $exclude[0];
-            }
-            $dep['exclude'] = $exclude;
-        }
-        if (isset($this->_packageInfo['dependencies']['required']['php'])) {
-            $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
-            $this->_packageInfo['dependencies']['required']['php']),
-                'warning: PHP dependency already exists, overwriting');
-            unset($this->_packageInfo['dependencies']['required']['php']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch')
-            ));
-        return true;
-    }
-
-    /**
-     * @param string minimum allowed PEAR installer version
-     * @param string maximum allowed PEAR installer version
-     * @param string recommended PEAR installer version
-     * @param array incompatible version of the PEAR installer
-     */
-    function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false)
-    {
-        $this->_isValid = 0;
-        $dep =
-            array(
-                'min' => $min,
-            );
-        if ($max) {
-            $dep['max'] = $max;
-        }
-        if ($recommended) {
-            $dep['recommended'] = $recommended;
-        }
-        if ($exclude) {
-            if (count($exclude) == 1) {
-                $exclude = $exclude[0];
-            }
-            $dep['exclude'] = $exclude;
-        }
-        if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) {
-            $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
-            $this->_packageInfo['dependencies']['required']['pearinstaller']),
-                'warning: PEAR Installer dependency already exists, overwriting');
-            unset($this->_packageInfo['dependencies']['required']['pearinstaller']);
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * Mark a package as conflicting with this package
-     * @param string package name
-     * @param string package channel
-     * @param string extension this package provides, if any
-     * @param string|false minimum version required
-     * @param string|false maximum version allowed
-     * @param array|false versions to exclude from installation
-     */
-    function addConflictingPackageDepWithChannel($name, $channel,
-                $providesextension = false, $min = false, $max = false, $exclude = false)
-    {
-        $this->_isValid = 0;
-        $dep = $this->_constructDep($name, $channel, false, $min, $max, false,
-            $exclude, $providesextension, false, true);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'package' => array('subpackage', 'extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * Mark a package as conflicting with this package
-     * @param string package name
-     * @param string package channel
-     * @param string extension this package provides, if any
-     */
-    function addConflictingPackageDepWithUri($name, $uri, $providesextension = false)
-    {
-        $this->_isValid = 0;
-        $dep =
-            array(
-                'name' => $name,
-                'uri' => $uri,
-                'conflicts' => '',
-            );
-        if ($providesextension) {
-            $dep['providesextension'] = $providesextension;
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'package' => array('subpackage', 'extension', 'os', 'arch')
-            ));
-    }
-
-    function addDependencyGroup($name, $hint)
-    {
-        $this->_isValid = 0;
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo,
-            array('attribs' => array('name' => $name, 'hint' => $hint)),
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'group' => array(),
-            ));
-    }
-
-    /**
-     * @param string package name
-     * @param string|false channel name, false if this is a uri
-     * @param string|false uri name, false if this is a channel
-     * @param string|false minimum version required
-     * @param string|false maximum version allowed
-     * @param string|false recommended installation version
-     * @param array|false versions to exclude from installation
-     * @param string extension this package provides, if any
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     * @param bool if true, tells the installer to negate this dependency (conflicts)
-     * @return array
-     * @access private
-     */
-    function _constructDep($name, $channel, $uri, $min, $max, $recommended, $exclude,
-                           $providesextension = false, $nodefault = false,
-                           $conflicts = false)
-    {
-        $dep =
-            array(
-                'name' => $name,
-            );
-        if ($channel) {
-            $dep['channel'] = $channel;
-        } elseif ($uri) {
-            $dep['uri'] = $uri;
-        }
-        if ($min) {
-            $dep['min'] = $min;
-        }
-        if ($max) {
-            $dep['max'] = $max;
-        }
-        if ($recommended) {
-            $dep['recommended'] = $recommended;
-        }
-        if ($exclude) {
-            if (is_array($exclude) && count($exclude) == 1) {
-                $exclude = $exclude[0];
-            }
-            $dep['exclude'] = $exclude;
-        }
-        if ($conflicts) {
-            $dep['conflicts'] = '';
-        }
-        if ($nodefault) {
-            $dep['nodefault'] = '';
-        }
-        if ($providesextension) {
-            $dep['providesextension'] = $providesextension;
-        }
-        return $dep;
-    }
-
-    /**
-     * @param package|subpackage
-     * @param string group name
-     * @param string package name
-     * @param string package channel
-     * @param string minimum version
-     * @param string maximum version
-     * @param string recommended version
-     * @param array|false optional excluded versions
-     * @param string extension this package provides, if any
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     * @return bool false if the dependency group has not been initialized with
-     *              {@link addDependencyGroup()}, or a subpackage is added with
-     *              a providesextension
-     */
-    function addGroupPackageDepWithChannel($type, $groupname, $name, $channel, $min = false,
-                                      $max = false, $recommended = false, $exclude = false,
-                                      $providesextension = false, $nodefault = false)
-    {
-        if ($type == 'subpackage' && $providesextension) {
-            return false; // subpackages must be php packages
-        }
-        $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
-            $providesextension, $nodefault);
-        return $this->_addGroupDependency($type, $dep, $groupname);
-    }
-
-    /**
-     * @param package|subpackage
-     * @param string group name
-     * @param string package name
-     * @param string package uri
-     * @param string extension this package provides, if any
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     * @return bool false if the dependency group has not been initialized with
-     *              {@link addDependencyGroup()}
-     */
-    function addGroupPackageDepWithURI($type, $groupname, $name, $uri, $providesextension = false,
-                                       $nodefault = false)
-    {
-        if ($type == 'subpackage' && $providesextension) {
-            return false; // subpackages must be php packages
-        }
-        $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
-            $providesextension, $nodefault);
-        return $this->_addGroupDependency($type, $dep, $groupname);
-    }
-
-    /**
-     * @param string group name (must be pre-existing)
-     * @param string extension name
-     * @param string minimum version allowed
-     * @param string maximum version allowed
-     * @param string recommended version
-     * @param array incompatible versions
-     */
-    function addGroupExtensionDep($groupname, $name, $min = false, $max = false,
-                                         $recommended = false, $exclude = false)
-    {
-        $this->_isValid = 0;
-        $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
-        return $this->_addGroupDependency('extension', $dep, $groupname);
-    }
-
-    /**
-     * @param package|subpackage|extension
-     * @param array dependency contents
-     * @param string name of the dependency group to add this to
-     * @return boolean
-     * @access private
-     */
-    function _addGroupDependency($type, $dep, $groupname)
-    {
-        $arr = array('subpackage', 'extension');
-        if ($type != 'package') {
-            array_shift($arr);
-        }
-        if ($type == 'extension') {
-            array_shift($arr);
-        }
-        if (!isset($this->_packageInfo['dependencies']['group'])) {
-            return false;
-        } else {
-            if (!isset($this->_packageInfo['dependencies']['group'][0])) {
-                if ($this->_packageInfo['dependencies']['group']['attribs']['name'] == $groupname) {
-                    $this->_packageInfo['dependencies']['group'] = $this->_mergeTag(
-                        $this->_packageInfo['dependencies']['group'], $dep,
-                        array(
-                            $type => $arr
-                        ));
-                    $this->_isValid = 0;
-                    return true;
-                } else {
-                    return false;
-                }
-            } else {
-                foreach ($this->_packageInfo['dependencies']['group'] as $i => $group) {
-                    if ($group['attribs']['name'] == $groupname) {
-                    $this->_packageInfo['dependencies']['group'][$i] = $this->_mergeTag(
-                        $this->_packageInfo['dependencies']['group'][$i], $dep,
-                        array(
-                            $type => $arr
-                        ));
-                        $this->_isValid = 0;
-                        return true;
-                    }
-                }
-                return false;
-            }
-        }
-    }
-
-    /**
-     * @param optional|required
-     * @param string package name
-     * @param string package channel
-     * @param string minimum version
-     * @param string maximum version
-     * @param string recommended version
-     * @param string extension this package provides, if any
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     * @param array|false optional excluded versions
-     */
-    function addPackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
-                                      $recommended = false, $exclude = false,
-                                      $providesextension = false, $nodefault = false)
-    {
-        if (!in_array($type, array('optional', 'required'), true)) {
-            $type = 'required';
-        }
-        $this->_isValid = 0;
-        $arr = array('optional', 'group');
-        if ($type != 'required') {
-            array_shift($arr);
-        }
-        $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
-            $providesextension, $nodefault);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                $type => $arr,
-                'package' => array('subpackage', 'extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * @param optional|required
-     * @param string name of the package
-     * @param string uri of the package
-     * @param string extension this package provides, if any
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     */
-    function addPackageDepWithUri($type, $name, $uri, $providesextension = false,
-                                  $nodefault = false)
-    {
-        $this->_isValid = 0;
-        $arr = array('optional', 'group');
-        if ($type != 'required') {
-            array_shift($arr);
-        }
-        $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
-            $providesextension, $nodefault);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                $type => $arr,
-                'package' => array('subpackage', 'extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * @param optional|required optional, required
-     * @param string package name
-     * @param string package channel
-     * @param string minimum version
-     * @param string maximum version
-     * @param string recommended version
-     * @param array incompatible versions
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     */
-    function addSubpackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
-                                         $recommended = false, $exclude = false,
-                                         $nodefault = false)
-    {
-        $this->_isValid = 0;
-        $arr = array('optional', 'group');
-        if ($type != 'required') {
-            array_shift($arr);
-        }
-        $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
-            $nodefault);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                $type => $arr,
-                'subpackage' => array('extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * @param optional|required optional, required
-     * @param string package name
-     * @param string package uri for download
-     * @param bool if true, tells the installer to ignore the default optional dependency group
-     *             when installing this package
-     */
-    function addSubpackageDepWithUri($type, $name, $uri, $nodefault = false)
-    {
-        $this->_isValid = 0;
-        $arr = array('optional', 'group');
-        if ($type != 'required') {
-            array_shift($arr);
-        }
-        $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $nodefault);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                $type => $arr,
-                'subpackage' => array('extension', 'os', 'arch')
-            ));
-    }
-
-    /**
-     * @param optional|required optional, required
-     * @param string extension name
-     * @param string minimum version
-     * @param string maximum version
-     * @param string recommended version
-     * @param array incompatible versions
-     */
-    function addExtensionDep($type, $name, $min = false, $max = false, $recommended = false,
-                             $exclude = false)
-    {
-        $this->_isValid = 0;
-        $arr = array('optional', 'group');
-        if ($type != 'required') {
-            array_shift($arr);
-        }
-        $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                $type => $arr,
-                'extension' => array('os', 'arch')
-            ));
-    }
-
-    /**
-     * @param string Operating system name
-     * @param boolean true if this package cannot be installed on this OS
-     */
-    function addOsDep($name, $conflicts = false)
-    {
-        $this->_isValid = 0;
-        $dep = array('name' => $name);
-        if ($conflicts) {
-            $dep['conflicts'] = '';
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'os' => array('arch')
-            ));
-    }
-
-    /**
-     * @param string Architecture matching pattern
-     * @param boolean true if this package cannot be installed on this architecture
-     */
-    function addArchDep($pattern, $conflicts = false)
-    {
-        $this->_isValid = 0;
-        $dep = array('pattern' => $pattern);
-        if ($conflicts) {
-            $dep['conflicts'] = '';
-        }
-        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
-            array(
-                'dependencies' => array('providesextension', 'usesrole', 'usestask',
-                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
-                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
-                'required' => array('optional', 'group'),
-                'arch' => array()
-            ));
-    }
-
-    /**
-     * Set the kind of package, and erase all release tags
-     *
-     * - a php package is a PEAR-style package
-     * - an extbin package is a PECL-style extension binary
-     * - an extsrc package is a PECL-style source for a binary
-     * - an zendextbin package is a PECL-style zend extension binary
-     * - an zendextsrc package is a PECL-style source for a zend extension binary
-     * - a bundle package is a collection of other pre-packaged packages
-     * @param php|extbin|extsrc|zendextsrc|zendextbin|bundle
-     * @return bool success
-     */
-    function setPackageType($type)
-    {
-        $this->_isValid = 0;
-        if (!in_array($type, array('php', 'extbin', 'extsrc', 'zendextsrc',
-                                   'zendextbin', 'bundle'))) {
-            return false;
-        }
-
-        if (in_array($type, array('zendextsrc', 'zendextbin'))) {
-            $this->_setPackageVersion2_1();
-        }
-
-        if ($type != 'bundle') {
-            $type .= 'release';
-        }
-
-        foreach (array('phprelease', 'extbinrelease', 'extsrcrelease',
-                       'zendextsrcrelease', 'zendextbinrelease', 'bundle') as $test) {
-            unset($this->_packageInfo[$test]);
-        }
-
-        if (!isset($this->_packageInfo[$type])) {
-            // ensure that the release tag is set up
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('changelog'),
-                array(), $type);
-        }
-
-        $this->_packageInfo[$type] = array();
-        return true;
-    }
-
-    /**
-     * @return bool true if package type is set up
-     */
-    function addRelease()
-    {
-        if ($type = $this->getPackageType()) {
-            if ($type != 'bundle') {
-                $type .= 'release';
-            }
-            $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
-                array($type => array('changelog')));
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get the current release tag in order to add to it
-     * @param bool returns only releases that have installcondition if true
-     * @return array|null
-     */
-    function &_getCurrentRelease($strict = true)
-    {
-        if ($p = $this->getPackageType()) {
-            if ($strict) {
-                if ($p == 'extsrc' || $p == 'zendextsrc') {
-                    $a = null;
-                    return $a;
-                }
-            }
-            if ($p != 'bundle') {
-                $p .= 'release';
-            }
-            if (isset($this->_packageInfo[$p][0])) {
-                return $this->_packageInfo[$p][count($this->_packageInfo[$p]) - 1];
-            } else {
-                return $this->_packageInfo[$p];
-            }
-        } else {
-            $a = null;
-            return $a;
-        }
-    }
-
-    /**
-     * Add a file to the current release that should be installed under a different name
-     * @param string <contents> path to file
-     * @param string name the file should be installed as
-     */
-    function addInstallAs($path, $as)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        $r = $this->_mergeTag($r, array('attribs' => array('name' => $path, 'as' => $as)),
-            array(
-                'filelist' => array(),
-                'install' => array('ignore')
-            ));
-    }
-
-    /**
-     * Add a file to the current release that should be ignored
-     * @param string <contents> path to file
-     * @return bool success of operation
-     */
-    function addIgnore($path)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        $r = $this->_mergeTag($r, array('attribs' => array('name' => $path)),
-            array(
-                'filelist' => array(),
-                'ignore' => array()
-            ));
-    }
-
-    /**
-     * Add an extension binary package for this extension source code release
-     *
-     * Note that the package must be from the same channel as the extension source package
-     * @param string
-     */
-    function addBinarypackage($package)
-    {
-        if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
-            return false;
-        }
-        $r = &$this->_getCurrentRelease(false);
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        $r = $this->_mergeTag($r, $package,
-            array(
-                'binarypackage' => array('filelist'),
-            ));
-    }
-
-    /**
-     * Add a configureoption to an extension source package
-     * @param string
-     * @param string
-     * @param string
-     */
-    function addConfigureOption($name, $prompt, $default = null)
-    {
-        if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
-            return false;
-        }
-
-        $r = &$this->_getCurrentRelease(false);
-        if ($r === null) {
-            return false;
-        }
-
-        $opt = array('attribs' => array('name' => $name, 'prompt' => $prompt));
-        if ($default !== null) {
-            $opt['attribs']['default'] = $default;
-        }
-
-        $this->_isValid = 0;
-        $r = $this->_mergeTag($r, $opt,
-            array(
-                'configureoption' => array('binarypackage', 'filelist'),
-            ));
-    }
-
-    /**
-     * Set an installation condition based on php version for the current release set
-     * @param string minimum version
-     * @param string maximum version
-     * @param false|array incompatible versions of PHP
-     */
-    function setPhpInstallCondition($min, $max, $exclude = false)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        if (isset($r['installconditions']['php'])) {
-            unset($r['installconditions']['php']);
-        }
-        $dep = array('min' => $min, 'max' => $max);
-        if ($exclude) {
-            if (is_array($exclude) && count($exclude) == 1) {
-                $exclude = $exclude[0];
-            }
-            $dep['exclude'] = $exclude;
-        }
-        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('configureoption', 'binarypackage',
-                        'filelist'),
-                    'php' => array('extension', 'os', 'arch')
-                ));
-        } else {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('filelist'),
-                    'php' => array('extension', 'os', 'arch')
-                ));
-        }
-    }
-
-    /**
-     * @param optional|required optional, required
-     * @param string extension name
-     * @param string minimum version
-     * @param string maximum version
-     * @param string recommended version
-     * @param array incompatible versions
-     */
-    function addExtensionInstallCondition($name, $min = false, $max = false, $recommended = false,
-                                          $exclude = false)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
-        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('configureoption', 'binarypackage',
-                        'filelist'),
-                    'extension' => array('os', 'arch')
-                ));
-        } else {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('filelist'),
-                    'extension' => array('os', 'arch')
-                ));
-        }
-    }
-
-    /**
-     * Set an installation condition based on operating system for the current release set
-     * @param string OS name
-     * @param bool whether this OS is incompatible with the current release
-     */
-    function setOsInstallCondition($name, $conflicts = false)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        if (isset($r['installconditions']['os'])) {
-            unset($r['installconditions']['os']);
-        }
-        $dep = array('name' => $name);
-        if ($conflicts) {
-            $dep['conflicts'] = '';
-        }
-        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('configureoption', 'binarypackage',
-                        'filelist'),
-                    'os' => array('arch')
-                ));
-        } else {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('filelist'),
-                    'os' => array('arch')
-                ));
-        }
-    }
-
-    /**
-     * Set an installation condition based on architecture for the current release set
-     * @param string architecture pattern
-     * @param bool whether this arch is incompatible with the current release
-     */
-    function setArchInstallCondition($pattern, $conflicts = false)
-    {
-        $r = &$this->_getCurrentRelease();
-        if ($r === null) {
-            return false;
-        }
-        $this->_isValid = 0;
-        if (isset($r['installconditions']['arch'])) {
-            unset($r['installconditions']['arch']);
-        }
-        $dep = array('pattern' => $pattern);
-        if ($conflicts) {
-            $dep['conflicts'] = '';
-        }
-        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('configureoption', 'binarypackage',
-                        'filelist'),
-                    'arch' => array()
-                ));
-        } else {
-            $r = $this->_mergeTag($r, $dep,
-                array(
-                    'installconditions' => array('filelist'),
-                    'arch' => array()
-                ));
-        }
-    }
-
-    /**
-     * For extension binary releases, this is used to specify either the
-     * static URI to a source package, or the package name and channel of the extsrc/zendextsrc
-     * package it is based on.
-     * @param string Package name, or full URI to source package (extsrc/zendextsrc type)
-     */
-    function setSourcePackage($packageOrUri)
-    {
-        $this->_isValid = 0;
-        if (isset($this->_packageInfo['channel'])) {
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',
-                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'bundle', 'changelog'),
-                $packageOrUri, 'srcpackage');
-        } else {
-            $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',
-                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
-                'bundle', 'changelog'), $packageOrUri, 'srcuri');
-        }
-    }
-
-    /**
-     * Generate a valid change log entry from the current package.xml
-     * @param string|false
-     */
-    function generateChangeLogEntry($notes = false)
-    {
-        return array(
-            'version' =>
-                array(
-                    'release' => $this->getVersion('release'),
-                    'api' => $this->getVersion('api'),
-                    ),
-            'stability' =>
-                $this->getStability(),
-            'date' => $this->getDate(),
-            'license' => $this->getLicense(true),
-            'notes' => $notes ? $notes : $this->getNotes()
-            );
-    }
-
-    /**
-     * @param string release version to set change log notes for
-     * @param array output of {@link generateChangeLogEntry()}
-     */
-    function setChangelogEntry($releaseversion, $contents)
-    {
-        if (!isset($this->_packageInfo['changelog'])) {
-            $this->_packageInfo['changelog']['release'] = $contents;
-            return;
-        }
-        if (!isset($this->_packageInfo['changelog']['release'][0])) {
-            if ($this->_packageInfo['changelog']['release']['version']['release'] == $releaseversion) {
-                $this->_packageInfo['changelog']['release'] = array(
-                    $this->_packageInfo['changelog']['release']);
-            } else {
-                $this->_packageInfo['changelog']['release'] = array(
-                    $this->_packageInfo['changelog']['release']);
-                return $this->_packageInfo['changelog']['release'][] = $contents;
-            }
-        }
-        foreach($this->_packageInfo['changelog']['release'] as $index => $changelog) {
-            if (isset($changelog['version']) &&
-                  strnatcasecmp($changelog['version']['release'], $releaseversion) == 0) {
-                $curlog = $index;
-            }
-        }
-        if (isset($curlog)) {
-            $this->_packageInfo['changelog']['release'][$curlog] = $contents;
-        } else {
-            $this->_packageInfo['changelog']['release'][] = $contents;
-        }
-    }
-
-    /**
-     * Remove the changelog entirely
-     */
-    function clearChangeLog()
-    {
-        unset($this->_packageInfo['changelog']);
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Packager.php b/lib/php/PEAR/Packager.php
deleted file mode 100644
index d71f6d126349ec275dfccf7884ec2bc369e37e86..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Packager.php
+++ /dev/null
@@ -1,201 +0,0 @@
-<?php
-/**
- * PEAR_Packager for generating releases
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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: Packager.php 286809 2009-08-04 15:10:26Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Common.php';
-require_once 'PEAR/PackageFile.php';
-require_once 'System.php';
-
-/**
- * Administration class used to make a PEAR release tarball.
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 0.1
- */
-class PEAR_Packager extends PEAR_Common
-{
-    /**
-     * @var PEAR_Registry
-     */
-    var $_registry;
-
-    function package($pkgfile = null, $compress = true, $pkg2 = null)
-    {
-        // {{{ validate supplied package.xml file
-        if (empty($pkgfile)) {
-            $pkgfile = 'package.xml';
-        }
-
-        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-        $pkg  = &new PEAR_PackageFile($this->config, $this->debug);
-        $pf   = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
-        $main = &$pf;
-        PEAR::staticPopErrorHandling();
-        if (PEAR::isError($pf)) {
-            if (is_array($pf->getUserInfo())) {
-                foreach ($pf->getUserInfo() as $error) {
-                    $this->log(0, 'Error: ' . $error['message']);
-                }
-            }
-
-            $this->log(0, $pf->getMessage());
-            return $this->raiseError("Cannot package, errors in package file");
-        }
-
-        foreach ($pf->getValidationWarnings() as $warning) {
-            $this->log(1, 'Warning: ' . $warning['message']);
-        }
-
-        // }}}
-        if ($pkg2) {
-            $this->log(0, 'Attempting to process the second package file');
-            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-            $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL);
-            PEAR::staticPopErrorHandling();
-            if (PEAR::isError($pf2)) {
-                if (is_array($pf2->getUserInfo())) {
-                    foreach ($pf2->getUserInfo() as $error) {
-                        $this->log(0, 'Error: ' . $error['message']);
-                    }
-                }
-                $this->log(0, $pf2->getMessage());
-                return $this->raiseError("Cannot package, errors in second package file");
-            }
-
-            foreach ($pf2->getValidationWarnings() as $warning) {
-                $this->log(1, 'Warning: ' . $warning['message']);
-            }
-
-            if ($pf2->getPackagexmlVersion() == '2.0' ||
-                  $pf2->getPackagexmlVersion() == '2.1'
-            ) {
-                $main  = &$pf2;
-                $other = &$pf;
-            } else {
-                $main  = &$pf;
-                $other = &$pf2;
-            }
-
-            if ($main->getPackagexmlVersion() != '2.0' &&
-                  $main->getPackagexmlVersion() != '2.1') {
-                return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' .
-                    'only package together a package.xml 1.0 and package.xml 2.0');
-            }
-
-            if ($other->getPackagexmlVersion() != '1.0') {
-                return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' .
-                    'only package together a package.xml 1.0 and package.xml 2.0');
-            }
-        }
-
-        $main->setLogger($this);
-        if (!$main->validate(PEAR_VALIDATE_PACKAGING)) {
-            foreach ($main->getValidationWarnings() as $warning) {
-                $this->log(0, 'Error: ' . $warning['message']);
-            }
-            return $this->raiseError("Cannot package, errors in package");
-        }
-
-        foreach ($main->getValidationWarnings() as $warning) {
-            $this->log(1, 'Warning: ' . $warning['message']);
-        }
-
-        if ($pkg2) {
-            $other->setLogger($this);
-            $a = false;
-            if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) {
-                foreach ($other->getValidationWarnings() as $warning) {
-                    $this->log(0, 'Error: ' . $warning['message']);
-                }
-
-                foreach ($main->getValidationWarnings() as $warning) {
-                    $this->log(0, 'Error: ' . $warning['message']);
-                }
-
-                if ($a) {
-                    return $this->raiseError('The two package.xml files are not equivalent!');
-                }
-
-                return $this->raiseError("Cannot package, errors in package");
-            }
-
-            foreach ($other->getValidationWarnings() as $warning) {
-                $this->log(1, 'Warning: ' . $warning['message']);
-            }
-
-            $gen = &$main->getDefaultGenerator();
-            $tgzfile = $gen->toTgz2($this, $other, $compress);
-            if (PEAR::isError($tgzfile)) {
-                return $tgzfile;
-            }
-
-            $dest_package = basename($tgzfile);
-            $pkgdir       = dirname($pkgfile);
-
-            // TAR the Package -------------------------------------------
-            $this->log(1, "Package $dest_package done");
-            if (file_exists("$pkgdir/CVS/Root")) {
-                $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
-                $cvstag = "RELEASE_$cvsversion";
-                $this->log(1, 'Tag the released code with "pear cvstag ' .
-                    $main->getPackageFile() . '"');
-                $this->log(1, "(or set the CVS tag $cvstag by hand)");
-            } elseif (file_exists("$pkgdir/.svn")) {
-                $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
-                $svntag = $pf->getName() . "-$svnversion";
-                $this->log(1, 'Tag the released code with "pear svntag ' .
-                    $main->getPackageFile() . '"');
-                $this->log(1, "(or set the SVN tag $svntag by hand)");
-            }
-        } else { // this branch is executed for single packagefile packaging
-            $gen = &$pf->getDefaultGenerator();
-            $tgzfile = $gen->toTgz($this, $compress);
-            if (PEAR::isError($tgzfile)) {
-                $this->log(0, $tgzfile->getMessage());
-                return $this->raiseError("Cannot package, errors in package");
-            }
-
-            $dest_package = basename($tgzfile);
-            $pkgdir       = dirname($pkgfile);
-
-            // TAR the Package -------------------------------------------
-            $this->log(1, "Package $dest_package done");
-            if (file_exists("$pkgdir/CVS/Root")) {
-                $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
-                $cvstag = "RELEASE_$cvsversion";
-                $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
-                $this->log(1, "(or set the CVS tag $cvstag by hand)");
-            } elseif (file_exists("$pkgdir/.svn")) {
-                $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
-                $svntag = $pf->getName() . "-$svnversion";
-                $this->log(1, "Tag the released code with `pear svntag $pkgfile'");
-                $this->log(1, "(or set the SVN tag $svntag by hand)");
-            }
-        }
-
-        return $dest_package;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/REST.php b/lib/php/PEAR/REST.php
deleted file mode 100644
index d2ff32b6521adbd206c481c353d1f164078e67f7..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/REST.php
+++ /dev/null
@@ -1,448 +0,0 @@
-<?php
-/**
- * PEAR_REST
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: REST.php 286489 2009-07-29 05:59:08Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * For downloading xml files
- */
-require_once 'PEAR.php';
-require_once 'PEAR/XMLParser.php';
-
-/**
- * Intelligently retrieve data, following hyperlinks if necessary, and re-directing
- * as well
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_REST
-{
-    var $config;
-    var $_options;
-
-    function PEAR_REST(&$config, $options = array())
-    {
-        $this->config   = &$config;
-        $this->_options = $options;
-    }
-
-    /**
-     * Retrieve REST data, but always retrieve the local cache if it is available.
-     *
-     * This is useful for elements that should never change, such as information on a particular
-     * release
-     * @param string full URL to this resource
-     * @param array|false contents of the accept-encoding header
-     * @param boolean     if true, xml will be returned as a string, otherwise, xml will be
-     *                    parsed using PEAR_XMLParser
-     * @return string|array
-     */
-    function retrieveCacheFirst($url, $accept = false, $forcestring = false, $channel = false)
-    {
-        $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
-            md5($url) . 'rest.cachefile';
-
-        if (file_exists($cachefile)) {
-            return unserialize(implode('', file($cachefile)));
-        }
-
-        return $this->retrieveData($url, $accept, $forcestring, $channel);
-    }
-
-    /**
-     * Retrieve a remote REST resource
-     * @param string full URL to this resource
-     * @param array|false contents of the accept-encoding header
-     * @param boolean     if true, xml will be returned as a string, otherwise, xml will be
-     *                    parsed using PEAR_XMLParser
-     * @return string|array
-     */
-    function retrieveData($url, $accept = false, $forcestring = false, $channel = false)
-    {
-        $cacheId = $this->getCacheId($url);
-        if ($ret = $this->useLocalCache($url, $cacheId)) {
-            return $ret;
-        }
-
-        $file = $trieddownload = false;
-        if (!isset($this->_options['offline'])) {
-            $trieddownload = true;
-            $file = $this->downloadHttp($url, $cacheId ? $cacheId['lastChange'] : false, $accept, $channel);
-        }
-
-        if (PEAR::isError($file)) {
-            if ($file->getCode() !== -9276) {
-                return $file;
-            }
-
-            $trieddownload = false;
-            $file = false; // use local copy if available on socket connect error
-        }
-
-        if (!$file) {
-            $ret = $this->getCache($url);
-            if (!PEAR::isError($ret) && $trieddownload) {
-                // reset the age of the cache if the server says it was unmodified
-                $this->saveCache($url, $ret, null, true, $cacheId);
-            }
-
-            return $ret;
-        }
-
-        if (is_array($file)) {
-            $headers      = $file[2];
-            $lastmodified = $file[1];
-            $content      = $file[0];
-        } else {
-            $headers      = array();
-            $lastmodified = false;
-            $content      = $file;
-        }
-
-        if ($forcestring) {
-            $this->saveCache($url, $content, $lastmodified, false, $cacheId);
-            return $content;
-        }
-
-        if (isset($headers['content-type'])) {
-            switch ($headers['content-type']) {
-                case 'text/xml' :
-                case 'application/xml' :
-                case 'text/plain' :
-                    if ($headers['content-type'] === 'text/plain') {
-                        $check = substr($content, 0, 5);
-                        if ($check !== '<?xml') {
-                            break;
-                        }
-                    }
-
-                    $parser = new PEAR_XMLParser;
-                    PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-                    $err = $parser->parse($content);
-                    PEAR::popErrorHandling();
-                    if (PEAR::isError($err)) {
-                        return PEAR::raiseError('Invalid xml downloaded from "' . $url . '": ' .
-                            $err->getMessage());
-                    }
-                    $content = $parser->getData();
-                case 'text/html' :
-                default :
-                    // use it as a string
-            }
-        } else {
-            // assume XML
-            $parser = new PEAR_XMLParser;
-            $parser->parse($content);
-            $content = $parser->getData();
-        }
-
-        $this->saveCache($url, $content, $lastmodified, false, $cacheId);
-        return $content;
-    }
-
-    function useLocalCache($url, $cacheid = null)
-    {
-        if ($cacheid === null) {
-            $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
-                md5($url) . 'rest.cacheid';
-            if (!file_exists($cacheidfile)) {
-                return false;
-            }
-
-            $cacheid = unserialize(implode('', file($cacheidfile)));
-        }
-
-        $cachettl = $this->config->get('cache_ttl');
-        // If cache is newer than $cachettl seconds, we use the cache!
-        if (time() - $cacheid['age'] < $cachettl) {
-            return $this->getCache($url);
-        }
-
-        return false;
-    }
-
-    function getCacheId($url)
-    {
-        $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
-            md5($url) . 'rest.cacheid';
-
-        if (!file_exists($cacheidfile)) {
-            return false;
-        }
-
-        $ret = unserialize(implode('', file($cacheidfile)));
-        return $ret;
-    }
-
-    function getCache($url)
-    {
-        $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
-            md5($url) . 'rest.cachefile';
-
-        if (!file_exists($cachefile)) {
-            return PEAR::raiseError('No cached content available for "' . $url . '"');
-        }
-
-        return unserialize(implode('', file($cachefile)));
-    }
-
-    /**
-     * @param string full URL to REST resource
-     * @param string original contents of the REST resource
-     * @param array  HTTP Last-Modified and ETag headers
-     * @param bool   if true, then the cache id file should be regenerated to
-     *               trigger a new time-to-live value
-     */
-    function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = null)
-    {
-        $cachedir    = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url);
-        $cacheidfile = $cachedir . 'rest.cacheid';
-        $cachefile   = $cachedir . 'rest.cachefile';
-
-        if ($cacheid === null && $nochange) {
-            $cacheid = unserialize(implode('', file($cacheidfile)));
-        }
-
-        $fp = @fopen($cacheidfile, 'wb');
-        if (!$fp) {
-            $cache_dir = $this->config->get('cache_dir');
-            if (is_dir($cache_dir)) {
-                return false;
-            }
-
-            System::mkdir(array('-p', $cache_dir));
-            $fp = @fopen($cacheidfile, 'wb');
-            if (!$fp) {
-                return false;
-            }
-        }
-
-        if ($nochange) {
-            fwrite($fp, serialize(array(
-                'age'        => time(),
-                'lastChange' => $cacheid['lastChange'],
-                ))
-            );
-
-            fclose($fp);
-            return true;
-        }
-
-        fwrite($fp, serialize(array(
-            'age'        => time(),
-            'lastChange' => $lastmodified,
-            ))
-        );
-
-        fclose($fp);
-        $fp = @fopen($cachefile, 'wb');
-        if (!$fp) {
-            if (file_exists($cacheidfile)) {
-                @unlink($cacheidfile);
-            }
-
-            return false;
-        }
-
-        fwrite($fp, serialize($contents));
-        fclose($fp);
-        return true;
-    }
-
-    /**
-     * Efficiently Download a file through HTTP.  Returns downloaded file as a string in-memory
-     * This is best used for small files
-     *
-     * If an HTTP proxy has been configured (http_proxy PEAR_Config
-     * setting), the proxy will be used.
-     *
-     * @param string  $url       the URL to download
-     * @param string  $save_dir  directory to save file in
-     * @param false|string|array $lastmodified header values to check against for caching
-     *                           use false to return the header values from this download
-     * @param false|array $accept Accept headers to send
-     * @return string|array  Returns the contents of the downloaded file or a PEAR
-     *                       error on failure.  If the error is caused by
-     *                       socket-related errors, the error object will
-     *                       have the fsockopen error code available through
-     *                       getCode().  If caching is requested, then return the header
-     *                       values.
-     *
-     * @access public
-     */
-    function downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)
-    {
-        static $redirect = 0;
-        // always reset , so we are clean case of error
-        $wasredirect = $redirect;
-        $redirect = 0;
-
-        $info = parse_url($url);
-        if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) {
-            return PEAR::raiseError('Cannot download non-http URL "' . $url . '"');
-        }
-
-        if (!isset($info['host'])) {
-            return PEAR::raiseError('Cannot download from non-URL "' . $url . '"');
-        }
-
-        $host   = isset($info['host']) ? $info['host'] : null;
-        $port   = isset($info['port']) ? $info['port'] : null;
-        $path   = isset($info['path']) ? $info['path'] : null;
-        $schema = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http';
-
-        $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
-        if ($this->config->get('http_proxy')&&
-              $proxy = parse_url($this->config->get('http_proxy'))
-        ) {
-            $proxy_host = isset($proxy['host']) ? $proxy['host'] : null;
-            if ($schema === 'https') {
-                $proxy_host = 'ssl://' . $proxy_host;
-            }
-
-            $proxy_port   = isset($proxy['port']) ? $proxy['port'] : 8080;
-            $proxy_user   = isset($proxy['user']) ? urldecode($proxy['user']) : null;
-            $proxy_pass   = isset($proxy['pass']) ? urldecode($proxy['pass']) : null;
-            $proxy_schema = (isset($proxy['scheme']) && $proxy['scheme'] == 'https') ? 'https' : 'http';
-        }
-
-        if (empty($port)) {
-            $port = (isset($info['scheme']) && $info['scheme'] == 'https')  ? 443 : 80;
-        }
-
-        if (isset($proxy['host'])) {
-            $request = "GET $url HTTP/1.1\r\n";
-        } else {
-            $request = "GET $path HTTP/1.1\r\n";
-        }
-
-        $request .= "Host: $host:$port\r\n";
-        $ifmodifiedsince = '';
-        if (is_array($lastmodified)) {
-            if (isset($lastmodified['Last-Modified'])) {
-                $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n";
-            }
-
-            if (isset($lastmodified['ETag'])) {
-                $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n";
-            }
-        } else {
-            $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : '');
-        }
-
-        $request .= $ifmodifiedsince .
-            "User-Agent: PEAR/1.9.0/PHP/" . PHP_VERSION . "\r\n";
-
-        $username = $this->config->get('username', null, $channel);
-        $password = $this->config->get('password', null, $channel);
-
-        if ($username && $password) {
-            $tmp = base64_encode("$username:$password");
-            $request .= "Authorization: Basic $tmp\r\n";
-        }
-
-        if ($proxy_host != '' && $proxy_user != '') {
-            $request .= 'Proxy-Authorization: Basic ' .
-                base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n";
-        }
-
-        if ($accept) {
-            $request .= 'Accept: ' . implode(', ', $accept) . "\r\n";
-        }
-
-        $request .= "Accept-Encoding:\r\n";
-        $request .= "Connection: close\r\n";
-        $request .= "\r\n";
-
-        if ($proxy_host != '') {
-            $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr, 15);
-            if (!$fp) {
-                return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", -9276);
-            }
-        } else {
-            if ($schema === 'https') {
-                $host = 'ssl://' . $host;
-            }
-
-            $fp = @fsockopen($host, $port, $errno, $errstr);
-            if (!$fp) {
-                return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
-            }
-        }
-
-        fwrite($fp, $request);
-
-        $headers = array();
-        $reply   = 0;
-        while ($line = trim(fgets($fp, 1024))) {
-            if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) {
-                $headers[strtolower($matches[1])] = trim($matches[2]);
-            } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) {
-                $reply = (int)$matches[1];
-                if ($reply == 304 && ($lastmodified || ($lastmodified === false))) {
-                    return false;
-                }
-
-                if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) {
-                    return PEAR::raiseError("File $schema://$host:$port$path not valid (received: $line)");
-                }
-            }
-        }
-
-        if ($reply != 200) {
-            if (!isset($headers['location'])) {
-                return PEAR::raiseError("File $schema://$host:$port$path not valid (redirected but no location)");
-            }
-
-            if ($wasredirect > 4) {
-                return PEAR::raiseError("File $schema://$host:$port$path not valid (redirection looped more than 5 times)");
-            }
-
-            $redirect = $wasredirect + 1;
-            return $this->downloadHttp($headers['location'], $lastmodified, $accept, $channel);
-        }
-
-        $length = isset($headers['content-length']) ? $headers['content-length'] : -1;
-
-        $data = '';
-        while ($chunk = @fread($fp, 8192)) {
-            $data .= $chunk;
-        }
-        fclose($fp);
-
-        if ($lastmodified === false || $lastmodified) {
-            if (isset($headers['etag'])) {
-                $lastmodified = array('ETag' => $headers['etag']);
-            }
-
-            if (isset($headers['last-modified'])) {
-                if (is_array($lastmodified)) {
-                    $lastmodified['Last-Modified'] = $headers['last-modified'];
-                } else {
-                    $lastmodified = $headers['last-modified'];
-                }
-            }
-
-            return array($data, $lastmodified, $headers);
-        }
-
-        return $data;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/REST/10.php b/lib/php/PEAR/REST/10.php
deleted file mode 100644
index 777610118a8f3f6c19f2cf5c21cf77429e195832..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/REST/10.php
+++ /dev/null
@@ -1,867 +0,0 @@
-<?php
-/**
- * PEAR_REST_10
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: 10.php 287558 2009-08-21 22:21:28Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a12
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-
-/**
- * Implement REST 1.0
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a12
- */
-class PEAR_REST_10
-{
-    /**
-     * @var PEAR_REST
-     */
-    var $_rest;
-    function PEAR_REST_10($config, $options = array())
-    {
-        $this->_rest = &new PEAR_REST($config, $options);
-    }
-
-    /**
-     * Retrieve information about a remote package to be downloaded from a REST server
-     *
-     * @param string $base The uri to prepend to all REST calls
-     * @param array $packageinfo an array of format:
-     * <pre>
-     *  array(
-     *   'package' => 'packagename',
-     *   'channel' => 'channelname',
-     *  ['state' => 'alpha' (or valid state),]
-     *  -or-
-     *  ['version' => '1.whatever']
-     * </pre>
-     * @param string $prefstate Current preferred_state config variable value
-     * @param bool $installed the installed version of this package to compare against
-     * @return array|false|PEAR_Error see {@link _returnDownloadURL()}
-     */
-    function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false)
-    {
-        $states = $this->betterStates($prefstate, true);
-        if (!$states) {
-            return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
-        }
-
-        $channel  = $packageinfo['channel'];
-        $package  = $packageinfo['package'];
-        $state    = isset($packageinfo['state'])   ? $packageinfo['state']   : null;
-        $version  = isset($packageinfo['version']) ? $packageinfo['version'] : null;
-        $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml';
-
-        $info = $this->_rest->retrieveData($restFile, false, false, $channel);
-        if (PEAR::isError($info)) {
-            return PEAR::raiseError('No releases available for package "' .
-                $channel . '/' . $package . '"');
-        }
-
-        if (!isset($info['r'])) {
-            return false;
-        }
-
-        $release = $found = false;
-        if (!is_array($info['r']) || !isset($info['r'][0])) {
-            $info['r'] = array($info['r']);
-        }
-
-        foreach ($info['r'] as $release) {
-            if (!isset($this->_rest->_options['force']) && ($installed &&
-                  version_compare($release['v'], $installed, '<'))) {
-                continue;
-            }
-
-            if (isset($state)) {
-                // try our preferred state first
-                if ($release['s'] == $state) {
-                    $found = true;
-                    break;
-                }
-                // see if there is something newer and more stable
-                // bug #7221
-                if (in_array($release['s'], $this->betterStates($state), true)) {
-                    $found = true;
-                    break;
-                }
-            } elseif (isset($version)) {
-                if ($release['v'] == $version) {
-                    $found = true;
-                    break;
-                }
-            } else {
-                if (in_array($release['s'], $states)) {
-                    $found = true;
-                    break;
-                }
-            }
-        }
-
-        return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel);
-    }
-
-    function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage,
-                               $prefstate = 'stable', $installed = false, $channel = false)
-    {
-        $states = $this->betterStates($prefstate, true);
-        if (!$states) {
-            return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
-        }
-
-        $channel  = $dependency['channel'];
-        $package  = $dependency['name'];
-        $state    = isset($dependency['state'])   ? $dependency['state']   : null;
-        $version  = isset($dependency['version']) ? $dependency['version'] : null;
-        $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml';
-
-        $info = $this->_rest->retrieveData($restFile, false, false, $channel);
-        if (PEAR::isError($info)) {
-            return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package']
-                . '" dependency "' . $channel . '/' . $package . '" has no releases');
-        }
-
-        if (!is_array($info) || !isset($info['r'])) {
-            return false;
-        }
-
-        $exclude = array();
-        $min = $max = $recommended = false;
-        if ($xsdversion == '1.0') {
-            switch ($dependency['rel']) {
-                case 'ge' :
-                    $min = $dependency['version'];
-                break;
-                case 'gt' :
-                    $min = $dependency['version'];
-                    $exclude = array($dependency['version']);
-                break;
-                case 'eq' :
-                    $recommended = $dependency['version'];
-                break;
-                case 'lt' :
-                    $max = $dependency['version'];
-                    $exclude = array($dependency['version']);
-                break;
-                case 'le' :
-                    $max = $dependency['version'];
-                break;
-                case 'ne' :
-                    $exclude = array($dependency['version']);
-                break;
-            }
-        } else {
-            $min = isset($dependency['min']) ? $dependency['min'] : false;
-            $max = isset($dependency['max']) ? $dependency['max'] : false;
-            $recommended = isset($dependency['recommended']) ?
-                $dependency['recommended'] : false;
-            if (isset($dependency['exclude'])) {
-                if (!isset($dependency['exclude'][0])) {
-                    $exclude = array($dependency['exclude']);
-                }
-            }
-        }
-        $release = $found = false;
-        if (!is_array($info['r']) || !isset($info['r'][0])) {
-            $info['r'] = array($info['r']);
-        }
-        foreach ($info['r'] as $release) {
-            if (!isset($this->_rest->_options['force']) && ($installed &&
-                  version_compare($release['v'], $installed, '<'))) {
-                continue;
-            }
-            if (in_array($release['v'], $exclude)) { // skip excluded versions
-                continue;
-            }
-            // allow newer releases to say "I'm OK with the dependent package"
-            if ($xsdversion == '2.0' && isset($release['co'])) {
-                if (!is_array($release['co']) || !isset($release['co'][0])) {
-                    $release['co'] = array($release['co']);
-                }
-                foreach ($release['co'] as $entry) {
-                    if (isset($entry['x']) && !is_array($entry['x'])) {
-                        $entry['x'] = array($entry['x']);
-                    } elseif (!isset($entry['x'])) {
-                        $entry['x'] = array();
-                    }
-                    if ($entry['c'] == $deppackage['channel'] &&
-                          strtolower($entry['p']) == strtolower($deppackage['package']) &&
-                          version_compare($deppackage['version'], $entry['min'], '>=') &&
-                          version_compare($deppackage['version'], $entry['max'], '<=') &&
-                          !in_array($release['v'], $entry['x'])) {
-                        $recommended = $release['v'];
-                        break;
-                    }
-                }
-            }
-            if ($recommended) {
-                if ($release['v'] != $recommended) { // if we want a specific
-                    // version, then skip all others
-                    continue;
-                } else {
-                    if (!in_array($release['s'], $states)) {
-                        // the stability is too low, but we must return the
-                        // recommended version if possible
-                        return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel);
-                    }
-                }
-            }
-            if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions
-                continue;
-            }
-            if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions
-                continue;
-            }
-            if ($installed && version_compare($release['v'], $installed, '<')) {
-                continue;
-            }
-            if (in_array($release['s'], $states)) { // if in the preferred state...
-                $found = true; // ... then use it
-                break;
-            }
-        }
-        return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel);
-    }
-
-    /**
-     * Take raw data and return the array needed for processing a download URL
-     *
-     * @param string $base REST base uri
-     * @param string $package Package name
-     * @param array $release an array of format array('v' => version, 's' => state)
-     *                       describing the release to download
-     * @param array $info list of all releases as defined by allreleases.xml
-     * @param bool|null $found determines whether the release was found or this is the next
-     *                    best alternative.  If null, then versions were skipped because
-     *                    of PHP dependency
-     * @return array|PEAR_Error
-     * @access private
-     */
-    function _returnDownloadURL($base, $package, $release, $info, $found, $phpversion = false, $channel = false)
-    {
-        if (!$found) {
-            $release = $info['r'][0];
-        }
-
-        $packageLower = strtolower($package);
-        $pinfo = $this->_rest->retrieveCacheFirst($base . 'p/' . $packageLower . '/' .
-            'info.xml', false, false, $channel);
-        if (PEAR::isError($pinfo)) {
-            return PEAR::raiseError('Package "' . $package .
-                '" does not have REST info xml available');
-        }
-
-        $releaseinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' .
-            $release['v'] . '.xml', false, false, $channel);
-        if (PEAR::isError($releaseinfo)) {
-            return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] .
-                '" does not have REST xml available');
-        }
-
-        $packagexml = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' .
-            'deps.' . $release['v'] . '.txt', false, true, $channel);
-        if (PEAR::isError($packagexml)) {
-            return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] .
-                '" does not have REST dependency information available');
-        }
-
-        $packagexml = unserialize($packagexml);
-        if (!$packagexml) {
-            $packagexml = array();
-        }
-
-        $allinfo = $this->_rest->retrieveData($base . 'r/' . $packageLower .
-            '/allreleases.xml', false, false, $channel);
-        if (!is_array($allinfo['r']) || !isset($allinfo['r'][0])) {
-            $allinfo['r'] = array($allinfo['r']);
-        }
-
-        $compatible = false;
-        foreach ($allinfo['r'] as $release) {
-            if ($release['v'] != $releaseinfo['v']) {
-                continue;
-            }
-
-            if (!isset($release['co'])) {
-                break;
-            }
-
-            $compatible = array();
-            if (!is_array($release['co']) || !isset($release['co'][0])) {
-                $release['co'] = array($release['co']);
-            }
-
-            foreach ($release['co'] as $entry) {
-                $comp = array();
-                $comp['name']    = $entry['p'];
-                $comp['channel'] = $entry['c'];
-                $comp['min']     = $entry['min'];
-                $comp['max']     = $entry['max'];
-                if (isset($entry['x']) && !is_array($entry['x'])) {
-                    $comp['exclude'] = $entry['x'];
-                }
-
-                $compatible[] = $comp;
-            }
-
-            if (count($compatible) == 1) {
-                $compatible = $compatible[0];
-            }
-
-            break;
-        }
-
-        $deprecated = false;
-        if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
-            if (is_array($pinfo['dp'])) {
-                $deprecated = array('channel' => (string) $pinfo['dc'],
-                                    'package' => trim($pinfo['dp']['_content']));
-            } else {
-                $deprecated = array('channel' => (string) $pinfo['dc'],
-                                    'package' => trim($pinfo['dp']));
-            }
-        }
-
-        $return = array(
-            'version'    => $releaseinfo['v'],
-            'info'       => $packagexml,
-            'package'    => $releaseinfo['p']['_content'],
-            'stability'  => $releaseinfo['st'],
-            'compatible' => $compatible,
-            'deprecated' => $deprecated,
-        );
-
-        if ($found) {
-            $return['url'] = $releaseinfo['g'];
-            return $return;
-        }
-
-        $return['php'] = $phpversion;
-        return $return;
-    }
-
-    function listPackages($base, $channel = false)
-    {
-        $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-
-        if (!is_array($packagelist) || !isset($packagelist['p'])) {
-            return array();
-        }
-
-        if (!is_array($packagelist['p'])) {
-            $packagelist['p'] = array($packagelist['p']);
-        }
-
-        return $packagelist['p'];
-    }
-
-    /**
-     * List all categories of a REST server
-     *
-     * @param string $base base URL of the server
-     * @return array of categorynames
-     */
-    function listCategories($base, $channel = false)
-    {
-        $categories = array();
-
-        // c/categories.xml does not exist;
-        // check for every package its category manually
-        // This is SLOOOWWWW : ///
-        $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-
-        if (!is_array($packagelist) || !isset($packagelist['p'])) {
-            $ret = array();
-            return $ret;
-        }
-
-        if (!is_array($packagelist['p'])) {
-            $packagelist['p'] = array($packagelist['p']);
-        }
-
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        foreach ($packagelist['p'] as $package) {
-                $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
-                if (PEAR::isError($inf)) {
-                    PEAR::popErrorHandling();
-                    return $inf;
-                }
-                $cat = $inf['ca']['_content'];
-                if (!isset($categories[$cat])) {
-                    $categories[$cat] = $inf['ca'];
-                }
-        }
-
-        return array_values($categories);
-    }
-
-    /**
-     * List a category of a REST server
-     *
-     * @param string $base base URL of the server
-     * @param string $category name of the category
-     * @param boolean $info also download full package info
-     * @return array of packagenames
-     */
-    function listCategory($base, $category, $info = false, $channel = false)
-    {
-        // gives '404 Not Found' error when category doesn't exist
-        $packagelist = $this->_rest->retrieveData($base.'c/'.urlencode($category).'/packages.xml', false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-
-        if (!is_array($packagelist) || !isset($packagelist['p'])) {
-            return array();
-        }
-
-        if (!is_array($packagelist['p']) ||
-            !isset($packagelist['p'][0])) { // only 1 pkg
-            $packagelist = array($packagelist['p']);
-        } else {
-            $packagelist = $packagelist['p'];
-        }
-
-        if ($info == true) {
-            // get individual package info
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            foreach ($packagelist as $i => $packageitem) {
-                $url = sprintf('%s'.'r/%s/latest.txt',
-                        $base,
-                        strtolower($packageitem['_content']));
-                $version = $this->_rest->retrieveData($url, false, false, $channel);
-                if (PEAR::isError($version)) {
-                    break; // skipit
-                }
-                $url = sprintf('%s'.'r/%s/%s.xml',
-                        $base,
-                        strtolower($packageitem['_content']),
-                        $version);
-                $info = $this->_rest->retrieveData($url, false, false, $channel);
-                if (PEAR::isError($info)) {
-                    break; // skipit
-                }
-                $packagelist[$i]['info'] = $info;
-            }
-            PEAR::popErrorHandling();
-        }
-
-        return $packagelist;
-    }
-
-
-    function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false)
-    {
-        $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-        if ($this->_rest->config->get('verbose') > 0) {
-            $ui = &PEAR_Frontend::singleton();
-            $ui->log('Retrieving data...0%', true);
-        }
-        $ret = array();
-        if (!is_array($packagelist) || !isset($packagelist['p'])) {
-            return $ret;
-        }
-        if (!is_array($packagelist['p'])) {
-            $packagelist['p'] = array($packagelist['p']);
-        }
-
-        // only search-packagename = quicksearch !
-        if ($searchpackage && (!$searchsummary || empty($searchpackage))) {
-            $newpackagelist = array();
-            foreach ($packagelist['p'] as $package) {
-                if (!empty($searchpackage) && stristr($package, $searchpackage) !== false) {
-                    $newpackagelist[] = $package;
-                }
-            }
-            $packagelist['p'] = $newpackagelist;
-        }
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $next = .1;
-        foreach ($packagelist['p'] as $progress => $package) {
-            if ($this->_rest->config->get('verbose') > 0) {
-                if ($progress / count($packagelist['p']) >= $next) {
-                    if ($next == .5) {
-                        $ui->log('50%', false);
-                    } else {
-                        $ui->log('.', false);
-                    }
-                    $next += .1;
-                }
-            }
-
-            if ($basic) { // remote-list command
-                if ($dostable) {
-                    $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
-                        '/stable.txt', false, false, $channel);
-                } else {
-                    $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
-                        '/latest.txt', false, false, $channel);
-                }
-                if (PEAR::isError($latest)) {
-                    $latest = false;
-                }
-                $info = array('stable' => $latest);
-            } else { // list-all command
-                $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
-                if (PEAR::isError($inf)) {
-                    PEAR::popErrorHandling();
-                    return $inf;
-                }
-                if ($searchpackage) {
-                    $found = (!empty($searchpackage) && stristr($package, $searchpackage) !== false);
-                    if (!$found && !(isset($searchsummary) && !empty($searchsummary)
-                        && (stristr($inf['s'], $searchsummary) !== false
-                            || stristr($inf['d'], $searchsummary) !== false)))
-                    {
-                        continue;
-                    };
-                }
-                $releases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
-                    '/allreleases.xml', false, false, $channel);
-                if (PEAR::isError($releases)) {
-                    continue;
-                }
-                if (!isset($releases['r'][0])) {
-                    $releases['r'] = array($releases['r']);
-                }
-                unset($latest);
-                unset($unstable);
-                unset($stable);
-                unset($state);
-                foreach ($releases['r'] as $release) {
-                    if (!isset($latest)) {
-                        if ($dostable && $release['s'] == 'stable') {
-                            $latest = $release['v'];
-                            $state = 'stable';
-                        }
-                        if (!$dostable) {
-                            $latest = $release['v'];
-                            $state = $release['s'];
-                        }
-                    }
-                    if (!isset($stable) && $release['s'] == 'stable') {
-                        $stable = $release['v'];
-                        if (!isset($unstable)) {
-                            $unstable = $stable;
-                        }
-                    }
-                    if (!isset($unstable) && $release['s'] != 'stable') {
-                        $latest = $unstable = $release['v'];
-                        $state = $release['s'];
-                    }
-                    if (isset($latest) && !isset($state)) {
-                        $state = $release['s'];
-                    }
-                    if (isset($latest) && isset($stable) && isset($unstable)) {
-                        break;
-                    }
-                }
-                $deps = array();
-                if (!isset($unstable)) {
-                    $unstable = false;
-                    $state = 'stable';
-                    if (isset($stable)) {
-                        $latest = $unstable = $stable;
-                    }
-                } else {
-                    $latest = $unstable;
-                }
-                if (!isset($latest)) {
-                    $latest = false;
-                }
-                if ($latest) {
-                    $d = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' .
-                        $latest . '.txt', false, false, $channel);
-                    if (!PEAR::isError($d)) {
-                        $d = unserialize($d);
-                        if ($d) {
-                            if (isset($d['required'])) {
-                                if (!class_exists('PEAR_PackageFile_v2')) {
-                                    require_once 'PEAR/PackageFile/v2.php';
-                                }
-                                if (!isset($pf)) {
-                                    $pf = new PEAR_PackageFile_v2;
-                                }
-                                $pf->setDeps($d);
-                                $tdeps = $pf->getDeps();
-                            } else {
-                                $tdeps = $d;
-                            }
-                            foreach ($tdeps as $dep) {
-                                if ($dep['type'] !== 'pkg') {
-                                    continue;
-                                }
-                                $deps[] = $dep;
-                            }
-                        }
-                    }
-                }
-                if (!isset($stable)) {
-                    $stable = '-n/a-';
-                }
-                if (!$searchpackage) {
-                    $info = array('stable' => $latest, 'summary' => $inf['s'], 'description' =>
-                        $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'],
-                        'unstable' => $unstable, 'state' => $state);
-                } else {
-                    $info = array('stable' => $stable, 'summary' => $inf['s'], 'description' =>
-                        $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'],
-                        'unstable' => $unstable, 'state' => $state);
-                }
-            }
-            $ret[$package] = $info;
-        }
-        PEAR::popErrorHandling();
-        return $ret;
-    }
-
-    function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg)
-    {
-        $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-
-        $ret = array();
-        if (!is_array($packagelist) || !isset($packagelist['p'])) {
-            return $ret;
-        }
-
-        if (!is_array($packagelist['p'])) {
-            $packagelist['p'] = array($packagelist['p']);
-        }
-
-        foreach ($packagelist['p'] as $package) {
-            if (!isset($installed[strtolower($package)])) {
-                continue;
-            }
-
-            $inst_version = $reg->packageInfo($package, 'version', $channel);
-            $inst_state   = $reg->packageInfo($package, 'release_state', $channel);
-            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-            $info = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
-                '/allreleases.xml', false, false, $channel);
-            PEAR::popErrorHandling();
-            if (PEAR::isError($info)) {
-                continue; // no remote releases
-            }
-
-            if (!isset($info['r'])) {
-                continue;
-            }
-
-            $release = $found = false;
-            if (!is_array($info['r']) || !isset($info['r'][0])) {
-                $info['r'] = array($info['r']);
-            }
-
-            // $info['r'] is sorted by version number
-            usort($info['r'], array($this, '_sortReleasesByVersionNumber'));
-            foreach ($info['r'] as $release) {
-                if ($inst_version && version_compare($release['v'], $inst_version, '<=')) {
-                    // not newer than the one installed
-                    break;
-                }
-
-                // new version > installed version
-                if (!$pref_state) {
-                    // every state is a good state
-                    $found = true;
-                    break;
-                } else {
-                    $new_state = $release['s'];
-                    // if new state >= installed state: go
-                    if (in_array($new_state, $this->betterStates($inst_state, true))) {
-                        $found = true;
-                        break;
-                    } else {
-                        // only allow to lower the state of package,
-                        // if new state >= preferred state: go
-                        if (in_array($new_state, $this->betterStates($pref_state, true))) {
-                            $found = true;
-                            break;
-                        }
-                    }
-                }
-            }
-
-            if (!$found) {
-                continue;
-            }
-
-            $relinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' .
-                $release['v'] . '.xml', false, false, $channel);
-            if (PEAR::isError($relinfo)) {
-                return $relinfo;
-            }
-
-            $ret[$package] = array(
-                'version'  => $release['v'],
-                'state'    => $release['s'],
-                'filesize' => $relinfo['f'],
-            );
-        }
-
-        return $ret;
-    }
-
-    function packageInfo($base, $package, $channel = false)
-    {
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $pinfo = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
-        if (PEAR::isError($pinfo)) {
-            PEAR::popErrorHandling();
-            return PEAR::raiseError('Unknown package: "' . $package . '" in channel "' . $channel . '"' . "\n". 'Debug: ' .
-                $pinfo->getMessage());
-        }
-
-        $releases = array();
-        $allreleases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
-            '/allreleases.xml', false, false, $channel);
-        if (!PEAR::isError($allreleases)) {
-            if (!class_exists('PEAR_PackageFile_v2')) {
-                require_once 'PEAR/PackageFile/v2.php';
-            }
-
-            if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) {
-                $allreleases['r'] = array($allreleases['r']);
-            }
-
-            $pf = new PEAR_PackageFile_v2;
-            foreach ($allreleases['r'] as $release) {
-                $ds = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' .
-                    $release['v'] . '.txt', false, false, $channel);
-                if (PEAR::isError($ds)) {
-                    continue;
-                }
-
-                if (!isset($latest)) {
-                    $latest = $release['v'];
-                }
-
-                $pf->setDeps(unserialize($ds));
-                $ds = $pf->getDeps();
-                $info = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package)
-                    . '/' . $release['v'] . '.xml', false, false, $channel);
-
-                if (PEAR::isError($info)) {
-                    continue;
-                }
-
-                $releases[$release['v']] = array(
-                    'doneby' => $info['m'],
-                    'license' => $info['l'],
-                    'summary' => $info['s'],
-                    'description' => $info['d'],
-                    'releasedate' => $info['da'],
-                    'releasenotes' => $info['n'],
-                    'state' => $release['s'],
-                    'deps' => $ds ? $ds : array(),
-                );
-            }
-        } else {
-            $latest = '';
-        }
-
-        PEAR::popErrorHandling();
-        if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
-            if (is_array($pinfo['dp'])) {
-                $deprecated = array('channel' => (string) $pinfo['dc'],
-                                    'package' => trim($pinfo['dp']['_content']));
-            } else {
-                $deprecated = array('channel' => (string) $pinfo['dc'],
-                                    'package' => trim($pinfo['dp']));
-            }
-        } else {
-            $deprecated = false;
-        }
-
-        if (!isset($latest)) {
-            $latest = '';
-        }
-
-        return array(
-            'name' => $pinfo['n'],
-            'channel' => $pinfo['c'],
-            'category' => $pinfo['ca']['_content'],
-            'stable' => $latest,
-            'license' => $pinfo['l'],
-            'summary' => $pinfo['s'],
-            'description' => $pinfo['d'],
-            'releases' => $releases,
-            'deprecated' => $deprecated,
-            );
-    }
-
-    /**
-     * Return an array containing all of the states that are more stable than
-     * or equal to the passed in state
-     *
-     * @param string Release state
-     * @param boolean Determines whether to include $state in the list
-     * @return false|array False if $state is not a valid release state
-     */
-    function betterStates($state, $include = false)
-    {
-        static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
-        $i = array_search($state, $states);
-        if ($i === false) {
-            return false;
-        }
-
-        if ($include) {
-            $i--;
-        }
-
-        return array_slice($states, $i + 1);
-    }
-
-    /**
-     * Sort releases by version number
-     *
-     * @access private
-     */
-    function _sortReleasesByVersionNumber($a, $b)
-    {
-        if (version_compare($a['v'], $b['v'], '=')) {
-            return 0;
-        }
-
-        if (version_compare($a['v'], $b['v'], '>')) {
-            return -1;
-        }
-
-        if (version_compare($a['v'], $b['v'], '<')) {
-            return 1;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/REST/11.php b/lib/php/PEAR/REST/11.php
deleted file mode 100644
index 02a908373c6c22f99cd17aab16e408800274a757..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/REST/11.php
+++ /dev/null
@@ -1,341 +0,0 @@
-<?php
-/**
- * PEAR_REST_11 - implement faster list-all/remote-list command
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: 11.php 286670 2009-08-02 14:16:06Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.3
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-
-/**
- * Implement REST 1.1
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.3
- */
-class PEAR_REST_11
-{
-    /**
-     * @var PEAR_REST
-     */
-    var $_rest;
-
-    function PEAR_REST_11($config, $options = array())
-    {
-        $this->_rest = &new PEAR_REST($config, $options);
-    }
-
-    function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false)
-    {
-        $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel);
-        if (PEAR::isError($categorylist)) {
-            return $categorylist;
-        }
-
-        $ret = array();
-        if (!is_array($categorylist['c']) || !isset($categorylist['c'][0])) {
-            $categorylist['c'] = array($categorylist['c']);
-        }
-
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-
-        foreach ($categorylist['c'] as $progress => $category) {
-            $category = $category['_content'];
-            $packagesinfo = $this->_rest->retrieveData($base .
-                'c/' . urlencode($category) . '/packagesinfo.xml', false, false, $channel);
-
-            if (PEAR::isError($packagesinfo)) {
-                continue;
-            }
-
-            if (!is_array($packagesinfo) || !isset($packagesinfo['pi'])) {
-                continue;
-            }
-
-            if (!is_array($packagesinfo['pi']) || !isset($packagesinfo['pi'][0])) {
-                $packagesinfo['pi'] = array($packagesinfo['pi']);
-            }
-
-            foreach ($packagesinfo['pi'] as $packageinfo) {
-                if (empty($packageinfo)) {
-                    continue;
-                }
-
-                $info     = $packageinfo['p'];
-                $package  = $info['n'];
-                $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false;
-                unset($latest);
-                unset($unstable);
-                unset($stable);
-                unset($state);
-
-                if ($releases) {
-                    if (!isset($releases['r'][0])) {
-                        $releases['r'] = array($releases['r']);
-                    }
-
-                    foreach ($releases['r'] as $release) {
-                        if (!isset($latest)) {
-                            if ($dostable && $release['s'] == 'stable') {
-                                $latest = $release['v'];
-                                $state = 'stable';
-                            }
-                            if (!$dostable) {
-                                $latest = $release['v'];
-                                $state = $release['s'];
-                            }
-                        }
-
-                        if (!isset($stable) && $release['s'] == 'stable') {
-                            $stable = $release['v'];
-                            if (!isset($unstable)) {
-                                $unstable = $stable;
-                            }
-                        }
-
-                        if (!isset($unstable) && $release['s'] != 'stable') {
-                            $unstable = $release['v'];
-                            $state = $release['s'];
-                        }
-
-                        if (isset($latest) && !isset($state)) {
-                            $state = $release['s'];
-                        }
-
-                        if (isset($latest) && isset($stable) && isset($unstable)) {
-                            break;
-                        }
-                    }
-                }
-
-                if ($basic) { // remote-list command
-                    if (!isset($latest)) {
-                        $latest = false;
-                    }
-
-                    if ($dostable) {
-                        // $state is not set if there are no releases
-                        if (isset($state) && $state == 'stable') {
-                            $ret[$package] = array('stable' => $latest);
-                        } else {
-                            $ret[$package] = array('stable' => '-n/a-');
-                        }
-                    } else {
-                        $ret[$package] = array('stable' => $latest);
-                    }
-
-                    continue;
-                }
-
-                // list-all command
-                if (!isset($unstable)) {
-                    $unstable = false;
-                    $state = 'stable';
-                    if (isset($stable)) {
-                        $latest = $unstable = $stable;
-                    }
-                } else {
-                    $latest = $unstable;
-                }
-
-                if (!isset($latest)) {
-                    $latest = false;
-                }
-
-                $deps = array();
-                if ($latest && isset($packageinfo['deps'])) {
-                    if (!is_array($packageinfo['deps']) ||
-                          !isset($packageinfo['deps'][0])
-                    ) {
-                        $packageinfo['deps'] = array($packageinfo['deps']);
-                    }
-
-                    $d = false;
-                    foreach ($packageinfo['deps'] as $dep) {
-                        if ($dep['v'] == $latest) {
-                            $d = unserialize($dep['d']);
-                        }
-                    }
-
-                    if ($d) {
-                        if (isset($d['required'])) {
-                            if (!class_exists('PEAR_PackageFile_v2')) {
-                                require_once 'PEAR/PackageFile/v2.php';
-                            }
-
-                            if (!isset($pf)) {
-                                $pf = new PEAR_PackageFile_v2;
-                            }
-
-                            $pf->setDeps($d);
-                            $tdeps = $pf->getDeps();
-                        } else {
-                            $tdeps = $d;
-                        }
-
-                        foreach ($tdeps as $dep) {
-                            if ($dep['type'] !== 'pkg') {
-                                continue;
-                            }
-
-                            $deps[] = $dep;
-                        }
-                    }
-                }
-
-                $info = array(
-                    'stable'      => $latest,
-                    'summary'     => $info['s'],
-                    'description' => $info['d'],
-                    'deps'        => $deps,
-                    'category'    => $info['ca']['_content'],
-                    'unstable'    => $unstable,
-                    'state'       => $state
-                );
-                $ret[$package] = $info;
-            }
-        }
-
-        PEAR::popErrorHandling();
-        return $ret;
-    }
-
-    /**
-     * List all categories of a REST server
-     *
-     * @param string $base base URL of the server
-     * @return array of categorynames
-     */
-    function listCategories($base, $channel = false)
-    {
-        $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel);
-        if (PEAR::isError($categorylist)) {
-            return $categorylist;
-        }
-
-        if (!is_array($categorylist) || !isset($categorylist['c'])) {
-            return array();
-        }
-
-        if (isset($categorylist['c']['_content'])) {
-            // only 1 category
-            $categorylist['c'] = array($categorylist['c']);
-        }
-
-        return $categorylist['c'];
-    }
-
-    /**
-     * List packages in a category of a REST server
-     *
-     * @param string $base base URL of the server
-     * @param string $category name of the category
-     * @param boolean $info also download full package info
-     * @return array of packagenames
-     */
-    function listCategory($base, $category, $info = false, $channel = false)
-    {
-        if ($info == false) {
-            $url = '%s'.'c/%s/packages.xml';
-        } else {
-            $url = '%s'.'c/%s/packagesinfo.xml';
-        }
-        $url = sprintf($url,
-                    $base,
-                    urlencode($category));
-
-        // gives '404 Not Found' error when category doesn't exist
-        $packagelist = $this->_rest->retrieveData($url, false, false, $channel);
-        if (PEAR::isError($packagelist)) {
-            return $packagelist;
-        }
-        if (!is_array($packagelist)) {
-            return array();
-        }
-
-        if ($info == false) {
-            if (!isset($packagelist['p'])) {
-                return array();
-            }
-            if (!is_array($packagelist['p']) ||
-                !isset($packagelist['p'][0])) { // only 1 pkg
-                $packagelist = array($packagelist['p']);
-            } else {
-                $packagelist = $packagelist['p'];
-            }
-            return $packagelist;
-        }
-
-        // info == true
-        if (!isset($packagelist['pi'])) {
-            return array();
-        }
-
-        if (!is_array($packagelist['pi']) ||
-            !isset($packagelist['pi'][0])) { // only 1 pkg
-            $packagelist_pre = array($packagelist['pi']);
-        } else {
-            $packagelist_pre = $packagelist['pi'];
-        }
-
-        $packagelist = array();
-        foreach ($packagelist_pre as $i => $item) {
-            // compatibility with r/<latest.txt>.xml
-            if (isset($item['a']['r'][0])) {
-                // multiple releases
-                $item['p']['v'] = $item['a']['r'][0]['v'];
-                $item['p']['st'] = $item['a']['r'][0]['s'];
-            } elseif (isset($item['a'])) {
-                // first and only release
-                $item['p']['v'] = $item['a']['r']['v'];
-                $item['p']['st'] = $item['a']['r']['s'];
-            }
-
-            $packagelist[$i] = array('attribs' => $item['p']['r'],
-                                     '_content' => $item['p']['n'],
-                                     'info' => $item['p']);
-        }
-
-        return $packagelist;
-    }
-
-    /**
-     * Return an array containing all of the states that are more stable than
-     * or equal to the passed in state
-     *
-     * @param string Release state
-     * @param boolean Determines whether to include $state in the list
-     * @return false|array False if $state is not a valid release state
-     */
-    function betterStates($state, $include = false)
-    {
-        static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
-        $i = array_search($state, $states);
-        if ($i === false) {
-            return false;
-        }
-        if ($include) {
-            $i--;
-        }
-        return array_slice($states, $i + 1);
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/REST/13.php b/lib/php/PEAR/REST/13.php
deleted file mode 100644
index 250adfe51fb5b9e15e72ba40cb5dbad10a3264c6..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/REST/13.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-/**
- * PEAR_REST_13
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: 13.php 287110 2009-08-11 18:51:15Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a12
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-require_once 'PEAR/REST/10.php';
-
-/**
- * Implement REST 1.3
- *
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a12
- */
-class PEAR_REST_13 extends PEAR_REST_10
-{
-    /**
-     * Retrieve information about a remote package to be downloaded from a REST server
-     *
-     * This is smart enough to resolve the minimum PHP version dependency prior to download
-     * @param string $base The uri to prepend to all REST calls
-     * @param array $packageinfo an array of format:
-     * <pre>
-     *  array(
-     *   'package' => 'packagename',
-     *   'channel' => 'channelname',
-     *  ['state' => 'alpha' (or valid state),]
-     *  -or-
-     *  ['version' => '1.whatever']
-     * </pre>
-     * @param string $prefstate Current preferred_state config variable value
-     * @param bool $installed the installed version of this package to compare against
-     * @return array|false|PEAR_Error see {@link _returnDownloadURL()}
-     */
-    function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false)
-    {
-        $states = $this->betterStates($prefstate, true);
-        if (!$states) {
-            return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
-        }
-
-        $channel  = $packageinfo['channel'];
-        $package  = $packageinfo['package'];
-        $state    = isset($packageinfo['state'])   ? $packageinfo['state']   : null;
-        $version  = isset($packageinfo['version']) ? $packageinfo['version'] : null;
-        $restFile = $base . 'r/' . strtolower($package) . '/allreleases2.xml';
-
-        $info = $this->_rest->retrieveData($restFile, false, false, $channel);
-        if (PEAR::isError($info)) {
-            return PEAR::raiseError('No releases available for package "' .
-                $channel . '/' . $package . '"');
-        }
-
-        if (!isset($info['r'])) {
-            return false;
-        }
-
-        $release = $found = false;
-        if (!is_array($info['r']) || !isset($info['r'][0])) {
-            $info['r'] = array($info['r']);
-        }
-
-        $skippedphp = false;
-        foreach ($info['r'] as $release) {
-            if (!isset($this->_rest->_options['force']) && ($installed &&
-                  version_compare($release['v'], $installed, '<'))) {
-                continue;
-            }
-
-            if (isset($state)) {
-                // try our preferred state first
-                if ($release['s'] == $state) {
-                    if (!isset($version) && version_compare($release['m'], phpversion(), '>')) {
-                        // skip releases that require a PHP version newer than our PHP version
-                        $skippedphp = $release;
-                        continue;
-                    }
-                    $found = true;
-                    break;
-                }
-
-                // see if there is something newer and more stable
-                // bug #7221
-                if (in_array($release['s'], $this->betterStates($state), true)) {
-                    if (!isset($version) && version_compare($release['m'], phpversion(), '>')) {
-                        // skip releases that require a PHP version newer than our PHP version
-                        $skippedphp = $release;
-                        continue;
-                    }
-                    $found = true;
-                    break;
-                }
-            } elseif (isset($version)) {
-                if ($release['v'] == $version) {
-                    if (!isset($this->_rest->_options['force']) &&
-                          !isset($version) &&
-                          version_compare($release['m'], phpversion(), '>')) {
-                        // skip releases that require a PHP version newer than our PHP version
-                        $skippedphp = $release;
-                        continue;
-                    }
-                    $found = true;
-                    break;
-                }
-            } else {
-                if (in_array($release['s'], $states)) {
-                    if (version_compare($release['m'], phpversion(), '>')) {
-                        // skip releases that require a PHP version newer than our PHP version
-                        $skippedphp = $release;
-                        continue;
-                    }
-                    $found = true;
-                    break;
-                }
-            }
-        }
-
-        if (!$found && $skippedphp) {
-            $found = null;
-        }
-
-        return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel);
-    }
-
-    function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage,
-                               $prefstate = 'stable', $installed = false, $channel = false)
-    {
-        $states = $this->betterStates($prefstate, true);
-        if (!$states) {
-            return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
-        }
-
-        $channel  = $dependency['channel'];
-        $package  = $dependency['name'];
-        $state    = isset($dependency['state'])   ? $dependency['state']   : null;
-        $version  = isset($dependency['version']) ? $dependency['version'] : null;
-        $restFile = $base . 'r/' . strtolower($package) .'/allreleases2.xml';
-
-        $info = $this->_rest->retrieveData($restFile, false, false, $channel);
-        if (PEAR::isError($info)) {
-            return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package']
-                . '" dependency "' . $channel . '/' . $package . '" has no releases');
-        }
-
-        if (!is_array($info) || !isset($info['r'])) {
-            return false;
-        }
-
-        $exclude = array();
-        $min = $max = $recommended = false;
-        if ($xsdversion == '1.0') {
-            $pinfo['package'] = $dependency['name'];
-            $pinfo['channel'] = 'pear.php.net'; // this is always true - don't change this
-            switch ($dependency['rel']) {
-                case 'ge' :
-                    $min = $dependency['version'];
-                break;
-                case 'gt' :
-                    $min = $dependency['version'];
-                    $exclude = array($dependency['version']);
-                break;
-                case 'eq' :
-                    $recommended = $dependency['version'];
-                break;
-                case 'lt' :
-                    $max = $dependency['version'];
-                    $exclude = array($dependency['version']);
-                break;
-                case 'le' :
-                    $max = $dependency['version'];
-                break;
-                case 'ne' :
-                    $exclude = array($dependency['version']);
-                break;
-            }
-        } else {
-            $pinfo['package'] = $dependency['name'];
-            $min = isset($dependency['min']) ? $dependency['min'] : false;
-            $max = isset($dependency['max']) ? $dependency['max'] : false;
-            $recommended = isset($dependency['recommended']) ?
-                $dependency['recommended'] : false;
-            if (isset($dependency['exclude'])) {
-                if (!isset($dependency['exclude'][0])) {
-                    $exclude = array($dependency['exclude']);
-                }
-            }
-        }
-
-        $skippedphp = $found = $release = false;
-        if (!is_array($info['r']) || !isset($info['r'][0])) {
-            $info['r'] = array($info['r']);
-        }
-
-        foreach ($info['r'] as $release) {
-            if (!isset($this->_rest->_options['force']) && ($installed &&
-                  version_compare($release['v'], $installed, '<'))) {
-                continue;
-            }
-
-            if (in_array($release['v'], $exclude)) { // skip excluded versions
-                continue;
-            }
-
-            // allow newer releases to say "I'm OK with the dependent package"
-            if ($xsdversion == '2.0' && isset($release['co'])) {
-                if (!is_array($release['co']) || !isset($release['co'][0])) {
-                    $release['co'] = array($release['co']);
-                }
-
-                foreach ($release['co'] as $entry) {
-                    if (isset($entry['x']) && !is_array($entry['x'])) {
-                        $entry['x'] = array($entry['x']);
-                    } elseif (!isset($entry['x'])) {
-                        $entry['x'] = array();
-                    }
-
-                    if ($entry['c'] == $deppackage['channel'] &&
-                          strtolower($entry['p']) == strtolower($deppackage['package']) &&
-                          version_compare($deppackage['version'], $entry['min'], '>=') &&
-                          version_compare($deppackage['version'], $entry['max'], '<=') &&
-                          !in_array($release['v'], $entry['x'])) {
-                        if (version_compare($release['m'], phpversion(), '>')) {
-                            // skip dependency releases that require a PHP version
-                            // newer than our PHP version
-                            $skippedphp = $release;
-                            continue;
-                        }
-
-                        $recommended = $release['v'];
-                        break;
-                    }
-                }
-            }
-
-            if ($recommended) {
-                if ($release['v'] != $recommended) { // if we want a specific
-                    // version, then skip all others
-                    continue;
-                }
-
-                if (!in_array($release['s'], $states)) {
-                    // the stability is too low, but we must return the
-                    // recommended version if possible
-                    return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel);
-                }
-            }
-
-            if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions
-                continue;
-            }
-
-            if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions
-                continue;
-            }
-
-            if ($installed && version_compare($release['v'], $installed, '<')) {
-                continue;
-            }
-
-            if (in_array($release['s'], $states)) { // if in the preferred state...
-                if (version_compare($release['m'], phpversion(), '>')) {
-                    // skip dependency releases that require a PHP version
-                    // newer than our PHP version
-                    $skippedphp = $release;
-                    continue;
-                }
-
-                $found = true; // ... then use it
-                break;
-            }
-        }
-
-        if (!$found && $skippedphp) {
-            $found = null;
-        }
-
-        return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel);
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Registry.php b/lib/php/PEAR/Registry.php
deleted file mode 100644
index ae110010d8886d4e90d7ebf781f45b3751c4b23f..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Registry.php
+++ /dev/null
@@ -1,2395 +0,0 @@
-<?php
-/**
- * PEAR_Registry
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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: Registry.php 287555 2009-08-21 21:27:27Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * for PEAR_Error
- */
-require_once 'PEAR.php';
-require_once 'PEAR/DependencyDB.php';
-
-define('PEAR_REGISTRY_ERROR_LOCK',         -2);
-define('PEAR_REGISTRY_ERROR_FORMAT',       -3);
-define('PEAR_REGISTRY_ERROR_FILE',         -4);
-define('PEAR_REGISTRY_ERROR_CONFLICT',     -5);
-define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6);
-
-/**
- * Administration class used to maintain the installed package database.
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V. V. Cox <cox@idecnet.com>
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Registry extends PEAR
-{
-    /**
-     * File containing all channel information.
-     * @var string
-     */
-    var $channels = '';
-
-    /** Directory where registry files are stored.
-     * @var string
-     */
-    var $statedir = '';
-
-    /** File where the file map is stored
-     * @var string
-     */
-    var $filemap = '';
-
-    /** Directory where registry files for channels are stored.
-     * @var string
-     */
-    var $channelsdir = '';
-
-    /** Name of file used for locking the registry
-     * @var string
-     */
-    var $lockfile = '';
-
-    /** File descriptor used during locking
-     * @var resource
-     */
-    var $lock_fp = null;
-
-    /** Mode used during locking
-     * @var int
-     */
-    var $lock_mode = 0; // XXX UNUSED
-
-    /** Cache of package information.  Structure:
-     * array(
-     *   'package' => array('id' => ... ),
-     *   ... )
-     * @var array
-     */
-    var $pkginfo_cache = array();
-
-    /** Cache of file map.  Structure:
-     * array( '/path/to/file' => 'package', ... )
-     * @var array
-     */
-    var $filemap_cache = array();
-
-    /**
-     * @var false|PEAR_ChannelFile
-     */
-    var $_pearChannel;
-
-    /**
-     * @var false|PEAR_ChannelFile
-     */
-    var $_peclChannel;
-
-    /**
-     * @var false|PEAR_ChannelFile
-     */
-    var $_docChannel;
-
-    /**
-     * @var PEAR_DependencyDB
-     */
-    var $_dependencyDB;
-
-    /**
-     * @var PEAR_Config
-     */
-    var $_config;
-
-    /**
-     * PEAR_Registry constructor.
-     *
-     * @param string (optional) PEAR install directory (for .php files)
-     * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if
-     *        default values are not desired.  Only used the very first time a PEAR
-     *        repository is initialized
-     * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if
-     *        default values are not desired.  Only used the very first time a PEAR
-     *        repository is initialized
-     *
-     * @access public
-     */
-    function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false,
-                           $pecl_channel = false)
-    {
-        parent::PEAR();
-        $this->setInstallDir($pear_install_dir);
-        $this->_pearChannel = $pear_channel;
-        $this->_peclChannel = $pecl_channel;
-        $this->_config      = false;
-    }
-
-    function setInstallDir($pear_install_dir = PEAR_INSTALL_DIR)
-    {
-        $ds = DIRECTORY_SEPARATOR;
-        $this->install_dir = $pear_install_dir;
-        $this->channelsdir = $pear_install_dir.$ds.'.channels';
-        $this->statedir    = $pear_install_dir.$ds.'.registry';
-        $this->filemap     = $pear_install_dir.$ds.'.filemap';
-        $this->lockfile    = $pear_install_dir.$ds.'.lock';
-    }
-
-    function hasWriteAccess()
-    {
-        if (!file_exists($this->install_dir)) {
-            $dir = $this->install_dir;
-            while ($dir && $dir != '.') {
-                $olddir = $dir;
-                $dir    = dirname($dir);
-                if ($dir != '.' && file_exists($dir)) {
-                    if (is_writeable($dir)) {
-                        return true;
-                    }
-
-                    return false;
-                }
-
-                if ($dir == $olddir) { // this can happen in safe mode
-                    return @is_writable($dir);
-                }
-            }
-
-            return false;
-        }
-
-        return is_writeable($this->install_dir);
-    }
-
-    function setConfig(&$config, $resetInstallDir = true)
-    {
-        $this->_config = &$config;
-        if ($resetInstallDir) {
-            $this->setInstallDir($config->get('php_dir'));
-        }
-    }
-
-    function _initializeChannelDirs()
-    {
-        static $running = false;
-        if (!$running) {
-            $running = true;
-            $ds = DIRECTORY_SEPARATOR;
-            if (!is_dir($this->channelsdir) ||
-                  !file_exists($this->channelsdir . $ds . 'pear.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . '__uri.reg')) {
-                if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
-                    $pear_channel = $this->_pearChannel;
-                    if (!is_a($pear_channel, 'PEAR_ChannelFile') || !$pear_channel->validate()) {
-                        if (!class_exists('PEAR_ChannelFile')) {
-                            require_once 'PEAR/ChannelFile.php';
-                        }
-
-                        $pear_channel = new PEAR_ChannelFile;
-                        $pear_channel->setAlias('pear');
-                        $pear_channel->setServer('pear.php.net');
-                        $pear_channel->setSummary('PHP Extension and Application Repository');
-                        $pear_channel->setDefaultPEARProtocols();
-                        $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
-                        $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
-                        $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/');
-                        //$pear_channel->setBaseURL('REST1.4', 'http://pear.php.net/rest/');
-                    } else {
-                        $pear_channel->setServer('pear.php.net');
-                        $pear_channel->setAlias('pear');
-                    }
-
-                    $pear_channel->validate();
-                    $this->_addChannel($pear_channel);
-                }
-
-                if (!file_exists($this->channelsdir . $ds . 'pecl.php.net.reg')) {
-                    $pecl_channel = $this->_peclChannel;
-                    if (!is_a($pecl_channel, 'PEAR_ChannelFile') || !$pecl_channel->validate()) {
-                        if (!class_exists('PEAR_ChannelFile')) {
-                            require_once 'PEAR/ChannelFile.php';
-                        }
-
-                        $pecl_channel = new PEAR_ChannelFile;
-                        $pecl_channel->setAlias('pecl');
-                        $pecl_channel->setServer('pecl.php.net');
-                        $pecl_channel->setSummary('PHP Extension Community Library');
-                        $pecl_channel->setDefaultPEARProtocols();
-                        $pecl_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
-                        $pecl_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
-                        $pecl_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
-                    } else {
-                        $pecl_channel->setServer('pecl.php.net');
-                        $pecl_channel->setAlias('pecl');
-                    }
-
-                    $pecl_channel->validate();
-                    $this->_addChannel($pecl_channel);
-                }
-
-                if (!file_exists($this->channelsdir . $ds . 'doc.php.net.reg')) {
-                    $doc_channel = $this->_docChannel;
-                    if (!is_a($doc_channel, 'PEAR_ChannelFile') || !$doc_channel->validate()) {
-                        if (!class_exists('PEAR_ChannelFile')) {
-                            require_once 'PEAR/ChannelFile.php';
-                        }
-
-                        $doc_channel = new PEAR_ChannelFile;
-                        $doc_channel->setAlias('phpdocs');
-                        $doc_channel->setServer('doc.php.net');
-                        $doc_channel->setSummary('PHP Documentation Team');
-                        $doc_channel->setDefaultPEARProtocols();
-                        $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/');
-                        $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/');
-                        $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/');
-                    } else {
-                        $doc_channel->setServer('doc.php.net');
-                        $doc_channel->setAlias('doc');
-                    }
-
-                    $doc_channel->validate();
-                    $this->_addChannel($doc_channel);
-                }
-
-                if (!file_exists($this->channelsdir . $ds . '__uri.reg')) {
-                    if (!class_exists('PEAR_ChannelFile')) {
-                        require_once 'PEAR/ChannelFile.php';
-                    }
-
-                    $private = new PEAR_ChannelFile;
-                    $private->setName('__uri');
-                    $private->setDefaultPEARProtocols();
-                    $private->setBaseURL('REST1.0', '****');
-                    $private->setSummary('Pseudo-channel for static packages');
-                    $this->_addChannel($private);
-                }
-                $this->_rebuildFileMap();
-            }
-
-            $running = false;
-        }
-    }
-
-    function _initializeDirs()
-    {
-        $ds = DIRECTORY_SEPARATOR;
-        // XXX Compatibility code should be removed in the future
-        // rename all registry files if any to lowercase
-        if (!OS_WINDOWS && file_exists($this->statedir) && is_dir($this->statedir) &&
-              $handle = opendir($this->statedir)) {
-            $dest = $this->statedir . $ds;
-            while (false !== ($file = readdir($handle))) {
-                if (preg_match('/^.*[A-Z].*\.reg\\z/', $file)) {
-                    rename($dest . $file, $dest . strtolower($file));
-                }
-            }
-            closedir($handle);
-        }
-
-        $this->_initializeChannelDirs();
-        if (!file_exists($this->filemap)) {
-            $this->_rebuildFileMap();
-        }
-        $this->_initializeDepDB();
-    }
-
-    function _initializeDepDB()
-    {
-        if (!isset($this->_dependencyDB)) {
-            static $initializing = false;
-            if (!$initializing) {
-                $initializing = true;
-                if (!$this->_config) { // never used?
-                    $file = OS_WINDOWS ? 'pear.ini' : '.pearrc';
-                    $this->_config = &new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR .
-                        $file);
-                    $this->_config->setRegistry($this);
-                    $this->_config->set('php_dir', $this->install_dir);
-                }
-
-                $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config);
-                if (PEAR::isError($this->_dependencyDB)) {
-                    // attempt to recover by removing the dep db
-                    if (file_exists($this->_config->get('php_dir', null, 'pear.php.net') .
-                        DIRECTORY_SEPARATOR . '.depdb')) {
-                        @unlink($this->_config->get('php_dir', null, 'pear.php.net') .
-                            DIRECTORY_SEPARATOR . '.depdb');
-                    }
-
-                    $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config);
-                    if (PEAR::isError($this->_dependencyDB)) {
-                        echo $this->_dependencyDB->getMessage();
-                        echo 'Unrecoverable error';
-                        exit(1);
-                    }
-                }
-
-                $initializing = false;
-            }
-        }
-    }
-
-    /**
-     * PEAR_Registry destructor.  Makes sure no locks are forgotten.
-     *
-     * @access private
-     */
-    function _PEAR_Registry()
-    {
-        parent::_PEAR();
-        if (is_resource($this->lock_fp)) {
-            $this->_unlock();
-        }
-    }
-
-    /**
-     * Make sure the directory where we keep registry files exists.
-     *
-     * @return bool TRUE if directory exists, FALSE if it could not be
-     * created
-     *
-     * @access private
-     */
-    function _assertStateDir($channel = false)
-    {
-        if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
-            return $this->_assertChannelStateDir($channel);
-        }
-
-        static $init = false;
-        if (!file_exists($this->statedir)) {
-            if (!$this->hasWriteAccess()) {
-                return false;
-            }
-
-            require_once 'System.php';
-            if (!System::mkdir(array('-p', $this->statedir))) {
-                return $this->raiseError("could not create directory '{$this->statedir}'");
-            }
-            $init = true;
-        } elseif (!is_dir($this->statedir)) {
-            return $this->raiseError('Cannot create directory ' . $this->statedir . ', ' .
-                'it already exists and is not a directory');
-        }
-
-        $ds = DIRECTORY_SEPARATOR;
-        if (!file_exists($this->channelsdir)) {
-            if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') ||
-                  !file_exists($this->channelsdir . $ds . '__uri.reg')) {
-                $init = true;
-            }
-        } elseif (!is_dir($this->channelsdir)) {
-            return $this->raiseError('Cannot create directory ' . $this->channelsdir . ', ' .
-                'it already exists and is not a directory');
-        }
-
-        if ($init) {
-            static $running = false;
-            if (!$running) {
-                $running = true;
-                $this->_initializeDirs();
-                $running = false;
-                $init = false;
-            }
-        } else {
-            $this->_initializeDepDB();
-        }
-
-        return true;
-    }
-
-    /**
-     * Make sure the directory where we keep registry files exists for a non-standard channel.
-     *
-     * @param string channel name
-     * @return bool TRUE if directory exists, FALSE if it could not be
-     * created
-     *
-     * @access private
-     */
-    function _assertChannelStateDir($channel)
-    {
-        $ds = DIRECTORY_SEPARATOR;
-        if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
-            if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
-                $this->_initializeChannelDirs();
-            }
-            return $this->_assertStateDir($channel);
-        }
-
-        $channelDir = $this->_channelDirectoryName($channel);
-        if (!is_dir($this->channelsdir) ||
-              !file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
-            $this->_initializeChannelDirs();
-        }
-
-        if (!file_exists($channelDir)) {
-            if (!$this->hasWriteAccess()) {
-                return false;
-            }
-
-            require_once 'System.php';
-            if (!System::mkdir(array('-p', $channelDir))) {
-                return $this->raiseError("could not create directory '" . $channelDir .
-                    "'");
-            }
-        } elseif (!is_dir($channelDir)) {
-            return $this->raiseError("could not create directory '" . $channelDir .
-                "', already exists and is not a directory");
-        }
-
-        return true;
-    }
-
-    /**
-     * Make sure the directory where we keep registry files for channels exists
-     *
-     * @return bool TRUE if directory exists, FALSE if it could not be
-     * created
-     *
-     * @access private
-     */
-    function _assertChannelDir()
-    {
-        if (!file_exists($this->channelsdir)) {
-            if (!$this->hasWriteAccess()) {
-                return false;
-            }
-
-            require_once 'System.php';
-            if (!System::mkdir(array('-p', $this->channelsdir))) {
-                return $this->raiseError("could not create directory '{$this->channelsdir}'");
-            }
-        } elseif (!is_dir($this->channelsdir)) {
-            return $this->raiseError("could not create directory '{$this->channelsdir}" .
-                "', it already exists and is not a directory");
-        }
-
-        if (!file_exists($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) {
-            if (!$this->hasWriteAccess()) {
-                return false;
-            }
-
-            require_once 'System.php';
-            if (!System::mkdir(array('-p', $this->channelsdir . DIRECTORY_SEPARATOR . '.alias'))) {
-                return $this->raiseError("could not create directory '{$this->channelsdir}/.alias'");
-            }
-        } elseif (!is_dir($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) {
-            return $this->raiseError("could not create directory '{$this->channelsdir}" .
-                "/.alias', it already exists and is not a directory");
-        }
-
-        return true;
-    }
-
-    /**
-     * Get the name of the file where data for a given package is stored.
-     *
-     * @param string channel name, or false if this is a PEAR package
-     * @param string package name
-     *
-     * @return string registry file name
-     *
-     * @access public
-     */
-    function _packageFileName($package, $channel = false)
-    {
-        if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
-            return $this->_channelDirectoryName($channel) . DIRECTORY_SEPARATOR .
-                strtolower($package) . '.reg';
-        }
-
-        return $this->statedir . DIRECTORY_SEPARATOR . strtolower($package) . '.reg';
-    }
-
-    /**
-     * Get the name of the file where data for a given channel is stored.
-     * @param string channel name
-     * @return string registry file name
-     */
-    function _channelFileName($channel, $noaliases = false)
-    {
-        if (!$noaliases) {
-            if (file_exists($this->_getChannelAliasFileName($channel))) {
-                $channel = implode('', file($this->_getChannelAliasFileName($channel)));
-            }
-        }
-        return $this->channelsdir . DIRECTORY_SEPARATOR . str_replace('/', '_',
-            strtolower($channel)) . '.reg';
-    }
-
-    /**
-     * @param string
-     * @return string
-     */
-    function _getChannelAliasFileName($alias)
-    {
-        return $this->channelsdir . DIRECTORY_SEPARATOR . '.alias' .
-              DIRECTORY_SEPARATOR . str_replace('/', '_', strtolower($alias)) . '.txt';
-    }
-
-    /**
-     * Get the name of a channel from its alias
-     */
-    function _getChannelFromAlias($channel)
-    {
-        if (!$this->_channelExists($channel)) {
-            if ($channel == 'pear.php.net') {
-                return 'pear.php.net';
-            }
-
-            if ($channel == 'pecl.php.net') {
-                return 'pecl.php.net';
-            }
-
-            if ($channel == 'doc.php.net') {
-                return 'doc.php.net';
-            }
-
-            if ($channel == '__uri') {
-                return '__uri';
-            }
-
-            return false;
-        }
-
-        $channel = strtolower($channel);
-        if (file_exists($this->_getChannelAliasFileName($channel))) {
-            // translate an alias to an actual channel
-            return implode('', file($this->_getChannelAliasFileName($channel)));
-        }
-
-        return $channel;
-    }
-
-    /**
-     * Get the alias of a channel from its alias or its name
-     */
-    function _getAlias($channel)
-    {
-        if (!$this->_channelExists($channel)) {
-            if ($channel == 'pear.php.net') {
-                return 'pear';
-            }
-
-            if ($channel == 'pecl.php.net') {
-                return 'pecl';
-            }
-
-            if ($channel == 'doc.php.net') {
-                return 'phpdocs';
-            }
-
-            return false;
-        }
-
-        $channel = $this->_getChannel($channel);
-        if (PEAR::isError($channel)) {
-            return $channel;
-        }
-
-        return $channel->getAlias();
-    }
-
-    /**
-     * Get the name of the file where data for a given package is stored.
-     *
-     * @param string channel name, or false if this is a PEAR package
-     * @param string package name
-     *
-     * @return string registry file name
-     *
-     * @access public
-     */
-    function _channelDirectoryName($channel)
-    {
-        if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
-            return $this->statedir;
-        }
-
-        $ch = $this->_getChannelFromAlias($channel);
-        if (!$ch) {
-            $ch = $channel;
-        }
-
-        return $this->statedir . DIRECTORY_SEPARATOR . strtolower('.channel.' .
-            str_replace('/', '_', $ch));
-    }
-
-    function _openPackageFile($package, $mode, $channel = false)
-    {
-        if (!$this->_assertStateDir($channel)) {
-            return null;
-        }
-
-        if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) {
-            return null;
-        }
-
-        $file = $this->_packageFileName($package, $channel);
-        if (!file_exists($file) && $mode == 'r' || $mode == 'rb') {
-            return null;
-        }
-
-        $fp = @fopen($file, $mode);
-        if (!$fp) {
-            return null;
-        }
-
-        return $fp;
-    }
-
-    function _closePackageFile($fp)
-    {
-        fclose($fp);
-    }
-
-    function _openChannelFile($channel, $mode)
-    {
-        if (!$this->_assertChannelDir()) {
-            return null;
-        }
-
-        if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) {
-            return null;
-        }
-
-        $file = $this->_channelFileName($channel);
-        if (!file_exists($file) && $mode == 'r' || $mode == 'rb') {
-            return null;
-        }
-
-        $fp = @fopen($file, $mode);
-        if (!$fp) {
-            return null;
-        }
-
-        return $fp;
-    }
-
-    function _closeChannelFile($fp)
-    {
-        fclose($fp);
-    }
-
-    function _rebuildFileMap()
-    {
-        if (!class_exists('PEAR_Installer_Role')) {
-            require_once 'PEAR/Installer/Role.php';
-        }
-
-        $channels = $this->_listAllPackages();
-        $files = array();
-        foreach ($channels as $channel => $packages) {
-            foreach ($packages as $package) {
-                $version = $this->_packageInfo($package, 'version', $channel);
-                $filelist = $this->_packageInfo($package, 'filelist', $channel);
-                if (!is_array($filelist)) {
-                    continue;
-                }
-
-                foreach ($filelist as $name => $attrs) {
-                    if (isset($attrs['attribs'])) {
-                        $attrs = $attrs['attribs'];
-                    }
-
-                    // it is possible for conflicting packages in different channels to
-                    // conflict with data files/doc files
-                    if ($name == 'dirtree') {
-                        continue;
-                    }
-
-                    if (isset($attrs['role']) && !in_array($attrs['role'],
-                          PEAR_Installer_Role::getInstallableRoles())) {
-                        // these are not installed
-                        continue;
-                    }
-
-                    if (isset($attrs['role']) && !in_array($attrs['role'],
-                          PEAR_Installer_Role::getBaseinstallRoles())) {
-                        $attrs['baseinstalldir'] = $package;
-                    }
-
-                    if (isset($attrs['baseinstalldir'])) {
-                        $file = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name;
-                    } else {
-                        $file = $name;
-                    }
-
-                    $file = preg_replace(',^/+,', '', $file);
-                    if ($channel != 'pear.php.net') {
-                        if (!isset($files[$attrs['role']])) {
-                            $files[$attrs['role']] = array();
-                        }
-                        $files[$attrs['role']][$file] = array(strtolower($channel),
-                            strtolower($package));
-                    } else {
-                        if (!isset($files[$attrs['role']])) {
-                            $files[$attrs['role']] = array();
-                        }
-                        $files[$attrs['role']][$file] = strtolower($package);
-                    }
-                }
-            }
-        }
-
-
-        $this->_assertStateDir();
-        if (!$this->hasWriteAccess()) {
-            return false;
-        }
-
-        $fp = @fopen($this->filemap, 'wb');
-        if (!$fp) {
-            return false;
-        }
-
-        $this->filemap_cache = $files;
-        fwrite($fp, serialize($files));
-        fclose($fp);
-        return true;
-    }
-
-    function _readFileMap()
-    {
-        if (!file_exists($this->filemap)) {
-            return array();
-        }
-
-        $fp = @fopen($this->filemap, 'r');
-        if (!$fp) {
-            return $this->raiseError('PEAR_Registry: could not open filemap "' . $this->filemap . '"', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg);
-        }
-
-        clearstatcache();
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        $fsize = filesize($this->filemap);
-        fclose($fp);
-        $data = file_get_contents($this->filemap);
-        set_magic_quotes_runtime($rt);
-        $tmp = unserialize($data);
-        if (!$tmp && $fsize > 7) {
-            return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data);
-        }
-
-        $this->filemap_cache = $tmp;
-        return true;
-    }
-
-    /**
-     * Lock the registry.
-     *
-     * @param integer lock mode, one of LOCK_EX, LOCK_SH or LOCK_UN.
-     *                See flock manual for more information.
-     *
-     * @return bool TRUE on success, FALSE if locking failed, or a
-     *              PEAR error if some other error occurs (such as the
-     *              lock file not being writable).
-     *
-     * @access private
-     */
-    function _lock($mode = LOCK_EX)
-    {
-        if (stristr(php_uname(), 'Windows 9')) {
-            return true;
-        }
-
-        if ($mode != LOCK_UN && is_resource($this->lock_fp)) {
-            // XXX does not check type of lock (LOCK_SH/LOCK_EX)
-            return true;
-        }
-
-        if (!$this->_assertStateDir()) {
-            if ($mode == LOCK_EX) {
-                return $this->raiseError('Registry directory is not writeable by the current user');
-            }
-
-            return true;
-        }
-
-        $open_mode = 'w';
-        // XXX People reported problems with LOCK_SH and 'w'
-        if ($mode === LOCK_SH || $mode === LOCK_UN) {
-            if (!file_exists($this->lockfile)) {
-                touch($this->lockfile);
-            }
-            $open_mode = 'r';
-        }
-
-        if (!is_resource($this->lock_fp)) {
-            $this->lock_fp = @fopen($this->lockfile, $open_mode);
-        }
-
-        if (!is_resource($this->lock_fp)) {
-            $this->lock_fp = null;
-            return $this->raiseError("could not create lock file" .
-                                     (isset($php_errormsg) ? ": " . $php_errormsg : ""));
-        }
-
-        if (!(int)flock($this->lock_fp, $mode)) {
-            switch ($mode) {
-                case LOCK_SH: $str = 'shared';    break;
-                case LOCK_EX: $str = 'exclusive'; break;
-                case LOCK_UN: $str = 'unlock';    break;
-                default:      $str = 'unknown';   break;
-            }
-
-            //is resource at this point, close it on error.
-            fclose($this->lock_fp);
-            $this->lock_fp = null;
-            return $this->raiseError("could not acquire $str lock ($this->lockfile)",
-                                     PEAR_REGISTRY_ERROR_LOCK);
-        }
-
-        return true;
-    }
-
-    function _unlock()
-    {
-        $ret = $this->_lock(LOCK_UN);
-        if (is_resource($this->lock_fp)) {
-            fclose($this->lock_fp);
-        }
-
-        $this->lock_fp = null;
-        return $ret;
-    }
-
-    function _packageExists($package, $channel = false)
-    {
-        return file_exists($this->_packageFileName($package, $channel));
-    }
-
-    /**
-     * Determine whether a channel exists in the registry
-     *
-     * @param string Channel name
-     * @param bool if true, then aliases will be ignored
-     * @return boolean
-     */
-    function _channelExists($channel, $noaliases = false)
-    {
-        $a = file_exists($this->_channelFileName($channel, $noaliases));
-        if (!$a && $channel == 'pear.php.net') {
-            return true;
-        }
-
-        if (!$a && $channel == 'pecl.php.net') {
-            return true;
-        }
-
-        if (!$a && $channel == 'doc.php.net') {
-            return true;
-        }
-
-        return $a;
-    }
-
-    /**
-     * Determine whether a mirror exists within the deafult channel in the registry
-     *
-     * @param string Channel name
-     * @param string Mirror name
-     *
-     * @return boolean
-     */
-    function _mirrorExists($channel, $mirror)
-    {
-        $data = $this->_channelInfo($channel);
-        if (!isset($data['servers']['mirror'])) {
-            return false;
-        }
-
-        foreach ($data['servers']['mirror'] as $m) {
-            if ($m['attribs']['host'] == $mirror) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * @param PEAR_ChannelFile Channel object
-     * @param donotuse
-     * @param string Last-Modified HTTP tag from remote request
-     * @return boolean|PEAR_Error True on creation, false if it already exists
-     */
-    function _addChannel($channel, $update = false, $lastmodified = false)
-    {
-        if (!is_a($channel, 'PEAR_ChannelFile')) {
-            return false;
-        }
-
-        if (!$channel->validate()) {
-            return false;
-        }
-
-        if (file_exists($this->_channelFileName($channel->getName()))) {
-            if (!$update) {
-                return false;
-            }
-
-            $checker = $this->_getChannel($channel->getName());
-            if (PEAR::isError($checker)) {
-                return $checker;
-            }
-
-            if ($channel->getAlias() != $checker->getAlias()) {
-                if (file_exists($this->_getChannelAliasFileName($checker->getAlias()))) {
-                    @unlink($this->_getChannelAliasFileName($checker->getAlias()));
-                }
-            }
-        } else {
-            if ($update && !in_array($channel->getName(), array('pear.php.net', 'pecl.php.net', 'doc.php.net'))) {
-                return false;
-            }
-        }
-
-        $ret = $this->_assertChannelDir();
-        if (PEAR::isError($ret)) {
-            return $ret;
-        }
-
-        $ret = $this->_assertChannelStateDir($channel->getName());
-        if (PEAR::isError($ret)) {
-            return $ret;
-        }
-
-        if ($channel->getAlias() != $channel->getName()) {
-            if (file_exists($this->_getChannelAliasFileName($channel->getAlias())) &&
-                  $this->_getChannelFromAlias($channel->getAlias()) != $channel->getName()) {
-                $channel->setAlias($channel->getName());
-            }
-
-            if (!$this->hasWriteAccess()) {
-                return false;
-            }
-
-            $fp = @fopen($this->_getChannelAliasFileName($channel->getAlias()), 'w');
-            if (!$fp) {
-                return false;
-            }
-
-            fwrite($fp, $channel->getName());
-            fclose($fp);
-        }
-
-        if (!$this->hasWriteAccess()) {
-            return false;
-        }
-
-        $fp = @fopen($this->_channelFileName($channel->getName()), 'wb');
-        if (!$fp) {
-            return false;
-        }
-
-        $info = $channel->toArray();
-        if ($lastmodified) {
-            $info['_lastmodified'] = $lastmodified;
-        } else {
-            $info['_lastmodified'] = date('r');
-        }
-
-        fwrite($fp, serialize($info));
-        fclose($fp);
-        return true;
-    }
-
-    /**
-     * Deletion fails if there are any packages installed from the channel
-     * @param string|PEAR_ChannelFile channel name
-     * @return boolean|PEAR_Error True on deletion, false if it doesn't exist
-     */
-    function _deleteChannel($channel)
-    {
-        if (!is_string($channel)) {
-            if (!is_a($channel, 'PEAR_ChannelFile')) {
-                return false;
-            }
-
-            if (!$channel->validate()) {
-                return false;
-            }
-            $channel = $channel->getName();
-        }
-
-        if ($this->_getChannelFromAlias($channel) == '__uri') {
-            return false;
-        }
-
-        if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') {
-            return false;
-        }
-
-        if ($this->_getChannelFromAlias($channel) == 'doc.php.net') {
-            return false;
-        }
-
-        if (!$this->_channelExists($channel)) {
-            return false;
-        }
-
-        if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
-            return false;
-        }
-
-        $channel = $this->_getChannelFromAlias($channel);
-        if ($channel == 'pear.php.net') {
-            return false;
-        }
-
-        $test = $this->_listChannelPackages($channel);
-        if (count($test)) {
-            return false;
-        }
-
-        $test = @rmdir($this->_channelDirectoryName($channel));
-        if (!$test) {
-            return false;
-        }
-
-        $file = $this->_getChannelAliasFileName($this->_getAlias($channel));
-        if (file_exists($file)) {
-            $test = @unlink($file);
-            if (!$test) {
-                return false;
-            }
-        }
-
-        $file = $this->_channelFileName($channel);
-        $ret = true;
-        if (file_exists($file)) {
-            $ret = @unlink($file);
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Determine whether a channel exists in the registry
-     * @param string Channel Alias
-     * @return boolean
-     */
-    function _isChannelAlias($alias)
-    {
-        return file_exists($this->_getChannelAliasFileName($alias));
-    }
-
-    /**
-     * @param string|null
-     * @param string|null
-     * @param string|null
-     * @return array|null
-     * @access private
-     */
-    function _packageInfo($package = null, $key = null, $channel = 'pear.php.net')
-    {
-        if ($package === null) {
-            if ($channel === null) {
-                $channels = $this->_listChannels();
-                $ret = array();
-                foreach ($channels as $channel) {
-                    $channel = strtolower($channel);
-                    $ret[$channel] = array();
-                    $packages = $this->_listPackages($channel);
-                    foreach ($packages as $package) {
-                        $ret[$channel][] = $this->_packageInfo($package, null, $channel);
-                    }
-                }
-
-                return $ret;
-            }
-
-            $ps = $this->_listPackages($channel);
-            if (!count($ps)) {
-                return array();
-            }
-            return array_map(array(&$this, '_packageInfo'),
-                             $ps, array_fill(0, count($ps), null),
-                             array_fill(0, count($ps), $channel));
-        }
-
-        $fp = $this->_openPackageFile($package, 'r', $channel);
-        if ($fp === null) {
-            return null;
-        }
-
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        clearstatcache();
-        $this->_closePackageFile($fp);
-        $data = file_get_contents($this->_packageFileName($package, $channel));
-        set_magic_quotes_runtime($rt);
-        $data = unserialize($data);
-        if ($key === null) {
-            return $data;
-        }
-
-        // compatibility for package.xml version 2.0
-        if (isset($data['old'][$key])) {
-            return $data['old'][$key];
-        }
-
-        if (isset($data[$key])) {
-            return $data[$key];
-        }
-
-        return null;
-    }
-
-    /**
-     * @param string Channel name
-     * @param bool whether to strictly retrieve info of channels, not just aliases
-     * @return array|null
-     */
-    function _channelInfo($channel, $noaliases = false)
-    {
-        if (!$this->_channelExists($channel, $noaliases)) {
-            return null;
-        }
-
-        $fp = $this->_openChannelFile($channel, 'r');
-        if ($fp === null) {
-            return null;
-        }
-
-        $rt = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        clearstatcache();
-        $this->_closeChannelFile($fp);
-        $data = file_get_contents($this->_channelFileName($channel));
-        set_magic_quotes_runtime($rt);
-        $data = unserialize($data);
-        return $data;
-    }
-
-    function _listChannels()
-    {
-        $channellist = array();
-        if (!file_exists($this->channelsdir) || !is_dir($this->channelsdir)) {
-            return array('pear.php.net', 'pecl.php.net', 'doc.php.net', '__uri');
-        }
-
-        $dp = opendir($this->channelsdir);
-        while ($ent = readdir($dp)) {
-            if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
-                continue;
-            }
-
-            if ($ent == '__uri.reg') {
-                $channellist[] = '__uri';
-                continue;
-            }
-
-            $channellist[] = str_replace('_', '/', substr($ent, 0, -4));
-        }
-
-        closedir($dp);
-        if (!in_array('pear.php.net', $channellist)) {
-            $channellist[] = 'pear.php.net';
-        }
-
-        if (!in_array('pecl.php.net', $channellist)) {
-            $channellist[] = 'pecl.php.net';
-        }
-
-        if (!in_array('doc.php.net', $channellist)) {
-            $channellist[] = 'doc.php.net';
-        }
-
-
-        if (!in_array('__uri', $channellist)) {
-            $channellist[] = '__uri';
-        }
-
-        natsort($channellist);
-        return $channellist;
-    }
-
-    function _listPackages($channel = false)
-    {
-        if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
-            return $this->_listChannelPackages($channel);
-        }
-
-        if (!file_exists($this->statedir) || !is_dir($this->statedir)) {
-            return array();
-        }
-
-        $pkglist = array();
-        $dp = opendir($this->statedir);
-        if (!$dp) {
-            return $pkglist;
-        }
-
-        while ($ent = readdir($dp)) {
-            if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
-                continue;
-            }
-
-            $pkglist[] = substr($ent, 0, -4);
-        }
-        closedir($dp);
-        return $pkglist;
-    }
-
-    function _listChannelPackages($channel)
-    {
-        $pkglist = array();
-        if (!file_exists($this->_channelDirectoryName($channel)) ||
-              !is_dir($this->_channelDirectoryName($channel))) {
-            return array();
-        }
-
-        $dp = opendir($this->_channelDirectoryName($channel));
-        if (!$dp) {
-            return $pkglist;
-        }
-
-        while ($ent = readdir($dp)) {
-            if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
-                continue;
-            }
-            $pkglist[] = substr($ent, 0, -4);
-        }
-
-        closedir($dp);
-        return $pkglist;
-    }
-
-    function _listAllPackages()
-    {
-        $ret = array();
-        foreach ($this->_listChannels() as $channel) {
-            $ret[$channel] = $this->_listPackages($channel);
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Add an installed package to the registry
-     * @param string package name
-     * @param array package info (parsed by PEAR_Common::infoFrom*() methods)
-     * @return bool success of saving
-     * @access private
-     */
-    function _addPackage($package, $info)
-    {
-        if ($this->_packageExists($package)) {
-            return false;
-        }
-
-        $fp = $this->_openPackageFile($package, 'wb');
-        if ($fp === null) {
-            return false;
-        }
-
-        $info['_lastmodified'] = time();
-        fwrite($fp, serialize($info));
-        $this->_closePackageFile($fp);
-        if (isset($info['filelist'])) {
-            $this->_rebuildFileMap();
-        }
-
-        return true;
-    }
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @return bool
-     * @access private
-     */
-    function _addPackage2($info)
-    {
-        if (!is_a($info, 'PEAR_PackageFile_v1') && !is_a($info, 'PEAR_PackageFile_v2')) {
-            return false;
-        }
-
-        if (!$info->validate()) {
-            if (class_exists('PEAR_Common')) {
-                $ui = PEAR_Frontend::singleton();
-                if ($ui) {
-                    foreach ($info->getValidationWarnings() as $err) {
-                        $ui->log($err['message'], true);
-                    }
-                }
-            }
-            return false;
-        }
-
-        $channel = $info->getChannel();
-        $package = $info->getPackage();
-        $save = $info;
-        if ($this->_packageExists($package, $channel)) {
-            return false;
-        }
-
-        if (!$this->_channelExists($channel, true)) {
-            return false;
-        }
-
-        $info = $info->toArray(true);
-        if (!$info) {
-            return false;
-        }
-
-        $fp = $this->_openPackageFile($package, 'wb', $channel);
-        if ($fp === null) {
-            return false;
-        }
-
-        $info['_lastmodified'] = time();
-        fwrite($fp, serialize($info));
-        $this->_closePackageFile($fp);
-        $this->_rebuildFileMap();
-        return true;
-    }
-
-    /**
-     * @param string Package name
-     * @param array parsed package.xml 1.0
-     * @param bool this parameter is only here for BC.  Don't use it.
-     * @access private
-     */
-    function _updatePackage($package, $info, $merge = true)
-    {
-        $oldinfo = $this->_packageInfo($package);
-        if (empty($oldinfo)) {
-            return false;
-        }
-
-        $fp = $this->_openPackageFile($package, 'w');
-        if ($fp === null) {
-            return false;
-        }
-
-        if (is_object($info)) {
-            $info = $info->toArray();
-        }
-        $info['_lastmodified'] = time();
-
-        $newinfo = $info;
-        if ($merge) {
-            $info = array_merge($oldinfo, $info);
-        } else {
-            $diff = $info;
-        }
-
-        fwrite($fp, serialize($info));
-        $this->_closePackageFile($fp);
-        if (isset($newinfo['filelist'])) {
-            $this->_rebuildFileMap();
-        }
-
-        return true;
-    }
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @return bool
-     * @access private
-     */
-    function _updatePackage2($info)
-    {
-        if (!$this->_packageExists($info->getPackage(), $info->getChannel())) {
-            return false;
-        }
-
-        $fp = $this->_openPackageFile($info->getPackage(), 'w', $info->getChannel());
-        if ($fp === null) {
-            return false;
-        }
-
-        $save = $info;
-        $info = $save->getArray(true);
-        $info['_lastmodified'] = time();
-        fwrite($fp, serialize($info));
-        $this->_closePackageFile($fp);
-        $this->_rebuildFileMap();
-        return true;
-    }
-
-    /**
-     * @param string Package name
-     * @param string Channel name
-     * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null
-     * @access private
-     */
-    function &_getPackage($package, $channel = 'pear.php.net')
-    {
-        $info = $this->_packageInfo($package, null, $channel);
-        if ($info === null) {
-            return $info;
-        }
-
-        $a = $this->_config;
-        if (!$a) {
-            $this->_config = &new PEAR_Config;
-            $this->_config->set('php_dir', $this->statedir);
-        }
-
-        if (!class_exists('PEAR_PackageFile')) {
-            require_once 'PEAR/PackageFile.php';
-        }
-
-        $pkg = &new PEAR_PackageFile($this->_config);
-        $pf = &$pkg->fromArray($info);
-        return $pf;
-    }
-
-    /**
-     * @param string channel name
-     * @param bool whether to strictly retrieve channel names
-     * @return PEAR_ChannelFile|PEAR_Error
-     * @access private
-     */
-    function &_getChannel($channel, $noaliases = false)
-    {
-        $ch = false;
-        if ($this->_channelExists($channel, $noaliases)) {
-            $chinfo = $this->_channelInfo($channel, $noaliases);
-            if ($chinfo) {
-                if (!class_exists('PEAR_ChannelFile')) {
-                    require_once 'PEAR/ChannelFile.php';
-                }
-
-                $ch = &PEAR_ChannelFile::fromArrayWithErrors($chinfo);
-            }
-        }
-
-        if ($ch) {
-            if ($ch->validate()) {
-                return $ch;
-            }
-
-            foreach ($ch->getErrors(true) as $err) {
-                $message = $err['message'] . "\n";
-            }
-
-            $ch = PEAR::raiseError($message);
-            return $ch;
-        }
-
-        if ($this->_getChannelFromAlias($channel) == 'pear.php.net') {
-            // the registry is not properly set up, so use defaults
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $pear_channel = new PEAR_ChannelFile;
-            $pear_channel->setServer('pear.php.net');
-            $pear_channel->setAlias('pear');
-            $pear_channel->setSummary('PHP Extension and Application Repository');
-            $pear_channel->setDefaultPEARProtocols();
-            $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
-            $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
-            $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/');
-            return $pear_channel;
-        }
-
-        if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') {
-            // the registry is not properly set up, so use defaults
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-            $pear_channel = new PEAR_ChannelFile;
-            $pear_channel->setServer('pecl.php.net');
-            $pear_channel->setAlias('pecl');
-            $pear_channel->setSummary('PHP Extension Community Library');
-            $pear_channel->setDefaultPEARProtocols();
-            $pear_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
-            $pear_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
-            $pear_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
-            return $pear_channel;
-        }
-
-        if ($this->_getChannelFromAlias($channel) == 'doc.php.net') {
-            // the registry is not properly set up, so use defaults
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $doc_channel = new PEAR_ChannelFile;
-            $doc_channel->setServer('doc.php.net');
-            $doc_channel->setAlias('phpdocs');
-            $doc_channel->setSummary('PHP Documentation Team');
-            $doc_channel->setDefaultPEARProtocols();
-            $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/');
-            $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/');
-            $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/');
-            return $doc_channel;
-        }
-
-
-        if ($this->_getChannelFromAlias($channel) == '__uri') {
-            // the registry is not properly set up, so use defaults
-            if (!class_exists('PEAR_ChannelFile')) {
-                require_once 'PEAR/ChannelFile.php';
-            }
-
-            $private = new PEAR_ChannelFile;
-            $private->setName('__uri');
-            $private->setDefaultPEARProtocols();
-            $private->setBaseURL('REST1.0', '****');
-            $private->setSummary('Pseudo-channel for static packages');
-            return $private;
-        }
-
-        return $ch;
-    }
-
-    /**
-     * @param string Package name
-     * @param string Channel name
-     * @return bool
-     */
-    function packageExists($package, $channel = 'pear.php.net')
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_packageExists($package, $channel);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-
-    // {{{ channelExists()
-
-    /**
-     * @param string channel name
-     * @param bool if true, then aliases will be ignored
-     * @return bool
-     */
-    function channelExists($channel, $noaliases = false)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_channelExists($channel, $noaliases);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-
-    /**
-     * @param string channel name mirror is in
-     * @param string mirror name
-     *
-     * @return bool
-     */
-    function mirrorExists($channel, $mirror)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-
-        $ret = $this->_mirrorExists($channel, $mirror);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // {{{ isAlias()
-
-    /**
-     * Determines whether the parameter is an alias of a channel
-     * @param string
-     * @return bool
-     */
-    function isAlias($alias)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_isChannelAlias($alias);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ packageInfo()
-
-    /**
-     * @param string|null
-     * @param string|null
-     * @param string
-     * @return array|null
-     */
-    function packageInfo($package = null, $key = null, $channel = 'pear.php.net')
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_packageInfo($package, $key, $channel);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ channelInfo()
-
-    /**
-     * Retrieve a raw array of channel data.
-     *
-     * Do not use this, instead use {@link getChannel()} for normal
-     * operations.  Array structure is undefined in this method
-     * @param string channel name
-     * @param bool whether to strictly retrieve information only on non-aliases
-     * @return array|null|PEAR_Error
-     */
-    function channelInfo($channel = null, $noaliases = false)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_channelInfo($channel, $noaliases);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-
-    /**
-     * @param string
-     */
-    function channelName($channel)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_getChannelFromAlias($channel);
-        $this->_unlock();
-        return $ret;
-    }
-
-    /**
-     * @param string
-     */
-    function channelAlias($channel)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_getAlias($channel);
-        $this->_unlock();
-        return $ret;
-    }
-    // {{{ listPackages()
-
-    function listPackages($channel = false)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_listPackages($channel);
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ listAllPackages()
-
-    function listAllPackages()
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_listAllPackages();
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ listChannel()
-
-    function listChannels()
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = $this->_listChannels();
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ addPackage()
-
-    /**
-     * Add an installed package to the registry
-     * @param string|PEAR_PackageFile_v1|PEAR_PackageFile_v2 package name or object
-     *               that will be passed to {@link addPackage2()}
-     * @param array package info (parsed by PEAR_Common::infoFrom*() methods)
-     * @return bool success of saving
-     */
-    function addPackage($package, $info)
-    {
-        if (is_object($info)) {
-            return $this->addPackage2($info);
-        }
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-        $ret = $this->_addPackage($package, $info);
-        $this->_unlock();
-        if ($ret) {
-            if (!class_exists('PEAR_PackageFile_v1')) {
-                require_once 'PEAR/PackageFile/v1.php';
-            }
-            $pf = new PEAR_PackageFile_v1;
-            $pf->setConfig($this->_config);
-            $pf->fromArray($info);
-            $this->_dependencyDB->uninstallPackage($pf);
-            $this->_dependencyDB->installPackage($pf);
-        }
-        return $ret;
-    }
-
-    // }}}
-    // {{{ addPackage2()
-
-    function addPackage2($info)
-    {
-        if (!is_object($info)) {
-            return $this->addPackage($info['package'], $info);
-        }
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-        $ret = $this->_addPackage2($info);
-        $this->_unlock();
-        if ($ret) {
-            $this->_dependencyDB->uninstallPackage($info);
-            $this->_dependencyDB->installPackage($info);
-        }
-        return $ret;
-    }
-
-    // }}}
-    // {{{ updateChannel()
-
-    /**
-     * For future expandibility purposes, separate this
-     * @param PEAR_ChannelFile
-     */
-    function updateChannel($channel, $lastmodified = null)
-    {
-        if ($channel->getName() == '__uri') {
-            return false;
-        }
-        return $this->addChannel($channel, $lastmodified, true);
-    }
-
-    // }}}
-    // {{{ deleteChannel()
-
-    /**
-     * Deletion fails if there are any packages installed from the channel
-     * @param string|PEAR_ChannelFile channel name
-     * @return boolean|PEAR_Error True on deletion, false if it doesn't exist
-     */
-    function deleteChannel($channel)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-
-        $ret = $this->_deleteChannel($channel);
-        $this->_unlock();
-        if ($ret && is_a($this->_config, 'PEAR_Config')) {
-            $this->_config->setChannels($this->listChannels());
-        }
-
-        return $ret;
-    }
-
-    // }}}
-    // {{{ addChannel()
-
-    /**
-     * @param PEAR_ChannelFile Channel object
-     * @param string Last-Modified header from HTTP for caching
-     * @return boolean|PEAR_Error True on creation, false if it already exists
-     */
-    function addChannel($channel, $lastmodified = false, $update = false)
-    {
-        if (!is_a($channel, 'PEAR_ChannelFile') || !$channel->validate()) {
-            return false;
-        }
-
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-
-        $ret = $this->_addChannel($channel, $update, $lastmodified);
-        $this->_unlock();
-        if (!$update && $ret && is_a($this->_config, 'PEAR_Config')) {
-            $this->_config->setChannels($this->listChannels());
-        }
-
-        return $ret;
-    }
-
-    // }}}
-    // {{{ deletePackage()
-
-    function deletePackage($package, $channel = 'pear.php.net')
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-
-        $file = $this->_packageFileName($package, $channel);
-        $ret  = file_exists($file) ? @unlink($file) : false;
-        $this->_rebuildFileMap();
-        $this->_unlock();
-        $p = array('channel' => $channel, 'package' => $package);
-        $this->_dependencyDB->uninstallPackage($p);
-        return $ret;
-    }
-
-    // }}}
-    // {{{ updatePackage()
-
-    function updatePackage($package, $info, $merge = true)
-    {
-        if (is_object($info)) {
-            return $this->updatePackage2($info, $merge);
-        }
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-        $ret = $this->_updatePackage($package, $info, $merge);
-        $this->_unlock();
-        if ($ret) {
-            if (!class_exists('PEAR_PackageFile_v1')) {
-                require_once 'PEAR/PackageFile/v1.php';
-            }
-            $pf = new PEAR_PackageFile_v1;
-            $pf->setConfig($this->_config);
-            $pf->fromArray($this->packageInfo($package));
-            $this->_dependencyDB->uninstallPackage($pf);
-            $this->_dependencyDB->installPackage($pf);
-        }
-        return $ret;
-    }
-
-    // }}}
-    // {{{ updatePackage2()
-
-    function updatePackage2($info)
-    {
-
-        if (!is_object($info)) {
-            return $this->updatePackage($info['package'], $info, $merge);
-        }
-
-        if (!$info->validate(PEAR_VALIDATE_DOWNLOADING)) {
-            return false;
-        }
-
-        if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
-            return $e;
-        }
-
-        $ret = $this->_updatePackage2($info);
-        $this->_unlock();
-        if ($ret) {
-            $this->_dependencyDB->uninstallPackage($info);
-            $this->_dependencyDB->installPackage($info);
-        }
-
-        return $ret;
-    }
-
-    // }}}
-    // {{{ getChannel()
-    /**
-     * @param string channel name
-     * @param bool whether to strictly return raw channels (no aliases)
-     * @return PEAR_ChannelFile|PEAR_Error
-     */
-    function &getChannel($channel, $noaliases = false)
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $ret = &$this->_getChannel($channel, $noaliases);
-        $this->_unlock();
-        if (!$ret) {
-            return PEAR::raiseError('Unknown channel: ' . $channel);
-        }
-        return $ret;
-    }
-
-    // }}}
-    // {{{ getPackage()
-    /**
-     * @param string package name
-     * @param string channel name
-     * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null
-     */
-    function &getPackage($package, $channel = 'pear.php.net')
-    {
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        $pf = &$this->_getPackage($package, $channel);
-        $this->_unlock();
-        return $pf;
-    }
-
-    // }}}
-
-    /**
-     * Get PEAR_PackageFile_v[1/2] objects representing the contents of
-     * a dependency group that are installed.
-     *
-     * This is used at uninstall-time
-     * @param array
-     * @return array|false
-     */
-    function getInstalledGroup($group)
-    {
-        $ret = array();
-        if (isset($group['package'])) {
-            if (!isset($group['package'][0])) {
-                $group['package'] = array($group['package']);
-            }
-            foreach ($group['package'] as $package) {
-                $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';
-                $p = &$this->getPackage($package['name'], $depchannel);
-                if ($p) {
-                    $save = &$p;
-                    $ret[] = &$save;
-                }
-            }
-        }
-        if (isset($group['subpackage'])) {
-            if (!isset($group['subpackage'][0])) {
-                $group['subpackage'] = array($group['subpackage']);
-            }
-            foreach ($group['subpackage'] as $package) {
-                $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';
-                $p = &$this->getPackage($package['name'], $depchannel);
-                if ($p) {
-                    $save = &$p;
-                    $ret[] = &$save;
-                }
-            }
-        }
-        if (!count($ret)) {
-            return false;
-        }
-        return $ret;
-    }
-
-    // {{{ getChannelValidator()
-    /**
-     * @param string channel name
-     * @return PEAR_Validate|false
-     */
-    function &getChannelValidator($channel)
-    {
-        $chan = $this->getChannel($channel);
-        if (PEAR::isError($chan)) {
-            return $chan;
-        }
-        $val = $chan->getValidationObject();
-        return $val;
-    }
-    // }}}
-    // {{{ getChannels()
-    /**
-     * @param string channel name
-     * @return array an array of PEAR_ChannelFile objects representing every installed channel
-     */
-    function &getChannels()
-    {
-        $ret = array();
-        if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-            return $e;
-        }
-        foreach ($this->_listChannels() as $channel) {
-            $e = &$this->_getChannel($channel);
-            if (!$e || PEAR::isError($e)) {
-                continue;
-            }
-            $ret[] = $e;
-        }
-        $this->_unlock();
-        return $ret;
-    }
-
-    // }}}
-    // {{{ checkFileMap()
-
-    /**
-     * Test whether a file or set of files belongs to a package.
-     *
-     * If an array is passed in
-     * @param string|array file path, absolute or relative to the pear
-     *                     install dir
-     * @param string|array name of PEAR package or array('package' => name, 'channel' =>
-     *                     channel) of a package that will be ignored
-     * @param string API version - 1.1 will exclude any files belonging to a package
-     * @param array private recursion variable
-     * @return array|false which package and channel the file belongs to, or an empty
-     *                     string if the file does not belong to an installed package,
-     *                     or belongs to the second parameter's package
-     */
-    function checkFileMap($path, $package = false, $api = '1.0', $attrs = false)
-    {
-        if (is_array($path)) {
-            static $notempty;
-            if (empty($notempty)) {
-                if (!class_exists('PEAR_Installer_Role')) {
-                    require_once 'PEAR/Installer/Role.php';
-                }
-                $notempty = create_function('$a','return !empty($a);');
-            }
-            $package = is_array($package) ? array(strtolower($package[0]), strtolower($package[1]))
-                : strtolower($package);
-            $pkgs = array();
-            foreach ($path as $name => $attrs) {
-                if (is_array($attrs)) {
-                    if (isset($attrs['install-as'])) {
-                        $name = $attrs['install-as'];
-                    }
-                    if (!in_array($attrs['role'], PEAR_Installer_Role::getInstallableRoles())) {
-                        // these are not installed
-                        continue;
-                    }
-                    if (!in_array($attrs['role'], PEAR_Installer_Role::getBaseinstallRoles())) {
-                        $attrs['baseinstalldir'] = is_array($package) ? $package[1] : $package;
-                    }
-                    if (isset($attrs['baseinstalldir'])) {
-                        $name = $attrs['baseinstalldir'] . DIRECTORY_SEPARATOR . $name;
-                    }
-                }
-                $pkgs[$name] = $this->checkFileMap($name, $package, $api, $attrs);
-                if (PEAR::isError($pkgs[$name])) {
-                    return $pkgs[$name];
-                }
-            }
-            return array_filter($pkgs, $notempty);
-        }
-        if (empty($this->filemap_cache)) {
-            if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
-                return $e;
-            }
-            $err = $this->_readFileMap();
-            $this->_unlock();
-            if (PEAR::isError($err)) {
-                return $err;
-            }
-        }
-        if (!$attrs) {
-            $attrs = array('role' => 'php'); // any old call would be for PHP role only
-        }
-        if (isset($this->filemap_cache[$attrs['role']][$path])) {
-            if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {
-                return false;
-            }
-            return $this->filemap_cache[$attrs['role']][$path];
-        }
-        $l = strlen($this->install_dir);
-        if (substr($path, 0, $l) == $this->install_dir) {
-            $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l));
-        }
-        if (isset($this->filemap_cache[$attrs['role']][$path])) {
-            if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {
-                return false;
-            }
-            return $this->filemap_cache[$attrs['role']][$path];
-        }
-        return false;
-    }
-
-    // }}}
-    // {{{ flush()
-    /**
-     * Force a reload of the filemap
-     * @since 1.5.0RC3
-     */
-    function flushFileMap()
-    {
-        $this->filemap_cache = null;
-        clearstatcache(); // ensure that the next read gets the full, current filemap
-    }
-
-    // }}}
-    // {{{ apiVersion()
-    /**
-     * Get the expected API version.  Channels API is version 1.1, as it is backwards
-     * compatible with 1.0
-     * @return string
-     */
-    function apiVersion()
-    {
-        return '1.1';
-    }
-    // }}}
-
-
-    /**
-     * Parse a package name, or validate a parsed package name array
-     * @param string|array pass in an array of format
-     *                     array(
-     *                      'package' => 'pname',
-     *                     ['channel' => 'channame',]
-     *                     ['version' => 'version',]
-     *                     ['state' => 'state',]
-     *                     ['group' => 'groupname'])
-     *                     or a string of format
-     *                     [channel://][channame/]pname[-version|-state][/group=groupname]
-     * @return array|PEAR_Error
-     */
-    function parsePackageName($param, $defaultchannel = 'pear.php.net')
-    {
-        $saveparam = $param;
-        if (is_array($param)) {
-            // convert to string for error messages
-            $saveparam = $this->parsedPackageNameToString($param);
-            // process the array
-            if (!isset($param['package'])) {
-                return PEAR::raiseError('parsePackageName(): array $param ' .
-                    'must contain a valid package name in index "param"',
-                    'package', null, null, $param);
-            }
-            if (!isset($param['uri'])) {
-                if (!isset($param['channel'])) {
-                    $param['channel'] = $defaultchannel;
-                }
-            } else {
-                $param['channel'] = '__uri';
-            }
-        } else {
-            $components = @parse_url((string) $param);
-            if (isset($components['scheme'])) {
-                if ($components['scheme'] == 'http') {
-                    // uri package
-                    $param = array('uri' => $param, 'channel' => '__uri');
-                } elseif($components['scheme'] != 'channel') {
-                    return PEAR::raiseError('parsePackageName(): only channel:// uris may ' .
-                        'be downloaded, not "' . $param . '"', 'invalid', null, null, $param);
-                }
-            }
-            if (!isset($components['path'])) {
-                return PEAR::raiseError('parsePackageName(): array $param ' .
-                    'must contain a valid package name in "' . $param . '"',
-                    'package', null, null, $param);
-            }
-            if (isset($components['host'])) {
-                // remove the leading "/"
-                $components['path'] = substr($components['path'], 1);
-            }
-            if (!isset($components['scheme'])) {
-                if (strpos($components['path'], '/') !== false) {
-                    if ($components['path']{0} == '/') {
-                        return PEAR::raiseError('parsePackageName(): this is not ' .
-                            'a package name, it begins with "/" in "' . $param . '"',
-                            'invalid', null, null, $param);
-                    }
-                    $parts = explode('/', $components['path']);
-                    $components['host'] = array_shift($parts);
-                    if (count($parts) > 1) {
-                        $components['path'] = array_pop($parts);
-                        $components['host'] .= '/' . implode('/', $parts);
-                    } else {
-                        $components['path'] = implode('/', $parts);
-                    }
-                } else {
-                    $components['host'] = $defaultchannel;
-                }
-            } else {
-                if (strpos($components['path'], '/')) {
-                    $parts = explode('/', $components['path']);
-                    $components['path'] = array_pop($parts);
-                    $components['host'] .= '/' . implode('/', $parts);
-                }
-            }
-
-            if (is_array($param)) {
-                $param['package'] = $components['path'];
-            } else {
-                $param = array(
-                    'package' => $components['path']
-                    );
-                if (isset($components['host'])) {
-                    $param['channel'] = $components['host'];
-                }
-            }
-            if (isset($components['fragment'])) {
-                $param['group'] = $components['fragment'];
-            }
-            if (isset($components['user'])) {
-                $param['user'] = $components['user'];
-            }
-            if (isset($components['pass'])) {
-                $param['pass'] = $components['pass'];
-            }
-            if (isset($components['query'])) {
-                parse_str($components['query'], $param['opts']);
-            }
-            // check for extension
-            $pathinfo = pathinfo($param['package']);
-            if (isset($pathinfo['extension']) &&
-                  in_array(strtolower($pathinfo['extension']), array('tgz', 'tar'))) {
-                $param['extension'] = $pathinfo['extension'];
-                $param['package'] = substr($pathinfo['basename'], 0,
-                    strlen($pathinfo['basename']) - 4);
-            }
-            // check for version
-            if (strpos($param['package'], '-')) {
-                $test = explode('-', $param['package']);
-                if (count($test) != 2) {
-                    return PEAR::raiseError('parsePackageName(): only one version/state ' .
-                        'delimiter "-" is allowed in "' . $saveparam . '"',
-                        'version', null, null, $param);
-                }
-                list($param['package'], $param['version']) = $test;
-            }
-        }
-        // validation
-        $info = $this->channelExists($param['channel']);
-        if (PEAR::isError($info)) {
-            return $info;
-        }
-        if (!$info) {
-            return PEAR::raiseError('unknown channel "' . $param['channel'] .
-                '" in "' . $saveparam . '"', 'channel', null, null, $param);
-        }
-        $chan = $this->getChannel($param['channel']);
-        if (PEAR::isError($chan)) {
-            return $chan;
-        }
-        if (!$chan) {
-            return PEAR::raiseError("Exception: corrupt registry, could not " .
-                "retrieve channel " . $param['channel'] . " information",
-                'registry', null, null, $param);
-        }
-        $param['channel'] = $chan->getName();
-        $validate = $chan->getValidationObject();
-        $vpackage = $chan->getValidationPackage();
-        // validate package name
-        if (!$validate->validPackageName($param['package'], $vpackage['_content'])) {
-            return PEAR::raiseError('parsePackageName(): invalid package name "' .
-                $param['package'] . '" in "' . $saveparam . '"',
-                'package', null, null, $param);
-        }
-        if (isset($param['group'])) {
-            if (!PEAR_Validate::validGroupName($param['group'])) {
-                return PEAR::raiseError('parsePackageName(): dependency group "' . $param['group'] .
-                    '" is not a valid group name in "' . $saveparam . '"', 'group', null, null,
-                    $param);
-            }
-        }
-        if (isset($param['state'])) {
-            if (!in_array(strtolower($param['state']), $validate->getValidStates())) {
-                return PEAR::raiseError('parsePackageName(): state "' . $param['state']
-                    . '" is not a valid state in "' . $saveparam . '"',
-                    'state', null, null, $param);
-            }
-        }
-        if (isset($param['version'])) {
-            if (isset($param['state'])) {
-                return PEAR::raiseError('parsePackageName(): cannot contain both ' .
-                    'a version and a stability (state) in "' . $saveparam . '"',
-                    'version/state', null, null, $param);
-            }
-            // check whether version is actually a state
-            if (in_array(strtolower($param['version']), $validate->getValidStates())) {
-                $param['state'] = strtolower($param['version']);
-                unset($param['version']);
-            } else {
-                if (!$validate->validVersion($param['version'])) {
-                    return PEAR::raiseError('parsePackageName(): "' . $param['version'] .
-                        '" is neither a valid version nor a valid state in "' .
-                        $saveparam . '"', 'version/state', null, null, $param);
-                }
-            }
-        }
-        return $param;
-    }
-
-    /**
-     * @param array
-     * @return string
-     */
-    function parsedPackageNameToString($parsed, $brief = false)
-    {
-        if (is_string($parsed)) {
-            return $parsed;
-        }
-        if (is_object($parsed)) {
-            $p = $parsed;
-            $parsed = array(
-                'package' => $p->getPackage(),
-                'channel' => $p->getChannel(),
-                'version' => $p->getVersion(),
-            );
-        }
-        if (isset($parsed['uri'])) {
-            return $parsed['uri'];
-        }
-        if ($brief) {
-            if ($channel = $this->channelAlias($parsed['channel'])) {
-                return $channel . '/' . $parsed['package'];
-            }
-        }
-        $upass = '';
-        if (isset($parsed['user'])) {
-            $upass = $parsed['user'];
-            if (isset($parsed['pass'])) {
-                $upass .= ':' . $parsed['pass'];
-            }
-            $upass = "$upass@";
-        }
-        $ret = 'channel://' . $upass . $parsed['channel'] . '/' . $parsed['package'];
-        if (isset($parsed['version']) || isset($parsed['state'])) {
-            $ver = isset($parsed['version']) ? $parsed['version'] : '';
-            $ver .= isset($parsed['state']) ? $parsed['state'] : '';
-            $ret .= '-' . $ver;
-        }
-        if (isset($parsed['extension'])) {
-            $ret .= '.' . $parsed['extension'];
-        }
-        if (isset($parsed['opts'])) {
-            $ret .= '?';
-            foreach ($parsed['opts'] as $name => $value) {
-                $parsed['opts'][$name] = "$name=$value";
-            }
-            $ret .= implode('&', $parsed['opts']);
-        }
-        if (isset($parsed['group'])) {
-            $ret .= '#' . $parsed['group'];
-        }
-        return $ret;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/RunTest.php b/lib/php/PEAR/RunTest.php
deleted file mode 100644
index 9d338e85032668072474b033594254ded84f5afa..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/RunTest.php
+++ /dev/null
@@ -1,951 +0,0 @@
-<?php
-/**
- * PEAR_RunTest
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @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: RunTest.php 287447 2009-08-18 11:46:19Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.3.3
- */
-
-/**
- * for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-define('DETAILED', 1);
-putenv("PHP_PEAR_RUNTESTS=1");
-
-/**
- * Simplified version of PHP's test suite
- *
- * Try it with:
- *
- * $ php -r 'include "../PEAR/RunTest.php"; $t=new PEAR_RunTest; $o=$t->run("./pear_system.phpt");print_r($o);'
- *
- *
- * @category   pear
- * @package    PEAR
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.3.3
- */
-class PEAR_RunTest
-{
-    var $_headers = array();
-    var $_logger;
-    var $_options;
-    var $_php;
-    var $tests_count;
-    var $xdebug_loaded;
-    /**
-     * Saved value of php executable, used to reset $_php when we
-     * have a test that uses cgi
-     *
-     * @var unknown_type
-     */
-    var $_savephp;
-    var $ini_overwrites = array(
-        'output_handler=',
-        'open_basedir=',
-        'safe_mode=0',
-        'disable_functions=',
-        'output_buffering=Off',
-        'display_errors=1',
-        'log_errors=0',
-        'html_errors=0',
-        'track_errors=1',
-        'report_memleaks=0',
-        'report_zend_debug=0',
-        'docref_root=',
-        'docref_ext=.html',
-        'error_prepend_string=',
-        'error_append_string=',
-        'auto_prepend_file=',
-        'auto_append_file=',
-        'magic_quotes_runtime=0',
-        'xdebug.default_enable=0',
-        'allow_url_fopen=1',
-    );
-
-    /**
-     * An object that supports the PEAR_Common->log() signature, or null
-     * @param PEAR_Common|null
-     */
-    function PEAR_RunTest($logger = null, $options = array())
-    {
-        if (!defined('E_DEPRECATED')) {
-            define('E_DEPRECATED', 0);
-        }
-        if (!defined('E_STRICT')) {
-            define('E_STRICT', 0);
-        }
-        $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
-        if (is_null($logger)) {
-            require_once 'PEAR/Common.php';
-            $logger = new PEAR_Common;
-        }
-        $this->_logger  = $logger;
-        $this->_options = $options;
-
-        $conf = &PEAR_Config::singleton();
-        $this->_php = $conf->get('php_bin');
-    }
-
-    /**
-     * Taken from php-src/run-tests.php
-     *
-     * @param string $commandline command name
-     * @param array $env
-     * @param string $stdin standard input to pass to the command
-     * @return unknown
-     */
-    function system_with_timeout($commandline, $env = null, $stdin = null)
-    {
-        $data = '';
-        if (version_compare(phpversion(), '5.0.0', '<')) {
-            $proc = proc_open($commandline, array(
-                0 => array('pipe', 'r'),
-                1 => array('pipe', 'w'),
-                2 => array('pipe', 'w')
-                ), $pipes);
-        } else {
-            $proc = proc_open($commandline, array(
-                0 => array('pipe', 'r'),
-                1 => array('pipe', 'w'),
-                2 => array('pipe', 'w')
-                ), $pipes, null, $env, array('suppress_errors' => true));
-        }
-
-        if (!$proc) {
-            return false;
-        }
-
-        if (is_string($stdin)) {
-            fwrite($pipes[0], $stdin);
-        }
-        fclose($pipes[0]);
-
-        while (true) {
-            /* hide errors from interrupted syscalls */
-            $r = $pipes;
-            $e = $w = null;
-            $n = @stream_select($r, $w, $e, 60);
-
-            if ($n === 0) {
-                /* timed out */
-                $data .= "\n ** ERROR: process timed out **\n";
-                proc_terminate($proc);
-                return array(1234567890, $data);
-            } else if ($n > 0) {
-                $line = fread($pipes[1], 8192);
-                if (strlen($line) == 0) {
-                    /* EOF */
-                    break;
-                }
-                $data .= $line;
-            }
-        }
-        if (function_exists('proc_get_status')) {
-            $stat = proc_get_status($proc);
-            if ($stat['signaled']) {
-                $data .= "\nTermsig=".$stat['stopsig'];
-            }
-        }
-        $code = proc_close($proc);
-        if (function_exists('proc_get_status')) {
-            $code = $stat['exitcode'];
-        }
-        return array($code, $data);
-    }
-
-    /**
-     * Turns a PHP INI string into an array
-     *
-     * Turns -d "include_path=/foo/bar" into this:
-     * array(
-     *   'include_path' => array(
-     *          'operator' => '-d',
-     *          'value'    => '/foo/bar',
-     *   )
-     * )
-     * Works both with quotes and without
-     *
-     * @param string an PHP INI string, -d "include_path=/foo/bar"
-     * @return array
-     */
-    function iniString2array($ini_string)
-    {
-        if (!$ini_string) {
-            return array();
-        }
-        $split = preg_split('/[\s]|=/', $ini_string, -1, PREG_SPLIT_NO_EMPTY);
-        $key   = $split[1][0] == '"'                     ? substr($split[1], 1)     : $split[1];
-        $value = $split[2][strlen($split[2]) - 1] == '"' ? substr($split[2], 0, -1) : $split[2];
-        // FIXME review if this is really the struct to go with
-        $array = array($key => array('operator' => $split[0], 'value' => $value));
-        return $array;
-    }
-
-    function settings2array($settings, $ini_settings)
-    {
-        foreach ($settings as $setting) {
-            if (strpos($setting, '=') !== false) {
-                $setting = explode('=', $setting, 2);
-                $name  = trim(strtolower($setting[0]));
-                $value = trim($setting[1]);
-                $ini_settings[$name] = $value;
-            }
-        }
-        return $ini_settings;
-    }
-
-    function settings2params($ini_settings)
-    {
-        $settings = '';
-        foreach ($ini_settings as $name => $value) {
-            if (is_array($value)) {
-                $operator = $value['operator'];
-                $value    = $value['value'];
-            } else {
-                $operator = '-d';
-            }
-            $value = addslashes($value);
-            $settings .= " $operator \"$name=$value\"";
-        }
-        return $settings;
-    }
-
-    function _preparePhpBin($php, $file, $ini_settings)
-    {
-        $file = escapeshellarg($file);
-        // This was fixed in php 5.3 and is not needed after that
-        if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<')) {
-            $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f ' . $file .'"';
-        } else {
-            $cmd = $php . $ini_settings . ' -f ' . $file;
-        }
-
-        return $cmd;
-    }
-
-    function runPHPUnit($file, $ini_settings = '')
-    {
-        if (!file_exists($file) && file_exists(getcwd() . DIRECTORY_SEPARATOR . $file)) {
-            $file = realpath(getcwd() . DIRECTORY_SEPARATOR . $file);
-        } elseif (file_exists($file)) {
-            $file = realpath($file);
-        }
-
-        $cmd = $this->_preparePhpBin($this->_php, $file, $ini_settings);
-        if (isset($this->_logger)) {
-            $this->_logger->log(2, 'Running command "' . $cmd . '"');
-        }
-
-        $savedir = getcwd(); // in case the test moves us around
-        chdir(dirname($file));
-        echo `$cmd`;
-        chdir($savedir);
-        return 'PASSED'; // we have no way of knowing this information so assume passing
-    }
-
-    /**
-     * Runs an individual test case.
-     *
-     * @param string       The filename of the test
-     * @param array|string INI settings to be applied to the test run
-     * @param integer      Number what the current running test is of the
-     *                     whole test suite being runned.
-     *
-     * @return string|object Returns PASSED, WARNED, FAILED depending on how the
-     *                       test came out.
-     *                       PEAR Error when the tester it self fails
-     */
-    function run($file, $ini_settings = array(), $test_number = 1)
-    {
-        if (isset($this->_savephp)) {
-            $this->_php = $this->_savephp;
-            unset($this->_savephp);
-        }
-        if (empty($this->_options['cgi'])) {
-            // try to see if php-cgi is in the path
-            $res = $this->system_with_timeout('php-cgi -v');
-            if (false !== $res && !(is_array($res) && $res === array(127, ''))) {
-                $this->_options['cgi'] = 'php-cgi';
-            }
-        }
-        if (1 < $len = strlen($this->tests_count)) {
-            $test_number = str_pad($test_number, $len, ' ', STR_PAD_LEFT);
-            $test_nr = "[$test_number/$this->tests_count] ";
-        } else {
-            $test_nr = '';
-        }
-
-        $file = realpath($file);
-        $section_text = $this->_readFile($file);
-        if (PEAR::isError($section_text)) {
-            return $section_text;
-        }
-
-        if (isset($section_text['POST_RAW']) && isset($section_text['UPLOAD'])) {
-            return PEAR::raiseError("Cannot contain both POST_RAW and UPLOAD in test file: $file");
-        }
-
-        $cwd = getcwd();
-
-        $pass_options = '';
-        if (!empty($this->_options['ini'])) {
-            $pass_options = $this->_options['ini'];
-        }
-
-        if (is_string($ini_settings)) {
-            $ini_settings = $this->iniString2array($ini_settings);
-        }
-
-        $ini_settings = $this->settings2array($this->ini_overwrites, $ini_settings);
-        if ($section_text['INI']) {
-            if (strpos($section_text['INI'], '{PWD}') !== false) {
-                $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
-            }
-            $ini = preg_split( "/[\n\r]+/", $section_text['INI']);
-            $ini_settings = $this->settings2array($ini, $ini_settings);
-        }
-        $ini_settings = $this->settings2params($ini_settings);
-        $shortname = str_replace($cwd . DIRECTORY_SEPARATOR, '', $file);
-
-        $tested = trim($section_text['TEST']);
-        $tested.= !isset($this->_options['simple']) ? "[$shortname]" : ' ';
-
-        if (!empty($section_text['POST']) || !empty($section_text['POST_RAW']) ||
-              !empty($section_text['UPLOAD']) || !empty($section_text['GET']) ||
-              !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) {
-            if (empty($this->_options['cgi'])) {
-                if (!isset($this->_options['quiet'])) {
-                    $this->_logger->log(0, "SKIP $test_nr$tested (reason: --cgi option needed for this test, type 'pear help run-tests')");
-                }
-                if (isset($this->_options['tapoutput'])) {
-                    return array('ok', ' # skip --cgi option needed for this test, "pear help run-tests" for info');
-                }
-                return 'SKIPPED';
-            }
-            $this->_savephp = $this->_php;
-            $this->_php = $this->_options['cgi'];
-        }
-
-        $temp_dir = realpath(dirname($file));
-        $main_file_name = basename($file, 'phpt');
-        $diff_filename     = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'diff';
-        $log_filename      = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'log';
-        $exp_filename      = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'exp';
-        $output_filename   = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'out';
-        $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'mem';
-        $temp_file         = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'php';
-        $temp_skipif       = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'skip.php';
-        $temp_clean        = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php';
-        $tmp_post          = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.');
-
-        // unlink old test results
-        $this->_cleanupOldFiles($file);
-
-        // Check if test should be skipped.
-        $res  = $this->_runSkipIf($section_text, $temp_skipif, $tested, $ini_settings);
-        if (count($res) != 2) {
-            return $res;
-        }
-        $info = $res['info'];
-        $warn = $res['warn'];
-
-        // We've satisfied the preconditions - run the test!
-        if (isset($this->_options['coverage']) && $this->xdebug_loaded) {
-            $xdebug_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'xdebug';
-            $text = '<?php';
-            $text .= "\n" . 'function coverage_shutdown() {' .
-                     "\n" . '    $xdebug = var_export(xdebug_get_code_coverage(), true);';
-            if (!function_exists('file_put_contents')) {
-                $text .= "\n" . '    $fh = fopen(\'' . $xdebug_file . '\', "wb");' .
-                        "\n" . '    if ($fh !== false) {' .
-                        "\n" . '        fwrite($fh, $xdebug);' .
-                        "\n" . '        fclose($fh);' .
-                        "\n" . '    }';
-            } else {
-                $text .= "\n" . '    file_put_contents(\'' . $xdebug_file . '\', $xdebug);';
-            }
-
-            $text .= "\n" . 'xdebug_stop_code_coverage();' .
-                "\n" . '} // end coverage_shutdown()' .
-                "\n" . 'register_shutdown_function("coverage_shutdown");';
-            $text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n?>";
-
-            $len_f = 5;
-            if (substr($section_text['FILE'], 0, 5) != '<?php'
-                && substr($section_text['FILE'], 0, 2) == '<?') {
-                $len_f = 2;
-            }
-            $text .= $section_text['FILE'];
-
-            $this->save_text($temp_file, $text);
-        } else {
-            $this->save_text($temp_file, $section_text['FILE']);
-        }
-
-        $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : '';
-        $cmd = $this->_preparePhpBin($this->_php, $temp_file, $ini_settings);
-        $cmd.= "$args 2>&1";
-        if (isset($this->_logger)) {
-            $this->_logger->log(2, 'Running command "' . $cmd . '"');
-        }
-
-        // Reset environment from any previous test.
-        $env = $this->_resetEnv($section_text, $temp_file);
-
-        $section_text = $this->_processUpload($section_text, $file);
-        if (PEAR::isError($section_text)) {
-            return $section_text;
-        }
-
-        if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) {
-            $post = trim($section_text['POST_RAW']);
-            $raw_lines = explode("\n", $post);
-
-            $request = '';
-            $started = false;
-            foreach ($raw_lines as $i => $line) {
-                if (empty($env['CONTENT_TYPE']) &&
-                    preg_match('/^Content-Type:(.*)/i', $line, $res)) {
-                    $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1]));
-                    continue;
-                }
-                if ($started) {
-                    $request .= "\n";
-                }
-                $started = true;
-                $request .= $line;
-            }
-
-            $env['CONTENT_LENGTH'] = strlen($request);
-            $env['REQUEST_METHOD'] = 'POST';
-
-            $this->save_text($tmp_post, $request);
-            $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post";
-        } elseif (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
-            $post = trim($section_text['POST']);
-            $this->save_text($tmp_post, $post);
-            $content_length = strlen($post);
-
-            $env['REQUEST_METHOD'] = 'POST';
-            $env['CONTENT_TYPE']   = 'application/x-www-form-urlencoded';
-            $env['CONTENT_LENGTH'] = $content_length;
-
-            $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post";
-        } else {
-            $env['REQUEST_METHOD'] = 'GET';
-            $env['CONTENT_TYPE']   = '';
-            $env['CONTENT_LENGTH'] = '';
-        }
-
-        if (OS_WINDOWS && isset($section_text['RETURNS'])) {
-            ob_start();
-            system($cmd, $return_value);
-            $out = ob_get_contents();
-            ob_end_clean();
-            $section_text['RETURNS'] = (int) trim($section_text['RETURNS']);
-            $returnfail = ($return_value != $section_text['RETURNS']);
-        } else {
-            $returnfail = false;
-            $stdin = isset($section_text['STDIN']) ? $section_text['STDIN'] : null;
-            $out = $this->system_with_timeout($cmd, $env, $stdin);
-            $return_value = $out[0];
-            $out = $out[1];
-        }
-
-        $output = preg_replace('/\r\n/', "\n", trim($out));
-
-        if (isset($tmp_post) && realpath($tmp_post) && file_exists($tmp_post)) {
-            @unlink(realpath($tmp_post));
-        }
-        chdir($cwd); // in case the test moves us around
-
-        $this->_testCleanup($section_text, $temp_clean);
-
-        /* when using CGI, strip the headers from the output */
-        $output = $this->_stripHeadersCGI($output);
-
-        if (isset($section_text['EXPECTHEADERS'])) {
-            $testheaders = $this->_processHeaders($section_text['EXPECTHEADERS']);
-            $missing = array_diff_assoc($testheaders, $this->_headers);
-            $changed = '';
-            foreach ($missing as $header => $value) {
-                if (isset($this->_headers[$header])) {
-                    $changed .= "-$header: $value\n+$header: ";
-                    $changed .= $this->_headers[$header];
-                } else {
-                    $changed .= "-$header: $value\n";
-                }
-            }
-            if ($missing) {
-                // tack on failed headers to output:
-                $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed";
-            }
-        }
-        // Does the output match what is expected?
-        do {
-            if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
-                if (isset($section_text['EXPECTF'])) {
-                    $wanted = trim($section_text['EXPECTF']);
-                } else {
-                    $wanted = trim($section_text['EXPECTREGEX']);
-                }
-                $wanted_re = preg_replace('/\r\n/', "\n", $wanted);
-                if (isset($section_text['EXPECTF'])) {
-                    $wanted_re = preg_quote($wanted_re, '/');
-                    // Stick to basics
-                    $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy
-                    $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re);
-                    $wanted_re = str_replace("%d", "[0-9]+", $wanted_re);
-                    $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re);
-                    $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re);
-                    $wanted_re = str_replace("%c", ".", $wanted_re);
-                    // %f allows two points "-.0.0" but that is the best *simple* expression
-                }
-
-    /* DEBUG YOUR REGEX HERE
-            var_dump($wanted_re);
-            print(str_repeat('=', 80) . "\n");
-            var_dump($output);
-    */
-                if (!$returnfail && preg_match("/^$wanted_re\$/s", $output)) {
-                    if (file_exists($temp_file)) {
-                        unlink($temp_file);
-                    }
-                    if (array_key_exists('FAIL', $section_text)) {
-                        break;
-                    }
-                    if (!isset($this->_options['quiet'])) {
-                        $this->_logger->log(0, "PASS $test_nr$tested$info");
-                    }
-                    if (isset($this->_options['tapoutput'])) {
-                        return array('ok', ' - ' . $tested);
-                    }
-                    return 'PASSED';
-                }
-            } else {
-                if (isset($section_text['EXPECTFILE'])) {
-                    $f = $temp_dir . '/' . trim($section_text['EXPECTFILE']);
-                    if (!($fp = @fopen($f, 'rb'))) {
-                        return PEAR::raiseError('--EXPECTFILE-- section file ' .
-                            $f . ' not found');
-                    }
-                    fclose($fp);
-                    $section_text['EXPECT'] = file_get_contents($f);
-                }
-
-                if (isset($section_text['EXPECT'])) {
-                    $wanted = preg_replace('/\r\n/', "\n", trim($section_text['EXPECT']));
-                } else {
-                    $wanted = '';
-                }
-
-                // compare and leave on success
-                if (!$returnfail && 0 == strcmp($output, $wanted)) {
-                    if (file_exists($temp_file)) {
-                        unlink($temp_file);
-                    }
-                    if (array_key_exists('FAIL', $section_text)) {
-                        break;
-                    }
-                    if (!isset($this->_options['quiet'])) {
-                        $this->_logger->log(0, "PASS $test_nr$tested$info");
-                    }
-                    if (isset($this->_options['tapoutput'])) {
-                        return array('ok', ' - ' . $tested);
-                    }
-                    return 'PASSED';
-                }
-            }
-        } while (false);
-
-        if (array_key_exists('FAIL', $section_text)) {
-            // we expect a particular failure
-            // this is only used for testing PEAR_RunTest
-            $expectf  = isset($section_text['EXPECTF']) ? $wanted_re : null;
-            $faildiff = $this->generate_diff($wanted, $output, null, $expectf);
-            $faildiff = preg_replace('/\r/', '', $faildiff);
-            $wanted   = preg_replace('/\r/', '', trim($section_text['FAIL']));
-            if ($faildiff == $wanted) {
-                if (!isset($this->_options['quiet'])) {
-                    $this->_logger->log(0, "PASS $test_nr$tested$info");
-                }
-                if (isset($this->_options['tapoutput'])) {
-                    return array('ok', ' - ' . $tested);
-                }
-                return 'PASSED';
-            }
-            unset($section_text['EXPECTF']);
-            $output = $faildiff;
-            if (isset($section_text['RETURNS'])) {
-                return PEAR::raiseError('Cannot have both RETURNS and FAIL in the same test: ' .
-                    $file);
-            }
-        }
-
-        // Test failed so we need to report details.
-        $txt = $warn ? 'WARN ' : 'FAIL ';
-        $this->_logger->log(0, $txt . $test_nr . $tested . $info);
-
-        // write .exp
-        $res = $this->_writeLog($exp_filename, $wanted);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-
-        // write .out
-        $res = $this->_writeLog($output_filename, $output);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-
-        // write .diff
-        $returns = isset($section_text['RETURNS']) ?
-                        array(trim($section_text['RETURNS']), $return_value) : null;
-        $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null;
-        $data = $this->generate_diff($wanted, $output, $returns, $expectf);
-        $res  = $this->_writeLog($diff_filename, $data);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-
-        // write .log
-        $data = "
----- EXPECTED OUTPUT
-$wanted
----- ACTUAL OUTPUT
-$output
----- FAILED
-";
-
-        if ($returnfail) {
-            $data .= "
----- EXPECTED RETURN
-$section_text[RETURNS]
----- ACTUAL RETURN
-$return_value
-";
-        }
-
-        $res = $this->_writeLog($log_filename, $data);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-
-        if (isset($this->_options['tapoutput'])) {
-            $wanted = explode("\n", $wanted);
-            $wanted = "# Expected output:\n#\n#" . implode("\n#", $wanted);
-            $output = explode("\n", $output);
-            $output = "#\n#\n# Actual output:\n#\n#" . implode("\n#", $output);
-            return array($wanted . $output . 'not ok', ' - ' . $tested);
-        }
-        return $warn ? 'WARNED' : 'FAILED';
-    }
-
-    function generate_diff($wanted, $output, $rvalue, $wanted_re)
-    {
-        $w  = explode("\n", $wanted);
-        $o  = explode("\n", $output);
-        $wr = explode("\n", $wanted_re);
-        $w1 = array_diff_assoc($w, $o);
-        $o1 = array_diff_assoc($o, $w);
-        $o2 = $w2 = array();
-        foreach ($w1 as $idx => $val) {
-            if (!$wanted_re || !isset($wr[$idx]) || !isset($o1[$idx]) ||
-                  !preg_match('/^' . $wr[$idx] . '\\z/', $o1[$idx])) {
-                $w2[sprintf("%03d<", $idx)] = sprintf("%03d- ", $idx + 1) . $val;
-            }
-        }
-        foreach ($o1 as $idx => $val) {
-            if (!$wanted_re || !isset($wr[$idx]) ||
-                  !preg_match('/^' . $wr[$idx] . '\\z/', $val)) {
-                $o2[sprintf("%03d>", $idx)] = sprintf("%03d+ ", $idx + 1) . $val;
-            }
-        }
-        $diff = array_merge($w2, $o2);
-        ksort($diff);
-        $extra = $rvalue ? "##EXPECTED: $rvalue[0]\r\n##RETURNED: $rvalue[1]" : '';
-        return implode("\r\n", $diff) . $extra;
-    }
-
-    //  Write the given text to a temporary file, and return the filename.
-    function save_text($filename, $text)
-    {
-        if (!$fp = fopen($filename, 'w')) {
-            return PEAR::raiseError("Cannot open file '" . $filename . "' (save_text)");
-        }
-        fwrite($fp, $text);
-        fclose($fp);
-    if (1 < DETAILED) echo "
-FILE $filename {{{
-$text
-}}}
-";
-    }
-
-    function _cleanupOldFiles($file)
-    {
-        $temp_dir = realpath(dirname($file));
-        $mainFileName = basename($file, 'phpt');
-        $diff_filename     = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'diff';
-        $log_filename      = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'log';
-        $exp_filename      = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'exp';
-        $output_filename   = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'out';
-        $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'mem';
-        $temp_file         = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'php';
-        $temp_skipif       = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'skip.php';
-        $temp_clean        = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'clean.php';
-        $tmp_post          = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.');
-
-        // unlink old test results
-        @unlink($diff_filename);
-        @unlink($log_filename);
-        @unlink($exp_filename);
-        @unlink($output_filename);
-        @unlink($memcheck_filename);
-        @unlink($temp_file);
-        @unlink($temp_skipif);
-        @unlink($tmp_post);
-        @unlink($temp_clean);
-    }
-
-    function _runSkipIf($section_text, $temp_skipif, $tested, $ini_settings)
-    {
-        $info = '';
-        $warn = false;
-        if (array_key_exists('SKIPIF', $section_text) && trim($section_text['SKIPIF'])) {
-            $this->save_text($temp_skipif, $section_text['SKIPIF']);
-            $output = $this->system_with_timeout("$this->_php$ini_settings -f \"$temp_skipif\"");
-            $output = $output[1];
-            $loutput = ltrim($output);
-            unlink($temp_skipif);
-            if (!strncasecmp('skip', $loutput, 4)) {
-                $skipreason = "SKIP $tested";
-                if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
-                    $skipreason .= '(reason: ' . $m[1] . ')';
-                }
-                if (!isset($this->_options['quiet'])) {
-                    $this->_logger->log(0, $skipreason);
-                }
-                if (isset($this->_options['tapoutput'])) {
-                    return array('ok', ' # skip ' . $reason);
-                }
-                return 'SKIPPED';
-            }
-
-            if (!strncasecmp('info', $loutput, 4)
-                && preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) {
-                $info = " (info: $m[1])";
-            }
-
-            if (!strncasecmp('warn', $loutput, 4)
-                && preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) {
-                $warn = true; /* only if there is a reason */
-                $info = " (warn: $m[1])";
-            }
-        }
-
-        return array('warn' => $warn, 'info' => $info);
-    }
-
-    function _stripHeadersCGI($output)
-    {
-        $this->headers = array();
-        if (!empty($this->_options['cgi']) &&
-              $this->_php == $this->_options['cgi'] &&
-              preg_match("/^(.*?)(?:\n\n(.*)|\\z)/s", $output, $match)) {
-            $output = isset($match[2]) ? trim($match[2]) : '';
-            $this->_headers = $this->_processHeaders($match[1]);
-        }
-
-        return $output;
-    }
-
-    /**
-     * Return an array that can be used with array_diff() to compare headers
-     *
-     * @param string $text
-     */
-    function _processHeaders($text)
-    {
-        $headers = array();
-        $rh = preg_split("/[\n\r]+/", $text);
-        foreach ($rh as $line) {
-            if (strpos($line, ':')!== false) {
-                $line = explode(':', $line, 2);
-                $headers[trim($line[0])] = trim($line[1]);
-            }
-        }
-        return $headers;
-    }
-
-    function _readFile($file)
-    {
-        // Load the sections of the test file.
-        $section_text = array(
-            'TEST'   => '(unnamed test)',
-            'SKIPIF' => '',
-            'GET'    => '',
-            'COOKIE' => '',
-            'POST'   => '',
-            'ARGS'   => '',
-            'INI'    => '',
-            'CLEAN'  => '',
-        );
-
-        if (!is_file($file) || !$fp = fopen($file, "r")) {
-            return PEAR::raiseError("Cannot open test file: $file");
-        }
-
-        $section = '';
-        while (!feof($fp)) {
-            $line = fgets($fp);
-
-            // Match the beginning of a section.
-            if (preg_match('/^--([_A-Z]+)--/', $line, $r)) {
-                $section = $r[1];
-                $section_text[$section] = '';
-                continue;
-            } elseif (empty($section)) {
-                fclose($fp);
-                return PEAR::raiseError("Invalid sections formats in test file: $file");
-            }
-
-            // Add to the section text.
-            $section_text[$section] .= $line;
-        }
-        fclose($fp);
-
-        return $section_text;
-    }
-
-    function _writeLog($logname, $data)
-    {
-        if (!$log = fopen($logname, 'w')) {
-            return PEAR::raiseError("Cannot create test log - $logname");
-        }
-        fwrite($log, $data);
-        fclose($log);
-    }
-
-    function _resetEnv($section_text, $temp_file)
-    {
-        $env = $_ENV;
-        $env['REDIRECT_STATUS'] = '';
-        $env['QUERY_STRING']    = '';
-        $env['PATH_TRANSLATED'] = '';
-        $env['SCRIPT_FILENAME'] = '';
-        $env['REQUEST_METHOD']  = '';
-        $env['CONTENT_TYPE']    = '';
-        $env['CONTENT_LENGTH']  = '';
-        if (!empty($section_text['ENV'])) {
-            if (strpos($section_text['ENV'], '{PWD}') !== false) {
-                $section_text['ENV'] = str_replace('{PWD}', dirname($temp_file), $section_text['ENV']);
-            }
-            foreach (explode("\n", trim($section_text['ENV'])) as $e) {
-                $e = explode('=', trim($e), 2);
-                if (!empty($e[0]) && isset($e[1])) {
-                    $env[$e[0]] = $e[1];
-                }
-            }
-        }
-        if (array_key_exists('GET', $section_text)) {
-            $env['QUERY_STRING'] = trim($section_text['GET']);
-        } else {
-            $env['QUERY_STRING'] = '';
-        }
-        if (array_key_exists('COOKIE', $section_text)) {
-            $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
-        } else {
-            $env['HTTP_COOKIE'] = '';
-        }
-        $env['REDIRECT_STATUS'] = '1';
-        $env['PATH_TRANSLATED'] = $temp_file;
-        $env['SCRIPT_FILENAME'] = $temp_file;
-
-        return $env;
-    }
-
-    function _processUpload($section_text, $file)
-    {
-        if (array_key_exists('UPLOAD', $section_text) && !empty($section_text['UPLOAD'])) {
-            $upload_files = trim($section_text['UPLOAD']);
-            $upload_files = explode("\n", $upload_files);
-
-            $request = "Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737\n" .
-                       "-----------------------------20896060251896012921717172737\n";
-            foreach ($upload_files as $fileinfo) {
-                $fileinfo = explode('=', $fileinfo);
-                if (count($fileinfo) != 2) {
-                    return PEAR::raiseError("Invalid UPLOAD section in test file: $file");
-                }
-                if (!realpath(dirname($file) . '/' . $fileinfo[1])) {
-                    return PEAR::raiseError("File for upload does not exist: $fileinfo[1] " .
-                        "in test file: $file");
-                }
-                $file_contents = file_get_contents(dirname($file) . '/' . $fileinfo[1]);
-                $fileinfo[1] = basename($fileinfo[1]);
-                $request .= "Content-Disposition: form-data; name=\"$fileinfo[0]\"; filename=\"$fileinfo[1]\"\n";
-                $request .= "Content-Type: text/plain\n\n";
-                $request .= $file_contents . "\n" .
-                    "-----------------------------20896060251896012921717172737\n";
-            }
-
-            if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
-                // encode POST raw
-                $post = trim($section_text['POST']);
-                $post = explode('&', $post);
-                foreach ($post as $i => $post_info) {
-                    $post_info = explode('=', $post_info);
-                    if (count($post_info) != 2) {
-                        return PEAR::raiseError("Invalid POST data in test file: $file");
-                    }
-                    $post_info[0] = rawurldecode($post_info[0]);
-                    $post_info[1] = rawurldecode($post_info[1]);
-                    $post[$i] = $post_info;
-                }
-                foreach ($post as $post_info) {
-                    $request .= "Content-Disposition: form-data; name=\"$post_info[0]\"\n\n";
-                    $request .= $post_info[1] . "\n" .
-                        "-----------------------------20896060251896012921717172737\n";
-                }
-                unset($section_text['POST']);
-            }
-            $section_text['POST_RAW'] = $request;
-        }
-
-        return $section_text;
-    }
-
-    function _testCleanup($section_text, $temp_clean)
-    {
-        if ($section_text['CLEAN']) {
-            // perform test cleanup
-            $this->save_text($temp_clean, $section_text['CLEAN']);
-            $output = $this->system_with_timeout("$this->_php $temp_clean  2>&1");
-            if (strlen($output[1])) {
-                echo "BORKED --CLEAN-- section! output:\n", $output[1];
-            }
-            if (file_exists($temp_clean)) {
-                unlink($temp_clean);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Common.php b/lib/php/PEAR/Task/Common.php
deleted file mode 100644
index e725355e91f12c5c7d0591c5df31d9802ef46740..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Common.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/**
- * PEAR_Task_Common, base class for installer tasks
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Common.php 276394 2009-02-25 00:15:49Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**#@+
- * Error codes for task validation routines
- */
-define('PEAR_TASK_ERROR_NOATTRIBS', 1);
-define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2);
-define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3);
-define('PEAR_TASK_ERROR_INVALID', 4);
-/**#@-*/
-define('PEAR_TASK_PACKAGE', 1);
-define('PEAR_TASK_INSTALL', 2);
-define('PEAR_TASK_PACKAGEANDINSTALL', 3);
-/**
- * A task is an operation that manipulates the contents of a file.
- *
- * Simple tasks operate on 1 file.  Multiple tasks are executed after all files have been
- * processed and installed, and are designed to operate on all files containing the task.
- * The Post-install script task simply takes advantage of the fact that it will be run
- * after installation, replace is a simple task.
- *
- * Combining tasks is possible, but ordering is significant.
- *
- * <file name="test.php" role="php">
- *  <tasks:replace from="@data-dir@" to="data_dir" type="pear-config"/>
- *  <tasks:postinstallscript/>
- * </file>
- *
- * This will first replace any instance of @data-dir@ in the test.php file
- * with the path to the current data directory.  Then, it will include the
- * test.php file and run the script it contains to configure the package post-installation.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- * @abstract
- */
-class PEAR_Task_Common
-{
-    /**
-     * Valid types for this version are 'simple' and 'multiple'
-     *
-     * - simple tasks operate on the contents of a file and write out changes to disk
-     * - multiple tasks operate on the contents of many files and write out the
-     *   changes directly to disk
-     *
-     * Child task classes must override this property.
-     * @access protected
-     */
-    var $type = 'simple';
-    /**
-     * Determines which install phase this task is executed under
-     */
-    var $phase = PEAR_TASK_INSTALL;
-    /**
-     * @access protected
-     */
-    var $config;
-    /**
-     * @access protected
-     */
-    var $registry;
-    /**
-     * @access protected
-     */
-    var $logger;
-    /**
-     * @access protected
-     */
-    var $installphase;
-    /**
-     * @param PEAR_Config
-     * @param PEAR_Common
-     */
-    function PEAR_Task_Common(&$config, &$logger, $phase)
-    {
-        $this->config = &$config;
-        $this->registry = &$config->getRegistry();
-        $this->logger = &$logger;
-        $this->installphase = $phase;
-        if ($this->type == 'multiple') {
-            $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this;
-        }
-    }
-
-    /**
-     * Validate the basic contents of a task tag.
-     * @param PEAR_PackageFile_v2
-     * @param array
-     * @param PEAR_Config
-     * @param array the entire parsed <file> tag
-     * @return true|array On error, return an array in format:
-     *    array(PEAR_TASK_ERROR_???[, param1][, param2][, ...])
-     *
-     *    For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in
-     *    For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and an array
-     *    of legal values in
-     * @static
-     * @abstract
-     */
-    function validateXml($pkg, $xml, $config, $fileXml)
-    {
-    }
-
-    /**
-     * Initialize a task instance with the parameters
-     * @param array raw, parsed xml
-     * @param array attributes from the <file> tag containing this task
-     * @param string|null last installed version of this package
-     * @abstract
-     */
-    function init($xml, $fileAttributes, $lastVersion)
-    {
-    }
-
-    /**
-     * Begin a task processing session.  All multiple tasks will be processed after each file
-     * has been successfully installed, all simple tasks should perform their task here and
-     * return any errors using the custom throwError() method to allow forward compatibility
-     *
-     * This method MUST NOT write out any changes to disk
-     * @param PEAR_PackageFile_v2
-     * @param string file contents
-     * @param string the eventual final file location (informational only)
-     * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
-     *         (use $this->throwError), otherwise return the new contents
-     * @abstract
-     */
-    function startSession($pkg, $contents, $dest)
-    {
-    }
-
-    /**
-     * This method is used to process each of the tasks for a particular multiple class
-     * type.  Simple tasks need not implement this method.
-     * @param array an array of tasks
-     * @access protected
-     * @static
-     * @abstract
-     */
-    function run($tasks)
-    {
-    }
-
-    /**
-     * @static
-     * @final
-     */
-    function hasPostinstallTasks()
-    {
-        return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
-    }
-
-    /**
-     * @static
-     * @final
-     */
-     function runPostinstallTasks()
-     {
-         foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
-             $err = call_user_func(array($class, 'run'),
-                  $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]);
-             if ($err) {
-                 return PEAR_Task_Common::throwError($err);
-             }
-         }
-         unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
-    }
-
-    /**
-     * Determines whether a role is a script
-     * @return bool
-     */
-    function isScript()
-    {
-        return $this->type == 'script';
-    }
-
-    function throwError($msg, $code = -1)
-    {
-        include_once 'PEAR.php';
-        return PEAR::raiseError($msg, $code);
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Postinstallscript.php b/lib/php/PEAR/Task/Postinstallscript.php
deleted file mode 100644
index cc9042469d864f14689f12c40679f43f7fb17cdc..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Postinstallscript.php
+++ /dev/null
@@ -1,323 +0,0 @@
-<?php
-/**
- * <tasks:postinstallscript>
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Postinstallscript.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the postinstallscript file task.
- *
- * Note that post-install scripts are handled separately from installation, by the
- * "pear run-scripts" command
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Task_Postinstallscript extends PEAR_Task_Common
-{
-    var $type = 'script';
-    var $_class;
-    var $_params;
-    var $_obj;
-    /**
-     *
-     * @var PEAR_PackageFile_v2
-     */
-    var $_pkg;
-    var $_contents;
-    var $phase = PEAR_TASK_INSTALL;
-
-    /**
-     * Validate the raw xml at parsing-time.
-     *
-     * This also attempts to validate the script to make sure it meets the criteria
-     * for a post-install script
-     * @param PEAR_PackageFile_v2
-     * @param array The XML contents of the <postinstallscript> tag
-     * @param PEAR_Config
-     * @param array the entire parsed <file> tag
-     * @static
-     */
-    function validateXml($pkg, $xml, $config, $fileXml)
-    {
-        if ($fileXml['role'] != 'php') {
-            return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-            $fileXml['name'] . '" must be role="php"');
-        }
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $file = $pkg->getFileContents($fileXml['name']);
-        if (PEAR::isError($file)) {
-            PEAR::popErrorHandling();
-            return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                $fileXml['name'] . '" is not valid: ' .
-                $file->getMessage());
-        } elseif ($file === null) {
-            return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                $fileXml['name'] . '" could not be retrieved for processing!');
-        } else {
-            $analysis = $pkg->analyzeSourceCode($file, true);
-            if (!$analysis) {
-                PEAR::popErrorHandling();
-                $warnings = '';
-                foreach ($pkg->getValidationWarnings() as $warn) {
-                    $warnings .= $warn['message'] . "\n";
-                }
-                return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "' .
-                    $fileXml['name'] . '" failed: ' . $warnings);
-            }
-            if (count($analysis['declared_classes']) != 1) {
-                PEAR::popErrorHandling();
-                return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                    $fileXml['name'] . '" must declare exactly 1 class');
-            }
-            $class = $analysis['declared_classes'][0];
-            if ($class != str_replace(array('/', '.php'), array('_', ''),
-                  $fileXml['name']) . '_postinstall') {
-                PEAR::popErrorHandling();
-                return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                    $fileXml['name'] . '" class "' . $class . '" must be named "' .
-                    str_replace(array('/', '.php'), array('_', ''),
-                    $fileXml['name']) . '_postinstall"');
-            }
-            if (!isset($analysis['declared_methods'][$class])) {
-                PEAR::popErrorHandling();
-                return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                    $fileXml['name'] . '" must declare methods init() and run()');
-            }
-            $methods = array('init' => 0, 'run' => 1);
-            foreach ($analysis['declared_methods'][$class] as $method) {
-                if (isset($methods[$method])) {
-                    unset($methods[$method]);
-                }
-            }
-            if (count($methods)) {
-                PEAR::popErrorHandling();
-                return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                    $fileXml['name'] . '" must declare methods init() and run()');
-            }
-        }
-        PEAR::popErrorHandling();
-        $definedparams = array();
-        $tasksNamespace = $pkg->getTasksNs() . ':';
-        if (!isset($xml[$tasksNamespace . 'paramgroup']) && isset($xml['paramgroup'])) {
-            // in order to support the older betas, which did not expect internal tags
-            // to also use the namespace
-            $tasksNamespace = '';
-        }
-        if (isset($xml[$tasksNamespace . 'paramgroup'])) {
-            $params = $xml[$tasksNamespace . 'paramgroup'];
-            if (!is_array($params) || !isset($params[0])) {
-                $params = array($params);
-            }
-            foreach ($params as $param) {
-                if (!isset($param[$tasksNamespace . 'id'])) {
-                    return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                        $fileXml['name'] . '" <paramgroup> must have ' .
-                        'an ' . $tasksNamespace . 'id> tag');
-                }
-                if (isset($param[$tasksNamespace . 'name'])) {
-                    if (!in_array($param[$tasksNamespace . 'name'], $definedparams)) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" ' . $tasksNamespace .
-                            'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
-                            '" parameter "' . $param[$tasksNamespace . 'name'] .
-                            '" has not been previously defined');
-                    }
-                    if (!isset($param[$tasksNamespace . 'conditiontype'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" ' . $tasksNamespace .
-                            'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
-                            '" must have a ' . $tasksNamespace .
-                            'conditiontype> tag containing either "=", ' .
-                            '"!=", or "preg_match"');
-                    }
-                    if (!in_array($param[$tasksNamespace . 'conditiontype'],
-                          array('=', '!=', 'preg_match'))) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" ' . $tasksNamespace .
-                            'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
-                            '" must have a ' . $tasksNamespace .
-                            'conditiontype> tag containing either "=", ' .
-                            '"!=", or "preg_match"');
-                    }
-                    if (!isset($param[$tasksNamespace . 'value'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" ' . $tasksNamespace .
-                            'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
-                            '" must have a ' . $tasksNamespace .
-                            'value> tag containing expected parameter value');
-                    }
-                }
-                if (isset($param[$tasksNamespace . 'instructions'])) {
-                    if (!is_string($param[$tasksNamespace . 'instructions'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" ' . $tasksNamespace .
-                            'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
-                            '" ' . $tasksNamespace . 'instructions> must be simple text');
-                    }
-                }
-                if (!isset($param[$tasksNamespace . 'param'])) {
-                    continue; // <param> is no longer required
-                }
-                $subparams = $param[$tasksNamespace . 'param'];
-                if (!is_array($subparams) || !isset($subparams[0])) {
-                    $subparams = array($subparams);
-                }
-                foreach ($subparams as $subparam) {
-                    if (!isset($subparam[$tasksNamespace . 'name'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" parameter for ' .
-                            $tasksNamespace . 'paramgroup> id "' .
-                            $param[$tasksNamespace . 'id'] . '" must have ' .
-                            'a ' . $tasksNamespace . 'name> tag');
-                    }
-                    if (!preg_match('/[a-zA-Z0-9]+/',
-                          $subparam[$tasksNamespace . 'name'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" parameter "' .
-                            $subparam[$tasksNamespace . 'name'] .
-                            '" for ' . $tasksNamespace . 'paramgroup> id "' .
-                            $param[$tasksNamespace . 'id'] .
-                            '" is not a valid name.  Must contain only alphanumeric characters');
-                    }
-                    if (!isset($subparam[$tasksNamespace . 'prompt'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" parameter "' .
-                            $subparam[$tasksNamespace . 'name'] .
-                            '" for ' . $tasksNamespace . 'paramgroup> id "' .
-                            $param[$tasksNamespace . 'id'] .
-                            '" must have a ' . $tasksNamespace . 'prompt> tag');
-                    }
-                    if (!isset($subparam[$tasksNamespace . 'type'])) {
-                        return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
-                            $fileXml['name'] . '" parameter "' .
-                            $subparam[$tasksNamespace . 'name'] .
-                            '" for ' . $tasksNamespace . 'paramgroup> id "' .
-                            $param[$tasksNamespace . 'id'] .
-                            '" must have a ' . $tasksNamespace . 'type> tag');
-                    }
-                    $definedparams[] = $param[$tasksNamespace . 'id'] . '::' .
-                    $subparam[$tasksNamespace . 'name'];
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Initialize a task instance with the parameters
-     * @param array raw, parsed xml
-     * @param array attributes from the <file> tag containing this task
-     * @param string|null last installed version of this package, if any (useful for upgrades)
-     */
-    function init($xml, $fileattribs, $lastversion)
-    {
-        $this->_class = str_replace('/', '_', $fileattribs['name']);
-        $this->_filename = $fileattribs['name'];
-        $this->_class = str_replace ('.php', '', $this->_class) . '_postinstall';
-        $this->_params = $xml;
-        $this->_lastversion = $lastversion;
-    }
-
-    /**
-     * Strip the tasks: namespace from internal params
-     *
-     * @access private
-     */
-    function _stripNamespace($params = null)
-    {
-        if ($params === null) {
-            $params = array();
-            if (!is_array($this->_params)) {
-                return;
-            }
-            foreach ($this->_params as $i => $param) {
-                if (is_array($param)) {
-                    $param = $this->_stripNamespace($param);
-                }
-                $params[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param;
-            }
-            $this->_params = $params;
-        } else {
-            $newparams = array();
-            foreach ($params as $i => $param) {
-                if (is_array($param)) {
-                    $param = $this->_stripNamespace($param);
-                }
-                $newparams[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param;
-            }
-            return $newparams;
-        }
-    }
-
-    /**
-     * Unlike other tasks, the installed file name is passed in instead of the file contents,
-     * because this task is handled post-installation
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param string file name
-     * @return bool|PEAR_Error false to skip this file, PEAR_Error to fail
-     *         (use $this->throwError)
-     */
-    function startSession($pkg, $contents)
-    {
-        if ($this->installphase != PEAR_TASK_INSTALL) {
-            return false;
-        }
-        // remove the tasks: namespace if present
-        $this->_pkg = $pkg;
-        $this->_stripNamespace();
-        $this->logger->log(0, 'Including external post-installation script "' .
-            $contents . '" - any errors are in this script');
-        include_once $contents;
-        if (class_exists($this->_class)) {
-            $this->logger->log(0, 'Inclusion succeeded');
-        } else {
-            return $this->throwError('init of post-install script class "' . $this->_class
-                . '" failed');
-        }
-        $this->_obj = new $this->_class;
-        $this->logger->log(1, 'running post-install script "' . $this->_class . '->init()"');
-        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-        $res = $this->_obj->init($this->config, $pkg, $this->_lastversion);
-        PEAR::popErrorHandling();
-        if ($res) {
-            $this->logger->log(0, 'init succeeded');
-        } else {
-            return $this->throwError('init of post-install script "' . $this->_class .
-                '->init()" failed');
-        }
-        $this->_contents = $contents;
-        return true;
-    }
-
-    /**
-     * No longer used
-     * @see PEAR_PackageFile_v2::runPostinstallScripts()
-     * @param array an array of tasks
-     * @param string install or upgrade
-     * @access protected
-     * @static
-     */
-    function run()
-    {
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Postinstallscript/rw.php b/lib/php/PEAR/Task/Postinstallscript/rw.php
deleted file mode 100644
index a89e75992caa9e7e001ef09078bc3f1f0b6397d3..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Postinstallscript/rw.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/**
- * <tasks:postinstallscript> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: rw.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Postinstallscript.php';
-/**
- * Abstracts the postinstallscript file task xml.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a10
- */
-class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript
-{
-    /**
-     * parent package file object
-     *
-     * @var PEAR_PackageFile_v2_rw
-     */
-    var $_pkg;
-    /**
-     * Enter description here...
-     *
-     * @param PEAR_PackageFile_v2_rw $pkg
-     * @param PEAR_Config $config
-     * @param PEAR_Frontend $logger
-     * @param array $fileXml
-     * @return PEAR_Task_Postinstallscript_rw
-     */
-    function PEAR_Task_Postinstallscript_rw(&$pkg, &$config, &$logger, $fileXml)
-    {
-        parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
-        $this->_contents = $fileXml;
-        $this->_pkg = &$pkg;
-        $this->_params = array();
-    }
-
-    function validate()
-    {
-        return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents);
-    }
-
-    function getName()
-    {
-        return 'postinstallscript';
-    }
-
-    /**
-     * add a simple <paramgroup> to the post-install script
-     *
-     * Order is significant, so call this method in the same
-     * sequence the users should see the paramgroups.  The $params
-     * parameter should either be the result of a call to {@link getParam()}
-     * or an array of calls to getParam().
-     *
-     * Use {@link addConditionTypeGroup()} to add a <paramgroup> containing
-     * a <conditiontype> tag
-     * @param string $id <paramgroup> id as seen by the script
-     * @param array|false $params array of getParam() calls, or false for no params
-     * @param string|false $instructions
-     */
-    function addParamGroup($id, $params = false, $instructions = false)
-    {
-        if ($params && isset($params[0]) && !isset($params[1])) {
-            $params = $params[0];
-        }
-        $stuff =
-            array(
-                $this->_pkg->getTasksNs() . ':id' => $id,
-            );
-        if ($instructions) {
-            $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions;
-        }
-        if ($params) {
-            $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
-        }
-        $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff;
-    }
-
-    /**
-     * add a complex <paramgroup> to the post-install script with conditions
-     *
-     * This inserts a <paramgroup> with
-     *
-     * Order is significant, so call this method in the same
-     * sequence the users should see the paramgroups.  The $params
-     * parameter should either be the result of a call to {@link getParam()}
-     * or an array of calls to getParam().
-     *
-     * Use {@link addParamGroup()} to add a simple <paramgroup>
-     *
-     * @param string $id <paramgroup> id as seen by the script
-     * @param string $oldgroup <paramgroup> id of the section referenced by
-     *                         <conditiontype>
-     * @param string $param name of the <param> from the older section referenced
-     *                      by <contitiontype>
-     * @param string $value value to match of the parameter
-     * @param string $conditiontype one of '=', '!=', 'preg_match'
-     * @param array|false $params array of getParam() calls, or false for no params
-     * @param string|false $instructions
-     */
-    function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=',
-                                   $params = false, $instructions = false)
-    {
-        if ($params && isset($params[0]) && !isset($params[1])) {
-            $params = $params[0];
-        }
-        $stuff = array(
-            $this->_pkg->getTasksNs() . ':id' => $id,
-        );
-        if ($instructions) {
-            $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions;
-        }
-        $stuff[$this->_pkg->getTasksNs() . ':name'] = $oldgroup . '::' . $param;
-        $stuff[$this->_pkg->getTasksNs() . ':conditiontype'] = $conditiontype;
-        $stuff[$this->_pkg->getTasksNs() . ':value'] = $value;
-        if ($params) {
-            $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
-        }
-        $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff;
-    }
-
-    function getXml()
-    {
-        return $this->_params;
-    }
-
-    /**
-     * Use to set up a param tag for use in creating a paramgroup
-     * @static
-     */
-    function getParam($name, $prompt, $type = 'string', $default = null)
-    {
-        if ($default !== null) {
-            return
-            array(
-                $this->_pkg->getTasksNs() . ':name' => $name,
-                $this->_pkg->getTasksNs() . ':prompt' => $prompt,
-                $this->_pkg->getTasksNs() . ':type' => $type,
-                $this->_pkg->getTasksNs() . ':default' => $default
-            );
-        }
-        return
-            array(
-                $this->_pkg->getTasksNs() . ':name' => $name,
-                $this->_pkg->getTasksNs() . ':prompt' => $prompt,
-                $this->_pkg->getTasksNs() . ':type' => $type,
-            );
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Replace.php b/lib/php/PEAR/Task/Replace.php
deleted file mode 100644
index fec254f032d1e8e1185239e338aa9d881fe643dc..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Replace.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-/**
- * <tasks:replace>
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Replace.php 276394 2009-02-25 00:15:49Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the replace file task.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Task_Replace extends PEAR_Task_Common
-{
-    var $type = 'simple';
-    var $phase = PEAR_TASK_PACKAGEANDINSTALL;
-    var $_replacements;
-
-    /**
-     * Validate the raw xml at parsing-time.
-     * @param PEAR_PackageFile_v2
-     * @param array raw, parsed xml
-     * @param PEAR_Config
-     * @static
-     */
-    function validateXml($pkg, $xml, $config, $fileXml)
-    {
-        if (!isset($xml['attribs'])) {
-            return array(PEAR_TASK_ERROR_NOATTRIBS);
-        }
-        if (!isset($xml['attribs']['type'])) {
-            return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'type');
-        }
-        if (!isset($xml['attribs']['to'])) {
-            return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'to');
-        }
-        if (!isset($xml['attribs']['from'])) {
-            return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'from');
-        }
-        if ($xml['attribs']['type'] == 'pear-config') {
-            if (!in_array($xml['attribs']['to'], $config->getKeys())) {
-                return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
-                    $config->getKeys());
-            }
-        } elseif ($xml['attribs']['type'] == 'php-const') {
-            if (defined($xml['attribs']['to'])) {
-                return true;
-            } else {
-                return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
-                    array('valid PHP constant'));
-            }
-        } elseif ($xml['attribs']['type'] == 'package-info') {
-            if (in_array($xml['attribs']['to'],
-                array('name', 'summary', 'channel', 'notes', 'extends', 'description',
-                    'release_notes', 'license', 'release-license', 'license-uri',
-                    'version', 'api-version', 'state', 'api-state', 'release_date',
-                    'date', 'time'))) {
-                return true;
-            } else {
-                return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
-                    array('name', 'summary', 'channel', 'notes', 'extends', 'description',
-                    'release_notes', 'license', 'release-license', 'license-uri',
-                    'version', 'api-version', 'state', 'api-state', 'release_date',
-                    'date', 'time'));
-            }
-        } else {
-            return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'],
-                array('pear-config', 'package-info', 'php-const'));
-        }
-        return true;
-    }
-
-    /**
-     * Initialize a task instance with the parameters
-     * @param array raw, parsed xml
-     * @param unused
-     */
-    function init($xml, $attribs)
-    {
-        $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml;
-    }
-
-    /**
-     * Do a package.xml 1.0 replacement, with additional package-info fields available
-     *
-     * See validateXml() source for the complete list of allowed fields
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param string file contents
-     * @param string the eventual final file location (informational only)
-     * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
-     *         (use $this->throwError), otherwise return the new contents
-     */
-    function startSession($pkg, $contents, $dest)
-    {
-        $subst_from = $subst_to = array();
-        foreach ($this->_replacements as $a) {
-            $a = $a['attribs'];
-            $to = '';
-            if ($a['type'] == 'pear-config') {
-                if ($this->installphase == PEAR_TASK_PACKAGE) {
-                    return false;
-                }
-                if ($a['to'] == 'master_server') {
-                    $chan = $this->registry->getChannel($pkg->getChannel());
-                    if (!PEAR::isError($chan)) {
-                        $to = $chan->getServer();
-                    } else {
-                        $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]");
-                        return false;
-                    }
-                } else {
-                    if ($this->config->isDefinedLayer('ftp')) {
-                        // try the remote config file first
-                        $to = $this->config->get($a['to'], 'ftp', $pkg->getChannel());
-                        if (is_null($to)) {
-                            // then default to local
-                            $to = $this->config->get($a['to'], null, $pkg->getChannel());
-                        }
-                    } else {
-                        $to = $this->config->get($a['to'], null, $pkg->getChannel());
-                    }
-                }
-                if (is_null($to)) {
-                    $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]");
-                    return false;
-                }
-            } elseif ($a['type'] == 'php-const') {
-                if ($this->installphase == PEAR_TASK_PACKAGE) {
-                    return false;
-                }
-                if (defined($a['to'])) {
-                    $to = constant($a['to']);
-                } else {
-                    $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]");
-                    return false;
-                }
-            } else {
-                if ($t = $pkg->packageInfo($a['to'])) {
-                    $to = $t;
-                } else {
-                    $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]");
-                    return false;
-                }
-            }
-            if (!is_null($to)) {
-                $subst_from[] = $a['from'];
-                $subst_to[] = $to;
-            }
-        }
-        $this->logger->log(3, "doing " . sizeof($subst_from) .
-            " substitution(s) for $dest");
-        if (sizeof($subst_from)) {
-            $contents = str_replace($subst_from, $subst_to, $contents);
-        }
-        return $contents;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Replace/rw.php b/lib/php/PEAR/Task/Replace/rw.php
deleted file mode 100644
index 9245db8bb301ab9911f25fe8c301f01f1a143316..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Replace/rw.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * <tasks:replace> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: rw.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Replace.php';
-/**
- * Abstracts the replace task xml.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a10
- */
-class PEAR_Task_Replace_rw extends PEAR_Task_Replace
-{
-    function PEAR_Task_Replace_rw(&$pkg, &$config, &$logger, $fileXml)
-    {
-        parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
-        $this->_contents = $fileXml;
-        $this->_pkg = &$pkg;
-        $this->_params = array();
-    }
-
-    function validate()
-    {
-        return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents);
-    }
-
-    function setInfo($from, $to, $type)
-    {
-        $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type));
-    }
-
-    function getName()
-    {
-        return 'replace';
-    }
-
-    function getXml()
-    {
-        return $this->_params;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Unixeol.php b/lib/php/PEAR/Task/Unixeol.php
deleted file mode 100644
index 7775e980c046610597eb85eb07060bc2f2656acc..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Unixeol.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * <tasks:unixeol>
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Unixeol.php 276394 2009-02-25 00:15:49Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the unix line endings file task.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Task_Unixeol extends PEAR_Task_Common
-{
-    var $type = 'simple';
-    var $phase = PEAR_TASK_PACKAGE;
-    var $_replacements;
-
-    /**
-     * Validate the raw xml at parsing-time.
-     * @param PEAR_PackageFile_v2
-     * @param array raw, parsed xml
-     * @param PEAR_Config
-     * @static
-     */
-    function validateXml($pkg, $xml, $config, $fileXml)
-    {
-        if ($xml != '') {
-            return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed');
-        }
-        return true;
-    }
-
-    /**
-     * Initialize a task instance with the parameters
-     * @param array raw, parsed xml
-     * @param unused
-     */
-    function init($xml, $attribs)
-    {
-    }
-
-    /**
-     * Replace all line endings with line endings customized for the current OS
-     *
-     * See validateXml() source for the complete list of allowed fields
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param string file contents
-     * @param string the eventual final file location (informational only)
-     * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
-     *         (use $this->throwError), otherwise return the new contents
-     */
-    function startSession($pkg, $contents, $dest)
-    {
-        $this->logger->log(3, "replacing all line endings with \\n in $dest");
-        return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents);
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Unixeol/rw.php b/lib/php/PEAR/Task/Unixeol/rw.php
deleted file mode 100644
index 4335a33d81e26c796ed801a02901bd0693b8e8ce..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Unixeol/rw.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * <tasks:unixeol> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: rw.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Unixeol.php';
-/**
- * Abstracts the unixeol task xml.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a10
- */
-class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol
-{
-    function PEAR_Task_Unixeol_rw(&$pkg, &$config, &$logger, $fileXml)
-    {
-        parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
-        $this->_contents = $fileXml;
-        $this->_pkg = &$pkg;
-        $this->_params = array();
-    }
-
-    function validate()
-    {
-        return true;
-    }
-
-    function getName()
-    {
-        return 'unixeol';
-    }
-
-    function getXml()
-    {
-        return '';
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Windowseol.php b/lib/php/PEAR/Task/Windowseol.php
deleted file mode 100644
index a36f7bddbeb7009d8f59955ac71d589e304c4ddf..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Windowseol.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * <tasks:windowseol>
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Windowseol.php 276394 2009-02-25 00:15:49Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the windows line endsings file task.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Task_Windowseol extends PEAR_Task_Common
-{
-    var $type = 'simple';
-    var $phase = PEAR_TASK_PACKAGE;
-    var $_replacements;
-
-    /**
-     * Validate the raw xml at parsing-time.
-     * @param PEAR_PackageFile_v2
-     * @param array raw, parsed xml
-     * @param PEAR_Config
-     * @static
-     */
-    function validateXml($pkg, $xml, $config, $fileXml)
-    {
-        if ($xml != '') {
-            return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed');
-        }
-        return true;
-    }
-
-    /**
-     * Initialize a task instance with the parameters
-     * @param array raw, parsed xml
-     * @param unused
-     */
-    function init($xml, $attribs)
-    {
-    }
-
-    /**
-     * Replace all line endings with windows line endings
-     *
-     * See validateXml() source for the complete list of allowed fields
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     * @param string file contents
-     * @param string the eventual final file location (informational only)
-     * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
-     *         (use $this->throwError), otherwise return the new contents
-     */
-    function startSession($pkg, $contents, $dest)
-    {
-        $this->logger->log(3, "replacing all line endings with \\r\\n in $dest");
-        return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents);
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Task/Windowseol/rw.php b/lib/php/PEAR/Task/Windowseol/rw.php
deleted file mode 100644
index 191b3a2dc313fef0ce1f431688ce1c31d23e0fc5..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Task/Windowseol/rw.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * <tasks:windowseol> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: rw.php 276385 2009-02-24 23:46:03Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Windowseol.php';
-/**
- * Abstracts the windowseol task xml.
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a10
- */
-class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol
-{
-    function PEAR_Task_Windowseol_rw(&$pkg, &$config, &$logger, $fileXml)
-    {
-        parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
-        $this->_contents = $fileXml;
-        $this->_pkg = &$pkg;
-        $this->_params = array();
-    }
-
-    function validate()
-    {
-        return true;
-    }
-
-    function getName()
-    {
-        return 'windowseol';
-    }
-
-    function getXml()
-    {
-        return '';
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/Validate.php b/lib/php/PEAR/Validate.php
deleted file mode 100644
index 75343648f0ac5d2dcca7c814f5462d16f54d5397..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Validate.php
+++ /dev/null
@@ -1,629 +0,0 @@
-<?php
-/**
- * PEAR_Validate
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @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: Validate.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-/**#@+
- * Constants for install stage
- */
-define('PEAR_VALIDATE_INSTALLING', 1);
-define('PEAR_VALIDATE_UNINSTALLING', 2); // this is not bit-mapped like the others
-define('PEAR_VALIDATE_NORMAL', 3);
-define('PEAR_VALIDATE_DOWNLOADING', 4); // this is not bit-mapped like the others
-define('PEAR_VALIDATE_PACKAGING', 7);
-/**#@-*/
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Validator/PECL.php';
-
-/**
- * Validation class for package.xml - channel-level advanced validation
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a1
- */
-class PEAR_Validate
-{
-    var $packageregex = _PEAR_COMMON_PACKAGE_NAME_PREG;
-    /**
-     * @var PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     */
-    var $_packagexml;
-    /**
-     * @var int one of the PEAR_VALIDATE_* constants
-     */
-    var $_state = PEAR_VALIDATE_NORMAL;
-    /**
-     * Format: ('error' => array('field' => name, 'reason' => reason), 'warning' => same)
-     * @var array
-     * @access private
-     */
-    var $_failures = array('error' => array(), 'warning' => array());
-
-    /**
-     * Override this method to handle validation of normal package names
-     * @param string
-     * @return bool
-     * @access protected
-     */
-    function _validPackageName($name)
-    {
-        return (bool) preg_match('/^' . $this->packageregex . '\\z/', $name);
-    }
-
-    /**
-     * @param string package name to validate
-     * @param string name of channel-specific validation package
-     * @final
-     */
-    function validPackageName($name, $validatepackagename = false)
-    {
-        if ($validatepackagename) {
-            if (strtolower($name) == strtolower($validatepackagename)) {
-                return (bool) preg_match('/^[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*\\z/', $name);
-            }
-        }
-        return $this->_validPackageName($name);
-    }
-
-    /**
-     * This validates a bundle name, and bundle names must conform
-     * to the PEAR naming convention, so the method is final and static.
-     * @param string
-     * @final
-     * @static
-     */
-    function validGroupName($name)
-    {
-        return (bool) preg_match('/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/', $name);
-    }
-
-    /**
-     * Determine whether $state represents a valid stability level
-     * @param string
-     * @return bool
-     * @static
-     * @final
-     */
-    function validState($state)
-    {
-        return in_array($state, array('snapshot', 'devel', 'alpha', 'beta', 'stable'));
-    }
-
-    /**
-     * Get a list of valid stability levels
-     * @return array
-     * @static
-     * @final
-     */
-    function getValidStates()
-    {
-        return array('snapshot', 'devel', 'alpha', 'beta', 'stable');
-    }
-
-    /**
-     * Determine whether a version is a properly formatted version number that can be used
-     * by version_compare
-     * @param string
-     * @return bool
-     * @static
-     * @final
-     */
-    function validVersion($ver)
-    {
-        return (bool) preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
-    }
-
-    /**
-     * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
-     */
-    function setPackageFile(&$pf)
-    {
-        $this->_packagexml = &$pf;
-    }
-
-    /**
-     * @access private
-     */
-    function _addFailure($field, $reason)
-    {
-        $this->_failures['errors'][] = array('field' => $field, 'reason' => $reason);
-    }
-
-    /**
-     * @access private
-     */
-    function _addWarning($field, $reason)
-    {
-        $this->_failures['warnings'][] = array('field' => $field, 'reason' => $reason);
-    }
-
-    function getFailures()
-    {
-        $failures = $this->_failures;
-        $this->_failures = array('warnings' => array(), 'errors' => array());
-        return $failures;
-    }
-
-    /**
-     * @param int one of the PEAR_VALIDATE_* constants
-     */
-    function validate($state = null)
-    {
-        if (!isset($this->_packagexml)) {
-            return false;
-        }
-        if ($state !== null) {
-            $this->_state = $state;
-        }
-        $this->_failures = array('warnings' => array(), 'errors' => array());
-        $this->validatePackageName();
-        $this->validateVersion();
-        $this->validateMaintainers();
-        $this->validateDate();
-        $this->validateSummary();
-        $this->validateDescription();
-        $this->validateLicense();
-        $this->validateNotes();
-        if ($this->_packagexml->getPackagexmlVersion() == '1.0') {
-            $this->validateState();
-            $this->validateFilelist();
-        } elseif ($this->_packagexml->getPackagexmlVersion() == '2.0' ||
-                  $this->_packagexml->getPackagexmlVersion() == '2.1') {
-            $this->validateTime();
-            $this->validateStability();
-            $this->validateDeps();
-            $this->validateMainFilelist();
-            $this->validateReleaseFilelist();
-            //$this->validateGlobalTasks();
-            $this->validateChangelog();
-        }
-        return !((bool) count($this->_failures['errors']));
-    }
-
-    /**
-     * @access protected
-     */
-    function validatePackageName()
-    {
-        if ($this->_state == PEAR_VALIDATE_PACKAGING ||
-              $this->_state == PEAR_VALIDATE_NORMAL) {
-            if (($this->_packagexml->getPackagexmlVersion() == '2.0' ||
-                 $this->_packagexml->getPackagexmlVersion() == '2.1') &&
-                  $this->_packagexml->getExtends()) {
-                $version = $this->_packagexml->getVersion() . '';
-                $name = $this->_packagexml->getPackage();
-                $test = array_shift($a = explode('.', $version));
-                if ($test == '0') {
-                    return true;
-                }
-                $vlen = strlen($test);
-                $majver = substr($name, strlen($name) - $vlen);
-                while ($majver && !is_numeric($majver{0})) {
-                    $majver = substr($majver, 1);
-                }
-                if ($majver != $test) {
-                    $this->_addWarning('package', "package $name extends package " .
-                        $this->_packagexml->getExtends() . ' and so the name should ' .
-                        'have a postfix equal to the major version like "' .
-                        $this->_packagexml->getExtends() . $test . '"');
-                    return true;
-                } elseif (substr($name, 0, strlen($name) - $vlen) !=
-                            $this->_packagexml->getExtends()) {
-                    $this->_addWarning('package', "package $name extends package " .
-                        $this->_packagexml->getExtends() . ' and so the name must ' .
-                        'be an extension like "' . $this->_packagexml->getExtends() .
-                        $test . '"');
-                    return true;
-                }
-            }
-        }
-        if (!$this->validPackageName($this->_packagexml->getPackage())) {
-            $this->_addFailure('name', 'package name "' .
-                $this->_packagexml->getPackage() . '" is invalid');
-            return false;
-        }
-    }
-
-    /**
-     * @access protected
-     */
-    function validateVersion()
-    {
-        if ($this->_state != PEAR_VALIDATE_PACKAGING) {
-            if (!$this->validVersion($this->_packagexml->getVersion())) {
-                $this->_addFailure('version',
-                    'Invalid version number "' . $this->_packagexml->getVersion() . '"');
-            }
-            return false;
-        }
-        $version = $this->_packagexml->getVersion();
-        $versioncomponents = explode('.', $version);
-        if (count($versioncomponents) != 3) {
-            $this->_addWarning('version',
-                'A version number should have 3 decimals (x.y.z)');
-            return true;
-        }
-        $name = $this->_packagexml->getPackage();
-        // version must be based upon state
-        switch ($this->_packagexml->getState()) {
-            case 'snapshot' :
-                return true;
-            case 'devel' :
-                if ($versioncomponents[0] . 'a' == '0a') {
-                    return true;
-                }
-                if ($versioncomponents[0] == 0) {
-                    $versioncomponents[0] = '0';
-                    $this->_addWarning('version',
-                        'version "' . $version . '" should be "' .
-                        implode('.' ,$versioncomponents) . '"');
-                } else {
-                    $this->_addWarning('version',
-                        'packages with devel stability must be < version 1.0.0');
-                }
-                return true;
-            break;
-            case 'alpha' :
-            case 'beta' :
-                // check for a package that extends a package,
-                // like Foo and Foo2
-                if ($this->_state == PEAR_VALIDATE_PACKAGING) {
-                    if (substr($versioncomponents[2], 1, 2) == 'rc') {
-                        $this->_addFailure('version', 'Release Candidate versions ' .
-                            'must have capital RC, not lower-case rc');
-                        return false;
-                    }
-                }
-                if (!$this->_packagexml->getExtends()) {
-                    if ($versioncomponents[0] == '1') {
-                        if ($versioncomponents[2]{0} == '0') {
-                            if ($versioncomponents[2] == '0') {
-                                // version 1.*.0000
-                                $this->_addWarning('version',
-                                    'version 1.' . $versioncomponents[1] .
-                                        '.0 probably should not be alpha or beta');
-                                return true;
-                            } elseif (strlen($versioncomponents[2]) > 1) {
-                                // version 1.*.0RC1 or 1.*.0beta24 etc.
-                                return true;
-                            } else {
-                                // version 1.*.0
-                                $this->_addWarning('version',
-                                    'version 1.' . $versioncomponents[1] .
-                                        '.0 probably should not be alpha or beta');
-                                return true;
-                            }
-                        } else {
-                            $this->_addWarning('version',
-                                'bugfix versions (1.3.x where x > 0) probably should ' .
-                                'not be alpha or beta');
-                            return true;
-                        }
-                    } elseif ($versioncomponents[0] != '0') {
-                        $this->_addWarning('version',
-                            'major versions greater than 1 are not allowed for packages ' .
-                            'without an <extends> tag or an identical postfix (foo2 v2.0.0)');
-                        return true;
-                    }
-                    if ($versioncomponents[0] . 'a' == '0a') {
-                        return true;
-                    }
-                    if ($versioncomponents[0] == 0) {
-                        $versioncomponents[0] = '0';
-                        $this->_addWarning('version',
-                            'version "' . $version . '" should be "' .
-                            implode('.' ,$versioncomponents) . '"');
-                    }
-                } else {
-                    $vlen = strlen($versioncomponents[0] . '');
-                    $majver = substr($name, strlen($name) - $vlen);
-                    while ($majver && !is_numeric($majver{0})) {
-                        $majver = substr($majver, 1);
-                    }
-                    if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
-                        $this->_addWarning('version', 'first version number "' .
-                            $versioncomponents[0] . '" must match the postfix of ' .
-                            'package name "' . $name . '" (' .
-                            $majver . ')');
-                        return true;
-                    }
-                    if ($versioncomponents[0] == $majver) {
-                        if ($versioncomponents[2]{0} == '0') {
-                            if ($versioncomponents[2] == '0') {
-                                // version 2.*.0000
-                                $this->_addWarning('version',
-                                    "version $majver." . $versioncomponents[1] .
-                                        '.0 probably should not be alpha or beta');
-                                return false;
-                            } elseif (strlen($versioncomponents[2]) > 1) {
-                                // version 2.*.0RC1 or 2.*.0beta24 etc.
-                                return true;
-                            } else {
-                                // version 2.*.0
-                                $this->_addWarning('version',
-                                    "version $majver." . $versioncomponents[1] .
-                                        '.0 cannot be alpha or beta');
-                                return true;
-                            }
-                        } else {
-                            $this->_addWarning('version',
-                                "bugfix versions ($majver.x.y where y > 0) should " .
-                                'not be alpha or beta');
-                            return true;
-                        }
-                    } elseif ($versioncomponents[0] != '0') {
-                        $this->_addWarning('version',
-                            "only versions 0.x.y and $majver.x.y are allowed for alpha/beta releases");
-                        return true;
-                    }
-                    if ($versioncomponents[0] . 'a' == '0a') {
-                        return true;
-                    }
-                    if ($versioncomponents[0] == 0) {
-                        $versioncomponents[0] = '0';
-                        $this->_addWarning('version',
-                            'version "' . $version . '" should be "' .
-                            implode('.' ,$versioncomponents) . '"');
-                    }
-                }
-                return true;
-            break;
-            case 'stable' :
-                if ($versioncomponents[0] == '0') {
-                    $this->_addWarning('version', 'versions less than 1.0.0 cannot ' .
-                    'be stable');
-                    return true;
-                }
-                if (!is_numeric($versioncomponents[2])) {
-                    if (preg_match('/\d+(rc|a|alpha|b|beta)\d*/i',
-                          $versioncomponents[2])) {
-                        $this->_addWarning('version', 'version "' . $version . '" or any ' .
-                            'RC/beta/alpha version cannot be stable');
-                        return true;
-                    }
-                }
-                // check for a package that extends a package,
-                // like Foo and Foo2
-                if ($this->_packagexml->getExtends()) {
-                    $vlen = strlen($versioncomponents[0] . '');
-                    $majver = substr($name, strlen($name) - $vlen);
-                    while ($majver && !is_numeric($majver{0})) {
-                        $majver = substr($majver, 1);
-                    }
-                    if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
-                        $this->_addWarning('version', 'first version number "' .
-                            $versioncomponents[0] . '" must match the postfix of ' .
-                            'package name "' . $name . '" (' .
-                            $majver . ')');
-                        return true;
-                    }
-                } elseif ($versioncomponents[0] > 1) {
-                    $this->_addWarning('version', 'major version x in x.y.z may not be greater than ' .
-                        '1 for any package that does not have an <extends> tag');
-                }
-                return true;
-            break;
-            default :
-                return false;
-            break;
-        }
-    }
-
-    /**
-     * @access protected
-     */
-    function validateMaintainers()
-    {
-        // maintainers can only be truly validated server-side for most channels
-        // but allow this customization for those who wish it
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateDate()
-    {
-        if ($this->_state == PEAR_VALIDATE_NORMAL ||
-              $this->_state == PEAR_VALIDATE_PACKAGING) {
-
-            if (!preg_match('/(\d\d\d\d)\-(\d\d)\-(\d\d)/',
-                  $this->_packagexml->getDate(), $res) ||
-                  count($res) < 4
-                  || !checkdate($res[2], $res[3], $res[1])
-                ) {
-                $this->_addFailure('date', 'invalid release date "' .
-                    $this->_packagexml->getDate() . '"');
-                return false;
-            }
-
-            if ($this->_state == PEAR_VALIDATE_PACKAGING &&
-                  $this->_packagexml->getDate() != date('Y-m-d')) {
-                $this->_addWarning('date', 'Release Date "' .
-                    $this->_packagexml->getDate() . '" is not today');
-            }
-        }
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateTime()
-    {
-        if (!$this->_packagexml->getTime()) {
-            // default of no time value set
-            return true;
-        }
-
-        // packager automatically sets time, so only validate if pear validate is called
-        if ($this->_state = PEAR_VALIDATE_NORMAL) {
-            if (!preg_match('/\d\d:\d\d:\d\d/',
-                  $this->_packagexml->getTime())) {
-                $this->_addFailure('time', 'invalid release time "' .
-                    $this->_packagexml->getTime() . '"');
-                return false;
-            }
-
-            $result = preg_match('|\d{2}\:\d{2}\:\d{2}|', $this->_packagexml->getTime(), $matches);
-            if ($result === false || empty($matches)) {
-                $this->_addFailure('time', 'invalid release time "' .
-                    $this->_packagexml->getTime() . '"');
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateState()
-    {
-        // this is the closest to "final" php4 can get
-        if (!PEAR_Validate::validState($this->_packagexml->getState())) {
-            if (strtolower($this->_packagexml->getState() == 'rc')) {
-                $this->_addFailure('state', 'RC is not a state, it is a version ' .
-                    'postfix, use ' . $this->_packagexml->getVersion() . 'RC1, state beta');
-            }
-            $this->_addFailure('state', 'invalid release state "' .
-                $this->_packagexml->getState() . '", must be one of: ' .
-                implode(', ', PEAR_Validate::getValidStates()));
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateStability()
-    {
-        $ret = true;
-        $packagestability = $this->_packagexml->getState();
-        $apistability = $this->_packagexml->getState('api');
-        if (!PEAR_Validate::validState($packagestability)) {
-            $this->_addFailure('state', 'invalid release stability "' .
-                $this->_packagexml->getState() . '", must be one of: ' .
-                implode(', ', PEAR_Validate::getValidStates()));
-            $ret = false;
-        }
-        $apistates = PEAR_Validate::getValidStates();
-        array_shift($apistates); // snapshot is not allowed
-        if (!in_array($apistability, $apistates)) {
-            $this->_addFailure('state', 'invalid API stability "' .
-                $this->_packagexml->getState('api') . '", must be one of: ' .
-                implode(', ', $apistates));
-            $ret = false;
-        }
-        return $ret;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateSummary()
-    {
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateDescription()
-    {
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateLicense()
-    {
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateNotes()
-    {
-        return true;
-    }
-
-    /**
-     * for package.xml 2.0 only - channels can't use package.xml 1.0
-     * @access protected
-     */
-    function validateDependencies()
-    {
-        return true;
-    }
-
-    /**
-     * for package.xml 1.0 only
-     * @access private
-     */
-    function _validateFilelist()
-    {
-        return true; // placeholder for now
-    }
-
-    /**
-     * for package.xml 2.0 only
-     * @access protected
-     */
-    function validateMainFilelist()
-    {
-        return true; // placeholder for now
-    }
-
-    /**
-     * for package.xml 2.0 only
-     * @access protected
-     */
-    function validateReleaseFilelist()
-    {
-        return true; // placeholder for now
-    }
-
-    /**
-     * @access protected
-     */
-    function validateChangelog()
-    {
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateFilelist()
-    {
-        return true;
-    }
-
-    /**
-     * @access protected
-     */
-    function validateDeps()
-    {
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR/Validator/PECL.php b/lib/php/PEAR/Validator/PECL.php
deleted file mode 100644
index c0c60b85806f11f45cbf4e30173dc4c3e7901f22..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/Validator/PECL.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Channel Validator for the pecl.php.net channel
- *
- * PHP 4 and PHP 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: PECL.php 276383 2009-02-24 23:39:37Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a5
- */
-/**
- * This is the parent class for all validators
- */
-require_once 'PEAR/Validate.php';
-/**
- * Channel Validator for the pecl.php.net channel
- * @category   pear
- * @package    PEAR
- * @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.0
- * @link       http://pear.php.net/package/PEAR
- * @since      Class available since Release 1.4.0a5
- */
-class PEAR_Validator_PECL extends PEAR_Validate
-{
-    function validateVersion()
-    {
-        if ($this->_state == PEAR_VALIDATE_PACKAGING) {
-            $version = $this->_packagexml->getVersion();
-            $versioncomponents = explode('.', $version);
-            $last = array_pop($versioncomponents);
-            if (substr($last, 1, 2) == 'rc') {
-                $this->_addFailure('version', 'Release Candidate versions must have ' .
-                'upper-case RC, not lower-case rc');
-                return false;
-            }
-        }
-        return true;
-    }
-
-    function validatePackageName()
-    {
-        $ret = parent::validatePackageName();
-        if ($this->_packagexml->getPackageType() == 'extsrc' ||
-              $this->_packagexml->getPackageType() == 'zendextsrc') {
-            if (strtolower($this->_packagexml->getPackage()) !=
-                  strtolower($this->_packagexml->getProvidesExtension())) {
-                $this->_addWarning('providesextension', 'package name "' .
-                    $this->_packagexml->getPackage() . '" is different from extension name "' .
-                    $this->_packagexml->getProvidesExtension() . '"');
-            }
-        }
-        return $ret;
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/php/PEAR/XMLParser.php b/lib/php/PEAR/XMLParser.php
deleted file mode 100644
index a56d3106473f33074cde9addf80703e703c53334..0000000000000000000000000000000000000000
--- a/lib/php/PEAR/XMLParser.php
+++ /dev/null
@@ -1,253 +0,0 @@
-<?php
-/**
- * PEAR_XMLParser
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Greg Beaver <cellog@php.net>
- * @author     Stephan Schmidt (original XML_Unserializer code)
- * @copyright  1997-2009 The Authors
- * @license   http://opensource.org/licenses/bsd-license New BSD License
- * @version    CVS: $Id: XMLParser.php 282970 2009-06-28 23:10:07Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 1.4.0a1
- */
-
-/**
- * Parser for any xml file
- * @category  pear
- * @package   PEAR
- * @author    Greg Beaver <cellog@php.net>
- * @author    Stephan Schmidt (original XML_Unserializer code)
- * @copyright 1997-2009 The Authors
- * @license   http://opensource.org/licenses/bsd-license New BSD License
- * @version   Release: 1.9.0
- * @link      http://pear.php.net/package/PEAR
- * @since     Class available since Release 1.4.0a1
- */
-class PEAR_XMLParser
-{
-    /**
-     * unserilialized data
-     * @var string $_serializedData
-     */
-    var $_unserializedData = null;
-
-    /**
-     * name of the root tag
-     * @var string $_root
-     */
-    var $_root = null;
-
-    /**
-     * stack for all data that is found
-     * @var array    $_dataStack
-     */
-    var $_dataStack = array();
-
-    /**
-     * stack for all values that are generated
-     * @var array    $_valStack
-     */
-    var $_valStack = array();
-
-    /**
-     * current tag depth
-     * @var int    $_depth
-     */
-    var $_depth = 0;
-
-    /**
-     * The XML encoding to use
-     * @var string $encoding
-     */
-    var $encoding = 'ISO-8859-1';
-
-    /**
-     * @return array
-     */
-    function getData()
-    {
-        return $this->_unserializedData;
-    }
-
-    /**
-     * @param string xml content
-     * @return true|PEAR_Error
-     */
-    function parse($data)
-    {
-        if (!extension_loaded('xml')) {
-            include_once 'PEAR.php';
-            return PEAR::raiseError("XML Extension not found", 1);
-        }
-        $this->_dataStack =  $this->_valStack = array();
-        $this->_depth = 0;
-
-        if (
-            strpos($data, 'encoding="UTF-8"')
-            || strpos($data, 'encoding="utf-8"')
-            || strpos($data, "encoding='UTF-8'")
-            || strpos($data, "encoding='utf-8'")
-        ) {
-            $this->encoding = 'UTF-8';
-        }
-
-        if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
-            $data = utf8_decode($data);
-            $this->encoding = 'ISO-8859-1';
-        }
-
-        $xp = xml_parser_create($this->encoding);
-        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
-        xml_set_object($xp, $this);
-        xml_set_element_handler($xp, 'startHandler', 'endHandler');
-        xml_set_character_data_handler($xp, 'cdataHandler');
-        if (!xml_parse($xp, $data)) {
-            $msg = xml_error_string(xml_get_error_code($xp));
-            $line = xml_get_current_line_number($xp);
-            xml_parser_free($xp);
-            include_once 'PEAR.php';
-            return PEAR::raiseError("XML Error: '$msg' on line '$line'", 2);
-        }
-        xml_parser_free($xp);
-        return true;
-    }
-
-    /**
-     * Start element handler for XML parser
-     *
-     * @access private
-     * @param  object $parser  XML parser object
-     * @param  string $element XML element
-     * @param  array  $attribs attributes of XML tag
-     * @return void
-     */
-    function startHandler($parser, $element, $attribs)
-    {
-        $this->_depth++;
-        $this->_dataStack[$this->_depth] = null;
-
-        $val = array(
-            'name'         => $element,
-            'value'        => null,
-            'type'         => 'string',
-            'childrenKeys' => array(),
-            'aggregKeys'   => array()
-       );
-
-        if (count($attribs) > 0) {
-            $val['children'] = array();
-            $val['type'] = 'array';
-            $val['children']['attribs'] = $attribs;
-        }
-
-        array_push($this->_valStack, $val);
-    }
-
-    /**
-     * post-process data
-     *
-     * @param string $data
-     * @param string $element element name
-     */
-    function postProcess($data, $element)
-    {
-        return trim($data);
-    }
-
-    /**
-     * End element handler for XML parser
-     *
-     * @access private
-     * @param  object XML parser object
-     * @param  string
-     * @return void
-     */
-    function endHandler($parser, $element)
-    {
-        $value = array_pop($this->_valStack);
-        $data  = $this->postProcess($this->_dataStack[$this->_depth], $element);
-
-        // adjust type of the value
-        switch (strtolower($value['type'])) {
-            // unserialize an array
-            case 'array':
-                if ($data !== '') {
-                    $value['children']['_content'] = $data;
-                }
-
-                $value['value'] = isset($value['children']) ? $value['children'] : array();
-                break;
-
-            /*
-             * unserialize a null value
-             */
-            case 'null':
-                $data = null;
-                break;
-
-            /*
-             * unserialize any scalar value
-             */
-            default:
-                settype($data, $value['type']);
-                $value['value'] = $data;
-                break;
-        }
-
-        $parent = array_pop($this->_valStack);
-        if ($parent === null) {
-            $this->_unserializedData = &$value['value'];
-            $this->_root = &$value['name'];
-            return true;
-        }
-
-        // parent has to be an array
-        if (!isset($parent['children']) || !is_array($parent['children'])) {
-            $parent['children'] = array();
-            if ($parent['type'] != 'array') {
-                $parent['type'] = 'array';
-            }
-        }
-
-        if (!empty($value['name'])) {
-            // there already has been a tag with this name
-            if (in_array($value['name'], $parent['childrenKeys'])) {
-                // no aggregate has been created for this tag
-                if (!in_array($value['name'], $parent['aggregKeys'])) {
-                    if (isset($parent['children'][$value['name']])) {
-                        $parent['children'][$value['name']] = array($parent['children'][$value['name']]);
-                    } else {
-                        $parent['children'][$value['name']] = array();
-                    }
-                    array_push($parent['aggregKeys'], $value['name']);
-                }
-                array_push($parent['children'][$value['name']], $value['value']);
-            } else {
-                $parent['children'][$value['name']] = &$value['value'];
-                array_push($parent['childrenKeys'], $value['name']);
-            }
-        } else {
-            array_push($parent['children'],$value['value']);
-        }
-        array_push($this->_valStack, $parent);
-
-        $this->_depth--;
-    }
-
-    /**
-     * Handler for character data
-     *
-     * @access private
-     * @param  object XML parser object
-     * @param  string CDATA
-     * @return void
-     */
-    function cdataHandler($parser, $cdata)
-    {
-        $this->_dataStack[$this->_depth] .= $cdata;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/PEAR5.php b/lib/php/PEAR5.php
deleted file mode 100644
index 428606780b7bf322bbf8bf2379da80d1340cb86b..0000000000000000000000000000000000000000
--- a/lib/php/PEAR5.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * This is only meant for PHP 5 to get rid of certain strict warning
- * that doesn't get hidden since it's in the shutdown function
- */
-class PEAR5
-{
-    /**
-    * If you have a class that's mostly/entirely static, and you need static
-    * properties, you can use this method to simulate them. Eg. in your method(s)
-    * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
-    * You MUST use a reference, or they will not persist!
-    *
-    * @access public
-    * @param  string $class  The calling classname, to prevent clashes
-    * @param  string $var    The variable to retrieve.
-    * @return mixed   A reference to the variable. If not set it will be
-    *                 auto initialised to NULL.
-    */
-    static function &getStaticProperty($class, $var)
-    {
-        static $properties;
-        if (!isset($properties[$class])) {
-            $properties[$class] = array();
-        }
-
-        if (!array_key_exists($var, $properties[$class])) {
-            $properties[$class][$var] = null;
-        }
-
-        return $properties[$class][$var];
-    }
-}
\ No newline at end of file
diff --git a/lib/php/Structures/Graph.php b/lib/php/Structures/Graph.php
deleted file mode 100644
index 3757f1584fd3d18cfaf840a426d28a524efd6018..0000000000000000000000000000000000000000
--- a/lib/php/Structures/Graph.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-/**
- * The Graph.php file contains the definition of the Structures_Graph class 
- *
- * @see Structures_Graph
- * @package Structures_Graph
- */
-
-/* dependencies {{{ */
-/** PEAR base classes */
-require_once 'PEAR.php';
-/** Graph Node */
-require_once 'Structures/Graph/Node.php';
-/* }}} */
-
-define('STRUCTURES_GRAPH_ERROR_GENERIC', 100);
-
-/* class Structures_Graph {{{ */
-/**
- * The Structures_Graph class represents a graph data structure. 
- *
- * A Graph is a data structure composed by a set of nodes, connected by arcs.
- * Graphs may either be directed or undirected. In a directed graph, arcs are 
- * directional, and can be traveled only one way. In an undirected graph, arcs
- * are bidirectional, and can be traveled both ways.
- *
- * @author		S�rgio Carvalho <sergio.carvalho@portugalmail.com> 
- * @copyright	(c) 2004 by S�rgio Carvalho
- * @package Structures_Graph
- */
-/* }}} */
-class Structures_Graph {
-    /* fields {{{ */
-    /**
-     * @access private
-     */
-    var $_nodes = array();
-    /**
-     * @access private
-     */
-    var $_directed = false;
-    /* }}} */
-
-    /* Constructor {{{ */
-    /**
-    *
-    * Constructor
-    *
-    * @param    boolean    Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true)
-    * @access	public
-    */
-    function Structures_Graph($directed = true) {
-        $this->_directed = $directed;
-    }
-    /* }}} */
-
-    /* isDirected {{{ */
-    /**
-    *
-    * Return true if a graph is directed
-    *
-    * @return	boolean	 true if the graph is directed
-    * @access	public
-    */
-    function isDirected() {
-        return (boolean) $this->_directed;
-    }
-    /* }}} */
-
-    /* addNode {{{ */
-    /**
-    *
-    * Add a Node to the Graph
-    *
-    * @param    Structures_Graph_Node   The node to be added.
-    * @access	public
-    */
-    function addNode(&$newNode) {
-        // We only add nodes
-        if (!is_a($newNode, 'Structures_Graph_Node')) return Pear::raiseError('Structures_Graph::addNode received an object that is not a Structures_Graph_Node', STRUCTURES_GRAPH_ERROR_GENERIC);
-        // Graphs are node *sets*, so duplicates are forbidden. We allow nodes that are exactly equal, but disallow equal references.
-        foreach($this->_nodes as $key => $node) {
-            /*
-             ZE1 equality operators choke on the recursive cycle introduced by the _graph field in the Node object.
-             So, we'll check references the hard way (change $this->_nodes[$key] and check if the change reflects in 
-             $node)
-            */
-            $savedData = $this->_nodes[$key];
-            $referenceIsEqualFlag = false;
-            $this->_nodes[$key] = true;
-            if ($node === true) {
-                $this->_nodes[$key] = false;
-                if ($node === false) $referenceIsEqualFlag = true;
-            }
-            $this->_nodes[$key] = $savedData;
-            if ($referenceIsEqualFlag) return Pear::raiseError('Structures_Graph::addNode received an object that is a duplicate for this dataset', STRUCTURES_GRAPH_ERROR_GENERIC);
-        }
-        $this->_nodes[] =& $newNode;
-        $newNode->setGraph($this);
-    }
-    /* }}} */
-
-    /* removeNode (unimplemented) {{{ */
-    /**
-    *
-    * Remove a Node from the Graph
-    *
-    * @todo     This is unimplemented
-    * @param    Structures_Graph_Node   The node to be removed from the graph
-    * @access	public
-    */
-    function removeNode(&$node) {
-    }
-    /* }}} */
-
-    /* getNodes {{{ */
-    /**
-    *
-    * Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.
-    *
-    * @access   public
-    * @see      Structures_Graph_Manipulator_TopologicalSorter
-    * @return   array The set of nodes in this graph
-    */
-    function &getNodes() {
-        return $this->_nodes;
-    }
-    /* }}} */
-}
-?>
diff --git a/lib/php/Structures/Graph/Manipulator/AcyclicTest.php b/lib/php/Structures/Graph/Manipulator/AcyclicTest.php
deleted file mode 100644
index fc1ba92f6a202aa9e9ae8381596bb2af3fd0ba88..0000000000000000000000000000000000000000
--- a/lib/php/Structures/Graph/Manipulator/AcyclicTest.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-/**
- * This file contains the definition of the Structures_Graph_Manipulator_AcyclicTest graph manipulator.
- * 
- * @see Structures_Graph_Manipulator_AcyclicTest
- * @package Structures_Graph
- */
-
-/* dependencies {{{ */
-/** */
-require_once 'PEAR.php';
-/** */
-require_once 'Structures/Graph.php';
-/** */
-require_once 'Structures/Graph/Node.php';
-/* }}} */
-
-/* class Structures_Graph_Manipulator_AcyclicTest {{{ */
-/**
- * The Structures_Graph_Manipulator_AcyclicTest is a graph manipulator
- * which tests whether a graph contains a cycle. 
- * 
- * The definition of an acyclic graph used in this manipulator is that of a 
- * DAG. The graph must be directed, or else it is considered cyclic, even when 
- * there are no arcs.
- *
- * @author		S�rgio Carvalho <sergio.carvalho@portugalmail.com> 
- * @copyright	(c) 2004 by S�rgio Carvalho
- * @package Structures_Graph
- */
-class Structures_Graph_Manipulator_AcyclicTest {
-    /* _nonVisitedInDegree {{{ */
-    /**
-    *
-    * This is a variant of Structures_Graph::inDegree which does 
-    * not count nodes marked as visited.
-    *
-    * @access   private
-    * @return	integer	 Number of non-visited nodes that link to this one
-    */
-    function _nonVisitedInDegree(&$node) {
-        $result = 0;
-        $graphNodes =& $node->_graph->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if ((!$graphNodes[$key]->getMetadata('acyclic-test-visited')) && $graphNodes[$key]->connectsTo($node)) $result++;
-        }
-        return $result;
-        
-    }
-    /* }}} */
-
-    /* _isAcyclic {{{ */
-    /**
-    * @access   private
-    */
-    function _isAcyclic(&$graph) {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata('acyclic-test-visited', $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach($nodeKeys as $key) {
-                if ((!$nodes[$key]->getMetadata('acyclic-test-visited')) && Structures_Graph_Manipulator_AcyclicTest::_nonVisitedInDegree($nodes[$key]) == 0) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            for ($i=sizeof($leafNodes) - 1; $i>=0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata('acyclic-test-visited');
-                $visited = true;
-                $leafNodes[$i]->setMetadata('acyclic-test-visited', $visited);
-            }
-        } while (sizeof($leafNodes) > 0);
-
-        // If graph is a DAG, there should be no non-visited nodes. Let's try to prove otherwise
-        $result = true;
-        foreach($nodeKeys as $key) if (!$nodes[$key]->getMetadata('acyclic-test-visited')) $result = false;
-        
-        // Cleanup visited marks
-        foreach($nodeKeys as $key) $nodes[$key]->unsetMetadata('acyclic-test-visited');
-
-        return $result;
-    }
-    /* }}} */
-
-    /* isAcyclic {{{ */
-    /**
-    *
-    * isAcyclic returns true if a graph contains no cycles, false otherwise.
-    *
-    * @return	boolean	 true iff graph is acyclic
-    * @access	public
-    */
-    function isAcyclic(&$graph) {
-        // We only test graphs
-        if (!is_a($graph, 'Structures_Graph')) return Pear::raiseError('Structures_Graph_Manipulator_AcyclicTest::isAcyclic received an object that is not a Structures_Graph', STRUCTURES_GRAPH_ERROR_GENERIC);
-        if (!$graph->isDirected()) return false; // Only directed graphs may be acyclic
-
-        return Structures_Graph_Manipulator_AcyclicTest::_isAcyclic($graph);
-    }
-    /* }}} */
-}
-/* }}} */
-?>
diff --git a/lib/php/Structures/Graph/Manipulator/TopologicalSorter.php b/lib/php/Structures/Graph/Manipulator/TopologicalSorter.php
deleted file mode 100644
index 98a9fa0b607ec403b52434347cc43b51de49a700..0000000000000000000000000000000000000000
--- a/lib/php/Structures/Graph/Manipulator/TopologicalSorter.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-/**
- * This file contains the definition of the Structures_Graph_Manipulator_TopologicalSorter class.
- * 
- * @see Structures_Graph_Manipulator_TopologicalSorter
- * @package Structures_Graph
- */
-
-/* dependencies {{{ */
-/** */
-require_once 'PEAR.php';
-/** */
-require_once 'Structures/Graph.php';
-/** */
-require_once 'Structures/Graph/Node.php';
-/** */
-require_once 'Structures/Graph/Manipulator/AcyclicTest.php';
-/* }}} */
-
-/* class Structures_Graph_Manipulator_TopologicalSorter {{{ */
-/**
- * The Structures_Graph_Manipulator_TopologicalSorter is a manipulator 
- * which is able to return the set of nodes in a graph, sorted by topological 
- * order.
- *
- * A graph may only be sorted topologically iff it's a DAG. You can test it
- * with the Structures_Graph_Manipulator_AcyclicTest.
- * 
- * @author		S�rgio Carvalho <sergio.carvalho@portugalmail.com> 
- * @copyright	(c) 2004 by S�rgio Carvalho
- * @see     Structures_Graph_Manipulator_AcyclicTest
- * @package Structures_Graph
- */
-class Structures_Graph_Manipulator_TopologicalSorter {
-    /* _nonVisitedInDegree {{{ */
-    /**
-    *
-    * This is a variant of Structures_Graph::inDegree which does 
-    * not count nodes marked as visited.
-    *
-    * @access   private
-    * @return	integer	 Number of non-visited nodes that link to this one
-    */
-    function _nonVisitedInDegree(&$node) {
-        $result = 0;
-        $graphNodes =& $node->_graph->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if ((!$graphNodes[$key]->getMetadata('topological-sort-visited')) && $graphNodes[$key]->connectsTo($node)) $result++;
-        }
-        return $result;
-        
-    }
-    /* }}} */
-
-    /* _sort {{{ */
-    /**
-    * @access   private
-    */
-    function _sort(&$graph) {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata('topological-sort-visited', $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        $topologicalLevel = 0;
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach($nodeKeys as $key) {
-                if ((!$nodes[$key]->getMetadata('topological-sort-visited')) && Structures_Graph_Manipulator_TopologicalSorter::_nonVisitedInDegree($nodes[$key]) == 0) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            $refGenerator[] = $topologicalLevel;
-            for ($i=sizeof($leafNodes) - 1; $i>=0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata('topological-sort-visited');
-                $visited = true;
-                $leafNodes[$i]->setMetadata('topological-sort-visited', $visited);
-                $leafNodes[$i]->setMetadata('topological-sort-level', $refGenerator[sizeof($refGenerator) - 1]);
-            }
-            $topologicalLevel++;
-        } while (sizeof($leafNodes) > 0);
-
-        // Cleanup visited marks
-        foreach($nodeKeys as $key) $nodes[$key]->unsetMetadata('topological-sort-visited');
-    }
-    /* }}} */
-
-    /* sort {{{ */
-    /**
-    *
-    * sort returns the graph's nodes, sorted by topological order. 
-    * 
-    * The result is an array with 
-    * as many entries as topological levels. Each entry in this array is an array of nodes within
-    * the given topological level.
-    *
-    * @return	array	 The graph's nodes, sorted by topological order.
-    * @access	public
-    */
-    function sort(&$graph) {
-        // We only sort graphs
-        if (!is_a($graph, 'Structures_Graph')) return Pear::raiseError('Structures_Graph_Manipulator_TopologicalSorter::sort received an object that is not a Structures_Graph', STRUCTURES_GRAPH_ERROR_GENERIC);
-        if (!Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph)) return Pear::raiseError('Structures_Graph_Manipulator_TopologicalSorter::sort received an graph that has cycles', STRUCTURES_GRAPH_ERROR_GENERIC);
-
-        Structures_Graph_Manipulator_TopologicalSorter::_sort($graph);
-        $result = array();
-
-        // Fill out result array
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        foreach($nodeKeys as $key) {
-            if (!array_key_exists($nodes[$key]->getMetadata('topological-sort-level'), $result)) $result[$nodes[$key]->getMetadata('topological-sort-level')] = array();
-            $result[$nodes[$key]->getMetadata('topological-sort-level')][] =& $nodes[$key];
-            $nodes[$key]->unsetMetadata('topological-sort-level');
-        }
-
-        return $result;
-    }
-    /* }}} */
-}
-/* }}} */
-?>
diff --git a/lib/php/Structures/Graph/Node.php b/lib/php/Structures/Graph/Node.php
deleted file mode 100644
index a2ea415e42e5d54cdae0304dcfed1c03e42834df..0000000000000000000000000000000000000000
--- a/lib/php/Structures/Graph/Node.php
+++ /dev/null
@@ -1,338 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-/**
- * This file contains the definition of the Structures_Graph_Node class
- * 
- * @see Structures_Graph_Node
- * @package Structures_Graph
- */
-
-/* dependencies {{{ */
-/** */
-require_once 'PEAR.php';
-/** */
-require_once 'Structures/Graph.php';
-/* }}} */
-
-/* class Structures_Graph_Node {{{ */
-/**
- * The Structures_Graph_Node class represents a Node that can be member of a 
- * graph node set.
- *
- * A graph node can contain data. Under this API, the node contains default data, 
- * and key index data. It behaves, thus, both as a regular data node, and as a 
- * dictionary (or associative array) node.
- * 
- * Regular data is accessed via getData and setData. Key indexed data is accessed
- * via getMetadata and setMetadata.
- *
- * @author		S�rgio Carvalho <sergio.carvalho@portugalmail.com> 
- * @copyright	(c) 2004 by S�rgio Carvalho
- * @package Structures_Graph
- */
-/* }}} */
-class Structures_Graph_Node {
-    /* fields {{{ */
-    /** 
-     * @access private 
-     */
-    var $_data = null;
-    /** @access private */
-    var $_metadata = array();
-    /** @access private */
-    var $_arcs = array();
-    /** @access private */
-    var $_graph = null;
-    /* }}} */
-
-    /* Constructor {{{ */
-    /**
-    *
-    * Constructor
-    *
-    * @access	public
-    */
-    function Structures_Graph_Node() {
-    }
-    /* }}} */
-
-    /* getGraph {{{ */
-    /**
-    *
-    * Node graph getter
-    *
-    * @return	Structures_Graph	Graph where node is stored
-    * @access	public
-    */
-    function &getGraph() {
-        return $this->_graph;
-    }
-    /* }}} */
-
-    /* setGraph {{{ */
-    /**
-    *
-    * Node graph setter. This method should not be called directly. Use Graph::addNode instead.
-    *
-    * @param    Structures_Graph   Set the graph for this node. 
-    * @see      Structures_Graph::addNode()
-    * @access	public
-    */
-    function setGraph(&$graph) {
-        $this->_graph =& $graph;
-    }
-    /* }}} */
-
-    /* getData {{{ */
-    /**
-    *
-    * Node data getter.
-    * 
-    * Each graph node can contain a reference to one variable. This is the getter for that reference.
-    *
-    * @return	mixed	Data stored in node
-    * @access	public
-    */
-    function &getData() {
-        return $this->_data;
-    }
-    /* }}} */
-
-    /* setData {{{ */
-    /**
-    *
-    * Node data setter
-    *
-    * Each graph node can contain a reference to one variable. This is the setter for that reference.
-    *
-    * @return	mixed	Data to store in node
-    * @access	public
-    */
-    function setData($data) {
-        $this->_data =& $data;
-    }
-    /* }}} */
-
-    /* metadataKeyExists {{{ */
-    /**
-    *
-    * Test for existence of metadata under a given key.
-    *
-    * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an 
-    * associative array or in a dictionary. This method tests whether a given metadata key exists for this node.
-    *
-    * @param    string    Key to test
-    * @return	boolean	 
-    * @access	public
-    */
-    function metadataKeyExists($key) {
-        return array_key_exists($key, $this->_metadata);
-    }
-    /* }}} */
-
-    /* getMetadata {{{ */
-    /**
-    *
-    * Node metadata getter
-    *
-    * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an 
-    * associative array or in a dictionary. This method gets the data under the given key. If the key does
-    * not exist, an error will be thrown, so testing using metadataKeyExists might be needed.
-    *
-    * @param    string  Key
-    * @param    boolean nullIfNonexistent (defaults to false).
-    * @return	mixed	Metadata Data stored in node under given key
-    * @see      metadataKeyExists
-    * @access	public
-    */
-    function &getMetadata($key, $nullIfNonexistent = false) {
-        if (array_key_exists($key, $this->_metadata)) {
-            return $this->_metadata[$key];
-        } else {
-            if ($nullIfNonexistent) {
-                $a = null;
-                return $a;
-            } else {
-                $a = Pear::raiseError('Structures_Graph_Node::getMetadata: Requested key does not exist', STRUCTURES_GRAPH_ERROR_GENERIC);
-                return $a;
-            }
-        }
-    }
-    /* }}} */
-
-    /* unsetMetadata {{{ */
-    /**
-    *
-    * Delete metadata by key
-    *
-    * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an 
-    * associative array or in a dictionary. This method removes any data that might be stored under the provided key.
-    * If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.
-    *
-    * @param    string  Key
-    * @access	public
-    */
-    function unsetMetadata($key) {
-        if (array_key_exists($key, $this->_metadata)) unset($this->_metadata[$key]);
-    }
-    /* }}} */
-
-    /* setMetadata {{{ */
-    /**
-    *
-    * Node metadata setter
-    *
-    * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an 
-    * associative array or in a dictionary. This method stores data under the given key. If the key already exists,
-    * previously stored data is discarded.
-    *
-    * @param    string  Key
-    * @param    mixed   Data 
-    * @access	public
-    */
-    function setMetadata($key, $data) {
-        $this->_metadata[$key] =& $data;
-    }
-    /* }}} */
-
-    /* _connectTo {{{ */
-    /** @access private */
-    function _connectTo(&$destinationNode) {
-        $this->_arcs[] =& $destinationNode;
-    }
-    /* }}} */
-
-    /* connectTo {{{ */
-    /**
-    *
-    * Connect this node to another one.
-    * 
-    * If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.
-    *
-    * @param    Structures_Graph Node to connect to
-    * @access	public
-    */
-    function connectTo(&$destinationNode) {
-        // We only connect to nodes
-        if (!is_a($destinationNode, 'Structures_Graph_Node')) return Pear::raiseError('Structures_Graph_Node::connectTo received an object that is not a Structures_Graph_Node', STRUCTURES_GRAPH_ERROR_GENERIC);
-        // Nodes must already be in graphs to be connected
-        if ($this->_graph == null) return Pear::raiseError('Structures_Graph_Node::connectTo Tried to connect a node that is not in a graph', STRUCTURES_GRAPH_ERROR_GENERIC);
-        if ($destinationNode->getGraph() == null) return Pear::raiseError('Structures_Graph_Node::connectTo Tried to connect to a node that is not in a graph', STRUCTURES_GRAPH_ERROR_GENERIC);
-        // Connect here
-        $this->_connectTo($destinationNode);
-        // If graph is undirected, connect back
-        if (!$this->_graph->isDirected()) {
-            $destinationNode->_connectTo($this);
-        }
-    }
-    /* }}} */
-
-    /* getNeighbours {{{ */
-    /**
-    *
-    * Return nodes connected to this one.
-    * 
-    * @return   array   Array of nodes
-    * @access	public
-    */
-    function getNeighbours() {
-        return $this->_arcs;
-    }
-    /* }}} */
-
-    /* connectsTo {{{ */
-    /**
-    *
-    * Test wether this node has an arc to the target node
-    *
-    * @return	boolean   True if the two nodes are connected
-    * @access	public
-    */
-    function connectsTo(&$target) {
-        $copy = $target;
-        $arcKeys = array_keys($this->_arcs);
-        foreach($arcKeys as $key) {
-            /* ZE1 chokes on this expression:
-                if ($target === $arc) return true;
-              so, we'll use more convoluted stuff
-            */
-            $arc =& $this->_arcs[$key];
-            $target = true;
-            if ($arc === true) {
-                $target = false;
-                if ($arc === false) {
-                    $target = $copy;
-                    return true;
-                }
-            }
-        }
-        $target = $copy;
-        return false;
-    }
-    /* }}} */
-
-    /* inDegree {{{ */
-    /**
-    *
-    * Calculate the in degree of the node.
-    * 
-    * The indegree for a node is the number of arcs entering the node. For non directed graphs, 
-    * the indegree is equal to the outdegree.
-    *
-    * @return	integer	 In degree of the node
-    * @access	public
-    */
-    function inDegree() {
-        if ($this->_graph == null) return 0;
-        if (!$this->_graph->isDirected()) return $this->outDegree();
-        $result = 0;
-        $graphNodes =& $this->_graph->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if ($graphNodes[$key]->connectsTo($this)) $result++;
-        }
-        return $result;
-        
-    }
-    /* }}} */
-
-    /* outDegree {{{ */
-    /**
-    *
-    * Calculate the out degree of the node.
-    *
-    * The outdegree for a node is the number of arcs exiting the node. For non directed graphs,
-    * the outdegree is always equal to the indegree.
-    * 
-    * @return	integer	 Out degree of the node
-    * @access	public
-    */
-    function outDegree() {
-        if ($this->_graph == null) return 0;
-        return sizeof($this->_arcs);
-    }
-    /* }}} */
-}
-?>
diff --git a/lib/php/System.php b/lib/php/System.php
deleted file mode 100644
index 69cc7acb936a41f9c1edf07236390ac3641c4cce..0000000000000000000000000000000000000000
--- a/lib/php/System.php
+++ /dev/null
@@ -1,621 +0,0 @@
-<?php
-/**
- * File/Directory manipulation
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    System
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: System.php 276386 2009-02-24 23:52:56Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- * @since      File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
-
-$GLOBALS['_System_temp_files'] = array();
-
-/**
-* System offers cross plattform compatible system functions
-*
-* Static functions for different operations. Should work under
-* Unix and Windows. The names and usage has been taken from its respectively
-* GNU commands. The functions will return (bool) false on error and will
-* trigger the error with the PHP trigger_error() function (you can silence
-* the error by prefixing a '@' sign after the function call, but this
-* is not recommended practice.  Instead use an error handler with
-* {@link set_error_handler()}).
-*
-* Documentation on this class you can find in:
-* http://pear.php.net/manual/
-*
-* Example usage:
-* if (!@System::rm('-r file1 dir1')) {
-*    print "could not delete file1 or dir1";
-* }
-*
-* In case you need to to pass file names with spaces,
-* pass the params as an array:
-*
-* System::rm(array('-r', $file1, $dir1));
-*
-* @category   pear
-* @package    System
-* @author     Tomas V.V. Cox <cox@idecnet.com>
-* @copyright  1997-2006 The PHP Group
-* @license    http://opensource.org/licenses/bsd-license.php New BSD License
-* @version    Release: 1.9.0
-* @link       http://pear.php.net/package/PEAR
-* @since      Class available since Release 0.1
-* @static
-*/
-class System
-{
-    /**
-     * returns the commandline arguments of a function
-     *
-     * @param    string  $argv           the commandline
-     * @param    string  $short_options  the allowed option short-tags
-     * @param    string  $long_options   the allowed option long-tags
-     * @return   array   the given options and there values
-     * @static
-     * @access private
-     */
-    function _parseArgs($argv, $short_options, $long_options = null)
-    {
-        if (!is_array($argv) && $argv !== null) {
-            $argv = preg_split('/\s+/', $argv, -1, PREG_SPLIT_NO_EMPTY);
-        }
-        return Console_Getopt::getopt2($argv, $short_options);
-    }
-
-    /**
-     * Output errors with PHP trigger_error(). You can silence the errors
-     * with prefixing a "@" sign to the function call: @System::mkdir(..);
-     *
-     * @param mixed $error a PEAR error or a string with the error message
-     * @return bool false
-     * @static
-     * @access private
-     */
-    function raiseError($error)
-    {
-        if (PEAR::isError($error)) {
-            $error = $error->getMessage();
-        }
-        trigger_error($error, E_USER_WARNING);
-        return false;
-    }
-
-    /**
-     * Creates a nested array representing the structure of a directory
-     *
-     * System::_dirToStruct('dir1', 0) =>
-     *   Array
-     *    (
-     *    [dirs] => Array
-     *        (
-     *            [0] => dir1
-     *        )
-     *
-     *    [files] => Array
-     *        (
-     *            [0] => dir1/file2
-     *            [1] => dir1/file3
-     *        )
-     *    )
-     * @param    string  $sPath      Name of the directory
-     * @param    integer $maxinst    max. deep of the lookup
-     * @param    integer $aktinst    starting deep of the lookup
-     * @param    bool    $silent     if true, do not emit errors.
-     * @return   array   the structure of the dir
-     * @static
-     * @access   private
-     */
-    function _dirToStruct($sPath, $maxinst, $aktinst = 0, $silent = false)
-    {
-        $struct = array('dirs' => array(), 'files' => array());
-        if (($dir = @opendir($sPath)) === false) {
-            if (!$silent) {
-                System::raiseError("Could not open dir $sPath");
-            }
-            return $struct; // XXX could not open error
-        }
-
-        $struct['dirs'][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ?
-        $list = array();
-        while (false !== ($file = readdir($dir))) {
-            if ($file != '.' && $file != '..') {
-                $list[] = $file;
-            }
-        }
-
-        closedir($dir);
-        natsort($list);
-        if ($aktinst < $maxinst || $maxinst == 0) {
-            foreach ($list as $val) {
-                $path = $sPath . DIRECTORY_SEPARATOR . $val;
-                if (is_dir($path) && !is_link($path)) {
-                    $tmp    = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent);
-                    $struct = array_merge_recursive($struct, $tmp);
-                } else {
-                    $struct['files'][] = $path;
-                }
-            }
-        }
-
-        return $struct;
-    }
-
-    /**
-     * Creates a nested array representing the structure of a directory and files
-     *
-     * @param    array $files Array listing files and dirs
-     * @return   array
-     * @static
-     * @see System::_dirToStruct()
-     */
-    function _multipleToStruct($files)
-    {
-        $struct = array('dirs' => array(), 'files' => array());
-        settype($files, 'array');
-        foreach ($files as $file) {
-            if (is_dir($file) && !is_link($file)) {
-                $tmp    = System::_dirToStruct($file, 0);
-                $struct = array_merge_recursive($tmp, $struct);
-            } else {
-                if (!in_array($file, $struct['files'])) {
-                    $struct['files'][] = $file;
-                }
-            }
-        }
-        return $struct;
-    }
-
-    /**
-     * The rm command for removing files.
-     * Supports multiple files and dirs and also recursive deletes
-     *
-     * @param    string  $args   the arguments for rm
-     * @return   mixed   PEAR_Error or true for success
-     * @static
-     * @access   public
-     */
-    function rm($args)
-    {
-        $opts = System::_parseArgs($args, 'rf'); // "f" does nothing but I like it :-)
-        if (PEAR::isError($opts)) {
-            return System::raiseError($opts);
-        }
-        foreach ($opts[0] as $opt) {
-            if ($opt[0] == 'r') {
-                $do_recursive = true;
-            }
-        }
-        $ret = true;
-        if (isset($do_recursive)) {
-            $struct = System::_multipleToStruct($opts[1]);
-            foreach ($struct['files'] as $file) {
-                if (!@unlink($file)) {
-                    $ret = false;
-                }
-            }
-
-            rsort($struct['dirs']);
-            foreach ($struct['dirs'] as $dir) {
-                if (!@rmdir($dir)) {
-                    $ret = false;
-                }
-            }
-        } else {
-            foreach ($opts[1] as $file) {
-                $delete = (is_dir($file)) ? 'rmdir' : 'unlink';
-                if (!@$delete($file)) {
-                    $ret = false;
-                }
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Make directories.
-     *
-     * The -p option will create parent directories
-     * @param    string  $args    the name of the director(y|ies) to create
-     * @return   bool    True for success
-     * @static
-     * @access   public
-     */
-    function mkDir($args)
-    {
-        $opts = System::_parseArgs($args, 'pm:');
-        if (PEAR::isError($opts)) {
-            return System::raiseError($opts);
-        }
-
-        $mode = 0777; // default mode
-        foreach ($opts[0] as $opt) {
-            if ($opt[0] == 'p') {
-                $create_parents = true;
-            } elseif ($opt[0] == 'm') {
-                // if the mode is clearly an octal number (starts with 0)
-                // convert it to decimal
-                if (strlen($opt[1]) && $opt[1]{0} == '0') {
-                    $opt[1] = octdec($opt[1]);
-                } else {
-                    // convert to int
-                    $opt[1] += 0;
-                }
-                $mode = $opt[1];
-            }
-        }
-
-        $ret = true;
-        if (isset($create_parents)) {
-            foreach ($opts[1] as $dir) {
-                $dirstack = array();
-                while ((!file_exists($dir) || !is_dir($dir)) &&
-                        $dir != DIRECTORY_SEPARATOR) {
-                    array_unshift($dirstack, $dir);
-                    $dir = dirname($dir);
-                }
-
-                while ($newdir = array_shift($dirstack)) {
-                    if (!is_writeable(dirname($newdir))) {
-                        $ret = false;
-                        break;
-                    }
-
-                    if (!mkdir($newdir, $mode)) {
-                        $ret = false;
-                    }
-                }
-            }
-        } else {
-            foreach($opts[1] as $dir) {
-                if ((@file_exists($dir) || !is_dir($dir)) && !mkdir($dir, $mode)) {
-                    $ret = false;
-                }
-            }
-        }
-
-        return $ret;
-    }
-
-    /**
-     * Concatenate files
-     *
-     * Usage:
-     * 1) $var = System::cat('sample.txt test.txt');
-     * 2) System::cat('sample.txt test.txt > final.txt');
-     * 3) System::cat('sample.txt test.txt >> final.txt');
-     *
-     * Note: as the class use fopen, urls should work also (test that)
-     *
-     * @param    string  $args   the arguments
-     * @return   boolean true on success
-     * @static
-     * @access   public
-     */
-    function &cat($args)
-    {
-        $ret = null;
-        $files = array();
-        if (!is_array($args)) {
-            $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY);
-        }
-
-        $count_args = count($args);
-        for ($i = 0; $i < $count_args; $i++) {
-            if ($args[$i] == '>') {
-                $mode = 'wb';
-                $outputfile = $args[$i+1];
-                break;
-            } elseif ($args[$i] == '>>') {
-                $mode = 'ab+';
-                $outputfile = $args[$i+1];
-                break;
-            } else {
-                $files[] = $args[$i];
-            }
-        }
-        $outputfd = false;
-        if (isset($mode)) {
-            if (!$outputfd = fopen($outputfile, $mode)) {
-                $err = System::raiseError("Could not open $outputfile");
-                return $err;
-            }
-            $ret = true;
-        }
-        foreach ($files as $file) {
-            if (!$fd = fopen($file, 'r')) {
-                System::raiseError("Could not open $file");
-                continue;
-            }
-            while ($cont = fread($fd, 2048)) {
-                if (is_resource($outputfd)) {
-                    fwrite($outputfd, $cont);
-                } else {
-                    $ret .= $cont;
-                }
-            }
-            fclose($fd);
-        }
-        if (is_resource($outputfd)) {
-            fclose($outputfd);
-        }
-        return $ret;
-    }
-
-    /**
-     * Creates temporary files or directories. This function will remove
-     * the created files when the scripts finish its execution.
-     *
-     * Usage:
-     *   1) $tempfile = System::mktemp("prefix");
-     *   2) $tempdir  = System::mktemp("-d prefix");
-     *   3) $tempfile = System::mktemp();
-     *   4) $tempfile = System::mktemp("-t /var/tmp prefix");
-     *
-     * prefix -> The string that will be prepended to the temp name
-     *           (defaults to "tmp").
-     * -d     -> A temporary dir will be created instead of a file.
-     * -t     -> The target dir where the temporary (file|dir) will be created. If
-     *           this param is missing by default the env vars TMP on Windows or
-     *           TMPDIR in Unix will be used. If these vars are also missing
-     *           c:\windows\temp or /tmp will be used.
-     *
-     * @param   string  $args  The arguments
-     * @return  mixed   the full path of the created (file|dir) or false
-     * @see System::tmpdir()
-     * @static
-     * @access  public
-     */
-    function mktemp($args = null)
-    {
-        static $first_time = true;
-        $opts = System::_parseArgs($args, 't:d');
-        if (PEAR::isError($opts)) {
-            return System::raiseError($opts);
-        }
-
-        foreach ($opts[0] as $opt) {
-            if ($opt[0] == 'd') {
-                $tmp_is_dir = true;
-            } elseif ($opt[0] == 't') {
-                $tmpdir = $opt[1];
-            }
-        }
-
-        $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
-        if (!isset($tmpdir)) {
-            $tmpdir = System::tmpdir();
-        }
-
-        if (!System::mkDir(array('-p', $tmpdir))) {
-            return false;
-        }
-
-        $tmp = tempnam($tmpdir, $prefix);
-        if (isset($tmp_is_dir)) {
-            unlink($tmp); // be careful possible race condition here
-            if (!mkdir($tmp, 0700)) {
-                return System::raiseError("Unable to create temporary directory $tmpdir");
-            }
-        }
-
-        $GLOBALS['_System_temp_files'][] = $tmp;
-        if (isset($tmp_is_dir)) {
-            //$GLOBALS['_System_temp_files'][] = dirname($tmp);
-        }
-
-        if ($first_time) {
-            PEAR::registerShutdownFunc(array('System', '_removeTmpFiles'));
-            $first_time = false;
-        }
-
-        return $tmp;
-    }
-
-    /**
-     * Remove temporary files created my mkTemp. This function is executed
-     * at script shutdown time
-     *
-     * @static
-     * @access private
-     */
-    function _removeTmpFiles()
-    {
-        if (count($GLOBALS['_System_temp_files'])) {
-            $delete = $GLOBALS['_System_temp_files'];
-            array_unshift($delete, '-r');
-            System::rm($delete);
-            $GLOBALS['_System_temp_files'] = array();
-        }
-    }
-
-    /**
-     * Get the path of the temporal directory set in the system
-     * by looking in its environments variables.
-     * Note: php.ini-recommended removes the "E" from the variables_order setting,
-     * making unavaible the $_ENV array, that s why we do tests with _ENV
-     *
-     * @static
-     * @return string The temporary directory on the system
-     */
-    function tmpdir()
-    {
-        if (OS_WINDOWS) {
-            if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
-                return $var;
-            }
-            if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
-                return $var;
-            }
-            if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
-                return $var;
-            }
-            if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
-                return $var;
-            }
-            return getenv('SystemRoot') . '\temp';
-        }
-        if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
-            return $var;
-        }
-        return realpath('/tmp');
-    }
-
-    /**
-     * The "which" command (show the full path of a command)
-     *
-     * @param string $program The command to search for
-     * @param mixed  $fallback Value to return if $program is not found
-     *
-     * @return mixed A string with the full path or false if not found
-     * @static
-     * @author Stig Bakken <ssb@php.net>
-     */
-    function which($program, $fallback = false)
-    {
-        // enforce API
-        if (!is_string($program) || '' == $program) {
-            return $fallback;
-        }
-
-        // full path given
-        if (basename($program) != $program) {
-            $path_elements[] = dirname($program);
-            $program = basename($program);
-        } else {
-            // Honor safe mode
-            if (!ini_get('safe_mode') || !$path = ini_get('safe_mode_exec_dir')) {
-                $path = getenv('PATH');
-                if (!$path) {
-                    $path = getenv('Path'); // some OSes are just stupid enough to do this
-                }
-            }
-            $path_elements = explode(PATH_SEPARATOR, $path);
-        }
-
-        if (OS_WINDOWS) {
-            $exe_suffixes = getenv('PATHEXT')
-                                ? explode(PATH_SEPARATOR, getenv('PATHEXT'))
-                                : array('.exe','.bat','.cmd','.com');
-            // allow passing a command.exe param
-            if (strpos($program, '.') !== false) {
-                array_unshift($exe_suffixes, '');
-            }
-            // is_executable() is not available on windows for PHP4
-            $pear_is_executable = (function_exists('is_executable')) ? 'is_executable' : 'is_file';
-        } else {
-            $exe_suffixes = array('');
-            $pear_is_executable = 'is_executable';
-        }
-
-        foreach ($exe_suffixes as $suff) {
-            foreach ($path_elements as $dir) {
-                $file = $dir . DIRECTORY_SEPARATOR . $program . $suff;
-                if (@$pear_is_executable($file)) {
-                    return $file;
-                }
-            }
-        }
-        return $fallback;
-    }
-
-    /**
-     * The "find" command
-     *
-     * Usage:
-     *
-     * System::find($dir);
-     * System::find("$dir -type d");
-     * System::find("$dir -type f");
-     * System::find("$dir -name *.php");
-     * System::find("$dir -name *.php -name *.htm*");
-     * System::find("$dir -maxdepth 1");
-     *
-     * Params implmented:
-     * $dir            -> Start the search at this directory
-     * -type d         -> return only directories
-     * -type f         -> return only files
-     * -maxdepth <n>   -> max depth of recursion
-     * -name <pattern> -> search pattern (bash style). Multiple -name param allowed
-     *
-     * @param  mixed Either array or string with the command line
-     * @return array Array of found files
-     * @static
-     *
-     */
-    function find($args)
-    {
-        if (!is_array($args)) {
-            $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY);
-        }
-        $dir = realpath(array_shift($args));
-        if (!$dir) {
-            return array();
-        }
-        $patterns = array();
-        $depth = 0;
-        $do_files = $do_dirs = true;
-        $args_count = count($args);
-        for ($i = 0; $i < $args_count; $i++) {
-            switch ($args[$i]) {
-                case '-type':
-                    if (in_array($args[$i+1], array('d', 'f'))) {
-                        if ($args[$i+1] == 'd') {
-                            $do_files = false;
-                        } else {
-                            $do_dirs = false;
-                        }
-                    }
-                    $i++;
-                    break;
-                case '-name':
-                    $name = preg_quote($args[$i+1], '#');
-                    // our magic characters ? and * have just been escaped,
-                    // so now we change the escaped versions to PCRE operators
-                    $name = strtr($name, array('\?' => '.', '\*' => '.*'));
-                    $patterns[] = '('.$name.')';
-                    $i++;
-                    break;
-                case '-maxdepth':
-                    $depth = $args[$i+1];
-                    break;
-            }
-        }
-        $path = System::_dirToStruct($dir, $depth, 0, true);
-        if ($do_files && $do_dirs) {
-            $files = array_merge($path['files'], $path['dirs']);
-        } elseif ($do_dirs) {
-            $files = $path['dirs'];
-        } else {
-            $files = $path['files'];
-        }
-        if (count($patterns)) {
-            $dsq = preg_quote(DIRECTORY_SEPARATOR, '#');
-            $pattern = '#(^|'.$dsq.')'.implode('|', $patterns).'($|'.$dsq.')#';
-            $ret = array();
-            $files_count = count($files);
-            for ($i = 0; $i < $files_count; $i++) {
-                // only search in the part of the file below the current directory
-                $filepart = basename($files[$i]);
-                if (preg_match($pattern, $filepart)) {
-                    $ret[] = $files[$i];
-                }
-            }
-            return $ret;
-        }
-        return $files;
-    }
-}
\ No newline at end of file
diff --git a/lib/php/XML/Util.php b/lib/php/XML/Util.php
deleted file mode 100644
index f5927b16cfd45bac188d11ac0a68a6fdaeeeac45..0000000000000000000000000000000000000000
--- a/lib/php/XML/Util.php
+++ /dev/null
@@ -1,911 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * XML_Util
- *
- * XML Utilities package
- * 
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2003-2008 Stephan Schmidt <schst@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer in the
- *      documentation and/or other materials provided with the distribution.
- *    * The name of the author may not be used to endorse or promote products
- *      derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category  XML
- * @package   XML_Util
- * @author    Stephan Schmidt <schst@php.net>
- * @copyright 2003-2008 Stephan Schmidt <schst@php.net>
- * @license   http://opensource.org/licenses/bsd-license New BSD License
- * @version   CVS: $Id: Util.php,v 1.38 2008/11/13 00:03:38 ashnazg Exp $
- * @link      http://pear.php.net/package/XML_Util
- */
-
-/**
- * error code for invalid chars in XML name
- */
-define('XML_UTIL_ERROR_INVALID_CHARS', 51);
-
-/**
- * error code for invalid chars in XML name
- */
-define('XML_UTIL_ERROR_INVALID_START', 52);
-
-/**
- * error code for non-scalar tag content
- */
-define('XML_UTIL_ERROR_NON_SCALAR_CONTENT', 60);
-
-/**
- * error code for missing tag name
- */
-define('XML_UTIL_ERROR_NO_TAG_NAME', 61);
-
-/**
- * replace XML entities
- */
-define('XML_UTIL_REPLACE_ENTITIES', 1);
-
-/**
- * embedd content in a CData Section
- */
-define('XML_UTIL_CDATA_SECTION', 5);
-
-/**
- * do not replace entitites
- */
-define('XML_UTIL_ENTITIES_NONE', 0);
-
-/**
- * replace all XML entitites
- * This setting will replace <, >, ", ' and &
- */
-define('XML_UTIL_ENTITIES_XML', 1);
-
-/**
- * replace only required XML entitites
- * This setting will replace <, " and &
- */
-define('XML_UTIL_ENTITIES_XML_REQUIRED', 2);
-
-/**
- * replace HTML entitites
- * @link http://www.php.net/htmlentities
- */
-define('XML_UTIL_ENTITIES_HTML', 3);
-
-/**
- * Collapse all empty tags.
- */
-define('XML_UTIL_COLLAPSE_ALL', 1);
-
-/**
- * Collapse only empty XHTML tags that have no end tag.
- */
-define('XML_UTIL_COLLAPSE_XHTML_ONLY', 2);
-
-/**
- * utility class for working with XML documents
- *
-
- * @category  XML
- * @package   XML_Util
- * @author    Stephan Schmidt <schst@php.net>
- * @copyright 2003-2008 Stephan Schmidt <schst@php.net>
- * @license   http://opensource.org/licenses/bsd-license New BSD License
- * @version   Release: 1.2.1
- * @link      http://pear.php.net/package/XML_Util
- */
-class XML_Util
-{
-    /**
-     * return API version
-     *
-     * @return string $version API version
-     * @access public
-     * @static
-     */
-    function apiVersion()
-    {
-        return '1.1';
-    }
-
-    /**
-     * replace XML entities
-     *
-     * With the optional second parameter, you may select, which
-     * entities should be replaced.
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // replace XML entites:
-     * $string = XML_Util::replaceEntities('This string contains < & >.');
-     * </code>
-     *
-     * With the optional third parameter, you may pass the character encoding
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // replace XML entites in UTF-8:
-     * $string = XML_Util::replaceEntities(
-     *     'This string contains < & > as well as ä, ö, ß, à and ê',
-     *     XML_UTIL_ENTITIES_HTML,
-     *     'UTF-8'
-     * );
-     * </code>
-     *
-     * @param string $string          string where XML special chars 
-     *                                should be replaced
-     * @param int    $replaceEntities setting for entities in attribute values 
-     *                                (one of XML_UTIL_ENTITIES_XML, 
-     *                                XML_UTIL_ENTITIES_XML_REQUIRED, 
-     *                                XML_UTIL_ENTITIES_HTML)
-     * @param string $encoding        encoding value (if any)...
-     *                                must be a valid encoding as determined
-     *                                by the htmlentities() function
-     *
-     * @return string string with replaced chars
-     * @access public
-     * @static
-     * @see reverseEntities()
-     */
-    function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML,
-        $encoding = 'ISO-8859-1')
-    {
-        switch ($replaceEntities) {
-        case XML_UTIL_ENTITIES_XML:
-            return strtr($string, array(
-                '&'  => '&amp;',
-                '>'  => '&gt;',
-                '<'  => '&lt;',
-                '"'  => '&quot;',
-                '\'' => '&apos;' ));
-            break;
-        case XML_UTIL_ENTITIES_XML_REQUIRED:
-            return strtr($string, array(
-                '&' => '&amp;',
-                '<' => '&lt;',
-                '"' => '&quot;' ));
-            break;
-        case XML_UTIL_ENTITIES_HTML:
-            return htmlentities($string, ENT_COMPAT, $encoding);
-            break;
-        }
-        return $string;
-    }
-
-    /**
-     * reverse XML entities
-     *
-     * With the optional second parameter, you may select, which
-     * entities should be reversed.
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // reverse XML entites:
-     * $string = XML_Util::reverseEntities('This string contains &lt; &amp; &gt;.');
-     * </code>
-     *
-     * With the optional third parameter, you may pass the character encoding
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // reverse XML entites in UTF-8:
-     * $string = XML_Util::reverseEntities(
-     *     'This string contains &lt; &amp; &gt; as well as'
-     *     . ' &auml;, &ouml;, &szlig;, &agrave; and &ecirc;',
-     *     XML_UTIL_ENTITIES_HTML,
-     *     'UTF-8'
-     * );
-     * </code>
-     *
-     * @param string $string          string where XML special chars 
-     *                                should be replaced
-     * @param int    $replaceEntities setting for entities in attribute values 
-     *                                (one of XML_UTIL_ENTITIES_XML, 
-     *                                XML_UTIL_ENTITIES_XML_REQUIRED, 
-     *                                XML_UTIL_ENTITIES_HTML)
-     * @param string $encoding        encoding value (if any)...
-     *                                must be a valid encoding as determined
-     *                                by the html_entity_decode() function
-     *
-     * @return string string with replaced chars
-     * @access public
-     * @static
-     * @see replaceEntities()
-     */
-    function reverseEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML,
-        $encoding = 'ISO-8859-1')
-    {
-        switch ($replaceEntities) {
-        case XML_UTIL_ENTITIES_XML:
-            return strtr($string, array(
-                '&amp;'  => '&',
-                '&gt;'   => '>',
-                '&lt;'   => '<',
-                '&quot;' => '"',
-                '&apos;' => '\'' ));
-            break;
-        case XML_UTIL_ENTITIES_XML_REQUIRED:
-            return strtr($string, array(
-                '&amp;'  => '&',
-                '&lt;'   => '<',
-                '&quot;' => '"' ));
-            break;
-        case XML_UTIL_ENTITIES_HTML:
-            return html_entity_decode($string, ENT_COMPAT, $encoding);
-            break;
-        }
-        return $string;
-    }
-
-    /**
-     * build an xml declaration
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // get an XML declaration:
-     * $xmlDecl = XML_Util::getXMLDeclaration('1.0', 'UTF-8', true);
-     * </code>
-     *
-     * @param string $version    xml version
-     * @param string $encoding   character encoding
-     * @param bool   $standalone document is standalone (or not)
-     *
-     * @return string xml declaration
-     * @access public
-     * @static
-     * @uses attributesToString() to serialize the attributes of the XML declaration
-     */
-    function getXMLDeclaration($version = '1.0', $encoding = null, 
-        $standalone = null)
-    {
-        $attributes = array(
-            'version' => $version,
-        );
-        // add encoding
-        if ($encoding !== null) {
-            $attributes['encoding'] = $encoding;
-        }
-        // add standalone, if specified
-        if ($standalone !== null) {
-            $attributes['standalone'] = $standalone ? 'yes' : 'no';
-        }
-
-        return sprintf('<?xml%s?>', 
-            XML_Util::attributesToString($attributes, false));
-    }
-
-    /**
-     * build a document type declaration
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // get a doctype declaration:
-     * $xmlDecl = XML_Util::getDocTypeDeclaration('rootTag','myDocType.dtd');
-     * </code>
-     *
-     * @param string $root        name of the root tag
-     * @param string $uri         uri of the doctype definition 
-     *                            (or array with uri and public id)
-     * @param string $internalDtd internal dtd entries
-     *
-     * @return string doctype declaration
-     * @access public
-     * @static
-     * @since 0.2
-     */
-    function getDocTypeDeclaration($root, $uri = null, $internalDtd = null)
-    {
-        if (is_array($uri)) {
-            $ref = sprintf(' PUBLIC "%s" "%s"', $uri['id'], $uri['uri']);
-        } elseif (!empty($uri)) {
-            $ref = sprintf(' SYSTEM "%s"', $uri);
-        } else {
-            $ref = '';
-        }
-
-        if (empty($internalDtd)) {
-            return sprintf('<!DOCTYPE %s%s>', $root, $ref);
-        } else {
-            return sprintf("<!DOCTYPE %s%s [\n%s\n]>", $root, $ref, $internalDtd);
-        }
-    }
-
-    /**
-     * create string representation of an attribute list
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // build an attribute string
-     * $att = array(
-     *              'foo'   =>  'bar',
-     *              'argh'  =>  'tomato'
-     *            );
-     *
-     * $attList = XML_Util::attributesToString($att);
-     * </code>
-     *
-     * @param array      $attributes attribute array
-     * @param bool|array $sort       sort attribute list alphabetically, 
-     *                               may also be an assoc array containing 
-     *                               the keys 'sort', 'multiline', 'indent', 
-     *                               'linebreak' and 'entities'
-     * @param bool       $multiline  use linebreaks, if more than 
-     *                               one attribute is given
-     * @param string     $indent     string used for indentation of 
-     *                               multiline attributes
-     * @param string     $linebreak  string used for linebreaks of 
-     *                               multiline attributes
-     * @param int        $entities   setting for entities in attribute values 
-     *                               (one of XML_UTIL_ENTITIES_NONE, 
-     *                               XML_UTIL_ENTITIES_XML, 
-     *                               XML_UTIL_ENTITIES_XML_REQUIRED, 
-     *                               XML_UTIL_ENTITIES_HTML)
-     *
-     * @return string string representation of the attributes
-     * @access public
-     * @static
-     * @uses replaceEntities() to replace XML entities in attribute values
-     * @todo allow sort also to be an options array
-     */
-    function attributesToString($attributes, $sort = true, $multiline = false, 
-        $indent = '    ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML)
-    {
-        /*
-         * second parameter may be an array
-         */
-        if (is_array($sort)) {
-            if (isset($sort['multiline'])) {
-                $multiline = $sort['multiline'];
-            }
-            if (isset($sort['indent'])) {
-                $indent = $sort['indent'];
-            }
-            if (isset($sort['linebreak'])) {
-                $multiline = $sort['linebreak'];
-            }
-            if (isset($sort['entities'])) {
-                $entities = $sort['entities'];
-            }
-            if (isset($sort['sort'])) {
-                $sort = $sort['sort'];
-            } else {
-                $sort = true;
-            }
-        }
-        $string = '';
-        if (is_array($attributes) && !empty($attributes)) {
-            if ($sort) {
-                ksort($attributes);
-            }
-            if ( !$multiline || count($attributes) == 1) {
-                foreach ($attributes as $key => $value) {
-                    if ($entities != XML_UTIL_ENTITIES_NONE) {
-                        if ($entities === XML_UTIL_CDATA_SECTION) {
-                            $entities = XML_UTIL_ENTITIES_XML;
-                        }
-                        $value = XML_Util::replaceEntities($value, $entities);
-                    }
-                    $string .= ' ' . $key . '="' . $value . '"';
-                }
-            } else {
-                $first = true;
-                foreach ($attributes as $key => $value) {
-                    if ($entities != XML_UTIL_ENTITIES_NONE) {
-                        $value = XML_Util::replaceEntities($value, $entities);
-                    }
-                    if ($first) {
-                        $string .= ' ' . $key . '="' . $value . '"';
-                        $first   = false;
-                    } else {
-                        $string .= $linebreak . $indent . $key . '="' . $value . '"';
-                    }
-                }
-            }
-        }
-        return $string;
-    }
-
-    /**
-     * Collapses empty tags.
-     *
-     * @param string $xml  XML
-     * @param int    $mode Whether to collapse all empty tags (XML_UTIL_COLLAPSE_ALL)
-     *                      or only XHTML (XML_UTIL_COLLAPSE_XHTML_ONLY) ones.
-     *
-     * @return string XML
-     * @access public
-     * @static
-     * @todo PEAR CS - unable to avoid "space after open parens" error
-     *       in the IF branch
-     */
-    function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL) 
-    {
-        if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) {
-            return preg_replace(
-                '/<(area|base(?:font)?|br|col|frame|hr|img|input|isindex|link|meta|'
-                . 'param)([^>]*)><\/\\1>/s',
-                '<\\1\\2 />',
-                $xml);
-        } else {
-            return preg_replace('/<(\w+)([^>]*)><\/\\1>/s', '<\\1\\2 />', $xml);
-        }
-    }
-
-    /**
-     * create a tag
-     *
-     * This method will call XML_Util::createTagFromArray(), which
-     * is more flexible.
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // create an XML tag:
-     * $tag = XML_Util::createTag('myNs:myTag', 
-     *     array('foo' => 'bar'), 
-     *     'This is inside the tag', 
-     *     'http://www.w3c.org/myNs#');
-     * </code>
-     *
-     * @param string $qname           qualified tagname (including namespace)
-     * @param array  $attributes      array containg attributes
-     * @param mixed  $content         the content
-     * @param string $namespaceUri    URI of the namespace
-     * @param int    $replaceEntities whether to replace XML special chars in 
-     *                                content, embedd it in a CData section 
-     *                                or none of both
-     * @param bool   $multiline       whether to create a multiline tag where 
-     *                                each attribute gets written to a single line
-     * @param string $indent          string used to indent attributes 
-     *                                (_auto indents attributes so they start 
-     *                                at the same column)
-     * @param string $linebreak       string used for linebreaks
-     * @param bool   $sortAttributes  Whether to sort the attributes or not
-     *
-     * @return string XML tag
-     * @access public
-     * @static
-     * @see createTagFromArray()
-     * @uses createTagFromArray() to create the tag
-     */
-    function createTag($qname, $attributes = array(), $content = null, 
-        $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, 
-        $multiline = false, $indent = '_auto', $linebreak = "\n", 
-        $sortAttributes = true)
-    {
-        $tag = array(
-            'qname'      => $qname,
-            'attributes' => $attributes
-        );
-
-        // add tag content
-        if ($content !== null) {
-            $tag['content'] = $content;
-        }
-
-        // add namespace Uri
-        if ($namespaceUri !== null) {
-            $tag['namespaceUri'] = $namespaceUri;
-        }
-
-        return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, 
-            $indent, $linebreak, $sortAttributes);
-    }
-
-    /**
-     * create a tag from an array
-     * this method awaits an array in the following format
-     * <pre>
-     * array(
-     *     // qualified name of the tag
-     *     'qname' => $qname        
-     *
-     *     // namespace prefix (optional, if qname is specified or no namespace)
-     *     'namespace' => $namespace    
-     *
-     *     // local part of the tagname (optional, if qname is specified)
-     *     'localpart' => $localpart,   
-     *
-     *     // array containing all attributes (optional)
-     *     'attributes' => array(),      
-     *
-     *     // tag content (optional)
-     *     'content' => $content,     
-     *
-     *     // namespaceUri for the given namespace (optional)
-     *     'namespaceUri' => $namespaceUri 
-     * )
-     * </pre>
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * $tag = array(
-     *     'qname'        => 'foo:bar',
-     *     'namespaceUri' => 'http://foo.com',
-     *     'attributes'   => array('key' => 'value', 'argh' => 'fruit&vegetable'),
-     *     'content'      => 'I\'m inside the tag',
-     * );
-     * // creating a tag with qualified name and namespaceUri
-     * $string = XML_Util::createTagFromArray($tag);
-     * </code>
-     *
-     * @param array  $tag             tag definition
-     * @param int    $replaceEntities whether to replace XML special chars in 
-     *                                content, embedd it in a CData section 
-     *                                or none of both
-     * @param bool   $multiline       whether to create a multiline tag where each 
-     *                                attribute gets written to a single line
-     * @param string $indent          string used to indent attributes 
-     *                                (_auto indents attributes so they start 
-     *                                at the same column)
-     * @param string $linebreak       string used for linebreaks
-     * @param bool   $sortAttributes  Whether to sort the attributes or not
-     *
-     * @return string XML tag
-     * @access public
-     * @static
-     * @see createTag()
-     * @uses attributesToString() to serialize the attributes of the tag
-     * @uses splitQualifiedName() to get local part and namespace of a qualified name
-     * @uses createCDataSection()
-     * @uses raiseError()
-     */
-    function createTagFromArray($tag, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
-        $multiline = false, $indent = '_auto', $linebreak = "\n", 
-        $sortAttributes = true)
-    {
-        if (isset($tag['content']) && !is_scalar($tag['content'])) {
-            return XML_Util::raiseError('Supplied non-scalar value as tag content',
-            XML_UTIL_ERROR_NON_SCALAR_CONTENT);
-        }
-
-        if (!isset($tag['qname']) && !isset($tag['localPart'])) {
-            return XML_Util::raiseError('You must either supply a qualified name '
-                . '(qname) or local tag name (localPart).', 
-                XML_UTIL_ERROR_NO_TAG_NAME);
-        }
-
-        // if no attributes hav been set, use empty attributes
-        if (!isset($tag['attributes']) || !is_array($tag['attributes'])) {
-            $tag['attributes'] = array();
-        }
-
-        if (isset($tag['namespaces'])) {
-            foreach ($tag['namespaces'] as $ns => $uri) {
-                $tag['attributes']['xmlns:' . $ns] = $uri;
-            }
-        }
-
-        if (!isset($tag['qname'])) {
-            // qualified name is not given
-
-            // check for namespace
-            if (isset($tag['namespace']) && !empty($tag['namespace'])) {
-                $tag['qname'] = $tag['namespace'] . ':' . $tag['localPart'];
-            } else {
-                $tag['qname'] = $tag['localPart'];
-            }
-        } elseif (isset($tag['namespaceUri']) && !isset($tag['namespace'])) {
-            // namespace URI is set, but no namespace
-
-            $parts = XML_Util::splitQualifiedName($tag['qname']);
-
-            $tag['localPart'] = $parts['localPart'];
-            if (isset($parts['namespace'])) {
-                $tag['namespace'] = $parts['namespace'];
-            }
-        }
-
-        if (isset($tag['namespaceUri']) && !empty($tag['namespaceUri'])) {
-            // is a namespace given
-            if (isset($tag['namespace']) && !empty($tag['namespace'])) {
-                $tag['attributes']['xmlns:' . $tag['namespace']] =
-                    $tag['namespaceUri'];
-            } else {
-                // define this Uri as the default namespace
-                $tag['attributes']['xmlns'] = $tag['namespaceUri'];
-            }
-        }
-
-        // check for multiline attributes
-        if ($multiline === true) {
-            if ($indent === '_auto') {
-                $indent = str_repeat(' ', (strlen($tag['qname'])+2));
-            }
-        }
-
-        // create attribute list
-        $attList = XML_Util::attributesToString($tag['attributes'], 
-            $sortAttributes, $multiline, $indent, $linebreak, $replaceEntities);
-        if (!isset($tag['content']) || (string)$tag['content'] == '') {
-            $tag = sprintf('<%s%s />', $tag['qname'], $attList);
-        } else {
-            switch ($replaceEntities) {
-            case XML_UTIL_ENTITIES_NONE:
-                break;
-            case XML_UTIL_CDATA_SECTION:
-                $tag['content'] = XML_Util::createCDataSection($tag['content']);
-                break;
-            default:
-                $tag['content'] = XML_Util::replaceEntities($tag['content'], 
-                    $replaceEntities);
-                break;
-            }
-            $tag = sprintf('<%s%s>%s</%s>', $tag['qname'], $attList, $tag['content'],
-                $tag['qname']);
-        }
-        return $tag;
-    }
-
-    /**
-     * create a start element
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // create an XML start element:
-     * $tag = XML_Util::createStartElement('myNs:myTag', 
-     *     array('foo' => 'bar') ,'http://www.w3c.org/myNs#');
-     * </code>
-     *
-     * @param string $qname          qualified tagname (including namespace)
-     * @param array  $attributes     array containg attributes
-     * @param string $namespaceUri   URI of the namespace
-     * @param bool   $multiline      whether to create a multiline tag where each 
-     *                               attribute gets written to a single line
-     * @param string $indent         string used to indent attributes (_auto indents
-     *                               attributes so they start at the same column)
-     * @param string $linebreak      string used for linebreaks
-     * @param bool   $sortAttributes Whether to sort the attributes or not
-     *
-     * @return string XML start element
-     * @access public
-     * @static
-     * @see createEndElement(), createTag()
-     */
-    function createStartElement($qname, $attributes = array(), $namespaceUri = null,
-        $multiline = false, $indent = '_auto', $linebreak = "\n", 
-        $sortAttributes = true)
-    {
-        // if no attributes hav been set, use empty attributes
-        if (!isset($attributes) || !is_array($attributes)) {
-            $attributes = array();
-        }
-
-        if ($namespaceUri != null) {
-            $parts = XML_Util::splitQualifiedName($qname);
-        }
-
-        // check for multiline attributes
-        if ($multiline === true) {
-            if ($indent === '_auto') {
-                $indent = str_repeat(' ', (strlen($qname)+2));
-            }
-        }
-
-        if ($namespaceUri != null) {
-            // is a namespace given
-            if (isset($parts['namespace']) && !empty($parts['namespace'])) {
-                $attributes['xmlns:' . $parts['namespace']] = $namespaceUri;
-            } else {
-                // define this Uri as the default namespace
-                $attributes['xmlns'] = $namespaceUri;
-            }
-        }
-
-        // create attribute list
-        $attList = XML_Util::attributesToString($attributes, $sortAttributes, 
-            $multiline, $indent, $linebreak);
-        $element = sprintf('<%s%s>', $qname, $attList);
-        return  $element;
-    }
-
-    /**
-     * create an end element
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // create an XML start element:
-     * $tag = XML_Util::createEndElement('myNs:myTag');
-     * </code>
-     *
-     * @param string $qname qualified tagname (including namespace)
-     *
-     * @return string XML end element
-     * @access public
-     * @static
-     * @see createStartElement(), createTag()
-     */
-    function createEndElement($qname)
-    {
-        $element = sprintf('</%s>', $qname);
-        return $element;
-    }
-
-    /**
-     * create an XML comment
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // create an XML start element:
-     * $tag = XML_Util::createComment('I am a comment');
-     * </code>
-     *
-     * @param string $content content of the comment
-     *
-     * @return string XML comment
-     * @access public
-     * @static
-     */
-    function createComment($content)
-    {
-        $comment = sprintf('<!-- %s -->', $content);
-        return $comment;
-    }
-
-    /**
-     * create a CData section
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // create a CData section
-     * $tag = XML_Util::createCDataSection('I am content.');
-     * </code>
-     *
-     * @param string $data data of the CData section
-     *
-     * @return string CData section with content
-     * @access public
-     * @static
-     */
-    function createCDataSection($data)
-    {
-        return sprintf('<![CDATA[%s]]>', 
-            preg_replace('/\]\]>/', ']]]]><![CDATA[>', strval($data)));
-
-    }
-
-    /**
-     * split qualified name and return namespace and local part
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // split qualified tag
-     * $parts = XML_Util::splitQualifiedName('xslt:stylesheet');
-     * </code>
-     * the returned array will contain two elements:
-     * <pre>
-     * array(
-     *     'namespace' => 'xslt',
-     *     'localPart' => 'stylesheet'
-     * );
-     * </pre>
-     *
-     * @param string $qname     qualified tag name
-     * @param string $defaultNs default namespace (optional)
-     *
-     * @return array array containing namespace and local part
-     * @access public
-     * @static
-     */
-    function splitQualifiedName($qname, $defaultNs = null)
-    {
-        if (strstr($qname, ':')) {
-            $tmp = explode(':', $qname);
-            return array(
-                'namespace' => $tmp[0],
-                'localPart' => $tmp[1]
-            );
-        }
-        return array(
-            'namespace' => $defaultNs,
-            'localPart' => $qname
-        );
-    }
-
-    /**
-     * check, whether string is valid XML name
-     *
-     * <p>XML names are used for tagname, attribute names and various
-     * other, lesser known entities.</p>
-     * <p>An XML name may only consist of alphanumeric characters,
-     * dashes, undescores and periods, and has to start with a letter
-     * or an underscore.</p>
-     *
-     * <code>
-     * require_once 'XML/Util.php';
-     *
-     * // verify tag name
-     * $result = XML_Util::isValidName('invalidTag?');
-     * if (is_a($result, 'PEAR_Error')) {
-     *    print 'Invalid XML name: ' . $result->getMessage();
-     * }
-     * </code>
-     *
-     * @param string $string string that should be checked
-     *
-     * @return mixed true, if string is a valid XML name, PEAR error otherwise
-     * @access public
-     * @static
-     * @todo support for other charsets
-     * @todo PEAR CS - unable to avoid 85-char limit on second preg_match
-     */
-    function isValidName($string)
-    {
-        // check for invalid chars
-        if (!preg_match('/^[[:alpha:]_]$/', $string{0})) {
-            return XML_Util::raiseError('XML names may only start with letter '
-                . 'or underscore', XML_UTIL_ERROR_INVALID_START);
-        }
-
-        // check for invalid chars
-        if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?$/',
-            $string)
-        ) {
-            return XML_Util::raiseError('XML names may only contain alphanumeric '
-                . 'chars, period, hyphen, colon and underscores', 
-                XML_UTIL_ERROR_INVALID_CHARS);
-        }
-        // XML name is valid
-        return true;
-    }
-
-    /**
-     * replacement for XML_Util::raiseError
-     *
-     * Avoids the necessity to always require
-     * PEAR.php
-     *
-     * @param string $msg  error message
-     * @param int    $code error code
-     *
-     * @return PEAR_Error
-     * @access public
-     * @static
-     * @todo PEAR CS - should this use include_once instead?
-     */
-    function raiseError($msg, $code)
-    {
-        require_once 'PEAR.php';
-        return PEAR::raiseError($msg, $code);
-    }
-}
-?>
diff --git a/lib/php/pearcmd.php b/lib/php/pearcmd.php
deleted file mode 100644
index 6a98507edc8c749886d882d24ab6670af4064835..0000000000000000000000000000000000000000
--- a/lib/php/pearcmd.php
+++ /dev/null
@@ -1,445 +0,0 @@
-<?php
-/**
- * PEAR, the PHP Extension and Application Repository
- *
- * Command line interface
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: pearcmd.php 286487 2009-07-29 05:57:28Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- */
-
-ob_end_clean();
-if (!defined('PEAR_RUNTYPE')) {
-    // this is defined in peclcmd.php as 'pecl'
-    define('PEAR_RUNTYPE', 'pear');
-}
-define('PEAR_IGNORE_BACKTRACE', 1);
-/**
- * @nodep Gtk
- */
-if ('/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php' != '@'.'include_path'.'@') {
-    ini_set('include_path', '/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php');
-    $raw = false;
-} else {
-    // this is a raw, uninstalled pear, either a cvs checkout, or php distro
-    $raw = true;
-}
-@ini_set('allow_url_fopen', true);
-if (!ini_get('safe_mode')) {
-    @set_time_limit(0);
-}
-ob_implicit_flush(true);
-@ini_set('track_errors', true);
-@ini_set('html_errors', false);
-@ini_set('magic_quotes_runtime', false);
-$_PEAR_PHPDIR = '#$%^&*';
-set_error_handler('error_handler');
-
-$pear_package_version = "1.9.0";
-
-require_once 'PEAR.php';
-require_once 'PEAR/Frontend.php';
-require_once 'PEAR/Config.php';
-require_once 'PEAR/Command.php';
-require_once 'Console/Getopt.php';
-
-
-PEAR_Command::setFrontendType('CLI');
-$all_commands = PEAR_Command::getCommands();
-
-// remove this next part when we stop supporting that crap-ass PHP 4.2
-if (!isset($_SERVER['argv']) && !isset($argv) && !isset($HTTP_SERVER_VARS['argv'])) {
-    echo 'ERROR: either use the CLI php executable, or set register_argc_argv=On in php.ini';
-    exit(1);
-}
-
-$argv = Console_Getopt::readPHPArgv();
-// fix CGI sapi oddity - the -- in pear.bat/pear is not removed
-if (php_sapi_name() != 'cli' && isset($argv[1]) && $argv[1] == '--') {
-    unset($argv[1]);
-    $argv = array_values($argv);
-}
-$progname = PEAR_RUNTYPE;
-array_shift($argv);
-$options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV");
-if (PEAR::isError($options)) {
-    usage($options);
-}
-
-$opts = $options[0];
-
-$fetype = 'CLI';
-if ($progname == 'gpear' || $progname == 'pear-gtk') {
-    $fetype = 'Gtk';
-} else {
-    foreach ($opts as $opt) {
-        if ($opt[0] == 'G') {
-            $fetype = 'Gtk';
-        }
-    }
-}
-//Check if Gtk and PHP >= 5.1.0
-if ($fetype == 'Gtk' && version_compare(phpversion(), '5.1.0', '>=')) {
-    $fetype = 'Gtk2';
-}
-
-$pear_user_config = '';
-$pear_system_config = '';
-$store_user_config = false;
-$store_system_config = false;
-$verbose = 1;
-
-foreach ($opts as $opt) {
-    switch ($opt[0]) {
-        case 'c':
-            $pear_user_config = $opt[1];
-            break;
-        case 'C':
-            $pear_system_config = $opt[1];
-            break;
-    }
-}
-
-PEAR_Command::setFrontendType($fetype);
-$ui = &PEAR_Command::getFrontendObject();
-$config = &PEAR_Config::singleton($pear_user_config, $pear_system_config);
-
-if (PEAR::isError($config)) {
-    $_file = '';
-    if ($pear_user_config !== false) {
-       $_file .= $pear_user_config;
-    }
-    if ($pear_system_config !== false) {
-       $_file .= '/' . $pear_system_config;
-    }
-    if ($_file == '/') {
-        $_file = 'The default config file';
-    }
-    $config->getMessage();
-    $ui->outputData("ERROR: $_file is not a valid config file or is corrupted.");
-    // We stop, we have no idea where we are :)
-    exit(1);
-}
-
-// this is used in the error handler to retrieve a relative path
-$_PEAR_PHPDIR = $config->get('php_dir');
-$ui->setConfig($config);
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
-if (ini_get('safe_mode')) {
-    $ui->outputData('WARNING: running in safe mode requires that all files created ' .
-        'be the same uid as the current script.  PHP reports this script is uid: ' .
-        @getmyuid() . ', and current user is: ' . @get_current_user());
-}
-
-$verbose = $config->get("verbose");
-$cmdopts = array();
-
-if ($raw) {
-    if (!$config->isDefinedLayer('user') && !$config->isDefinedLayer('system')) {
-        $found = false;
-        foreach ($opts as $opt) {
-            if ($opt[0] == 'd' || $opt[0] == 'D') {
-                $found = true; // the user knows what they are doing, and are setting config values
-            }
-        }
-        if (!$found) {
-            // no prior runs, try to install PEAR
-            if (strpos(dirname(__FILE__), 'scripts')) {
-                $packagexml = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'package2.xml';
-                $pearbase = dirname(dirname(__FILE__));
-            } else {
-                $packagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package2.xml';
-                $pearbase = dirname(__FILE__);
-            }
-            if (file_exists($packagexml)) {
-                $options[1] = array(
-                    'install',
-                    $packagexml
-                );
-                $config->set('php_dir', $pearbase . DIRECTORY_SEPARATOR . 'php');
-                $config->set('data_dir', $pearbase . DIRECTORY_SEPARATOR . 'data');
-                $config->set('doc_dir', $pearbase . DIRECTORY_SEPARATOR . 'docs');
-                $config->set('test_dir', $pearbase . DIRECTORY_SEPARATOR . 'tests');
-                $config->set('ext_dir', $pearbase . DIRECTORY_SEPARATOR . 'extensions');
-                $config->set('bin_dir', $pearbase);
-                $config->mergeConfigFile($pearbase . 'pear.ini', false);
-                $config->store();
-                $config->set('auto_discover', 1);
-            }
-        }
-    }
-}
-foreach ($opts as $opt) {
-    $param = !empty($opt[1]) ? $opt[1] : true;
-    switch ($opt[0]) {
-        case 'd':
-            if ($param === true) {
-                die('Invalid usage of "-d" option, expected -d config_value=value, ' .
-                    'received "-d"' . "\n");
-            }
-            $possible = explode('=', $param);
-            if (count($possible) != 2) {
-                die('Invalid usage of "-d" option, expected -d config_value=value, received "' .
-                    $param . '"' . "\n");
-            }
-            list($key, $value) = explode('=', $param);
-            $config->set($key, $value, 'user');
-            break;
-        case 'D':
-            if ($param === true) {
-                die('Invalid usage of "-d" option, expected -d config_value=value, ' .
-                    'received "-d"' . "\n");
-            }
-            $possible = explode('=', $param);
-            if (count($possible) != 2) {
-                die('Invalid usage of "-d" option, expected -d config_value=value, received "' .
-                    $param . '"' . "\n");
-            }
-            list($key, $value) = explode('=', $param);
-            $config->set($key, $value, 'system');
-            break;
-        case 's':
-            $store_user_config = true;
-            break;
-        case 'S':
-            $store_system_config = true;
-            break;
-        case 'u':
-            $config->remove($param, 'user');
-            break;
-        case 'v':
-            $config->set('verbose', $config->get('verbose') + 1);
-            break;
-        case 'q':
-            $config->set('verbose', $config->get('verbose') - 1);
-            break;
-        case 'V':
-            usage(null, 'version');
-        case 'c':
-        case 'C':
-            break;
-        default:
-            // all non pear params goes to the command
-            $cmdopts[$opt[0]] = $param;
-            break;
-    }
-}
-
-if ($store_system_config) {
-    $config->store('system');
-}
-
-if ($store_user_config) {
-    $config->store('user');
-}
-
-$command = (isset($options[1][0])) ? $options[1][0] : null;
-if (empty($command) && ($store_user_config || $store_system_config)) {
-    exit;
-}
-
-if ($fetype == 'Gtk' || $fetype == 'Gtk2') {
-    if (!$config->validConfiguration()) {
-        PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' .
-            "'$pear_user_config' or '$pear_system_config', please copy an existing configuration" .
-            'file to one of these locations, or use the -c and -s options to create one');
-    }
-    Gtk::main();
-} else do {
-    if ($command == 'help') {
-        usage(null, @$options[1][1]);
-    }
-
-    if (!$config->validConfiguration()) {
-        PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' .
-            "'$pear_user_config' or '$pear_system_config', please copy an existing configuration" .
-            'file to one of these locations, or use the -c and -s options to create one');
-    }
-
-    PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-    $cmd = PEAR_Command::factory($command, $config);
-    PEAR::popErrorHandling();
-    if (PEAR::isError($cmd)) {
-        usage(null, @$options[1][0]);
-    }
-
-    $short_args = $long_args = null;
-    PEAR_Command::getGetoptArgs($command, $short_args, $long_args);
-    array_shift($options[1]);
-    $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args);
-
-    if (PEAR::isError($tmp)) {
-        break;
-    }
-
-    list($tmpopt, $params) = $tmp;
-    $opts = array();
-    foreach ($tmpopt as $foo => $tmp2) {
-        list($opt, $value) = $tmp2;
-        if ($value === null) {
-            $value = true; // options without args
-        }
-
-        if (strlen($opt) == 1) {
-            $cmdoptions = $cmd->getOptions($command);
-            foreach ($cmdoptions as $o => $d) {
-                if (isset($d['shortopt']) && $d['shortopt'] == $opt) {
-                    $opts[$o] = $value;
-                }
-            }
-        } else {
-            if (substr($opt, 0, 2) == '--') {
-                $opts[substr($opt, 2)] = $value;
-            }
-        }
-    }
-
-    $ok = $cmd->run($command, $opts, $params);
-    if ($ok === false) {
-        PEAR::raiseError("unknown command `$command'");
-    }
-
-    if (PEAR::isError($ok)) {
-        PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
-        PEAR::raiseError($ok);
-    }
-} while (false);
-
-// {{{ usage()
-
-function usage($error = null, $helpsubject = null)
-{
-    global $progname, $all_commands;
-    $stderr = fopen('php://stderr', 'w');
-    if (PEAR::isError($error)) {
-        fputs($stderr, $error->getMessage() . "\n");
-    } elseif ($error !== null) {
-        fputs($stderr, "$error\n");
-    }
-
-    if ($helpsubject != null) {
-        $put = cmdHelp($helpsubject);
-    } else {
-        $put =
-            "Commands:\n";
-        $maxlen = max(array_map("strlen", $all_commands));
-        $formatstr = "%-{$maxlen}s  %s\n";
-        ksort($all_commands);
-        foreach ($all_commands as $cmd => $class) {
-            $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd));
-        }
-        $put .=
-            "Usage: $progname [options] command [command-options] <parameters>\n".
-            "Type \"$progname help options\" to list all options.\n".
-            "Type \"$progname help shortcuts\" to list all command shortcuts.\n".
-            "Type \"$progname help <command>\" to get the help for the specified command.";
-    }
-    fputs($stderr, "$put\n");
-    fclose($stderr);
-    exit(1);
-}
-
-function cmdHelp($command)
-{
-    global $progname, $all_commands, $config;
-    if ($command == "options") {
-        return
-        "Options:\n".
-        "     -v         increase verbosity level (default 1)\n".
-        "     -q         be quiet, decrease verbosity level\n".
-        "     -c file    find user configuration in `file'\n".
-        "     -C file    find system configuration in `file'\n".
-        "     -d foo=bar set user config variable `foo' to `bar'\n".
-        "     -D foo=bar set system config variable `foo' to `bar'\n".
-        "     -G         start in graphical (Gtk) mode\n".
-        "     -s         store user configuration\n".
-        "     -S         store system configuration\n".
-        "     -u foo     unset `foo' in the user configuration\n".
-        "     -h, -?     display help/usage (this message)\n".
-        "     -V         version information\n";
-    } elseif ($command == "shortcuts") {
-        $sc = PEAR_Command::getShortcuts();
-        $ret = "Shortcuts:\n";
-        foreach ($sc as $s => $c) {
-            $ret .= sprintf("     %-8s %s\n", $s, $c);
-        }
-        return $ret;
-
-    } elseif ($command == "version") {
-        return "PEAR Version: ".$GLOBALS['pear_package_version'].
-               "\nPHP Version: ".phpversion().
-               "\nZend Engine Version: ".zend_version().
-               "\nRunning on: ".php_uname();
-
-    } elseif ($help = PEAR_Command::getHelp($command)) {
-        if (is_string($help)) {
-            return "$progname $command [options] $help\n";
-        }
-
-        if ($help[1] === null) {
-            return "$progname $command $help[0]";
-        }
-
-        return "$progname $command [options] $help[0]\n$help[1]";
-    }
-
-    return "Command '$command' is not valid, try '$progname help'";
-}
-
-// }}}
-
-function error_handler($errno, $errmsg, $file, $line, $vars) {
-    if ((defined('E_STRICT') && $errno & E_STRICT) || (defined('E_DEPRECATED') &&
-          $errno & E_DEPRECATED) || !error_reporting()) {
-        if (defined('E_STRICT') && $errno & E_STRICT) {
-            return; // E_STRICT
-        }
-        if (defined('E_DEPRECATED') && $errno & E_DEPRECATED) {
-            return; // E_DEPRECATED
-        }
-        if ($GLOBALS['config']->get('verbose') < 4) {
-            return false; // @silenced error, show all if debug is high enough
-        }
-    }
-    $errortype = array (
-        E_ERROR   =>  "Error",
-        E_WARNING   =>  "Warning",
-        E_PARSE   =>  "Parsing Error",
-        E_NOTICE   =>  "Notice",
-        E_CORE_ERROR  =>  "Core Error",
-        E_CORE_WARNING  =>  "Core Warning",
-        E_COMPILE_ERROR  =>  "Compile Error",
-        E_COMPILE_WARNING =>  "Compile Warning",
-        E_USER_ERROR =>  "User Error",
-        E_USER_WARNING =>  "User Warning",
-        E_USER_NOTICE =>  "User Notice"
-    );
-    $prefix = $errortype[$errno];
-    global $_PEAR_PHPDIR;
-    if (stristr($file, $_PEAR_PHPDIR)) {
-        $file = substr($file, strlen($_PEAR_PHPDIR) + 1);
-    } else {
-        $file = basename($file);
-    }
-    print "\n$prefix: $errmsg in $file on line $line\n";
-    return false;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * mode: php
- * End:
- */
-// vim600:syn=php
\ No newline at end of file
diff --git a/lib/php/peclcmd.php b/lib/php/peclcmd.php
deleted file mode 100644
index 69e81edd03582385c599c89aa3f17ba97754bd2e..0000000000000000000000000000000000000000
--- a/lib/php/peclcmd.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * PEAR, the PHP Extension and Application Repository
- *
- * Command line interface
- *
- * PHP versions 4 and 5
- *
- * @category   pear
- * @package    PEAR
- * @author     Stig Bakken <ssb@php.net>
- * @author     Tomas V.V.Cox <cox@idecnet.com>
- * @copyright  1997-2009 The Authors
- * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: peclcmd.php 276392 2009-02-25 00:06:23Z dufuz $
- * @link       http://pear.php.net/package/PEAR
- */
-
-/**
- * @nodep Gtk
- */
-if ('/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php' != '@'.'include_path'.'@') {
-    ini_set('include_path', '/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php');
-    $raw = false;
-} else {
-    // this is a raw, uninstalled pear, either a cvs checkout, or php distro
-    $raw = true;
-}
-define('PEAR_RUNTYPE', 'pecl');
-require_once 'pearcmd.php';
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * mode: php
- * End:
- */
-// vim600:syn=php
-
-?>
diff --git a/lib/tests/DB/tests/db_error.phpt b/lib/tests/DB/tests/db_error.phpt
deleted file mode 100644
index 66de08bd2580b892a1a140475069c95a4c205941..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/db_error.phpt
+++ /dev/null
@@ -1,79 +0,0 @@
---TEST--
-DB::DB_Error
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php // -*- C++ -*-
-require_once './include.inc';
-require_once 'DB.php';
-
-function test_error_handler($errno, $errmsg, $file, $line, $vars) {
-    if (defined('E_STRICT')) {
-        if ($errno & E_STRICT
-            && (error_reporting() & E_STRICT) != E_STRICT) {
-            // Ignore E_STRICT notices unless they have been turned on
-            return;
-        }
-    } else {
-        define('E_STRICT', 2048);
-    }
-    $errortype = array (
-        E_ERROR => 'Error',
-        E_WARNING => 'Warning',
-        E_PARSE => 'Parsing Error',
-        E_NOTICE => 'Notice',
-        E_CORE_ERROR => 'Core Error',
-        E_CORE_WARNING => 'Core Warning',
-        E_COMPILE_ERROR => 'Compile Error',
-        E_COMPILE_WARNING => 'Compile Warning',
-        E_USER_ERROR => 'User Error',
-        E_USER_WARNING => 'User Warning',
-        E_USER_NOTICE => 'User Notice',
-        E_STRICT => 'Strict Notice',
-    );
-    $prefix = $errortype[$errno];
-    print "\n$prefix: $errmsg in " . basename($file) . " on line XXX\n";
-}
-
-error_reporting(E_ALL);
-set_error_handler('test_error_handler');
-
-print "testing different error codes...\n";
-$e = new DB_Error(); print strtolower($e->toString())."\n";
-$e = new DB_Error("test error"); print strtolower($e->toString())."\n";
-$e = new DB_Error(DB_OK); print strtolower($e->toString())."\n";
-$e = new DB_Error(DB_ERROR); print strtolower($e->toString())."\n";
-$e = new DB_Error(DB_ERROR_SYNTAX); print strtolower($e->toString())."\n";
-$e = new DB_Error(DB_ERROR_DIVZERO); print strtolower($e->toString())."\n";
-
-print "testing different error modes...\n";
-$e = new DB_Error(DB_ERROR, PEAR_ERROR_PRINT); print strtolower($e->toString())."\n";
-$e = new DB_Error(DB_ERROR_SYNTAX, PEAR_ERROR_TRIGGER);
-
-print "testing different error serverities...\n";
-$e = new DB_Error(DB_ERROR_SYNTAX, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
-$e = new DB_Error(DB_ERROR_SYNTAX, PEAR_ERROR_TRIGGER, E_USER_WARNING);
-$e = new DB_Error(DB_ERROR_SYNTAX, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-
-?>
---GET--
---POST--
---EXPECT--
-testing different error codes...
-[db_error: message="db error: unknown error" code=-1 mode=return level=notice prefix="" info=""]
-[db_error: message="db error: test error" code=-1 mode=return level=notice prefix="" info=""]
-[db_error: message="db error: no error" code=1 mode=return level=notice prefix="" info=""]
-[db_error: message="db error: unknown error" code=-1 mode=return level=notice prefix="" info=""]
-[db_error: message="db error: syntax error" code=-2 mode=return level=notice prefix="" info=""]
-[db_error: message="db error: division by zero" code=-13 mode=return level=notice prefix="" info=""]
-testing different error modes...
-DB Error: unknown error[db_error: message="db error: unknown error" code=-1 mode=print level=notice prefix="" info=""]
-
-User Notice: DB Error: syntax error in PEAR.php on line XXX
-testing different error serverities...
-
-User Notice: DB Error: syntax error in PEAR.php on line XXX
-
-User Warning: DB Error: syntax error in PEAR.php on line XXX
-
-User Error: DB Error: syntax error in PEAR.php on line XXX
diff --git a/lib/tests/DB/tests/db_error2.phpt b/lib/tests/DB/tests/db_error2.phpt
deleted file mode 100644
index 2cc01ff2b2f75775b6a3bfd244e324aa8d6534bd..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/db_error2.phpt
+++ /dev/null
@@ -1,92 +0,0 @@
---TEST--
-DB::Error 2
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './include.inc';
-require_once 'DB.php';
-
-error_reporting(E_ALL);
-
-function myfunc(&$obj) {
-    print 'myfunc here, obj='
-          . strtolower($obj->toString()) . "\n";
-}
-function myfunc2(&$obj) {
-    print 'myfunc2 here, obj='
-          . strtolower($obj->toString()) . "\n";
-}
-class myclass {
-    function myfunc(&$obj) {
-        print 'myclass::myfunc here, obj='
-          . strtolower($obj->toString()) . "\n";
-    }
-}
-function test_error_handler($errno, $errmsg, $file, $line, $vars) {
-    if (defined('E_STRICT')) {
-        if ($errno & E_STRICT
-            && (error_reporting() & E_STRICT) != E_STRICT) {
-            // Ignore E_STRICT notices unless they have been turned on
-            return;
-        }
-    } else {
-        define('E_STRICT', 2048);
-    }
-    $errortype = array (
-        E_ERROR => 'Error',
-        E_WARNING => 'Warning',
-        E_PARSE => 'Parsing Error',
-        E_NOTICE => 'Notice',
-        E_CORE_ERROR => 'Core Error',
-        E_CORE_WARNING => 'Core Warning',
-        E_COMPILE_ERROR => 'Compile Error',
-        E_COMPILE_WARNING => 'Compile Warning',
-        E_USER_ERROR => 'User Error',
-        E_USER_WARNING => 'User Warning',
-        E_USER_NOTICE => 'User Notice',
-        E_STRICT => 'Strict Notice',
-    );
-    $prefix = $errortype[$errno];
-    print strtolower("$prefix: $errmsg in " . basename($file)
-                     . " on line XXX\n");
-}
-
-$obj = new myclass;
-
-$dbh = DB::factory("mysql");
-
-print "default: ";
-$e = $dbh->raiseError("return testing error");
-print strtolower($e->toString()) . "\n";
-
-print "global default: ";
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "myfunc2");
-$e = $dbh->raiseError("global default test");
-
-$dbh->setErrorHandling(PEAR_ERROR_PRINT);
-print "mode=print: ";
-$e = $dbh->raiseError("print testing error");
-print "\n";
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, "myfunc");
-print "mode=function callback: ";
-$e = $dbh->raiseError("function callback testing error");
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, array($obj, "myfunc"));
-print "mode=object callback: ";
-$e = $dbh->raiseError("object callback testing error");
-
-set_error_handler("test_error_handler");
-$dbh->setErrorHandling(PEAR_ERROR_TRIGGER);
-print "mode=trigger: ";
-$e = $dbh->raiseError("trigger testing error");
-
-?>
---EXPECT--
-default: [db_error: message="db error: return testing error" code=-1 mode=return level=notice prefix="" info=" [db error: unknown error]"]
-global default: myfunc2 here, obj=[db_error: message="db error: global default test" code=-1 mode=callback callback=myfunc2 prefix="" info=" [db error: unknown error]"]
-mode=print: DB Error: print testing error
-mode=function callback: myfunc here, obj=[db_error: message="db error: function callback testing error" code=-1 mode=callback callback=myfunc prefix="" info=" [db error: unknown error]"]
-mode=object callback: myclass::myfunc here, obj=[db_error: message="db error: object callback testing error" code=-1 mode=callback callback=myclass::myfunc prefix="" info=" [db error: unknown error]"]
-mode=trigger: user notice: db error: trigger testing error in pear.php on line xxx
diff --git a/lib/tests/DB/tests/db_factory.phpt b/lib/tests/DB/tests/db_factory.phpt
deleted file mode 100644
index e359485e3a89bce9e51bd5479c29efc49bfe5c1f..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/db_factory.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
---TEST--
-DB::factory
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php // -*- C++ -*-
-require_once './include.inc';
-require_once 'DB.php';
-
-$backends = array(
-    'dbase',
-    'fbsql',
-    'ibase',
-    'ifx',
-    'msql',
-    'mssql',
-    'mysql',
-    'mysqli',
-    'oci8',
-    'odbc',
-    'pgsql',
-    'sqlite',
-    'sybase',
-);
-
-foreach ($backends as $name) {
-    $obj = DB::factory($name);
-
-    print "testing $name: ";
-    if (DB::isError($obj)) {
-	    print 'error: ' . $obj->getMessage() . "\n";
-    } else {
-	    print 'object: ' . $obj->toString() . "\n";
-    }
-}
-
-?>
---GET--
---POST--
---EXPECT--
-testing dbase: object: db_dbase: (phptype=dbase, dbsyntax=dbase)
-testing fbsql: object: db_fbsql: (phptype=fbsql, dbsyntax=fbsql)
-testing ibase: object: db_ibase: (phptype=ibase, dbsyntax=ibase)
-testing ifx: object: db_ifx: (phptype=ifx, dbsyntax=ifx)
-testing msql: object: db_msql: (phptype=msql, dbsyntax=msql)
-testing mssql: object: db_mssql: (phptype=mssql, dbsyntax=mssql)
-testing mysql: object: db_mysql: (phptype=mysql, dbsyntax=mysql)
-testing mysqli: object: db_mysqli: (phptype=mysqli, dbsyntax=mysqli)
-testing oci8: object: db_oci8: (phptype=oci8, dbsyntax=oci8)
-testing odbc: object: db_odbc: (phptype=odbc, dbsyntax=sql92)
-testing pgsql: object: db_pgsql: (phptype=pgsql, dbsyntax=pgsql)
-testing sqlite: object: db_sqlite: (phptype=sqlite, dbsyntax=sqlite)
-testing sybase: object: db_sybase: (phptype=sybase, dbsyntax=sybase)
diff --git a/lib/tests/DB/tests/db_ismanip.phpt b/lib/tests/DB/tests/db_ismanip.phpt
deleted file mode 100644
index 8c4a281a774f12c68419c8d3d8abdf03d3631960..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/db_ismanip.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-DB::isManip
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php // -*- C++ -*-
-require_once './include.inc';
-require_once 'DB.php';
-
-function test($query) {
-    printf("%s : %d\n", preg_replace('/\s+.*/', '', $query),
-           DB::isManip($query));
-}
-
-print "testing DB::isManip...\n";
-
-test("SELECT * FROM table");
-test("Select * from table");
-test("select * From table");
-test("sElECt * frOm table");
-test("SELECT DISTINCT name FROM table");
-test("SELECT a, b INTO table2 FROM table1");
-test("SELECT a, b FROM table WHERE b = ' INTO '");
-test("UPDATE table SET foo = 'bar'");
-test("DELETE FROM table");
-test("delete from table where id is null");
-test("create table (id integer, name varchar(100))");
-test("CREATE SEQUENCE foo");
-test("\"CREATE PROCEDURE foo\"");
-test("GRANT SELECT ON table TO user");
-test("REVOKE SELECT ON table FROM user");
-test("SHOW OPTIONS");
-test("DROP TABLE foo");
-test("ALTER TABLE foo ADD COLUMN (bar INTEGER)");
-test("  SELECT * FROM table");
-test("  DELETE FROM table");
-?>
---GET--
---POST--
---EXPECT--
-testing DB::isManip...
-SELECT : 0
-Select : 0
-select : 0
-sElECt : 0
-SELECT : 0
-SELECT : 1
-SELECT : 0
-UPDATE : 1
-DELETE : 1
-delete : 1
-create : 1
-CREATE : 1
-"CREATE : 1
-GRANT : 1
-REVOKE : 1
-SHOW : 0
-DROP : 1
-ALTER : 1
- : 0
- : 1
diff --git a/lib/tests/DB/tests/db_parsedsn.phpt b/lib/tests/DB/tests/db_parsedsn.phpt
deleted file mode 100644
index f84a0d4dca5f6874c4147bfee0d8caac80dd38d1..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/db_parsedsn.phpt
+++ /dev/null
@@ -1,496 +0,0 @@
---TEST--
-DB::parseDSN
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php // -*- C++ -*-
-require_once './include.inc';
-require_once 'DB.php';
-
-function reparseDSN($dsn) {
-    $parsed = DB::parseDSN($dsn);
-    $reparsed = DB::parseDSN(DB::getDSNString($dsn, false));
-    if (count($diff = array_diff($parsed, $reparsed)) > 0) {
-        echo "Parsing the original DSN and the DSN generated by getDSNString results in differences:\n";
-        printf("%-20s%-29s%-29s\n", 'Field', 'Parsed', 'Reparsed');
-        printf("%-20s%-29s%-29s\n", '-----', '------', '--------');
-        foreach ($parsed as $key => $value) {
-            printf("%-20s%-29s%-29s\n", $key, $value, $reparsed[$key]);
-        }
-        echo "The reparsed DSN was: ".DB::getDSNString($dsn, false)."\n";
-    }
-}
-
-function test($dsn) {
-    echo "DSN: $dsn\n";
-    print_r(DB::parseDSN($dsn));
-    reparseDSN($dsn);
-}
-
-function testArray($dsn) {
-    echo "DSN: array\n";
-    print_r(DB::parseDSN($dsn));
-    reparseDSN($dsn);
-}
-
-print "testing DB::parseDSN...\n\n";
-
-test("mysql");
-test("odbc(mssql)");
-test('odbc(db2)://user:password@/database');
-test('odbc(access):///database');
-test('odbc://admin@/datasourceName');
-test("mysql://localhost");
-test("mysql://remote.host.com/db");
-test("oci8://system:manager@");
-test("oci8://user:pass@tns-name");
-test("odbc(solid)://foo:bar@tcp+localhost+1313");  // deprecated
-test("pgsql://user@unix+localhost/pear");          // deprecated
-test("ibase://user%40domain:password@host");
-test("ibase://user@domain:pass@word@/database");   // also supported
-test("ifx://user@domain:pass@word@host.com//usr/db/general.db");
-test('ifx://remote.host.com/c:\windows\my.db');
-test('oci8://SHOOTOUT:******@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))');
-
-// new formats
-test("odbc(solid)://foo:bar@localhost:1313");
-test("pgsql://user@unix()/pear");
-test("mysql://user@unix(/path/to/socket)/pear");
-test("pgsql://user@tcp()/pear");
-test("pgsql://user@tcp(somehost)/pear");
-test("pgsql://user:pass@word@tcp(somehost:7777)/pear");
-
-// special backend options
-test('ibase://user:pass@localhost//var/lib/dbase.dbf?role=foo');
-test('dbase://@/?role=foo&dialect=bar');
-test('sqlite:////unix/path/to/database?option=value&anotheroption=anothervalue');
-test('sqlite:///c:/win/path/to/database?option=value');
-
-// some examples from manual
-test('mysql://username@hostspec');
-test('mysql://hostspec/database');
-test('mysql://hostspec');
-test('mysql:///database');
-
-// array tests
-$array = array(
-    'phptype'  => 'mysql',
-    'hostspec' => 'foobar',
-);
-testArray($array);
-
-?>
---GET--
---POST--
---EXPECT--
-testing DB::parseDSN...
-
-DSN: mysql
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => 
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: odbc(mssql)
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => mssql
-    [username] => 
-    [password] => 
-    [protocol] => 
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: odbc(db2)://user:password@/database
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => db2
-    [username] => user
-    [password] => password
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => database
-)
-DSN: odbc(access):///database
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => access
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => database
-)
-DSN: odbc://admin@/datasourceName
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => odbc
-    [username] => admin
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => datasourceName
-)
-DSN: mysql://localhost
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => localhost
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: mysql://remote.host.com/db
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => remote.host.com
-    [port] => 
-    [socket] => 
-    [database] => db
-)
-DSN: oci8://system:manager@
-Array
-(
-    [phptype] => oci8
-    [dbsyntax] => oci8
-    [username] => system
-    [password] => manager
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: oci8://user:pass@tns-name
-Array
-(
-    [phptype] => oci8
-    [dbsyntax] => oci8
-    [username] => user
-    [password] => pass
-    [protocol] => tcp
-    [hostspec] => tns-name
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: odbc(solid)://foo:bar@tcp+localhost+1313
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => solid
-    [username] => foo
-    [password] => bar
-    [protocol] => tcp
-    [hostspec] => localhost+1313
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: pgsql://user@unix+localhost/pear
-Array
-(
-    [phptype] => pgsql
-    [dbsyntax] => pgsql
-    [username] => user
-    [password] => 
-    [protocol] => unix
-    [hostspec] => 
-    [port] => 
-    [socket] => localhost
-    [database] => pear
-)
-DSN: ibase://user%40domain:password@host
-Array
-(
-    [phptype] => ibase
-    [dbsyntax] => ibase
-    [username] => user@domain
-    [password] => password
-    [protocol] => tcp
-    [hostspec] => host
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: ibase://user@domain:pass@word@/database
-Array
-(
-    [phptype] => ibase
-    [dbsyntax] => ibase
-    [username] => user@domain
-    [password] => pass@word
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => database
-)
-DSN: ifx://user@domain:pass@word@host.com//usr/db/general.db
-Array
-(
-    [phptype] => ifx
-    [dbsyntax] => ifx
-    [username] => user@domain
-    [password] => pass@word
-    [protocol] => tcp
-    [hostspec] => host.com
-    [port] => 
-    [socket] => 
-    [database] => /usr/db/general.db
-)
-DSN: ifx://remote.host.com/c:\windows\my.db
-Array
-(
-    [phptype] => ifx
-    [dbsyntax] => ifx
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => remote.host.com
-    [port] => 
-    [socket] => 
-    [database] => c:\windows\my.db
-)
-DSN: oci8://SHOOTOUT:******@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))
-Array
-(
-    [phptype] => oci8
-    [dbsyntax] => oci8
-    [username] => SHOOTOUT
-    [password] => ******
-    [protocol] => tcp
-    [hostspec] => (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.161)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TIS)))
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: odbc(solid)://foo:bar@localhost:1313
-Array
-(
-    [phptype] => odbc
-    [dbsyntax] => solid
-    [username] => foo
-    [password] => bar
-    [protocol] => tcp
-    [hostspec] => localhost
-    [port] => 1313
-    [socket] => 
-    [database] => 
-)
-DSN: pgsql://user@unix()/pear
-Array
-(
-    [phptype] => pgsql
-    [dbsyntax] => pgsql
-    [username] => user
-    [password] => 
-    [protocol] => unix
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => pear
-)
-DSN: mysql://user@unix(/path/to/socket)/pear
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => user
-    [password] => 
-    [protocol] => unix
-    [hostspec] => 
-    [port] => 
-    [socket] => /path/to/socket
-    [database] => pear
-)
-DSN: pgsql://user@tcp()/pear
-Array
-(
-    [phptype] => pgsql
-    [dbsyntax] => pgsql
-    [username] => user
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => pear
-)
-DSN: pgsql://user@tcp(somehost)/pear
-Array
-(
-    [phptype] => pgsql
-    [dbsyntax] => pgsql
-    [username] => user
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => somehost
-    [port] => 
-    [socket] => 
-    [database] => pear
-)
-DSN: pgsql://user:pass@word@tcp(somehost:7777)/pear
-Array
-(
-    [phptype] => pgsql
-    [dbsyntax] => pgsql
-    [username] => user
-    [password] => pass@word
-    [protocol] => tcp
-    [hostspec] => somehost
-    [port] => 7777
-    [socket] => 
-    [database] => pear
-)
-DSN: ibase://user:pass@localhost//var/lib/dbase.dbf?role=foo
-Array
-(
-    [phptype] => ibase
-    [dbsyntax] => ibase
-    [username] => user
-    [password] => pass
-    [protocol] => tcp
-    [hostspec] => localhost
-    [port] => 
-    [socket] => 
-    [database] => /var/lib/dbase.dbf
-    [role] => foo
-)
-DSN: dbase://@/?role=foo&dialect=bar
-Array
-(
-    [phptype] => dbase
-    [dbsyntax] => dbase
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => 
-    [role] => foo
-    [dialect] => bar
-)
-DSN: sqlite:////unix/path/to/database?option=value&anotheroption=anothervalue
-Array
-(
-    [phptype] => sqlite
-    [dbsyntax] => sqlite
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => /unix/path/to/database
-    [option] => value
-    [anotheroption] => anothervalue
-)
-DSN: sqlite:///c:/win/path/to/database?option=value
-Array
-(
-    [phptype] => sqlite
-    [dbsyntax] => sqlite
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => c:/win/path/to/database
-    [option] => value
-)
-DSN: mysql://username@hostspec
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => username
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => hostspec
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: mysql://hostspec/database
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => hostspec
-    [port] => 
-    [socket] => 
-    [database] => database
-)
-DSN: mysql://hostspec
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => hostspec
-    [port] => 
-    [socket] => 
-    [database] => 
-)
-DSN: mysql:///database
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => tcp
-    [hostspec] => 
-    [port] => 
-    [socket] => 
-    [database] => database
-)
-DSN: array
-Array
-(
-    [phptype] => mysql
-    [dbsyntax] => mysql
-    [username] => 
-    [password] => 
-    [protocol] => 
-    [hostspec] => foobar
-    [port] => 
-    [socket] => 
-    [database] => 
-)
diff --git a/lib/tests/DB/tests/driver/01connect.phpt b/lib/tests/DB/tests/driver/01connect.phpt
deleted file mode 100644
index 8ac2aabba1194235cc172b90caac509657034a6a..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/01connect.phpt
+++ /dev/null
@@ -1,84 +0,0 @@
---TEST--
-DB_driver::connect
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './connect.inc';
-
-/**
- * Determine if the database connection matches what's expected
- *
- * @param object $dbh   the PEAR DB object
- * @param string $name  the name of the current test
- *
- * @return void
- */
-function check_dbh($dbh, $name) {
-    if (DB::isError($dbh)) {
-        die('connect.inc: ' . $dbh->toString());
-    }
-    if (is_object($dbh)) {
-        print "$name is an object\n";
-    }
-    switch ($dbh->phptype) {
-        case 'dbase':
-            if (is_int($dbh->connection)) {
-                print "$name is connected\n";
-            } else {
-                print "$name NOT connected\n";
-            }
-            break;
-        case 'mysqli':
-            if (is_a($dbh->connection, 'mysqli')) {
-                print "$name is connected\n";
-            } else {
-                print "$name NOT connected\n";
-            }
-            break;
-        case 'sybase':
-            if (gettype($dbh->connection) == 'resource' ||
-                (gettype($dbh->connection) == 'integer' && $dbh->connection > 0)) {
-                print "$name is connected\n";
-            } else {
-                print "$name NOT connected\n";
-            }
-            break;
-        default:
-            if (gettype($dbh->connection) == 'resource') {
-                print "$name is connected\n";
-            } else {
-                print "$name NOT connected\n";
-            }
-    }
-}
-
-
-check_dbh($dbh, '$dbh');
-
-
-$test_array_dsn = DB::parseDSN($dsn);
-foreach ($test_array_dsn as $key => $value) {
-    if ($value === false) {
-        unset($test_array_dsn[$key]);
-    }
-}
-
-$dbha =& DB::connect($test_array_dsn, $options);
-check_dbh($dbha, '$dbha');
-
-
-$tmp  = serialize($dbha);
-$dbhu = unserialize($tmp);
-check_dbh($dbhu, '$dbhu');
-
-?>
---EXPECT--
-$dbh is an object
-$dbh is connected
-$dbha is an object
-$dbha is connected
-$dbhu is an object
-$dbhu is connected
diff --git a/lib/tests/DB/tests/driver/02fetch.phpt b/lib/tests/DB/tests/driver/02fetch.phpt
deleted file mode 100644
index 28c96aaf564654e46f626024d9032fa52f2764c7..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/02fetch.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-DB_driver::fetch
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../fetchmodes.inc';
-?>
---EXPECT--
-testing fetchrow:
-row 1: 42, bing, This is a test, 1999-11-21
-row 2: 1, one, One, 2001-02-16
-row 3: 2, two, Two, 2001-02-15
-row 4: 3, three, Three, 2001-02-14
-row 5: NULL
-testing fetchmodes: fetchrow default default, portability mode DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM
-0 1 2 3
-output matched expected format
-testing fetchmodes: fetchinto default default
-0 1 2 3
-42 bing This is a test 1999-11-21
-testing fetchmodes: fetchrow ordered default
-0 1 2 3
-testing fetchmodes: fetchrow assoc default
-a b cc d
-testing fetchmodes: fetchrow ordered default with assoc specified
-a b cc d
-testing fetchmodes: fetchrow assoc default with ordered specified
-0 1 2 3
-testing fetchmodes: fetchinto ordered default
-0 1 2 3
-testing fetchmodes: fetchinto assoc default
-a b cc d
-testing fetchmodes: fetchinto ordered default with assoc specified
-a b cc d
-testing fetchmodes: fetchinto assoc default with ordered specified
-0 1 2 3
-testing fetchmodes: fetchrow assoc quoted identifiers
-a b cc d
diff --git a/lib/tests/DB/tests/driver/03simplequery.phpt b/lib/tests/DB/tests/driver/03simplequery.phpt
deleted file mode 100644
index c0b450ab08b8f7c97626e191f3ffb70718c804e8..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/03simplequery.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-DB_driver::simpleQuery
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../simplequery.inc';
-?>
---EXPECT--
-passed
diff --git a/lib/tests/DB/tests/driver/04numcols.phpt b/lib/tests/DB/tests/driver/04numcols.phpt
deleted file mode 100644
index f9a275af2c665237a43c418624f1252a890a9be8..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/04numcols.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-DB_driver::numCols
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../numcols.inc';
-?>
---EXPECT--
-1
-2
-3
-4
diff --git a/lib/tests/DB/tests/driver/05sequences.phpt b/lib/tests/DB/tests/driver/05sequences.phpt
deleted file mode 100644
index 87c782c928b63b72d2609b671cc4622a19e7626e..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/05sequences.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-DB_driver::sequences
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-require_once './skipif.inc';
-$tableInfo = $dbh->dropSequence('ajkdslfajoijkadie');
-if (DB::isError($tableInfo) && $tableInfo->code == DB_ERROR_NOT_CAPABLE) {
-    die("skip $tableInfo->message");
-}
-?>
---FILE--
-<?php
-require_once './connect.inc';
-require_once '../sequences.inc';
-?>
---EXPECT--
-an error is the proper response here
-an error cought by the error handler is good
-a=1
-b=2
-b-a=1
-c=1
-d=1
-e=1
diff --git a/lib/tests/DB/tests/driver/06prepexec.phpt b/lib/tests/DB/tests/driver/06prepexec.phpt
deleted file mode 100644
index 3feb0ebbfabde88e25db02d9f91b4001c39ff51d..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/06prepexec.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-DB_driver::prepare/execute
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../prepexe.inc';
-?>
---EXPECT--
-------------1------------
-sth1,sth2,sth3,sth4 created
-sth1: ? as param, passing as array... sth1 executed
-sth2: ! and ? as params, passing as array... sth2 executed
-sth3: ?, ! and & as params, passing as array... sth3 executed
-sth4: no params... sth4 executed
-results:
-|72 - a -  - |
-|72 - direct -  - |
-|72 - it's good - opaque placeholder's test - |
-|72 - that's right -  - |
-
-------------2------------
-results:
-|72 - set1 - opaque placeholder's test - 1234-56-78|
-|72 - set2 - opaque placeholder's test - |
-|72 - set3 - opaque placeholder's test - |
-
-------------3------------
-TRUE
-FALSE
-
-------------4------------
-|72 - set1 - opaque placeholder's test - 1234-56-78|
-|72 - set2 - opaque placeholder's test - |
-|72 - set3 - opaque placeholder's test - |
-~~
-~~
-|72 - set1 - opaque placeholder's test - 1234-56-78|
-~~
-|72 - set1 - opaque placeholder's test - 1234-56-78|
-|72 - set2 - opaque placeholder's test - |
-|72 - set3 - opaque placeholder's test - |
-~~
-
-------------5------------
-insert: okay
-a = 11, b = three, d = got expected outcome
diff --git a/lib/tests/DB/tests/driver/08affectedrows.phpt b/lib/tests/DB/tests/driver/08affectedrows.phpt
deleted file mode 100644
index 2624ac845ef42e00daf291d2c40254d3ae48477e..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/08affectedrows.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-DB_driver::affectedRows
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-
-/**
- * Local error callback handler.
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-// Clean table
-$dbh->query("DELETE FROM phptest");
-
-// Affected rows by INSERT statement
-$dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')");
-$dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')");
-printf("%d after insert\n", $dbh->affectedRows());
-
-// Affected rows by SELECT statement
-$dbh->query("SELECT * FROM phptest");
-printf("%d after select\n", $dbh->affectedRows());
-$dbh->query("DELETE FROM phptest WHERE b = 'test'");
-printf("%d after delete\n", $dbh->affectedRows());
-
-// Affected rows by DELETE statement
-$dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')");
-$dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')");
-$dbh->query("DELETE FROM phptest");
-printf("%d after delete all\n", $dbh->affectedRows());
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
-
-?>
---EXPECT--
-1 after insert
-0 after select
-2 after delete
-2 after delete all
diff --git a/lib/tests/DB/tests/driver/09numrows.phpt b/lib/tests/DB/tests/driver/09numrows.phpt
deleted file mode 100644
index bc08f776303efaf4abb0a0e074b05d418f064a72..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/09numrows.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-DB_driver::numRows
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../numrows.inc';
-?>
---EXPECT--
-(want 1) got 1 from first
-(want 2) got 2 from 0
-(want 3) got 3 from 1
-(want 4) got 4 from 2
-(want 5) got 5 from 3
-(want 6) got 6 from 4
-(want 5) got 5 from > 0 (passing params to query)
-(want 4) got 4 from < 4 (doing prepare/execute)
-(want 2) got 2 from 5 and 6 not deleted
-(want 0) got 0 from < 0
diff --git a/lib/tests/DB/tests/driver/10errormap.phpt b/lib/tests/DB/tests/driver/10errormap.phpt
deleted file mode 100644
index d953bef4274b0de8e1e25010f51fd5c6078b0fbf..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/10errormap.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-DB_driver::error mapping
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../errors.inc';
-?>
---EXPECT--
-DB_ERROR_NOSUCHTABLE for select:  matches expected outcome
-DB_ERROR_NOSUCHTABLE for drop:  matches expected outcome
-DB_ERROR_NOT_FOUND for drop index:  matches expected outcome
-DB_ERROR_ALREADY_EXISTS for create table:  matches expected outcome
-DB_ERROR_ALREADY_EXISTS for create index:  matches expected outcome
-DB_ERROR_CONSTRAINT for primary key insert duplicate:  matches expected outcome
-DB_ERROR_CONSTRAINT for primary key update duplicate:  matches expected outcome
-DB_ERROR_CONSTRAINT for unique key insert duplicate:  matches expected outcome
-DB_ERROR_CONSTRAINT for unique key update duplicate:  matches expected outcome
-DB_ERROR_CONSTRAINT for foreign key on insert:  matches expected outcome
-DB_ERROR_CONSTRAINT for foreign key on delete:  matches expected outcome
-DB_ERROR_CONSTRAINT_NOT_NULL on insert:  matches expected outcome
-DB_ERROR_CONSTRAINT_NOT_NULL on update:  matches expected outcome
-DB_ERROR_NOSUCHFIELD joining ON bogus column:  matches expected outcome
-DB_ERROR_NOSUCHFIELD joining USING bogus column:  matches expected outcome
-DB_ERROR_DIVZERO:  matches expected outcome
-DB_ERROR_INVALID_NUMBER putting chars in INT column:  matches expected outcome
-DB_ERROR_INVALID_NUMBER putting float in INT column:  matches expected outcome
-DB_ERROR_INVALID_NUMBER putting excessive int in INT column:  matches expected outcome
-DB_ERROR_INVALID_NUMBER putting int in CHAR column:  matches expected outcome
-DB_ERROR_NOSUCHFIELD:  matches expected outcome
-DB_ERROR_SYNTAX:  matches expected outcome
-DB_ERROR_VALUE_COUNT_ON_ROW:  matches expected outcome
-DB_ERROR_INVALID on CHAR column data too long:  matches expected outcome
-DB_ERROR_INVALID on VARCHAR column data too long:  matches expected outcome
diff --git a/lib/tests/DB/tests/driver/11transactions.phpt b/lib/tests/DB/tests/driver/11transactions.phpt
deleted file mode 100644
index 3518788930cff3e4d27075e0a39fb5a36803d89d..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/11transactions.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-DB_driver::transaction test
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-chdir(dirname(__FILE__)); require_once './skipif.inc';
-if (!$dbh->features['transactions']) {
-    die('skip this driver does not support transactions');
-}
-?>
---FILE--
-<?php
-$needinnodb = true;
-require_once './mktable.inc';
-require_once '../transactions.inc';
-?>
---EXPECT--
-1) after autocommit: bing one.  ops=ok
-2) before commit: bing one two three.  ops=ok
-3) after commit: bing one two three.  ops=ok
-4) before rollback: bing one two three four five.  ops=ok
-5) after rollback: bing one two three.  ops=ok
-6) before autocommit+rollback: bing one two three six seven.  ops=ok
-7) after autocommit+rollback: bing one two three six seven.  ops=ok
-8) testing that select doesn't disturbe opcount: ok
diff --git a/lib/tests/DB/tests/driver/13limit.phpt b/lib/tests/DB/tests/driver/13limit.phpt
deleted file mode 100644
index 701157aafc927e0467df769b72f963618801e596..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/13limit.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-DB_driver::row limit
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './connect.inc';
-require_once './droptable.inc';
-require_once '../limit.inc';
-?>
---EXPECT--
-======= From: 0 || Number of rows to fetch: 10 =======
-1.- result 0
-2.- result 1
-3.- result 2
-4.- result 3
-5.- result 4
-6.- result 5
-7.- result 6
-8.- result 7
-9.- result 8
-10.- result 9
-Row count for limited result: 10
-======= From: 10 || Number of rows to fetch: 10 =======
-11.- result 10
-12.- result 11
-13.- result 12
-14.- result 13
-15.- result 14
-16.- result 15
-17.- result 16
-18.- result 17
-19.- result 18
-20.- result 19
-Row count for limited result: 10
-======= From: 20 || Number of rows to fetch: 10 =======
-21.- result 20
-22.- result 21
-23.- result 22
-24.- result 23
-25.- result 24
-26.- result 25
-27.- result 26
-28.- result 27
-29.- result 28
-30.- result 29
-Row count for limited result: 10
-======= From: 30 || Number of rows to fetch: 10 =======
-31.- result 30
-32.- result 31
-33.- result 32
-Row count for limited result: 3
-======= Passing $params || From: 11 || Number of rows to fetch: 3 =======
-12.- result 11
-13.- result 12
-14.- result 13
-======= From: 0 || Number of rows to fetch: 3 || Iterations: 10 =======
-Row count for limited result: 3
diff --git a/lib/tests/DB/tests/driver/14fetchmode_object.phpt b/lib/tests/DB/tests/driver/14fetchmode_object.phpt
deleted file mode 100644
index 3718d3ce1f8e2d019651b27c423c365f2ac8287d..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/14fetchmode_object.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-DB_driver::fetchmode object
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './mktable.inc';
-require_once '../fetchmode_object.inc';
-?>
---EXPECT--
---- fetch with param DB_FETCHMODE_OBJECT ---
-stdclass -> a b cc d
-stdclass -> a b cc d
---- fetch with default fetchmode DB_FETCHMODE_OBJECT ---
-stdclass -> a b cc d
-stdclass -> a b cc d
---- fetch with default fetchmode DB_FETCHMODE_OBJECT and class DB_row ---
-db_row -> a b cc d
-db_row -> a b cc d
---- fetch with default fetchmode DB_FETCHMODE_OBJECT with no class then DB_row ---
-stdclass -> a b cc d
-db_row -> a b cc d
diff --git a/lib/tests/DB/tests/driver/15quote.phpt b/lib/tests/DB/tests/driver/15quote.phpt
deleted file mode 100644
index e80aaa97914ea236fa630ebb4a178f6d7ae593ce..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/15quote.phpt
+++ /dev/null
@@ -1,273 +0,0 @@
---TEST--
-DB_driver::quote
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-require_once './connect.inc';
-require_once './droptable.inc';
-
-
-/**
- * Local error callback handler.
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'pearquote');
-
-    die($o->toString());
-}
-
-// DBMS boolean column type simulation...
-$boolean_col_type = array(
-    'dbase'  => 'Logical',
-    'fbsql'  => 'BOOLEAN',
-    'ibase'  => 'SMALLINT',
-    'ifx'    => 'SMALLINT',
-    'msql'   => 'INTEGER',
-    'mssql'  => 'BIT',
-    'mysql'  => 'TINYINT(1)',
-    'mysqli' => 'TINYINT(1)',
-    'oci8'   => 'NUMBER(1)',
-    'odbc'   => 'SMALLINT',
-    'pgsql'  => 'BOOLEAN',
-    'sqlite' => 'INTEGER',
-    'sybase' => 'TINYINT',
-);
-
-// adjust things for specific DBMS's
-
-if ($dbh->phptype == 'odbc') {
-    if ($dbh->dbsyntax == 'odbc') {
-        $type = $dbh->phptype;
-    } else {
-        $type = $dbh->dbsyntax;
-    }
-} else {
-    $type = $dbh->phptype;
-}
-
-switch ($type) {
-    case 'access':
-        $decimal = 'SINGLE';
-        $null = '';
-        $chr  = 'VARCHAR(8)';
-        $identifier = 'q\ut "dnt';
-        break;
-    case 'db2':
-    case 'ibase':
-        $decimal = 'DECIMAL(3,1)';
-        $null = '';
-        $chr  = 'VARCHAR(8)';
-        $identifier = 'q\ut] "dn[t';
-        break;
-    case 'ifx':
-        // doing this for ifx to keep certain versions happy
-        $decimal = 'DECIMAL(3,1)';
-        $null = '';
-        $chr  = 'CHAR(8)';
-        $identifier = '';
-        break;
-    case 'msql':
-        $decimal = 'REAL';
-        $null = '';
-        $chr  = 'CHAR(8)';
-        $identifier = '';
-        break;
-    case 'fbsql':
-    case 'oci8':
-        $decimal = 'DECIMAL(3,1)';
-        $null = '';
-        $chr  = 'VARCHAR(8)';
-        $identifier = 'q\ut] dn[t';
-        break;
-    default:
-        $decimal = 'DECIMAL(3,1)';
-        $null = 'NULL';
-        $chr  = 'VARCHAR(8)';
-        $identifier = 'q\ut] "dn[t';
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'pearquote');
-
-
-if ($identifier) {
-    switch ($dbh->phptype) {
-        case 'sybase':
-            $res = $dbh->query('set quoted_identifier on');
-            if (DB::isError($res) ) {
-                pe($res);
-            }
-            break;
-        default:
-    }
-    $create = $dbh->query("
-        CREATE TABLE pearquote (
-          n $decimal $null,
-          s $chr $null,
-          " . $dbh->quoteIdentifier($identifier) . " $decimal $null,
-          b {$boolean_col_type[$dbh->phptype]} $null
-        )
-    ");
-
-    if (DB::isError($create) ) {
-        pe($create);
-    }
-
-    $info = $dbh->tableInfo('pearquote');
-    if (DB::isError($info) ) {
-        if ($info->code == DB_ERROR_NOT_CAPABLE) {
-            print "Got outcome expected from delimited identifier.\n";
-        } else {
-            print "tableInfo() failed.\n";
-        }
-    } else {
-        if ($identifier == $info[2]['name']) {
-            print "Got outcome expected from delimited identifier.\n";
-            // print "COLUMN NAME IS: {$info[2]['name']}\n";
-        } else {
-            print "Expected column name: '$identifier' ... ";
-            print "Actual column name: '{$info[2]['name']}'\n";
-        }
-    }
-
-} else {
-    $dbh->query("
-        CREATE TABLE pearquote (
-          n $decimal $null,
-          s $chr $null,
-          plainidentifier $decimal $null,
-          b {$boolean_col_type[$dbh->phptype]} $null
-        )
-    ");
-    print "Got outcome expected from delimited identifier.\n";
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$strings = array(
-    "'",
-    "\"",
-    "\\",
-    "%",
-    "_",
-    "''",
-    "\"\"",
-    "\\\\",
-    "\\'\\'",
-    "\\\"\\\""
-);
-
-$nums = array(
-    12.3,
-    15,
-);
-
-$bools = array(
-    TRUE,
-    FALSE,
-);
-
-
-echo "String escape test: ";
-foreach ($strings as $s) {
-    $quoted = $dbh->quoteSmart($s);
-    $dbh->query("INSERT INTO pearquote (s) VALUES ($quoted)");
-}
-$diff = array_diff($strings, $res = $dbh->getCol("SELECT s FROM pearquote"));
-if (count($diff) > 0) {
-    echo "FAIL";
-    print_r($strings);
-    print_r($res);
-} else {
-    echo "OK";
-}
-
-$dbh->query("DELETE FROM pearquote");
-
-
-echo "\nNumber escape test: ";
-foreach ($nums as $n) {
-    $quoted = $dbh->quoteSmart($n);
-    $dbh->query("INSERT INTO pearquote (n) VALUES ($quoted)");
-}
-
-$diff = array();
-$res =& $dbh->getCol('SELECT n FROM pearquote ORDER BY n');
-foreach ($nums as $key => $val) {
-    if ($val != $res[$key]) {
-        $diff[] = "$val != {$res[$key]}";
-    }
-}
-
-if (count($diff) > 0) {
-    echo "FAIL\n";
-    print_r($diff);
-} else {
-    echo 'OK';
-}
-
-$dbh->query('DELETE FROM pearquote');
-
-
-echo "\nBoolean escape test: ";
-$i = 1;
-foreach ($bools as $b) {
-    $quoted = $dbh->quoteSmart($b);
-    $dbh->query("INSERT INTO pearquote (n, b) VALUES ($i, $quoted)");
-    $i++;
-}
-
-$diff = array();
-$res =& $dbh->getCol('SELECT b, n FROM pearquote ORDER BY n');
-foreach ($bools as $key => $val) {
-    if ($val === true) {
-        if ($res[$key] == 1 || $res[$key] == true ||
-            substr(strtolower($res[$key]), 0, 1) == 't')
-        {
-            // good
-        } else {
-            $diff[] = "in:true != out:{$res[$key]}";
-        }
-    } else {
-        if ($res[$key] == 0 || $res[$key] == false ||
-            substr(strtolower($res[$key]), 0, 1) == 'f')
-        {
-            // good
-        } else {
-            $diff[] = "in:false != out:{$res[$key]}";
-        }
-    }
-}
-
-if (count($diff) > 0) {
-    echo "FAIL\n";
-    print_r($diff);
-} else {
-    echo "OK\n";
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'pearquote');
-
-?>
---EXPECT--
-Got outcome expected from delimited identifier.
-String escape test: OK
-Number escape test: OK
-Boolean escape test: OK
diff --git a/lib/tests/DB/tests/driver/16tableinfo.phpt b/lib/tests/DB/tests/driver/16tableinfo.phpt
deleted file mode 100644
index 246640dbee7fe171bdd603dee26329911ee93d82..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/16tableinfo.phpt
+++ /dev/null
@@ -1,1354 +0,0 @@
---TEST--
-DB_driver::tableInfo
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-
-/**
- * Calls tableInfo() in various ways and checks to see that the output
- * matches what's expected.
- *
- * These tests account for each DBMS using different column types and
- * reporting back different information.  These differences are accounted
- * for in the <var>$quirks</var> array, which has the following format:
- *
- * <pre>
- * 'driver' => array(
- *     'clob' => DBMS's column type for creating CLOB fields
- *     'date' => DBMS's column type for creating DATE fields
- *     'dateliteral' => The SQL keyword necessary for defining dates
- *     'finds_table' => Can this DBMS determine table names from queries?
- *     'size_from_table' => Does this DBMS know the column size via table name?
- *     'handles_results' => Can the DBMS get info from query results?
- *     'commands' => array(
- *         Extra commands to be passed to PHP's eval() function
- *     )
- *     0 => array(
- *         //  Info expected to be reported for phptest_fk.a
- *         //  (INTEGER NOT NULL) (UNIQUE KEY with d)
- *         'type' => Column type reported by the DBMS
- *         'len' => Column size reported by the DBMS
- *         'flags' => Flags reported by the DBMS
- *     )
- *     1 => array()  Info expected to be reported for phptest_fk.fk
- *                   (INTEGER NOT NULL) (PRIMARY KEY)
- *     2 => array()  Info expected to be reported for phptest_fk.c
- *                   (CLOB/CHAR/VARCHAR NULL)
- *     3 => array()  Info expected to be reported for phptest_fk.d
- *                   (DATE NOT NULL) (UNIQUE KEY with a)
- *     4 => array()  Info expected to be reported for phptest_fk.e
- *                   (CHAR(2) DEFAULT ' e' NOT NULL)
- *     5 => array()  Info expected to be reported for phptest_fk.f
- *                   (DECIMAL(2,1) NULL)
- *     9 => array()  Info expected to be reported for phptest.d
- *                   (VARCHAR(20) NULL)
- * )
- * </pre>
- *
- * @category Database
- * @package  DB
- * @version  $Id: 16tableinfo.phpt,v 1.40 2007/02/06 07:12:30 aharvey Exp $
- * @author   Daniel Convissor <danielc@analysisandsolutions.com>
- * @see      DB_common::tableInfo()
- */
-
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-require_once './skipif.inc';
-$tableInfo = $dbh->tableInfo('ajkdslfajoijkadie');
-if (DB::isError($tableInfo) && $tableInfo->code == DB_ERROR_NOT_CAPABLE) {
-    die("skip $tableInfo->message");
-}
-
-?>
---FILE--
-<?php
-
-//  $Id: 16tableinfo.phpt,v 1.40 2007/02/06 07:12:30 aharvey Exp $
-
-/**
- * Connect to the database and make the phptest table.
- */
-require_once './mktable.inc';
-
-/**
- * Local error callback handler.
- *
- * In general, it prints out an error message and kills the process.
- * But some errors are expected and allowed to exist.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o){
-    global $dbh, $quirks;
-
-    if ($o->getMessage() == "DB Error: can't distinguish duplicate field names") {
-        print "NOTICE: $dbh->phptype can't distinguish duplicate field names";
-        return;
-    }
-
-    if ($o->getCode() == DB_ERROR_NOT_CAPABLE &&
-        !$quirks[$dbh->phptype . ':' . $dbh->dbsyntax]['handles_results'])
-    {
-        return;
-    }
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-    drop_table($dbh, 'phptest_fk');
-
-    die($o->toString());
-}
-
-/**
- * Loop through an array returned from tableInfo(), compare the actual
- * contents to the expected contents.  If the actual results match the
- * expectations, say so.  If not, say so and show the information.
- *
- * @param array   $array     the array to be examined
- * @param string  $expected  the expected contents of the array
- * @param string  $field     field index number of $quriks and table
- * @param boolean $query     true if array is from a query or false if array
- *                           is tableInfo()
- * @return void
- */
-function examineArrayData($array, $expected, $field = false, $query = true) {
-    global $dbh, $quirks;
-
-    $quirk_key = $dbh->phptype . ':' . $dbh->dbsyntax;
-
-    if (DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE) {
-        print "matched expected result\n";
-        return;
-    }
-
-    if (!is_array($array)) {
-        print "This DMBS didn't produce proper results\n";
-        return;
-    }
-
-    if (is_int($field)) {
-        $array = $array[$field];
-    }
-
-    $actual = '';
-    foreach ($array as $key => $value) {
-        if ($field !== false &&
-            isset($quirks[$quirk_key][$field][$key]))
-        {
-            if ($key == 'flags' && $value == '' && $query &&
-                !$quirks[$quirk_key]['finds_table'])
-            {
-                $actual .= "$key ... matched expected value\n";
-            } else {
-                if ($quirks[$quirk_key][$field][$key] == $value) {
-                    $actual .= "$key ... matched expected value\n";
-                } else {
-                    if ($value == 0
-                        && !$quirks[$quirk_key]['size_from_table'])
-                    {
-                        $actual .= "$key ... matched expected value\n";
-                    } else {
-                        $actual .= "$key ... was '$value' but we expected ";
-                        $actual .= "'{$quirks[$quirk_key][$field][$key]}'\n";
-                    }
-                }
-            }
-        } else {
-            if ($key == 'table') {
-                if ($field <= 5) {
-                    if ($value == 'phptest_fk') {
-                        $actual .= "$key ... matched expected value\n";
-                    } else {
-                        if ($value == '' && $query &&
-                            !$quirks[$quirk_key]['finds_table'])
-                        {
-                            $actual .= "$key ... matched expected value\n";
-                        } else {
-                            $actual .= "$key ... was '$value' but we expected 'phptest_fk'\n";
-                        }
-                    }
-                } else {
-                    if ($value == 'phptest') {
-                        $actual .= "$key ... matched expected value\n";
-                    } else {
-                        if ($value == '' && $query &&
-                            !$quirks[$quirk_key]['finds_table'])
-                        {
-                            $actual .= "$key ... matched expected value\n";
-                        } else {
-                            $actual .= "$key ... was '$value' but we expected 'phptest_fk'\n";
-                        }
-                    }
-                }
-            } else {
-                $actual .= "$key => $value\n";
-            }
-        }
-    }
-    if ($actual == $expected) {
-        print "matched expected result\n";
-    } else {
-        print "DIDN'T match expected values...\n";
-        print "~~~~~~~~\nExpected:\n$expected\n";
-        print "~~~~\nActual:\n$actual\n~~~~~~~~\n\n";
-    }
-}
-
-/**
- * Loop through an array of table info data and return the results.
- *
- * @param array  $array  the array to be examined
- * @return string
- */
-function returnArrayData($array) {
-    global $dbh, $quirks;
-
-    $quirk_key = $dbh->phptype . ':' . $dbh->dbsyntax;
-
-    if (!$quirks[$quirk_key]['handles_results']) {
-        return "\n";
-    }
-
-    $out = '';
-    foreach ($array as $key => $value) {
-        $out .= "$key => $value\n";
-    }
-    return $out;
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$quirks = array(
-    'fbsql:fbsql' => array(
-        'clob' => 'CHAR(29)',
-        'date' => 'DATE',
-        'dateliteral' => ' DATE ',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 0,
-            'flags' => '',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 0,
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'CHARACTER',
-            'len' => 29,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 0,
-            'flags' => '',
-        ),
-        4 => array(
-            'type' => 'CHARACTER',
-            'len' => 2,
-            'flags' => '',
-        ),
-        5 => array(
-            'type' => 'DECIMAL',
-            'len' => 0,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'CHARACTER',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'ibase:ibase' => array(
-        'clob' => 'VARCHAR(50)',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 4,
-            'flags' => 'unique_key not_null',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 4,
-            'flags' => 'primary_key not_null',
-        ),
-        2 => array(
-            'type' => 'VARCHAR',
-            'len' => 50,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 4,
-            'flags' => 'unique_key not_null',
-        ),
-        4 => array(
-            'type' => 'CHAR',
-            'len' => 2,
-            'flags' => 'not_null default',
-        ),
-        5 => array(
-            'type' => 'NUMERIC(9,1)',
-            'len' => 4,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'ibase:firebird' => array(
-        'clob' => 'VARCHAR(50)',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 4,
-            'flags' => 'unique_key not_null',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 4,
-            'flags' => 'primary_key not_null',
-        ),
-        2 => array(
-            'type' => 'VARCHAR',
-            'len' => 50,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 4,
-            'flags' => 'unique_key not_null',
-        ),
-        4 => array(
-            'type' => 'CHAR',
-            'len' => 2,
-            'flags' => 'not_null default',
-        ),
-        5 => array(
-            'type' => 'NUMERIC(9,1)',
-            'len' => 4,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'ifx:ifx' => array(
-        'clob' => 'CHAR(29)',
-        'date' => 'CHAR(10)',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'SQLINT',
-            'len' => 4,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'SQLINT',
-            'len' => 4,
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'SQLCHAR',
-            'len' => 29,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'SQLCHAR',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'SQLCHAR',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'SQLDECIMAL',
-            'len' => 513,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'SQLCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'msql:msql' => array(
-        'clob' => 'TEXT(255)',
-        'date' => 'CHAR(10)',
-        'dateliteral' => '',
-        'finds_table' => true,
-        'size_from_table' => true,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'int',
-            'len' => 4,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'int',
-            'len' => 4,
-            // for some reason, the unique property always contains 0
-            // 'flags' => 'unique_key not_null',
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'text',
-            'len' => 255,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'char',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'char',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'real',
-            'len' => 8,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'char',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'mssql:mssql' => array(
-        'clob' => 'TEXT',
-        'date' => 'SMALLDATETIME',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-            'ini_set("mssql.datetimeconvert", "Off");',
-            '$dbh->query("SET DATEFORMAT ymd");',
-        ),
-        0 => array(
-            'type' => 'int',
-            'len' => 4,
-            'flags' => 'multiple_key unique_key not_null',
-        ),
-        1 => array(
-            'type' => 'int',
-            'len' => 4,
-            'flags' => 'primary_key not_null',
-        ),
-        2 => array(
-            'type' => 'text',
-            'len' => 4096,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'datetime',
-            'len' => 4,
-            'flags' => 'multiple_key unique_key not_null',
-        ),
-        4 => array(
-            'type' => 'char',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'real',
-            'len' => 8,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'char',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'mysql:mysql' => array(
-        'clob' => 'TEXT',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => true,
-        'size_from_table' => true,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'not_null multiple_key',
-        ),
-        1 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'not_null primary_key',
-        ),
-        2 => array(
-            'type' => 'blob',
-            'len' => 65535,
-            'flags' => 'blob',
-        ),
-        3 => array(
-            'type' => 'date',
-            'len' => 10,
-            'flags' => 'not_null multiple_key binary',
-        ),
-        4 => array(
-            'type' => 'string',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'real',
-            'len' => 4,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'string',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'mysqli:mysqli' => array(
-        'clob' => 'TEXT',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => true,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'not_null multiple_key',
-        ),
-        1 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'not_null primary_key',
-        ),
-        2 => array(
-            'type' => 'blob',
-            'len' => 65535,
-            'flags' => 'blob',
-        ),
-        3 => array(
-            'type' => 'date',
-            'len' => 10,
-            'flags' => 'not_null multiple_key binary',
-        ),
-        4 => array(
-            'type' => 'string',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'real',
-            'len' => 4,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'string',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'oci8:oci8' => array(
-        'clob' => 'CLOB',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-            '$dbh->query("ALTER SESSION SET NLS_DATE_FORMAT = \'YYYY-MM-DD\'");',
-        ),
-        0 => array(
-            'type' => 'NUMBER',
-            'len' => 22,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'NUMBER',
-            'len' => 22,
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'CLOB',
-            'len' => 4000,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 7,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'CHAR',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'NUMBER',
-            'len' => 22,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'odbc:access' => array(
-        'clob' => 'TEXT',
-        'date' => 'DATETIME',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'LONGCHAR',
-            'len' => 255,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATETIME',
-            'len' => 19,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'VARCHAR',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'DECIMAL',
-            'len' => 15,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'odbc:db2' => array(
-        'clob' => 'CLOB',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        2 => array(
-            'type' => 'CLOB',
-            'len' => 1048576,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 10,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'CHAR',
-            'len' => 2,
-            'flags' => 'not_null',
-        ),
-        5 => array(
-            'type' => 'DECIMAL',
-            'len' => 2,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'pgsql:pgsql' => array(
-        'clob' => 'TEXT',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-            '$dbh->query("SET DATESTYLE = ISO");',
-        ),
-        0 => array(
-            'type' => 'int4',
-            'len' => 4,
-            'flags' => 'not_null unique_key multiple_key',
-        ),
-        1 => array(
-            'type' => 'int4',
-            'len' => 4,
-            'flags' => 'not_null primary_key',
-        ),
-        2 => array(
-            'type' => 'text',
-            'len' => -1,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'date',
-            'len' => 4,
-            'flags' => 'not_null unique_key multiple_key',
-        ),
-        4 => array(
-            'type' => 'bpchar',
-            'len' => -1,
-            'flags' => 'not_null default_%20e',
-        ),
-        5 => array(
-            'type' => 'numeric',
-            'len' => -1,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'varchar',
-            'len' => -1,
-            'flags' => '',
-        ),
-    ),
-
-    'sqlite:sqlite' => array(
-        'clob' => 'CLOB',
-        'date' => 'DATE',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => false,
-        'commands' => array(
-        ),
-        0 => array(
-            'type' => 'INTEGER',
-            'len' => 0,
-            'flags' => 'not_null',
-        ),
-        1 => array(
-            'type' => 'INTEGER',
-            'len' => 0,
-            'flags' => 'primary_key not_null',
-        ),
-        2 => array(
-            'type' => 'CLOB',
-            'len' => 0,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'DATE',
-            'len' => 0,
-            'flags' => 'not_null',
-        ),
-        4 => array(
-            'type' => 'CHAR',
-            'len' => 2,
-            'flags' => 'not_null default_%20e',
-        ),
-        5 => array(
-            'type' => 'DECIMAL',
-            'len' => 2,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'VARCHAR',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-
-    'sybase:sybase' => array(
-        'clob' => 'TEXT',
-        'date' => 'SMALLDATETIME',
-        'dateliteral' => '',
-        'finds_table' => false,
-        'size_from_table' => false,
-        'handles_results' => true,
-        'commands' => array(
-            '$dbh->query("SET DATEFORMAT ymd");',
-        ),
-        0 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'multiple_key unique_key',
-        ),
-        1 => array(
-            'type' => 'int',
-            'len' => 11,
-            'flags' => 'unique_key',
-        ),
-        2 => array(
-            'type' => 'string',
-            'len' => 64512,
-            'flags' => '',
-        ),
-        3 => array(
-            'type' => 'datetime',
-            'len' => 29,
-            'flags' => 'multiple_key unique_key',
-        ),
-        4 => array(
-            'type' => 'string',
-            'len' => 2,
-            'flags' => '',
-        ),
-        5 => array(
-            'type' => 'real',
-            'len' => 4,
-            'flags' => '',
-        ),
-        9 => array(
-            'type' => 'string',
-            'len' => 20,
-            'flags' => '',
-        ),
-    ),
-);
-
-
-$quirk_key = $dbh->phptype . ':' . $dbh->dbsyntax;
-
-if (!isset($quirks[$quirk_key])) {
-    die("This test does not yet support $quirk_key");
-}
-
-if (count($quirks[$quirk_key]['commands'])) {
-    foreach ($quirks[$quirk_key]['commands'] as $value) {
-        eval($value);
-    }
-}
-
-
-$dbh->query('DELETE FROM phptest');
-$dbh->query("INSERT INTO phptest VALUES (1, 'one', 'One', '2001-02-16')");
-$dbh->query("INSERT INTO phptest VALUES (2, 'two', 'Two', '2001-02-15')");
-$dbh->query("INSERT INTO phptest VALUES (3, 'three', 'Three', '2001-02-14')");
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest_fk');
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-if ($quirk_key == 'odbc:access') {
-    $default_e = '';
-    $decimal   = 'NUMERIC';
-} elseif ($quirk_key == 'msql:msql') {
-    $default_e = '';
-    $decimal   = 'REAL';
-} else {
-    $default_e = "DEFAULT ' e'";
-    $decimal   = 'DECIMAL(2,1)';
-}
-
-if ($quirk_key == 'mssql:mssql') {
-    /* We need to reset the expected length of phptest_fk.c to match
-     * @@TEXTSIZE, since the default value seems to vary based on the version
-     * of SQL Server we're talking to and its configuration. */
-    $textsize = $dbh->getOne('SELECT @@TEXTSIZE');
-    if (DB::isError($textsize)) {
-        echo 'Error retrieving @@TEXTSIZE: '.$textsize->getMessage()."\n";
-    } else {
-        $quirks[$quirk_key][2]['len'] = (integer) $textsize;
-    }
-}
-
-// $null is set in mktable.inc
-
-switch ($dbh->phptype) {
-    case 'msql':
-        $dbh->query("
-            CREATE TABLE phptest_fk (
-                a INTEGER NOT NULL,
-                fk INTEGER NOT NULL,
-                cc {$quirks[$quirk_key]['clob']} $null,
-                d {$quirks[$quirk_key]['date']} NOT NULL,
-                e CHAR(2) $default_e NOT NULL,
-                f $decimal $null
-            )
-        ");
-        $dbh->query('CREATE UNIQUE INDEX fkpk ON phptest_fk (fk)');
-        $dbh->query('CREATE UNIQUE INDEX fkuk ON phptest_fk (a, d)');
-        break;
-    default:
-        $dbh->query("
-            CREATE TABLE phptest_fk (
-                a INTEGER NOT NULL,
-                fk INTEGER NOT NULL,
-                cc {$quirks[$quirk_key]['clob']} $null,
-                d {$quirks[$quirk_key]['date']} NOT NULL,
-                e CHAR(2) $default_e NOT NULL,
-                f $decimal $null,
-                PRIMARY KEY (fk),
-                UNIQUE (a, d)
-            )
-        ");
-}
-
-$dbh->query("CREATE INDEX thedidx ON phptest_fk (d)");
-$dbh->query("INSERT INTO phptest_fk VALUES (10, 1, 'One',"
-            . $quirks[$quirk_key]['dateliteral'] . "'2001-02-16',  'c1', 1.1)");
-$dbh->query("INSERT INTO phptest_fk VALUES (20, 2, 'Two',"
-            . $quirks[$quirk_key]['dateliteral'] . "'2001-02-15', 'c2', 2.2)");
-$dbh->query("INSERT INTO phptest_fk VALUES (30, 3, 'Three',"
-            . $quirks[$quirk_key]['dateliteral'] . "'2001-02-14', 'c3', 3.3)");
-
-function &runQuery() {
-    global $dbh, $resultobj;
-
-    $quirk_key = $dbh->phptype . ':' . $dbh->dbsyntax;
-
-    switch ($quirk_key) {
-        case 'odbc:db2':
-            // can't extract blob's this way so make a fake column
-            $query = "SELECT phptest_fk.a, phptest_fk.fk, 'tempxyz' AS cc,"
-                   . ' phptest_fk.d, phptest_fk.e, phptest_fk.f,'
-                   . ' phptest.a, phptest.b, phptest.cc, phptest.d'
-                   . ' FROM phptest_fk, phptest'
-                   . ' WHERE phptest.a = phptest_fk.fk';
-            break;
-        case 'msql:msql':
-            $query = 'SELECT phptest_fk.a, phptest_fk.fk, phptest_fk.cc,'
-                   . ' phptest_fk.d, phptest_fk.e, phptest_fk.f,'
-                   . ' phptest.a, phptest.b, phptest.cc, phptest.d'
-                   . ' FROM phptest_fk, phptest'
-                   . ' WHERE phptest.a = phptest_fk.fk';
-            break;
-        default:
-            $query = 'SELECT phptest_fk.a, phptest_fk.fk, phptest_fk.cc,'
-                   . ' phptest_fk.d, phptest_fk.e, phptest_fk.f,'
-                   . ' phptest.a, phptest.b, phptest.cc, phptest.d'
-                   . ' FROM phptest_fk, phptest'
-                   . ' WHERE phptest.a = phptest_fk.fk';
-    }
-    $resultobj =& $dbh->query($query);
-    return $resultobj;
-}
-
-
-$expected01 = 'table ... matched expected value
-name => a
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected02 = 'table ... matched expected value
-name => fk
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected03 = 'table ... matched expected value
-name => cc
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected04 = 'table ... matched expected value
-name => d
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected05 = 'table ... matched expected value
-name => e
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected06 = 'table ... matched expected value
-name => f
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-$expected10 = 'table ... matched expected value
-name => d
-type ... matched expected value
-len ... matched expected value
-flags ... matched expected value
-';
-
-
-
-print "\n==========================================\n";
-print "Passing result OBJECT to method in DB_<type>.\n";
-print "Output = default.\n";
-print "------------------------------------------\n";
-$resultobj =& runQuery();
-// This numRows call provides a regression test for bug #4388.
-$resultobj->numRows();
-$array = $dbh->tableInfo($resultobj);
-
-print "\ncolumn 0:\n";
-examineArrayData($array, $expected01, 0);
-
-print "\ncolumn 9:\n";
-examineArrayData($array, $expected10, 9);
-
-
-print "\n==========================================\n";
-print "Passing result ID to method in DB_<type>.\n";
-print "Output = DB_TABLEINFO_ORDER.\n";
-print "------------------------------------------\n";
-$resultobj =& runQuery();
-$array = $dbh->tableInfo($resultobj->result, DB_TABLEINFO_ORDER);
-
-print "\ncolumn 0:\n";
-examineArrayData($array, $expected01, 0);
-
-print "\ncolumn 3:\n";
-examineArrayData($array, $expected04, 3);
-
-print "\nnum_fields: ";
-if ($quirks[$quirk_key]['handles_results'] && $array['num_fields'] == 10) {
-    print "matched expected result\n";
-} elseif (DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE) {
-    print "matched expected result\n";
-} else {
-    print "This DMBS didn't produce proper results\n";
-}
-
-print "\norder:\n";
-if ($quirks[$quirk_key]['handles_results'] && is_array($array['order'])) {
-    $expected = 'a => 6
-b => 7
-cc => 8
-d => 9
-e => 4
-f => 5
-fk => 1
-';
-    ksort($array['order']);
-    examineArrayData($array['order'], $expected);
-} elseif (DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE) {
-    print "matched expected result\n";
-} else {
-    print "This DMBS didn't produce proper results\n";
-}
-
-
-
-print "\n==========================================\n";
-print "Passing DB_TABLEINFO_ORDERTABLE to method in DB_result.\n";
-print "Output = DB_TABLEINFO_ORDERTABLE.\n";
-print "------------------------------------------\n";
-$resultobj =& runQuery();
-$array = $resultobj->tableInfo(DB_TABLEINFO_ORDERTABLE);
-// Free this to keep interbase happy.
-$resultobj->free();
-
-print "\ncolumn 0:\n";
-examineArrayData($array, $expected01, 0);
-
-print "\ncolumn 3:\n";
-examineArrayData($array, $expected04, 3);
-
-print "\nnum_fields: ";
-if ($quirks[$quirk_key]['handles_results'] && $array['num_fields'] == 10) {
-    print "matched expected result\n";
-} elseif (DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE) {
-    print "matched expected result\n";
-} else {
-    print "This DMBS didn't produce proper results\n";
-}
-
-
-print 'ordertable[phptest]: ';
-$expected = 'a => 6
-b => 7
-cc => 8
-d => 9
-';
-if ($quirks[$quirk_key]['handles_results']
-    && isset($array['ordertable']['phptest'])) {
-    $actual = returnArrayData($array['ordertable']['phptest']);
-} else {
-    $actual = '';
-}
-if ($actual == $expected) {
-    print "matched expected result\n";
-} else {
-    if (($quirks[$quirk_key]['finds_table'] === false 
-        || DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE)
-        && $actual == '') {
-        print "matched expected result\n";
-    } else {
-        print "DIDN'T match expected values...\n";
-        print "~~~~~~~~\nExpected:\n$expected\n";
-        print "~~~~\nActual:\n$actual\n~~~~~~~~\n\n";
-    }
-}
-
-
-print 'ordertable[phptest_fk]: ';
-$expected = 'a => 0
-fk => 1
-cc => 2
-d => 3
-e => 4
-f => 5
-';
-if ($quirks[$quirk_key]['handles_results']
-    && isset($array['ordertable']['phptest_fk'])) {
-    $actual = returnArrayData($array['ordertable']['phptest_fk']);
-} else {
-    $actual = '';
-}
-if ($actual == $expected) {
-    print "matched expected result\n";
-} else {
-    if (($quirks[$quirk_key]['finds_table'] === false 
-        || DB::isError($array) && $array->getCode() == DB_ERROR_NOT_CAPABLE)
-        && $actual == '') {
-        print "matched expected result\n";
-    } else {
-        print "DIDN'T match expected values...\n";
-        print "~~~~~~~~\nExpected:\n$expected\n";
-        print "~~~~\nActual:\n$actual\n~~~~~~~~\n\n";
-    }
-}
-
-
-print "\n==========================================\n";
-print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.\n";
-print "Output = default.\n";
-print "------------------------------------------\n";
-$array = $dbh->tableInfo('phptest_fk');
-
-print "\ncolumn 0:\n";
-examineArrayData($array, $expected01, 0, false);
-
-print "\ncolumn 1:\n";
-examineArrayData($array, $expected02, 1, false);
-
-print "\ncolumn 2:\n";
-examineArrayData($array, $expected03, 2, false);
-
-print "\ncolumn 3:\n";
-examineArrayData($array, $expected04, 3, false);
-
-print "\ncolumn 4:\n";
-examineArrayData($array, $expected05, 4, false);
-
-print "\ncolumn 5:\n";
-examineArrayData($array, $expected06, 5, false);
-
-
-print "\n==========================================\n";
-print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.\n";
-print "Output = DB_TABLEINFO_FULL.\n";
-print "------------------------------------------\n";
-$array = $dbh->tableInfo('phptest_fk', DB_TABLEINFO_FULL);
-
-print "\ncolumn 0:\n";
-examineArrayData($array, $expected01, 0, false);
-
-print "\norder:\n";
-$expect ='a => 0
-fk => 1
-cc => 2
-d => 3
-e => 4
-f => 5
-';
-examineArrayData($array['order'], $expect, false, false);
-
-print "\nordertable[phptest_fk]:\n";
-$expect ='a => 0
-fk => 1
-cc => 2
-d => 3
-e => 4
-f => 5
-';
-examineArrayData($array['ordertable']['phptest_fk'], $expect);
-
-
-
-print "\n==========================================\n";
-print "Passing TABLE NAME 'phptest_fk' to method in DB_<driver> AGAIN.\n";
-print "Output = DB_TABLEINFO_FULL, lowercasing turned off.\n";
-print "------------------------------------------\n";
-$dbh->setOption('portability', DB_PORTABILITY_ALL ^ DB_PORTABILITY_LOWERCASE);
-$array = $dbh->tableInfo('phptest_fk', DB_TABLEINFO_FULL);
-
-// testing non-lowercasing above to ensure program doesn't die.
-// lowercase the names here to ensure test uniformity.
-$array[0]['table'] = strtolower($array[0]['table']);
-$array[0]['name'] = strtolower($array[0]['name']);
-
-print "\ncolumn 0:\n";
-examineArrayData($array, 0, false);
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
-drop_table($dbh, 'phptest_fk');
-
-?>
---EXPECT--
-==========================================
-Passing result OBJECT to method in DB_<type>.
-Output = default.
-------------------------------------------
-
-column 0:
-matched expected result
-
-column 9:
-matched expected result
-
-==========================================
-Passing result ID to method in DB_<type>.
-Output = DB_TABLEINFO_ORDER.
-------------------------------------------
-
-column 0:
-matched expected result
-
-column 3:
-matched expected result
-
-num_fields: matched expected result
-
-order:
-matched expected result
-
-==========================================
-Passing DB_TABLEINFO_ORDERTABLE to method in DB_result.
-Output = DB_TABLEINFO_ORDERTABLE.
-------------------------------------------
-
-column 0:
-matched expected result
-
-column 3:
-matched expected result
-
-num_fields: matched expected result
-ordertable[phptest]: matched expected result
-ordertable[phptest_fk]: matched expected result
-
-==========================================
-Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.
-Output = default.
-------------------------------------------
-
-column 0:
-matched expected result
-
-column 1:
-matched expected result
-
-column 2:
-matched expected result
-
-column 3:
-matched expected result
-
-column 4:
-matched expected result
-
-column 5:
-matched expected result
-
-==========================================
-Passing TABLE NAME 'phptest_fk' to method in DB_<driver>.
-Output = DB_TABLEINFO_FULL.
-------------------------------------------
-
-column 0:
-matched expected result
-
-order:
-matched expected result
-
-ordertable[phptest_fk]:
-matched expected result
-
-==========================================
-Passing TABLE NAME 'phptest_fk' to method in DB_<driver> AGAIN.
-Output = DB_TABLEINFO_FULL, lowercasing turned off.
-------------------------------------------
-
-column 0:
-matched expected result
diff --git a/lib/tests/DB/tests/driver/17query.phpt b/lib/tests/DB/tests/driver/17query.phpt
deleted file mode 100644
index eb934c11c43586189bf498b84f6feb41c5a137a0..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/17query.phpt
+++ /dev/null
@@ -1,170 +0,0 @@
---TEST--
-DB_driver::query
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-
-/**
- * Calls the query() method in various ways against any DBMS.
- *
- * @see      DB_common::query()
- * 
- * @package  DB
- * @version  $Id: 17query.phpt,v 1.19 2007/09/21 15:14:26 aharvey Exp $
- * @category Database
- * @author   Daniel Convissor <danielc@analysisandsolutions.com>
- * @internal
- */
-
-chdir(dirname(__FILE__));
-require_once './skipif.inc';
-
-?>
---FILE--
-<?php
-
-// $Id: 17query.phpt,v 1.19 2007/09/21 15:14:26 aharvey Exp $
-
-/**
- * Connect to the database and make the phptest table.
- */
-require_once './mktable.inc';
-
-
-/**
- * Local error callback handler.
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-
-
-$res =& $dbh->query('DELETE FROM phptest WHERE a = 17');
-print '1) delete: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$res =& $dbh->query("INSERT INTO phptest (a, b, cc) VALUES (17, 'one', 'One')");
-print '2) insert: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$res =& $dbh->query('INSERT INTO phptest (a, b, cc) VALUES (?, ?, ?)', array(17, 'two', 'Two'));
-print '3) insert: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-
-$res =& $dbh->query('SELECT a, b FROM phptest WHERE a = 17');
-$row = $res->fetchRow();
-print "4) a = {$row['a']}, b = {$row['b']}\n";
-$res->free();  // keep fbsql happy.
-
-$res =& $dbh->query('SELECT a, b FROM phptest WHERE cc = ?', array('Two'));
-$row = $res->fetchRow();
-print "5) a = {$row['a']}, b = {$row['b']}\n";
-
-
-$array = array(
-    'foo' => 11,
-    'bar' => 'three',
-    'baz' => null,
-);
-$res =& $dbh->query('INSERT INTO phptest (a, b, d) VALUES (?, ?, ?)', $array);
-print '6) insert: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$res =& $dbh->query('SELECT a, b, d FROM phptest WHERE a = ?', 11);
-$row = $res->fetchRow();
-print "7) a = {$row['a']}, b = {$row['b']}, d = ";
-if ($dbh->phptype == 'msql') {
-    if (array_key_exists('d', $row)) {
-        $type = gettype($row['d']);
-        if ($type == 'NULL' || $row['d'] == '') {
-            print "got expected value\n";
-        } else {
-            print "ERR: expected d's type to be NULL but it's $type and the value is ";
-            print $row['d'] . "\n";
-        }
-    } else {
-        // http://bugs.php.net/?id=31960
-        print "Prior to PHP 4.3.11 or 5.0.4, PHP's msql extension silently"
-              . " dropped columns with null values. You need to upgrade.\n";
-    }
-} else {
-    $type = gettype($row['d']);
-    if ($type == 'NULL' || $row['d'] == '') {
-        print "got expected value\n";
-    } else {
-        print "ERR: expected d's type to be NULL but it's $type and the value is ";
-        print $row['d'] . "\n";
-    }
-}
-
-
-$res =& $dbh->query('DELETE FROM phptest WHERE a = ?', array(17));
-print '8) delete: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$res =& $dbh->query('DELETE FROM phptest WHERE a = ?', array(0));
-print '9) delete with array(0) as param: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$res =& $dbh->query('DELETE FROM phptest WHERE a = ?', 0);
-print '10) delete with 0 as param: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$dbh->nextQueryIsManip(true);
-$res =& $dbh->query('SELECT * FROM phptest');
-print '11) query is manip (with override): ' . ($dbh->_last_query_manip ? 'true' : 'false') . "\n";
-
-$dbh->nextQueryIsManip(false);
-$res =& $dbh->query('SELECT * FROM phptest');
-print '12) query is manip (without override): ' . ($dbh->_last_query_manip ? 'true' : 'false') . "\n";
-
-// This one's here for bug #11716.
-if ($dbh->phptype == 'msql' || $dbh->phptype == 'ibase' || $dbh->phptype == 'oci8') {
-    // Some databases don't support quoted identifiers. They are full of lose.
-    $res =& $dbh->query('SELECT a FROM phptest');
-} else {
-    $res =& $dbh->query('SELECT '.$dbh->quoteIdentifier('a').' FROM phptest');
-}
-
-print '13) select with quoteIdentifier: ';
-$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
-if (isset($row['a'])) {
-    if ($row['a'] == 42) {
-        print "okay\n";
-    } else {
-        print "field value incorrect\n";
-    }
-} else {
-    print "expected field not in row\n";
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
-
-?>
---EXPECT--
-1) delete: okay
-2) insert: okay
-3) insert: okay
-4) a = 17, b = one
-5) a = 17, b = two
-6) insert: okay
-7) a = 11, b = three, d = got expected value
-8) delete: okay
-9) delete with array(0) as param: okay
-10) delete with 0 as param: okay
-11) query is manip (with override): true
-12) query is manip (without override): false
-13) select with quoteIdentifier: okay
diff --git a/lib/tests/DB/tests/driver/18get.phpt b/lib/tests/DB/tests/driver/18get.phpt
deleted file mode 100644
index 49d1eeb3d2c15facd75cdf358f407ddf93b4503c..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/18get.phpt
+++ /dev/null
@@ -1,661 +0,0 @@
---TEST--
-DB_driver::get
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-
-/**
- * Calls the get*() methods in various ways against any DBMS.
- *
- * @see DB_Common::getAll(), DB_Common::getAssoc(), DB_Common::getCol()
- *      DB_Common::getListOf(), DB_Common::getOne(), DB_Common::getRow()
- *
- * @package  DB
- * @version  $Id: 18get.phpt,v 1.11 2007/01/08 00:19:48 aharvey Exp $
- * @category Database
- * @author   Daniel Convissor <danielc@analysisandsolutions.com>
- * @internal
- */
-
-chdir(dirname(__FILE__));
-require_once './skipif.inc';
-
-?>
---FILE--
-<?php
-
-// $Id: 18get.phpt,v 1.11 2007/01/08 00:19:48 aharvey Exp $
-
-/**
- * Connect to the database and make the <kbd>phptest</kbd> table.
- */
-require_once './mktable.inc';
-
-
-/**
- * Local error callback handler.
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o){
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$dbh->query("INSERT INTO phptest VALUES (2, 'two', 'Two', '2002-02-22')");
-$dbh->query("INSERT INTO phptest VALUES (42, 'three', 'Three', '2003-03-23')");
-
-
-print "===================================================\n";
-print 'testing getOne: ';
-$ret =& $dbh->getOne("SELECT * FROM phptest WHERE cc = 'Two'");
-print_r($ret);
-print "\n";
-
-print 'testing getOne with string params: ';
-$ret =& $dbh->getOne('SELECT * FROM phptest WHERE cc = ?', 'Three');
-print_r($ret);
-print "\n";
-
-print 'testing getOne with array params: ';
-$ret =& $dbh->getOne('SELECT * FROM phptest WHERE cc = ?', array('Two'));
-print_r($ret);
-print "\n";
-
-print "\n===================================================\n";
-print "testing getRow:\n";
-$ret =& $dbh->getRow("SELECT * FROM phptest WHERE cc = 'Two'");
-print_r($ret);
-
-print "testing getRow with null params, DB_FETCHMODE_ORDERED:\n";
-$ret =& $dbh->getRow("SELECT * FROM phptest WHERE cc = 'Two'",
-        null, DB_FETCHMODE_ORDERED);
-print_r($ret);
-
-// THIS DOESN'T WORK DUE TO BACKWARDS COMPATIBILITY CRAP
-// print "testing getRow with string params, DB_FETCHMODE_ORDERED:\n";
-// $ret =& $dbh->getRow('SELECT * FROM phptest WHERE cc = ?',
-//         'Two', DB_FETCHMODE_ORDERED);
-// print_r($ret);
-//
-// testing getRow with string params, DB_FETCHMODE_ORDERED:
-// Array
-// (
-//     [0] => 2
-//     [1] => two
-//     [2] => Two
-//     [3] => 2002-02-22
-// )
-
-   print "testing getRow with REVERSED args: DB_FETCHMODE_ASSOC, array params:\n";
-   $ret =& $dbh->getRow('SELECT * FROM phptest WHERE cc = ?',
-           DB_FETCHMODE_ASSOC, array('Two'));
-   print_r($ret);
-   
-   print "testing getRow with REVERSED args: DB_FETCHMODE_ASSOC:\n";
-   $ret =& $dbh->getRow("SELECT * FROM phptest WHERE cc = 'Two'",
-           DB_FETCHMODE_ASSOC);
-   print_r($ret);
-
-print "testing getRow with array params, DB_FETCHMODE_ASSOC:\n";
-$ret =& $dbh->getRow('SELECT * FROM phptest WHERE cc = ?',
-        array('Two'), DB_FETCHMODE_ASSOC);
-print_r($ret);
-
-print "testing getRow with array params, DB_FETCHMODE_OBJECT:\n";
-$ret =& $dbh->getRow('SELECT * FROM phptest WHERE cc = ?',
-        array('Two'), DB_FETCHMODE_OBJECT);
-print_r($ret);
-
-
-print "\n===================================================\n";
-print "testing getCol:\n";
-$ret =& $dbh->getCol("SELECT * FROM phptest ORDER BY b");
-print_r($ret);
-
-print "testing getCol on query with no records:\n";
-$ret =& $dbh->getCol('SELECT * FROM phptest WHERE a > 200');
-print_r($ret);
-
-print "testing getCol with invalid column id:\n";
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-$ret =& $dbh->getCol('SELECT b FROM phptest ORDER BY b', 1);
-if (DB::isError($ret)) {
-    echo $ret->getMessage() . "\n";
-} else {
-    print ">> Should have produced 'no such field' error\n";
-}
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-print "testing getCol with 1 col:\n";
-$ret =& $dbh->getCol("SELECT * FROM phptest ORDER BY b", 1);
-print_r($ret);
-
-print "testing getCol with b col:\n";
-$ret =& $dbh->getCol("SELECT * FROM phptest ORDER BY b", 'b');
-print_r($ret);
-
-print "testing getCol with b col, scalar params:\n";
-$ret =& $dbh->getCol("SELECT * FROM phptest WHERE a < ? ORDER BY b",
-        'b', 100);
-print_r($ret);
-
-print "testing getCol with b col, array params:\n";
-$ret =& $dbh->getCol("SELECT * FROM phptest WHERE a < ? ORDER BY b",
-        'b', array(100));
-print_r($ret);
-
-
-print "\n===================================================\n";
-print "testing getAssoc:\n";
-$ret =& $dbh->getAssoc('SELECT a, b, cc FROM phptest WHERE a < 100 ORDER BY b');
-print_r($ret);
-
-print "testing getAssoc with false force, null params, DB_FETCHMODE_ORDERED:\n";
-$ret =& $dbh->getAssoc("SELECT a, b, cc FROM phptest WHERE a < 100 ORDER BY b",
-                        false, null, DB_FETCHMODE_ORDERED);
-print_r($ret);
-
-print "testing getAssoc with false force, scalar params, DB_FETCHMODE_ASSOC:\n";
-$ret =& $dbh->getAssoc('SELECT a, b, cc FROM phptest WHERE a < ? ORDER BY b',
-                        false, 100, DB_FETCHMODE_ASSOC);
-print_r($ret);
-
-print "testing getAssoc with two cols, false force, scalar params, DB_FETCHMODE_ASSOC:\n";
-$ret =& $dbh->getAssoc('SELECT a, b FROM phptest WHERE a < ? ORDER BY b',
-                        false, 100, DB_FETCHMODE_ASSOC);
-print_r($ret);
-
-print "testing getAssoc with two cols, true force, scalar params, DB_FETCHMODE_ASSOC:\n";
-$ret =& $dbh->getAssoc('SELECT a, b FROM phptest WHERE a < ? ORDER BY b',
-                        true, 100, DB_FETCHMODE_ASSOC);
-print_r($ret);
-
-print "testing getAssoc with false force, scalar params, DB_FETCHMODE_ASSOC, true group:\n";
-$ret =& $dbh->getAssoc('SELECT a, b, cc FROM phptest WHERE a < ? ORDER BY b',
-                        false, 100, DB_FETCHMODE_ASSOC, true);
-print_r($ret);
-
-print "testing getAssoc with false force, array params, DB_FETCHMODE_OBJECT:\n";
-$ret =& $dbh->getAssoc('SELECT a, b, cc FROM phptest WHERE a < ? ORDER BY b',
-                        false, array(100), DB_FETCHMODE_OBJECT);
-print_r($ret);
-
-print "testing getAssoc with true force, array params, DB_FETCHMODE_OBJECT, true group:\n";
-$ret =& $dbh->getAssoc('SELECT a, b, cc FROM phptest WHERE a < ? ORDER BY b',
-                        false, array(100), DB_FETCHMODE_OBJECT, true);
-print_r($ret);
-
-
-print "\n===================================================\n";
-print "testing getAll:\n";
-$ret =& $dbh->getAll("SELECT * FROM phptest WHERE cc = 'Two' OR cc = 'Three'");
-print_r($ret);
-
-print "testing getAll with null params, DB_FETCHMODE_ORDERED:\n";
-$ret =& $dbh->getAll("SELECT * FROM phptest WHERE cc = 'Two' OR cc = 'Three'",
-        null, DB_FETCHMODE_ORDERED);
-print_r($ret);
-
-// THIS DOESN'T WORK DUE TO BACKWARDS COMPATIBILITY CRAP
-// print "testing getAll with string params, DB_FETCHMODE_ORDERED:\n";
-// $ret =& $dbh->getAll('SELECT * FROM phptest WHERE cc = ?',
-//         'Two', DB_FETCHMODE_ORDERED);
-// print_r($ret);
-//
-// testing getAll with string params, DB_FETCHMODE_ORDERED:
-// Array
-// (
-//     [0] => 2
-//     [1] => two
-//     [2] => Two
-//     [3] => 2002-02-22
-// )
-
-   print "testing getAll with REVERSED args: DB_FETCHMODE_ASSOC, array params:\n";
-   $ret =& $dbh->getAll('SELECT * FROM phptest WHERE cc = ? OR cc = ? ORDER BY cc',
-           DB_FETCHMODE_ASSOC, array('Two', 'Three'));
-   print_r($ret);
-   
-   print "testing getAll with REVERSED args: DB_FETCHMODE_ASSOC:\n";
-   $ret =& $dbh->getAll("SELECT * FROM phptest WHERE cc = 'Two' OR cc = 'Three'",
-           DB_FETCHMODE_ASSOC);
-   print_r($ret);
-
-print "testing getAll with array params, DB_FETCHMODE_ASSOC:\n";
-$ret =& $dbh->getAll('SELECT * FROM phptest WHERE cc = ? OR cc = ? ORDER BY cc',
-        array('Two', 'Three'), DB_FETCHMODE_ASSOC);
-print_r($ret);
-
-print "testing getAll with array params, DB_FETCHMODE_OBJECT:\n";
-$ret =& $dbh->getAll('SELECT * FROM phptest WHERE cc = ? OR cc = ? ORDER BY cc',
-        array('Two', 'Three'), DB_FETCHMODE_OBJECT);
-print_r($ret);
-
-
-print "\n===================================================\n";
-print 'testing getOne with null value in column: ';
-$dbh->query("INSERT INTO phptest VALUES (9, 'nine', '', NULL)");
-$ret =& $dbh->getOne('SELECT d FROM phptest WHERE a = 9');
-if ($ret === '') {
-    print "matches expected result\n";
-} else {
-    if ($dbh->phptype == 'msql') {
-        if (gettype($ret) == 'NULL') {
-            // msql doesn't even return the column.  Joy! :)
-            // http://bugs.php.net/?id=31960
-            print "matches expected result\n";
-        } else {
-            print "WOW, mSQL now returns columns that have NULLS in them\n";
-        }
-    } else {
-        print 'type=' . gettype($ret) . ", value=$ret\n";
-    }
-}
-
-print 'testing getOne with empty string in column: ';
-$ret =& $dbh->getOne('SELECT cc FROM phptest WHERE a = 9');
-if ($ret === '') {
-    print "empty string\n";
-} else {
-    print 'type=' . gettype($ret) . ", value=$ret\n";
-}
-
-
-print "\n===================================================\n";
-
-
-drop_table($dbh, 'phptest');
-
-
-?>
---EXPECT--
-===================================================
-testing getOne: 2
-testing getOne with string params: 42
-testing getOne with array params: 2
-
-===================================================
-testing getRow:
-Array
-(
-    [0] => 2
-    [1] => two
-    [2] => Two
-    [3] => 2002-02-22
-)
-testing getRow with null params, DB_FETCHMODE_ORDERED:
-Array
-(
-    [0] => 2
-    [1] => two
-    [2] => Two
-    [3] => 2002-02-22
-)
-testing getRow with REVERSED args: DB_FETCHMODE_ASSOC, array params:
-Array
-(
-    [a] => 2
-    [b] => two
-    [cc] => Two
-    [d] => 2002-02-22
-)
-testing getRow with REVERSED args: DB_FETCHMODE_ASSOC:
-Array
-(
-    [a] => 2
-    [b] => two
-    [cc] => Two
-    [d] => 2002-02-22
-)
-testing getRow with array params, DB_FETCHMODE_ASSOC:
-Array
-(
-    [a] => 2
-    [b] => two
-    [cc] => Two
-    [d] => 2002-02-22
-)
-testing getRow with array params, DB_FETCHMODE_OBJECT:
-stdClass Object
-(
-    [a] => 2
-    [b] => two
-    [cc] => Two
-    [d] => 2002-02-22
-)
-
-===================================================
-testing getCol:
-Array
-(
-    [0] => 42
-    [1] => 42
-    [2] => 2
-)
-testing getCol on query with no records:
-Array
-(
-)
-testing getCol with invalid column id:
-DB Error: no such field
-testing getCol with 1 col:
-Array
-(
-    [0] => bing
-    [1] => three
-    [2] => two
-)
-testing getCol with b col:
-Array
-(
-    [0] => bing
-    [1] => three
-    [2] => two
-)
-testing getCol with b col, scalar params:
-Array
-(
-    [0] => bing
-    [1] => three
-    [2] => two
-)
-testing getCol with b col, array params:
-Array
-(
-    [0] => bing
-    [1] => three
-    [2] => two
-)
-
-===================================================
-testing getAssoc:
-Array
-(
-    [42] => Array
-        (
-            [0] => three
-            [1] => Three
-        )
-
-    [2] => Array
-        (
-            [0] => two
-            [1] => Two
-        )
-
-)
-testing getAssoc with false force, null params, DB_FETCHMODE_ORDERED:
-Array
-(
-    [42] => Array
-        (
-            [0] => three
-            [1] => Three
-        )
-
-    [2] => Array
-        (
-            [0] => two
-            [1] => Two
-        )
-
-)
-testing getAssoc with false force, scalar params, DB_FETCHMODE_ASSOC:
-Array
-(
-    [42] => Array
-        (
-            [b] => three
-            [cc] => Three
-        )
-
-    [2] => Array
-        (
-            [b] => two
-            [cc] => Two
-        )
-
-)
-testing getAssoc with two cols, false force, scalar params, DB_FETCHMODE_ASSOC:
-Array
-(
-    [42] => three
-    [2] => two
-)
-testing getAssoc with two cols, true force, scalar params, DB_FETCHMODE_ASSOC:
-Array
-(
-    [42] => Array
-        (
-            [b] => three
-        )
-
-    [2] => Array
-        (
-            [b] => two
-        )
-
-)
-testing getAssoc with false force, scalar params, DB_FETCHMODE_ASSOC, true group:
-Array
-(
-    [42] => Array
-        (
-            [0] => Array
-                (
-                    [b] => bing
-                    [cc] => This is a test
-                )
-
-            [1] => Array
-                (
-                    [b] => three
-                    [cc] => Three
-                )
-
-        )
-
-    [2] => Array
-        (
-            [0] => Array
-                (
-                    [b] => two
-                    [cc] => Two
-                )
-
-        )
-
-)
-testing getAssoc with false force, array params, DB_FETCHMODE_OBJECT:
-Array
-(
-    [42] => stdClass Object
-        (
-            [a] => 42
-            [b] => three
-            [cc] => Three
-        )
-
-    [2] => stdClass Object
-        (
-            [a] => 2
-            [b] => two
-            [cc] => Two
-        )
-
-)
-testing getAssoc with true force, array params, DB_FETCHMODE_OBJECT, true group:
-Array
-(
-    [42] => Array
-        (
-            [0] => stdClass Object
-                (
-                    [a] => 42
-                    [b] => bing
-                    [cc] => This is a test
-                )
-
-            [1] => stdClass Object
-                (
-                    [a] => 42
-                    [b] => three
-                    [cc] => Three
-                )
-
-        )
-
-    [2] => Array
-        (
-            [0] => stdClass Object
-                (
-                    [a] => 2
-                    [b] => two
-                    [cc] => Two
-                )
-
-        )
-
-)
-
-===================================================
-testing getAll:
-Array
-(
-    [0] => Array
-        (
-            [0] => 2
-            [1] => two
-            [2] => Two
-            [3] => 2002-02-22
-        )
-
-    [1] => Array
-        (
-            [0] => 42
-            [1] => three
-            [2] => Three
-            [3] => 2003-03-23
-        )
-
-)
-testing getAll with null params, DB_FETCHMODE_ORDERED:
-Array
-(
-    [0] => Array
-        (
-            [0] => 2
-            [1] => two
-            [2] => Two
-            [3] => 2002-02-22
-        )
-
-    [1] => Array
-        (
-            [0] => 42
-            [1] => three
-            [2] => Three
-            [3] => 2003-03-23
-        )
-
-)
-testing getAll with REVERSED args: DB_FETCHMODE_ASSOC, array params:
-Array
-(
-    [0] => Array
-        (
-            [a] => 42
-            [b] => three
-            [cc] => Three
-            [d] => 2003-03-23
-        )
-
-    [1] => Array
-        (
-            [a] => 2
-            [b] => two
-            [cc] => Two
-            [d] => 2002-02-22
-        )
-
-)
-testing getAll with REVERSED args: DB_FETCHMODE_ASSOC:
-Array
-(
-    [0] => Array
-        (
-            [a] => 2
-            [b] => two
-            [cc] => Two
-            [d] => 2002-02-22
-        )
-
-    [1] => Array
-        (
-            [a] => 42
-            [b] => three
-            [cc] => Three
-            [d] => 2003-03-23
-        )
-
-)
-testing getAll with array params, DB_FETCHMODE_ASSOC:
-Array
-(
-    [0] => Array
-        (
-            [a] => 42
-            [b] => three
-            [cc] => Three
-            [d] => 2003-03-23
-        )
-
-    [1] => Array
-        (
-            [a] => 2
-            [b] => two
-            [cc] => Two
-            [d] => 2002-02-22
-        )
-
-)
-testing getAll with array params, DB_FETCHMODE_OBJECT:
-Array
-(
-    [0] => stdClass Object
-        (
-            [a] => 42
-            [b] => three
-            [cc] => Three
-            [d] => 2003-03-23
-        )
-
-    [1] => stdClass Object
-        (
-            [a] => 2
-            [b] => two
-            [cc] => Two
-            [d] => 2002-02-22
-        )
-
-)
-
-===================================================
-testing getOne with null value in column: matches expected result
-testing getOne with empty string in column: empty string
-
-===================================================
diff --git a/lib/tests/DB/tests/driver/19getlistof.phpt b/lib/tests/DB/tests/driver/19getlistof.phpt
deleted file mode 100644
index c89eac4aa81a53d3ed09670db4919c9722699850..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/19getlistof.phpt
+++ /dev/null
@@ -1,225 +0,0 @@
---TEST--
-DB_driver::getListOf
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
---FILE--
-<?php
-
-require_once './mktable.inc';
-
-/*
- * An array with keys containing the $type to be passed to the getListOf()
- * method.  The values of the main array are a sub-array that has keys
- * listing the phptype and dbsyntax of each driver and values of the
- * result expected from the combination of all these factors.
- */
-$tests = array(
-    'tables' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => 'array',
-        'ibase:ibase' => 'array',
-        'ibase:firebird' => 'array',
-        'ifx:ifx' => 'array',
-        'msql:msql' => 'array',
-        'mssql:mssql' => 'array',
-        'mysql:mysql' => 'array',
-        'mysqli:mysqli' => 'array',
-        'oci8:oci8' => 'array',
-        'odbc:access' => 'array',
-        'odbc:db2' => 'array',
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => 'array',
-        'sybase:sybase' => 'array',
-    ),
-    'views' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => 'array',
-        'ibase:ibase' => 'array',
-        'ibase:firebird' => 'array',
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => 'array',
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => 'array',
-        'odbc:access' => 'array',
-        'odbc:db2' => 'array',
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => 'array',
-    ),
-    'users' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => 'array',
-        'ibase:ibase' => 'array',
-        'ibase:firebird' => 'array',
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_ACCESS_VIOLATION,
-        'mysqli:mysqli' => DB_ERROR_ACCESS_VIOLATION,
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => DB_ERROR_UNSUPPORTED,
-        'odbc:db2' => DB_ERROR_UNSUPPORTED,
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'databases' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => DB_ERROR_UNSUPPORTED,
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => 'array',
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => 'array',
-        'mysqli:mysqli' => 'array',
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => 'array',
-        'odbc:db2' => 'array',
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'functions' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => 'array',
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => DB_ERROR_UNSUPPORTED,
-        'odbc:db2' => DB_ERROR_UNSUPPORTED,
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'procedures' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => 'array',
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => DB_ERROR_UNSUPPORTED,
-        'odbc:db2' => DB_ERROR_UNSUPPORTED,
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'schema.tables' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => DB_ERROR_UNSUPPORTED,
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => 'array',
-        'odbc:db2' => 'array',
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'schema.views' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => DB_ERROR_UNSUPPORTED,
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => DB_ERROR_UNSUPPORTED,
-        'odbc:access' => DB_ERROR_UNSUPPORTED,
-        'odbc:db2' => DB_ERROR_UNSUPPORTED,
-        'pgsql:pgsql' => 'array',
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-    'synonyms' => array(
-        'dbase:dbase' => DB_ERROR_UNSUPPORTED,
-        'fbsql:fbsql' => DB_ERROR_UNSUPPORTED,
-        'ibase:ibase' => DB_ERROR_UNSUPPORTED,
-        'ibase:firebird' => DB_ERROR_UNSUPPORTED,
-        'ifx:ifx' => DB_ERROR_UNSUPPORTED,
-        'msql:msql' => DB_ERROR_UNSUPPORTED,
-        'mssql:mssql' => DB_ERROR_UNSUPPORTED,
-        'mysql:mysql' => DB_ERROR_UNSUPPORTED,
-        'mysqli:mysqli' => DB_ERROR_UNSUPPORTED,
-        'oci8:oci8' => 'array',
-        'odbc:access' => DB_ERROR_UNSUPPORTED,
-        'odbc:db2' => DB_ERROR_UNSUPPORTED,
-        'pgsql:pgsql' => DB_ERROR_UNSUPPORTED,
-        'sqlite:sqlite' => DB_ERROR_UNSUPPORTED,
-        'sybase:sybase' => DB_ERROR_UNSUPPORTED,
-    ),
-);
-
-/**
- * Determine if the output from the driver matches what we expect
- *
- * If things are as we expect, nothing is printed out.
- *
- * If things go wrong, print "UNEXPECTED OUTCOME" and display
- * what happened.
- *
- * @param mixed  $result    the result from getListOf
- * @param mixed  $expected  the expected result
- * @param string $name      the name of the current test
- *
- * @return void
- */
-function check_output($result, $expected, $name) {
-    if (is_object($result)) {
-        if ($result->getCode() !== $expected) {
-            echo "UNEXPECTED OUTCOME FOR $name...\n";
-            echo $result->getDebugInfo() . "\n";
-        }
-    } else {
-        $type = gettype($result);
-        if ($type != $expected) {
-            if ($expected === DB_ERROR_ACCESS_VIOLATION
-                && $type == 'array')
-            {
-                // This user has access to the mysql table.
-                // Not a problem
-            } else {
-                echo "UNEXPECTED OUTCOME FOR $name...\n";
-                echo "  Expected: $expected\n";
-                echo '  Result: ';
-                print_r($result);
-                echo "\n";
-            }
-        }
-    }
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-foreach ($tests as $test => $dbms) {
-    check_output($dbh->getListOf($test),
-                 $dbms[$dbh->phptype . ':' . $dbh->dbsyntax],
-                 $test);
-}
-
-
-drop_table($dbh, 'phptest');
-
-?>
---EXPECT--
diff --git a/lib/tests/DB/tests/driver/20locale.phpt b/lib/tests/DB/tests/driver/20locale.phpt
deleted file mode 100644
index 6698db43fd0733574b9f29f6209ed9d0c59ab061..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/20locale.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-DB_driver::locale
---INI--
-error_reporting = 2047
---SKIPIF--
-<?phpi
-chdir(dirname(__FILE__)); require_once './skipif.inc';
-if (!function_exists('setlocale')) {
-    die('skip setlocale is not defined');
-}
-if (!OS_UNIX) {
-    die('skip not on a UNIX-like platform');
-}
-?>
---FILE--
-<?php
-require_once './mktable.inc';
-
-if ($dbh->phptype == 'odbc') {
-    if ($dbh->dbsyntax == 'odbc') {
-        $type = $dbh->phptype;
-    } else {
-        $type = $dbh->dbsyntax;
-    }
-} else {
-    $type = $dbh->phptype;
-}
-
-switch ($type) {
-    case 'access':
-        $decimal = 'SINGLE';
-        break;
-    case 'db2':
-    case 'ibase':
-        $decimal = 'DECIMAL(3,1)';
-        break;
-    case 'ifx':
-        // doing this for ifx to keep certain versions happy
-        $decimal = 'DECIMAL(3,1)';
-        break;
-    case 'msql':
-        $decimal = 'REAL';
-        break;
-    case 'fbsql':
-    case 'oci8':
-        $decimal = 'DECIMAL(3,1)';
-        break;
-    default:
-        $decimal = 'DECIMAL(3,1)';
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'localetest');
-
-$res = $dbh->query("CREATE TABLE localetest (a $decimal)");
-if (DB::isError($res)) {
-    echo 'Unable to create table: '.$res->getMessage()."\n";
-}
-
-setlocale(LC_NUMERIC, 'de_DE');
-
-$res = $dbh->query('INSERT INTO localetest (a) VALUES (?)', array(42.2));
-if (DB::isError($res)) {
-    echo 'Error inserting record: '.$res->getMessage()."\n";
-    var_dump($res);
-}
-
-setlocale(LC_NUMERIC, 'en_AU');
-
-$res = $dbh->query('INSERT INTO localetest (a) VALUES (?)', array(42.2));
-if (DB::isError($res)) {
-    echo 'Error inserting record: '.$res->getMessage()."\n";
-    var_dump($res);
-}
-
-$res = $dbh->query('SELECT * FROM localetest');
-if (DB::isError($res)) {
-    echo 'Error retrieving count: '.$res->getMessage()."\n";
-    var_dump($res);
-} else {
-    echo 'Got '.$res->numRows()." records.\n";
-}
-
-drop_table($dbh, 'localetest');
-
-?>
---EXPECT--
-Got 2 records.
diff --git a/lib/tests/DB/tests/driver/21freeResult.phpt b/lib/tests/DB/tests/driver/21freeResult.phpt
deleted file mode 100644
index 18454235f2d174d54f01650a442e94c9fee361bb..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/21freeResult.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-DB_driver::freeResult
---INI--
-error_reporting = 2047
---SKIPIF--
-<?php
-chdir(dirname(__FILE__)); require_once './skipif.inc';
-if ($dbh->phptype == 'mysqli') die ('skip mysqli returns result objects rather than resources');
-?>
---FILE--
-<?php
-require_once './mktable.inc';
-
-$res = $dbh->query('SELECT * FROM phptest');
-
-if (DB::isError($res)) {
-    echo "Result is a DB_Error.\n";
-}
-
-if (is_resource($res->result)) {
-    echo "Result includes resource.\n";
-} else {
-    echo "Result does not include a resource!\n";
-    print_r($res->result);
-}
-
-if ($dbh->freeResult($res->result)) {
-    echo "Resource was freed successfully.\n";
-} else {
-    echo "Error freeing result.\n";
-}
-
-drop_table($dbh, 'phptest');
-?>
---EXPECT--
-Result includes resource.
-Resource was freed successfully.
diff --git a/lib/tests/DB/tests/driver/connect.inc b/lib/tests/DB/tests/driver/connect.inc
deleted file mode 100644
index 2e935b874027d65e42648e16c6b81bb3cb242366..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/connect.inc
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Connects to the database
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: connect.inc,v 1.13 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-error_reporting(E_ALL);
-
-// Setting of $options and requiring DB are done in setup.inc
-
-/**
- * Establish the include_path, DSN's and connection $options
- */
-require_once './setup.inc';
-
-if (empty($dsns)) {
-    die('At least one element of $dsns must be defined in setup.inc');
-}
-
-list($dbms, $dsn) = each($dsns);
-
-if ($dbms == 'mssql') {
-    ini_set('mssql.textlimit', 4096);
-    ini_set('mssql.textsize', 4096);
-}
-
-$dbh =& DB::connect($dsn, $options);
-if (DB::isError($dbh)) {
-    die('connect.inc: ' . $dbh->toString());
-}
diff --git a/lib/tests/DB/tests/driver/droptable.inc b/lib/tests/DB/tests/driver/droptable.inc
deleted file mode 100644
index 0c0727f41212337674e39022f8da54f9289e09d5..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/droptable.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Contains the function for dropping tables
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: droptable.inc,v 1.3 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Drops the requested table
- *
- * @param object $dbh    the PEAR DB object currently in use
- * @param string $table  the name of the table to be dropped
- *
- * @return int  DB_OK on success.  DB_Error object on failure.
- */
-function drop_table($dbh, $table) {
-    switch ($dbh->phptype) {
-        case 'fbsql':
-            $res = $dbh->query("DROP TABLE $table CASCADE");
-            break;
-        default:
-            $res = $dbh->query("DROP TABLE $table");
-    }
-    return $res;
-}
diff --git a/lib/tests/DB/tests/driver/mktable.inc b/lib/tests/DB/tests/driver/mktable.inc
deleted file mode 100644
index e10e712fb35bfe3b13467ba2105665390db8e410..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/mktable.inc
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-/**
- * Creates the <kbd>phptest</kbd> table
- *
- * Tries to drop the table first, in case it already exists.
- *
- * <pre>
- * CREATE TABLE phptest (
- *   a INTEGER NULL,
- *   b CHAR(40) DEFAULT 'def' NOT NULL,
- *   cc VARCHAR(255) NULL,
- *   d VARCHAR(20) NULL)
- * </pre>
- *
- * Need <kbd>NOT NULL</kbd> on <kbd>b</kbd> to test
- * <kbd>DB_PORTABILITY_RTRIM</kbd>.  MS SQL and Sybase trim output from
- * <kbd>VARCHAR</kbd>, but not on <kbd>CHAR</kbd>.
- *
- * Need <kbd>DEFAULT</kbd> value on <kbd>b</kbd> because Oracle considers
- * an empty string to be <kbd>NULL</kbd>.
- *
- * In Oracle, when using placeholders in <kbd>WHERE</kbd> clauses on 
- * <kbd>CHAR</kbd> columns, the column must have <kbd>RTRIM()</kbd> run on
- * the column:
- * <samp>
- *    SELECT * FROM phptest WHERE RTRIM(b) = ?
- * </samp>
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: mktable.inc,v 1.21 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Establishes the DB object and connects to the database
- */
-require_once './connect.inc';
-
-/**
- * Get the drop_table() function
- */
-require_once './droptable.inc';
-
-/**
- * The error handler for the drop table procedure
- *
- * Prints out an error message and dies.
- */
-function debug_die($o){
-    die($o->toString());
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
-
-//$dbh->setErrorHandling(PEAR_ERROR_TRIGGER);
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'debug_die');
-
-if ($dbh->phptype == 'odbc') {
-    if ($dbh->dbsyntax == 'odbc') {
-        $type = $dbh->phptype;
-    } else {
-        $type = $dbh->dbsyntax;
-    }
-} else {
-    $type = $dbh->phptype;
-}
-
-
-switch ($type) {
-    case 'access':
-        $null = 'NULL';
-        $chrc = 'VARCHAR(255)';
-        $chrd = 'VARCHAR(20)';
-        $default = '';
-        $tabletype = '';
-        break;
-    case 'db2':
-    case 'ibase':
-        $null = '';
-        $chrc = 'VARCHAR(255)';
-        $chrd = 'VARCHAR(20)';
-        $default = "DEFAULT 'def' NOT NULL";
-        $tabletype = '';
-        break;
-    case 'fbsql':
-        $null = '';
-        $chrc = 'CHAR(255)';
-        $chrd = 'CHAR(20)';
-        $default = "DEFAULT 'def' NOT NULL";
-        $date_literal = ' DATE ';
-        $tabletype = '';
-        break;
-    case 'ifx':
-        // doing this for ifx to keep certain versions happy
-        $null = '';
-        $chrc = 'CHAR(255)';
-        $chrd = 'CHAR(20)';
-        $default = "DEFAULT 'def' NOT NULL";
-        $tabletype = '';
-        break;
-    case 'msql':
-        $null = '';
-        $chrc = 'CHAR(255)';
-        $chrd = 'CHAR(20)';
-        $default = '';
-        $tabletype = '';
-        break;
-    case 'mysql':
-    case 'mysqli':
-        $null = 'NULL';
-        $chrc = 'VARCHAR(255)';
-        $chrd = 'VARCHAR(20)';
-        $default = "DEFAULT 'def' NOT NULL";
-        if (!empty($needinnodb)) {
-            $tabletype = 'TYPE=INNODB';
-        } else {
-            $tabletype = '';
-        }
-        break;
-    default:
-        $null = 'NULL';
-        $chrc = 'VARCHAR(255)';
-        $chrd = 'VARCHAR(20)';
-        $default = "DEFAULT 'def' NOT NULL";
-        $tabletype = '';
-}
-
-switch ($dbh->phptype) {
-    case 'dbase':
-        // file exists or was created in DB_dbase::connect()
-        break;
-    default:
-        $test_mktable_query = "
-            CREATE TABLE phptest (
-              a INTEGER $null,
-              b CHAR(40) $default,
-              cc $chrc $null,
-              d $chrd $null) $tabletype
-        ";
-}
-
-
-$dbh->query($test_mktable_query);
-$dbh->query("INSERT INTO phptest VALUES(42, 'bing', 'This is a test', '1999-11-21')");
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
diff --git a/lib/tests/DB/tests/driver/multiconnect.php b/lib/tests/DB/tests/driver/multiconnect.php
deleted file mode 100644
index d2b5655d83915e76653d757a2245977a5e4600c1..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/multiconnect.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-/**
- * Tests the various ways DB's connect() function operates
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: multiconnect.php,v 1.3 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- * @since      File available since Release 1.7.0
- */
-
-/**
- * Establish the include_path, DSN's and connection $options
- */
-require_once './setup.inc';
-
-foreach ($dsns as $dbms => $dsn) {
-    echo "======== $dbms ========\n";
-    $options['persistent'] = false;
-    $dbh =& DB::connect($dsn, $options);
-    if (DB::isError($dbh)) {
-        echo 'PROBLEM: ' . $dbh->getUserInfo() . "\n";
-        continue;
-    }
-
-    if ($dbh->provides('new_link')
-        && version_compare(phpversion(), $dbh->provides('new_link'), '>='))
-    {
-        $probs = false;
-        $dsn = DB::parseDSN($dsn);
-        $dsn['new_link'] = true;
-        $dbh =& DB::connect($dsn, $options);
-        if (DB::isError($dbh)) {
-            echo 'NEW LINK PROBLEM: ' . $dbh->getUserInfo() . "\n";
-            $probs = true;
-        }
-
-        if ($dbh->provides('pconnect')) {
-            $options['persistent'] = true;
-            $dbh->disconnect();
-            $dbh =& DB::connect($dsn, $options);
-            if (DB::isError($dbh)) {
-                echo 'PERSIST NEWCON PROBLEM: ' . $dbh->getUserInfo() . "\n";
-                $probs = true;
-            }
-
-            unset($dsn['new_link']);
-            $dbh->disconnect();
-            $dbh =& DB::connect($dsn, $options);
-            if (DB::isError($dbh)) {
-                echo 'PERSIST OLDCON PROBLEM: ' . $dbh->getUserInfo() . "\n";
-                $probs = true;
-            }
-        }
-        if ($probs) {
-            continue;
-        }
-        $dbh->disconnect();
-
-    } elseif ($dbh->provides('pconnect')) {
-        $options['persistent'] = true;
-        $dbh->disconnect();
-        $dbh =& DB::connect($dsn, $options);
-        if (DB::isError($dbh)) {
-            echo 'PERSIST PROBLEM: ' . $dbh->getUserInfo() . "\n";
-            continue;
-        }
-        $dbh->disconnect();
-    }
-    echo "GOOD\n";
-}
diff --git a/lib/tests/DB/tests/driver/run.cvs b/lib/tests/DB/tests/driver/run.cvs
deleted file mode 100644
index 56a1cd04da9969f3c863d20802de0f8eb54a97e0..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/run.cvs
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-# $Id: run.cvs,v 1.2 2004/02/20 18:57:52 danielc Exp $
-
-# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-# PEAR DB TEST STARTER
-#
-#   To run all tests:  ./run
-#   To run one test:   ./run <test file name>
-#   Example:           ./run db_parsedsn.phpt
-#
-# Before running the tests you must adjust the
-# following three variables:
-
-#   The full path to your PHP directory:
-    DB_TEST_PHP_PATH=c:/progra~1/php
-
-#   The name of your PHP CLI executable
-#   (examples php.exe, php-cli.exe, cli/php.exe):
-    DB_TEST_PHP_CLI=php.exe
-
-#   The full path to the present directory
-#   (not using $PWD due to Cygwin):
-    DB_TEST_DIR=d:/peartest/pear/DB/tests/driver
-
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-
-
-TEST_PHP_EXECUTABLE=$DB_TEST_PHP_PATH/$DB_TEST_PHP_CLI
-export TEST_PHP_EXECUTABLE
-
-if [ $# -gt 0 ]
-then
-    test=$1
-else
-    test=*.phpt
-fi
-
-$TEST_PHP_EXECUTABLE $DB_TEST_PHP_PATH/run-tests.php $DB_TEST_DIR/${test}
diff --git a/lib/tests/DB/tests/driver/setup.inc.cvs b/lib/tests/DB/tests/driver/setup.inc.cvs
deleted file mode 100644
index 78ee209cefcf53a64b4be744443ba20d9f6e66ab..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/setup.inc.cvs
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-/**
- * Establishes the include_path, DSN's and connection $options
- *
- * If this file is named "setup.inc.cvs," it is the original one from CVS.
- * Please do the following:
- *   1) Make a copy of this file named "setup.inc".
- *   2) Then, in the copy, edit the $dsns array as appropriate for your
- *      environment.
- *   3) At least one element of the $dsns array needs to be uncommented.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: setup.inc.cvs,v 1.7 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-if (!defined('PATH_SEPARATOR')) {
-    if (stristr(PHP_OS, 'WIN')) {
-        /**
-         * The string used to delimit elements of the path.
-         */
-        define('PATH_SEPARATOR', ';');
-    } else {
-        /**
-         * The string used to delimit elements of the path.
-         */
-        define('PATH_SEPARATOR', ':');
-    }
-}
-
-/*
- * If the path to your PEAR installation is found in the left hand
- * portion of the if() expression below, that means this file has
- * come from the PEAR installer.  Therefore, let's use the
- * installed version of DB, which should be found via the
- * computer's default include_path.  Add '.' to the include_path
- * to ensure '.' is in there.
- * 
- * If the path has not been substituted in the if() expression,
- * this file has likely come from a CVS checkout or a .tar file.
- * Therefore, we'll assume the tests should use the version of
- * DB that has come from there as well.
- */
-if ('/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php' != '@'.'include_path'.'@') {
-    ini_set('include_path', ini_get('include_path')
-            . PATH_SEPARATOR . '.'
-    );
-} else {
-    ini_set('include_path', realpath(dirname(__FILE__) . '/../..')
-            . PATH_SEPARATOR . '.' . PATH_SEPARATOR
-            . ini_get('include_path')
-    );
-}
-
-/**
- * Grab the PEAR DB classes.
- */
-require_once 'DB.php';
-
-// Options used when connecting
-$options = array(
-    //'optimize' => 'portability',
-    'portability' => DB_PORTABILITY_ALL,
-    'debug' => 2,
-);
-
-$dbasedsn = array(
-    'phptype'  => 'dbase',
-    'database' => '/path/and/name/of/dbase/file',
-    'mode'     => 2,
-    'fields'   => array(
-        array('a', 'N', 5, 0),
-        array('b', 'C', 40),
-        array('c', 'C', 255),
-        array('d', 'C', 20),
-    ),
-);
-
-/*
- * Uncomment at least one of the following elements.
- * When running the .phpt tests, the first uncommented element is used.
- * When running the multiconnect.php test, all uncommented elements are used.
- */
-$dsns = array(
-    // 'dbase'    => $dbasedsn,
-    // 'fbsql'    => 'fbsql://_system:@/db',
-    // 'firebird' => 'ibase(firebird)://SYSDBA:masterkey@//opt/interbase/examples/employee.gdb?dialect=3',
-    // 'ifx'      => 'ifx://user:pw@localhost/db',
-    // 'msql'     => 'msql:///db',
-
-    // It's advisable to use only one of the following at a time:
-    // 'mssql'    => 'mssql://sa@somehost/pubs',
-    // 'sybase'   => 'sybase://sa@somehost/pubs',
-
-    // 'mysql'    => 'mysql://root@localhost/test',
-    // 'mysqli'   => 'mysqli://root@localhost/test',
-    // 'oci8'     => 'oci8://system:manager@',
-    // 'access'   => 'odbc(access)://admin@/SystemDsnName',
-    // 'db2'      => 'odbc(db2)://db2inst1:XXXX@/SAMPLE',
-    // 'pgsql'    => 'pgsql://postgres@localhost/test',
-    // 'sqlite'   => 'sqlite://dummy:@localhost/' . getcwd() . DIRECTORY_SEPARATOR . 'test.db?mode=0644',
-);
diff --git a/lib/tests/DB/tests/driver/skipif.inc b/lib/tests/DB/tests/driver/skipif.inc
deleted file mode 100644
index 045957aae8f9933e8f742ce792df8d5dc0046a84..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/driver/skipif.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * A test to make sure the database can be connected to
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2006 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: skipif.inc,v 1.8 2006/08/21 01:37:50 danielc Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Establish the include_path, DSN's and connection $options
- */
-require_once './setup.inc';
-
-if (empty($dsns)) {
-    die('skip At least one element of $dsns must be defined in setup.inc');
-}
-
-list($dbms, $dsn) = each($dsns);
-
-$dbh =& DB::connect($dsn, $options);
-if (DB::isError($dbh)) {
-    die('skip ' . $dbh->getUserInfo());
-}
diff --git a/lib/tests/DB/tests/errors.inc b/lib/tests/DB/tests/errors.inc
deleted file mode 100644
index e13f883f94845a7bf2e8172acdbd0c011c4221eb..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/errors.inc
+++ /dev/null
@@ -1,477 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' error mapping
- *
- * Executed by driver/10errormap.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: errors.inc,v 1.40 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Determine if the error from the driver matches the error we expect
- *
- * If things are as we expect, print out "matches expected outcome"
- *
- * If things go wrong, print "UNEXPECTED OUTCOME" and display the
- * error's information.
- *
- * @param object  $e                 the DB_Error object from the query
- * @param int     $expected_db_code  the DB_ERROR* constant to expect
- * @param boolean $should_be_error   does the DBMS consider this an error?
- *
- * @return void
- */
-function check_error($e, $expected_db_code, $should_be_error = true) {
-    if ($should_be_error) {
-        if (DB::isError($e)) {
-            if ($e->getCode() == $expected_db_code) {
-                print "matches expected outcome\n";
-            } else {
-                print "UNEXPECTED OUTCOME...\n";
-                print '    PEAR::DB errorcode: ' . $e->getCode() . "\n";
-                print '    ' . $e->getUserInfo() . "\n";
-            }
-        } else {
-            print "\n    UNEXPECTED OUTCOME... expected error but it wasn't\n";
-        }
-    } else {
-        if (DB::isError($e)) {
-            print "UNEXPECTED OUTCOME... didn't expect error but it was\n";
-            print '    PEAR::DB errorcode: ' . $e->getCode() . "\n";
-            print '    ' . $e->getUserInfo() . "\n";
-        } else {
-            print "matches expected outcome\n";
-        }
-    }
-}
-
-/**
- * Local error callback handler
- * 
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    print "\n---------------\n";
-    print "Having problems creating a table for testing...\n";
-    print $o->getDebugInfo() . "\n";
-    print "---------------\n";
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-
-
-print 'DB_ERROR_NOSUCHTABLE for select:  ';
-$res = $dbh->query('SELECT * FROM tableThatsBogus');
-check_error($res, DB_ERROR_NOSUCHTABLE);
-
-print 'DB_ERROR_NOSUCHTABLE for drop:  ';
-$res = drop_table($dbh, 'tableThatsBogus');
-check_error($res, DB_ERROR_NOSUCHTABLE);
-
-print 'DB_ERROR_NOT_FOUND for drop index:  ';
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'fbsql:fbsql':
-    case 'ibase:firebird':
-    case 'ibase:ibase':
-    case 'ifx:ifx':
-    case 'odbc:db2':
-    case 'oci8:oci8':
-    case 'pgsql:pgsql':
-    case 'sqlite:sqlite':
-        $res = $dbh->query('DROP INDEX fakeindex');
-        break;
-    case 'mssql:mssql':
-    case 'sybase:sybase':
-        $res = $dbh->query('DROP INDEX phptest.fakeindex');
-        break;
-    case 'msql:msql':
-        $res = $dbh->query('DROP INDEX fakeindex FROM phptest');
-        break;
-    default:
-        $res = $dbh->query('DROP INDEX fakeindex ON phptest');
-}
-check_error($res, DB_ERROR_NOT_FOUND);
-
-
-print 'DB_ERROR_ALREADY_EXISTS for create table:  ';
-$res = $dbh->query($test_mktable_query);
-check_error($res, DB_ERROR_ALREADY_EXISTS);
-
-print 'DB_ERROR_ALREADY_EXISTS for create index:  ';
-$res = drop_table($dbh, 'a');
-$dbh->pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-$res = $dbh->query('CREATE TABLE a (a INTEGER)');
-$dbh->popErrorHandling();
-$res = $dbh->query('CREATE INDEX aa_idx ON a (a)');
-$res = $dbh->query('CREATE INDEX aa_idx ON a (a)');
-switch ($dbh->phptype) {
-    case 'fbsql':
-        // FrontBase doesn't assign a specific code for this yet.
-        check_error($res, DB_ERROR_ALREADY_EXISTS, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_ALREADY_EXISTS);
-}
-$res = drop_table($dbh, 'a');
-
-
-print 'DB_ERROR_CONSTRAINT for primary key insert duplicate:  ';
-$res = drop_table($dbh, 'a');
-$dbh->pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-switch ($dbh->phptype) {
-    case 'msql':
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL)');
-        $res = $dbh->query('CREATE UNIQUE INDEX apk ON a (a)');
-        break;
-    default:
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL, PRIMARY KEY (a))');
-}
-$dbh->popErrorHandling();
-$res = $dbh->query('INSERT INTO a VALUES (1)');
-$res = $dbh->query('INSERT INTO a VALUES (1)');
-check_error($res, DB_ERROR_CONSTRAINT);
-
-
-print 'DB_ERROR_CONSTRAINT for primary key update duplicate:  ';
-$res = $dbh->query('INSERT INTO a VALUES (2)');
-$res = $dbh->query('UPDATE a SET a=1 WHERE a=2');
-check_error($res, DB_ERROR_CONSTRAINT);
-
-
-print 'DB_ERROR_CONSTRAINT for unique key insert duplicate:  ';
-$res = drop_table($dbh, 'a');
-$dbh->pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-switch ($dbh->phptype) {
-    case 'msql':
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL)');
-        $res = $dbh->query('CREATE UNIQUE INDEX auk ON a (a)');
-        break;
-    default:
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL, UNIQUE (a))');
-}
-$dbh->popErrorHandling();
-$res = $dbh->query('INSERT INTO a VALUES (1)');
-$res = $dbh->query('INSERT INTO a VALUES (1)');
-check_error($res, DB_ERROR_CONSTRAINT);
-
-
-print 'DB_ERROR_CONSTRAINT for unique key update duplicate:  ';
-$res = $dbh->query('INSERT INTO a VALUES (2)');
-$res = $dbh->query('UPDATE a SET a=1 WHERE a=2');
-check_error($res, DB_ERROR_CONSTRAINT);
-
-
-print 'DB_ERROR_CONSTRAINT for foreign key on insert:  ';
-$res = drop_table($dbh, 'b');
-$res = drop_table($dbh, 'a');
-$dbh->pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-switch ($dbh->phptype) {
-    case 'mysql':
-    case 'mysqli':
-        $res = $dbh->query('CREATE TABLE a (a INT NOT NULL, '
-                    . 'PRIMARY KEY (a)) '
-                    . 'TYPE=INNODB');
-        $res = $dbh->query('CREATE TABLE b (b INT, '
-                    . 'INDEX par_ind (b), '
-                    . 'FOREIGN KEY (b) REFERENCES a (a)) '
-                    . 'TYPE=INNODB');
-        $dbh->popErrorHandling();
-        break;
-
-    case 'msql':
-        // msql does not support foreign keys
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL)');
-        $res = $dbh->query('CREATE UNIQUE INDEX auk ON a (a)');
-        $dbh->popErrorHandling();
-        $res = $dbh->query('CREATE TABLE b (b INTEGER REFERENCES a (a))');
-        if (DB::isError($res)) {
-            print "matches expected outcome\n";
-            print "DB_ERROR_CONSTRAINT for foreign key on delete:  matches expected outcome\n";
-        } else {
-            print "WOW, it seems mSQL now supports references\n";
-            print "WOW, it seems mSQL now supports references\n";
-        }
-        break;
-
-    default:
-        $res = $dbh->query('CREATE TABLE a (a INTEGER NOT NULL, PRIMARY KEY (a))');
-        $res = $dbh->query('CREATE TABLE b (b INTEGER REFERENCES a (a))');
-        $dbh->popErrorHandling();
-}
-
-if ($dbh->phptype != 'msql') {
-    $res = $dbh->query('INSERT INTO a (a) values (1)');
-    $res = $dbh->query('INSERT INTO b (b) values (2)');
-    switch ($dbh->phptype) {
-        case 'sqlite':
-            check_error($res, DB_ERROR_CONSTRAINT, false);
-            break;
-        default:
-            check_error($res, DB_ERROR_CONSTRAINT);
-    }   
-
-    print 'DB_ERROR_CONSTRAINT for foreign key on delete:  ';
-    $res = $dbh->query('INSERT INTO b (b) values (1)');
-    $res = $dbh->query('DELETE FROM a WHERE a = 1');
-    switch ($dbh->phptype) {
-        case 'sqlite':
-            check_error($res, DB_ERROR_CONSTRAINT, false);
-            break;
-        default:
-            check_error($res, DB_ERROR_CONSTRAINT);
-    }
-}
-
-
-print 'DB_ERROR_CONSTRAINT_NOT_NULL on insert:  ';
-$res = drop_table($dbh, 'peartestnull');
-$dbh->pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-$res = $dbh->query('CREATE TABLE peartestnull (a CHAR(3) NOT NULL)');
-$dbh->popErrorHandling();
-$res = $dbh->query('INSERT INTO peartestnull VALUES (NULL)');
-check_error($res, DB_ERROR_CONSTRAINT_NOT_NULL);
-
-
-print 'DB_ERROR_CONSTRAINT_NOT_NULL on update:  ';
-$res = $dbh->query("INSERT INTO peartestnull VALUES ('one')");
-$res = $dbh->query("UPDATE peartestnull SET a = NULL WHERE a = 'one'");
-switch ($dbh->phptype) {
-    case 'mysql':
-    case 'mysqli':
-        check_error($res, DB_ERROR_CONSTRAINT_NOT_NULL, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_CONSTRAINT_NOT_NULL);
-}
-
-
-print 'DB_ERROR_NOSUCHFIELD joining ON bogus column:  ';
-$res = $dbh->query('SELECT * FROM phptest JOIN a ON (phptest.a = a.b)');
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'msql:msql':
-    case 'odbc:access':
-        check_error($res, DB_ERROR_SYNTAX);
-        break;
-    default:
-        check_error($res, DB_ERROR_NOSUCHFIELD);
-}
-
-
-print 'DB_ERROR_NOSUCHFIELD joining USING bogus column:  ';
-$res = $dbh->query('SELECT * FROM phptest JOIN a USING (b)');
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'ibase:firebird':
-        /* FirebirdSQL 2 returns -902 (feature is not supported) for this test
-         * rather than a syntax error. For now, we'll test for both. */
-        if ($res->getCode() == DB_ERROR_SYNTAX)
-            check_error($res, DB_ERROR_SYNTAX);
-        else
-            check_error($res, DB_ERROR_NOT_CAPABLE);
-        break;
-    case 'ibase:ibase':
-    case 'ifx:ifx':
-    case 'msql:msql':
-    case 'odbc:access':
-    case 'odbc:db2':
-    case 'sybase:sybase':
-        check_error($res, DB_ERROR_SYNTAX);
-        break;
-    default:
-        check_error($res, DB_ERROR_NOSUCHFIELD);
-}
-
-
-print 'DB_ERROR_DIVZERO:  ';
-// Interbase detects the error on fetching
-$res = $dbh->getAll('SELECT 0/0 FROM phptest');
-switch ($dbh->phptype) {
-    case 'odbc':
-        switch ($dbh->dbsyntax) {
-            case 'access':
-                check_error($res, DB_ERROR_DIVZERO, false);
-                break;
-            case 'db2':
-                check_error($res, DB_ERROR_DIVZERO);
-                break;
-        }
-        break;
-    case 'msql':
-        check_error($res, DB_ERROR_SYNTAX);
-        break;
-    case 'fbsql':
-    case 'ibase':
-    case 'mssql':
-    case 'mysql':
-    case 'mysqli':
-    case 'sqlite':
-        /* Not all databases detect division by zero errors. We call these
-         * databases "broken". */
-        check_error($res, null, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_DIVZERO);
-}
-
-
-print 'DB_ERROR_INVALID_NUMBER putting chars in INT column:  ';
-$res = $dbh->query("UPDATE phptest SET a = 'abc' WHERE a = 42");
-switch ($dbh->phptype) {
-    case 'mysql':
-    case 'mysqli':
-    case 'sqlite':
-        check_error($res, DB_ERROR_INVALID_NUMBER, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID_NUMBER);
-}
-
-
-print 'DB_ERROR_INVALID_NUMBER putting float in INT column:  ';
-$res = $dbh->query("UPDATE phptest SET a = 8.9 WHERE a = 42");
-switch ($dbh->phptype) {
-    case 'fbsql':
-    case 'ibase':
-    case 'ifx':
-    case 'mssql':
-    case 'mysql':
-    case 'mysqli':
-    case 'oci8':
-    case 'odbc':
-    case 'pgsql':
-    case 'sqlite':
-        check_error($res, DB_ERROR_INVALID_NUMBER, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID_NUMBER);
-}
-
-
-print 'DB_ERROR_INVALID_NUMBER putting excessive int in INT column:  ';
-$res = $dbh->query("UPDATE phptest SET a = 18446744073709551616 WHERE a = 42");
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'ibase:ibase':
-    case 'ibase:firebird':
-        check_error($res, DB_ERROR_SYNTAX);
-        break;
-    case 'fbsql:fbsql':
-    case 'ifx:ifx':
-    case 'msql:msql':
-    case 'mssql:mssql':
-    case 'mysql:mysql':
-    case 'mysqli:mysqli':
-    case 'oci8:oci8':
-    case 'odbc:access':
-    case 'sqlite:sqlite':
-        check_error($res, DB_ERROR_INVALID_NUMBER, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID_NUMBER);
-}
-
-
-print 'DB_ERROR_INVALID_NUMBER putting int in CHAR column:  ';
-$res = $dbh->query("UPDATE phptest SET b = 8 WHERE a = 42");
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'ibase:ibase':
-    case 'ibase:firebird':
-    case 'ifx:ifx':
-    case 'mssql:mssql':
-    case 'mysql:mysql':
-    case 'mysqli:mysqli':
-    case 'oci8:oci8':
-    case 'odbc:access':
-    case 'pgsql:pgsql':
-    case 'sqlite:sqlite':
-        check_error($res, DB_ERROR_INVALID_NUMBER, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID_NUMBER);
-}
-
-
-print 'DB_ERROR_NOSUCHFIELD:  ';
-$res = $dbh->query('SELECT e FROM phptest');
-check_error($res, DB_ERROR_NOSUCHFIELD);
-
-
-print 'DB_ERROR_SYNTAX:  ';
-$res = $dbh->query('CREATE');
-check_error($res, DB_ERROR_SYNTAX);
-
-
-print 'DB_ERROR_VALUE_COUNT_ON_ROW:  ';
-$res = $dbh->query('INSERT INTO phptest (a) VALUES (678, 2)');
-switch ($dbh->phptype) {
-    case 'msql':
-        check_error($res, DB_ERROR_VALUE_COUNT_ON_ROW, false);
-        break;
-    default:
-        check_error($res, DB_ERROR_VALUE_COUNT_ON_ROW);
-}
-
-
-print 'DB_ERROR_INVALID on CHAR column data too long:  ';
-$res = $dbh->query("INSERT INTO phptest (b) VALUES ('123456789.123456789.123456789.123456789.1')");
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'ifx:ifx':
-    case 'msql:msql':
-    case 'mssql:mssql':
-    case 'mysql:mysql':
-    case 'mysqli:mysqli':
-    case 'odbc:access':
-    case 'sqlite:sqlite':
-    case 'sybase:sybase':
-        check_error($res, DB_ERROR_INVALID, false);
-        break;
-    case 'fbsql:fbsql':
-        check_error($res, DB_ERROR_TRUNCATED);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID);
-}
-
-
-print 'DB_ERROR_INVALID on VARCHAR column data too long:  ';
-$res = $dbh->query("INSERT INTO phptest (d) VALUES ('123456789.123456789.1')");
-switch ($dbh->phptype . ':' . $dbh->dbsyntax) {
-    case 'ifx:ifx':
-    case 'msql:msql':
-    case 'mssql:mssql':
-    case 'mysql:mysql':
-    case 'mysqli:mysqli':
-    case 'odbc:access':
-    case 'sqlite:sqlite':
-    case 'sybase:sybase':
-        check_error($res, DB_ERROR_INVALID, false);
-        break;
-    case 'fbsql:fbsql':
-        check_error($res, DB_ERROR_TRUNCATED);
-        break;
-    default:
-        check_error($res, DB_ERROR_INVALID);
-}
-
-
-
-drop_table($dbh, 'phptest');
-drop_table($dbh, 'b');
-drop_table($dbh, 'a');
-drop_table($dbh, 'peartestnull');
diff --git a/lib/tests/DB/tests/fetchmode_object.inc b/lib/tests/DB/tests/fetchmode_object.inc
deleted file mode 100644
index cd5dfb0a342c7955aedd23089ae80e90030dce06..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/fetchmode_object.inc
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' object fetch mode procedures
- *
- * Executed by driver/14fetchmode_object.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: fetchmode_object.inc,v 1.12 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-error_reporting(E_ALL);
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-/**
- * Print out the object
- */
-function print_obj(&$obj) {
-    if (!is_object($obj)) {
-        echo "ERROR: no object!\n";
-    } else {
-        echo strtolower(get_class($obj)) . ' -> ' . implode(' ', array_keys((array)$obj)) . "\n";
-    }
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-echo "--- fetch with param DB_FETCHMODE_OBJECT ---\n";
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow(DB_FETCHMODE_OBJECT);
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-$sth = $dbh->query("SELECT * FROM phptest");
-$sth->fetchInto($row, DB_FETCHMODE_OBJECT);
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-echo "--- fetch with default fetchmode DB_FETCHMODE_OBJECT ---\n";
-$dbh->setFetchMode(DB_FETCHMODE_OBJECT);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow();
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-$sth = $dbh->query("SELECT * FROM phptest");
-$sth->fetchInto($row);
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-echo "--- fetch with default fetchmode DB_FETCHMODE_OBJECT and class DB_row ---\n";
-$dbh->setFetchMode(DB_FETCHMODE_OBJECT, 'DB_row');
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow();
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-$sth = $dbh->query("SELECT * FROM phptest");
-$sth->fetchInto($row);
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-echo "--- fetch with default fetchmode DB_FETCHMODE_OBJECT with no class then DB_row ---\n";
-$dbh->setFetchMode(DB_FETCHMODE_OBJECT);
-$sth = $dbh->query('SELECT * FROM phptest');
-$row = $sth->fetchRow();
-print_obj($row);
-$sth->free();  // keep fbsql happy.
-
-$dbh->setFetchMode(DB_FETCHMODE_OBJECT, 'DB_row');
-$sth = $dbh->query('SELECT * FROM phptest');
-$row = $sth->fetchRow();
-print_obj($row);
-
-$sth->free();  // keep fbsql happy.
-               // keep ibase happy: can't drop tbl that has results open against it.
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
diff --git a/lib/tests/DB/tests/fetchmodes.inc b/lib/tests/DB/tests/fetchmodes.inc
deleted file mode 100644
index b4d9eae1c4621405289eb1a7704d346e419f739d..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/fetchmodes.inc
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' various fetch methods
- *
- * Executed by driver/02fetch.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: fetchmodes.inc,v 1.14 2007/09/21 15:14:26 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-$dbh->setOption('autofree', true);
-
-$dbh->query("INSERT INTO phptest VALUES (1, 'one', 'One', '2001-02-16')");
-$dbh->query("INSERT INTO phptest VALUES (2, 'two', 'Two', '2001-02-15')");
-$dbh->query("INSERT INTO phptest VALUES (3, 'three', 'Three', '2001-02-14')");
-
-print "testing fetchrow:\n";
-$sth = $dbh->query("SELECT * FROM phptest");
-for ($i = 1; $i <= 5; $i++) {
-    print "row $i: ";
-    $row = $sth->fetchRow();
-    if (DB::isError($row)) {
-        print $row->toString() . "\n";
-        continue;
-    }
-    if (is_array($row)) {
-        print implode(', ', $row) . "\n";
-    } else {
-        var_dump($row);
-    }
-}
-$sth->free();  // keep fbsql happy.
-
-$dbh->query('DELETE FROM phptest WHERE a <> 42');
-
-
-print "testing fetchmodes: fetchrow default default, portability mode DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM\n";
-$dbh->setOption('portability', DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow();
-print implode(" ", array_keys($row))."\n";
-$actual = implode(' ', array_values($row));
-switch ($dbh->phptype) {
-    case 'fbsql':
-    case 'msql':
-    case 'mysql':
-    case 'mysqli':
-    case 'sqlite':
-        $expected = '42 bing This is a test 1999-11-21';
-        break;
-    case 'ifx':
-        $expected = '42 bing                                     This is a test                                                                                                                                                                                                                                                  1999-11-21          ';
-        break;
-    default:
-        $expected = '42 bing                                     This is a test 1999-11-21';
-}
-if ($actual == $expected) {
-    echo "output matched expected format\n";
-} else {
-    echo "DIDN'T MATCH!  Expected output: '$expected'.  Actual output: '$actual'.\n";
-}
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchinto default default\n";
-$dbh->setOption('portability', DB_PORTABILITY_ALL);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = array();
-$sth->fetchInto($row);
-print implode(" ", array_keys($row))."\n";
-print implode(' ', array_values($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchrow ordered default\n";
-$dbh->setFetchMode(DB_FETCHMODE_ORDERED);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow();
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchrow assoc default\n";
-$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow();
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchrow ordered default with assoc specified\n";
-$dbh->setFetchMode(DB_FETCHMODE_ORDERED);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow(DB_FETCHMODE_ASSOC);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchrow assoc default with ordered specified\n";
-$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = $sth->fetchRow(DB_FETCHMODE_ORDERED);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchinto ordered default\n";
-$dbh->setFetchMode(DB_FETCHMODE_ORDERED);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = array();
-$sth->fetchInto($row);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchinto assoc default\n";
-$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = array();
-$sth->fetchInto($row);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchinto ordered default with assoc specified\n";
-$dbh->setFetchMode(DB_FETCHMODE_ORDERED);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = array();
-$sth->fetchInto($row, DB_FETCHMODE_ASSOC);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchinto assoc default with ordered specified\n";
-$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-$sth = $dbh->query("SELECT * FROM phptest");
-$row = array();
-$sth->fetchInto($row, DB_FETCHMODE_ORDERED);
-print implode(" ", array_keys($row))."\n";
-$sth->free();  // keep fbsql happy.
-
-print "testing fetchmodes: fetchrow assoc quoted identifiers\n";
-if ($dbh->phptype == 'msql' || $dbh->phptype == 'ibase' || $dbh->phptype == 'oci8') {
-    // Some databases don't support quoted identifiers. Fake the output.
-    echo "a b cc d\n";
-} else {
-    $dbh->setFetchMode(DB_FETCHMODE_ASSOC);
-    $sql = sprintf('SELECT %s, %s, %s, %s FROM %s',
-        $dbh->quoteIdentifier('a'),
-        $dbh->quoteIdentifier('b'),
-        $dbh->quoteIdentifier('cc'),
-        $dbh->quoteIdentifier('d'),
-        $dbh->quoteIdentifier('phptest'));
-    $sth = $dbh->query($sql);
-    $row = $sth->fetchRow();
-    print implode(" ", array_keys($row))."\n";
-    $sth->free();  // keep fbsql happy.
-                   // keep ibase happy: can't drop tbl that has results open against it.
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
diff --git a/lib/tests/DB/tests/include.inc b/lib/tests/DB/tests/include.inc
deleted file mode 100644
index 46fbeddda6e8b51b3c9dd50641a314b72ab87ed5..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/include.inc
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Sets the include_path, error_reporting and PATH_SEPARATOR for tests
- * in the DB/tests directory
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: include.inc,v 1.6 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-error_reporting(E_ALL);
-
-if (!defined('PATH_SEPARATOR')) {
-    if (stristr(PHP_OS, 'WIN')) {
-        /**
-         * Define the path separator for windows
-         */
-        define('PATH_SEPARATOR', ';');
-    } else {
-        /**
-         * Define the path separator for other systems
-         */
-        define('PATH_SEPARATOR', ':');
-    }
-}
-
-/*
- * If the path to your PEAR installation is found in the left hand
- * portion of the if() expression below, that means this file has
- * come from the PEAR installer.  Therefore, let's use the
- * installed version of DB, which should be found via the
- * computer's default include_path.  Add '.' to the include_path
- * to ensure '.' is in there.
- * 
- * If the path has not been substituted in the if() expression,
- * this file has likely come from a CVS checkout or a .tar file.
- * Therefore, we'll assume the tests should use the version of
- * DB that has come from there as well.
- */
-if ('/Users/bbieber/Documents/workspace/UNL_GraduateBulletin/lib/php' != '@'.'include_path'.'@') {
-    ini_set('include_path', ini_get('include_path')
-            . PATH_SEPARATOR . '.'
-    );
-} else {
-    ini_set('include_path', realpath(dirname(__FILE__) . '/..')
-            . PATH_SEPARATOR . '.' . PATH_SEPARATOR
-            . ini_get('include_path')
-    );
-}
diff --git a/lib/tests/DB/tests/limit.inc b/lib/tests/DB/tests/limit.inc
deleted file mode 100644
index 3a585ee10a83616577eb1ae5e940fe8bab9a3b10..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/limit.inc
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' limitQuery() method
- *
- * Executed by driver/13limit.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: limit.inc,v 1.14 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-error_reporting(E_ALL);
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'php_limit');
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-$dbh->query('CREATE TABLE php_limit (a CHAR(20))');
-
-
-$from    = 0;
-$count   = 10;
-$numrows = 30;
-
-for ($i=0; $i<=$numrows+2; $i++) {
-    $dbh->query("INSERT INTO php_limit VALUES('result $i')");
-}
-for ($i = 0; $i <= 3; $i++) {
-    $from = 10 * $i;
-    $res = $dbh->limitQuery("select * from php_limit", $from, $count);
-    echo "======= From: $from || Number of rows to fetch: $count =======\n";
-    while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
-        echo $res->getRowCounter() . '.- ' . $row['a'] . "\n";
-    }
-    $count = $res->numRows();
-    echo "Row count for limited result: $count\n";
-    $res->free();  // keep fbsql happy.
-}
-
-
-$from  = 11;
-$count = 3;
-
-echo "======= Passing \$params || From: $from || Number of rows to fetch: $count =======\n";
-$res = $dbh->limitQuery('SELECT * FROM php_limit WHERE a < ?', $from, $count, array('result 99'));
-while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
-    echo $res->getRowCounter() . '.- ' . $row['a'] . "\n";
-}
-
-$res->free();  // keep fbsql happy.
-               // keep ibase happy: can't drop tbl that has results open against it.
-
-// Regression test for bug #7502.
-$from  = 0;
-$count = 3;
-$iter  = 10;
-echo "======= From: $from || Number of rows to fetch: $count || Iterations: $iter =======\n";
-$res = $dbh->limitQuery("select * from php_limit", $from, $count);
-if (!in_array($dbh->phptype, array('ibase', 'oci8'))) {
-    for ($i = 0; $i < $iter; ++$i) {
-        if (is_null($row = $res->fetchRow(DB_FETCHMODE_ASSOC, 1))) {
-            echo "Error in iteration $i: {$row['a']}\n";
-        }
-    }
-}
-$count = $res->numRows();
-echo "Row count for limited result: $count\n";
-$res->free();  // keep fbsql happy.
-
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'php_limit');
diff --git a/lib/tests/DB/tests/numcols.inc b/lib/tests/DB/tests/numcols.inc
deleted file mode 100644
index 86035943223fcd8b737d8dd43c3a1e00e9006cbb..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/numcols.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' numCols() method
- *
- * Executed by driver/04numcols.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: numcols.inc,v 1.9 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$sth = $dbh->query("SELECT a FROM phptest");
-printf("%d\n", $sth->numCols());
-$sth = $dbh->query("SELECT a,b FROM phptest");
-printf("%d\n", $sth->numCols());
-$sth = $dbh->query("SELECT a,b,cc FROM phptest");
-printf("%d\n", $sth->numCols());
-$sth = $dbh->query("SELECT * FROM phptest");
-printf("%d\n", $sth->numCols());
-
-
-switch ($dbh->phptype) {
-    case 'ibase':
-        /*
-         * Interbase doesn't allow dropping tables that have result
-         * sets still open.
-         */
-        $dbh->freeResult($sth->result);
-        break;
-}
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
diff --git a/lib/tests/DB/tests/numrows.inc b/lib/tests/DB/tests/numrows.inc
deleted file mode 100644
index d38c518e5991337a275ec67d5a3800efcafd9a4c..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/numrows.inc
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' numRows() method
- *
- * Executed by driver/09numrows.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: numrows.inc,v 1.15 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh, $res;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    $res->free();
-    drop_table($dbh, 'phptest');
-
-    print "\n------------\n";
-    if ($o->getCode() == DB_ERROR_UNSUPPORTED) {
-        print "This DBMS does not support numRows().";
-    } elseif ($o->getCode() == DB_ERROR_MISMATCH) {
-        print "Mismatch between the number of placeholders and parameters.\n";
-        foreach ($o->backtrace as $item => $detail) {
-            if ($detail['function'] == 'query') {
-                echo 'QUERY: ' . $detail['args'][0] . "\n";
-                echo "PARAMETERS:\n";
-                print_r($detail['args'][1]);
-            }
-        }
-    } else {
-        print $o->getDebugInfo() . "\n";
-    }
-    exit;
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$res = $dbh->query("SELECT a FROM phptest");
-if (!DB::isError($rows = $res->numRows())) {
-    print "(want 1) got $rows from first\n";
-} else {
-    print "\n";
-}
-for ($i = 0; $i < 5; $i++) {
-    $dbh->query("INSERT INTO phptest (a) VALUES ($i)");
-    $res = $dbh->query("SELECT a FROM phptest");
-    if (!DB::isError($rows = $res->numRows())) {
-        print '(want ' . ($i + 2) . ") got $rows from $i\n";
-    } else {
-        print "\n";
-    }
-}
-
-$res = $dbh->query('SELECT a FROM phptest WHERE a > ?', array(0));
-if (!DB::isError($rows = $res->numRows())) {
-    print "(want 5) got $rows from > 0 (passing params to query)\n";
-} else {
-    print "\n";
-}
-
-$sth = $dbh->prepare('SELECT a FROM phptest WHERE a < ?');
-$res = $dbh->execute($sth, array(4));
-if (!DB::isError($rows = $res->numRows())) {
-    print "(want 4) got $rows from < 4 (doing prepare/execute)\n";
-} else {
-    print "\n";
-}
-
-$dbh->query("DELETE FROM phptest WHERE a < 4");
-$res = $dbh->query("SELECT a FROM phptest");
-if (!DB::isError($rows = $res->numRows())) {
-    print "(want 2) got $rows from 5 and 6 not deleted\n";
-} else {
-    print "\n";
-}
-$res = $dbh->query("SELECT a FROM phptest where a < 0");
-if (!DB::isError($rows = $res->numRows())) {
-    print "(want 0) got $rows from < 0\n";
-} else {
-    print "\n";
-}
-
-
-drop_table($dbh, 'phptest');
diff --git a/lib/tests/DB/tests/prepexe.inc b/lib/tests/DB/tests/prepexe.inc
deleted file mode 100644
index df0035bcf7f536297ef67c26ca1ec3cb06faca62..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/prepexe.inc
+++ /dev/null
@@ -1,241 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' prepare and execute methods
- *
- * Executed by driver/06prepexec.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: prepexe.inc,v 1.28 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-$tmpfile = tempnam("/tmp", "phptmp");
-register_shutdown_function("my_shutdown");
-$fp = fopen($tmpfile, "w");
-$filedata = "opaque placeholder's test";
-fwrite($fp, $filedata);
-fclose($fp);
-
-
-/**
- * Local error callback handler
- *
- * Prints out an error message and kills the process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    print "\n" . $o->toString();
-    exit;
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-// 1) Multiple prepare/exec INSERT queries
-echo "------------1------------\n";
-
-$sth1 = $dbh->prepare("INSERT INTO phptest (a, b) VALUES (?, 'a')");
-$sth2 = $dbh->prepare("INSERT INTO phptest (a,b) VALUES (!,?)");
-$sth3 = $dbh->prepare("INSERT INTO phptest (a,b,cc) VALUES (?,!,&)");
-$sth4 = $dbh->prepare("INSERT INTO phptest (a, b) VALUES (72, 'direct')");
-print "sth1,sth2,sth3,sth4 created\n";
-print 'sth1: ? as param, passing as array... ';
-if (($res = $dbh->execute($sth1, array(72))) === DB_OK) {
-    print "sth1 executed\n";
-} else {
-    print "sth1 failed\n";
-}
-
-print 'sth2: ! and ? as params, passing as array... ';
-if (($res = $dbh->execute($sth2, array(72, "that's right"))) === DB_OK) {
-    print "sth2 executed\n";
-} else {
-    print "sth2 failed\n";
-}
-
-print 'sth3: ?, ! and & as params, passing as array... ';
-switch ($dbh->phptype) {
-    case 'msql':
-        $res = $dbh->execute($sth3, array(72, "'it\\'s good'", $tmpfile));
-        break;
-    default:
-        $res = $dbh->execute($sth3, array(72, "'it''s good'", $tmpfile));
-}
-if ($res === DB_OK) {
-    print "sth3 executed\n";
-} else {
-    print "sth3 failed\n";
-}
-
-print 'sth4: no params... ';
-if (($res = $dbh->execute($sth4)) === DB_OK) {
-    print "sth4 executed\n";
-} else {
-    print "sth4 failed\n";
-}
-print_results();
-
-
-// 2) One prepared, multiple time executed
-echo "\n------------2------------\n";
-
-$dbh->query('DELETE FROM phptest');
-$sth = $dbh->prepare('INSERT INTO phptest (a, b, cc, d) VALUES (?, ?, &, ?)');
-$data = array(
-    0 => array(72, 'set1', $tmpfile, '1234-56-78'),
-    1 => array(72, 'set2', $tmpfile, null),
-    2 => array(72, 'set3', $tmpfile, null)
-);
-$res = $dbh->executeMultiple($sth, $data);
-print_results();
-
-
-// 3) freePrepared() test
-echo "\n------------3------------\n";
-
-if ($dbh->freePrepared($sth)) {
-    echo 'TRUE';
-} else {
-    echo 'FALSE';
-}
-echo "\n";
-if ($dbh->freePrepared(666)) {
-    echo 'TRUE';
-} else {
-    echo 'FALSE';
-}
-echo "\n";
-
-
-// 4) SELECTs tests
-echo "\n------------4------------\n";
-$sth1 = $dbh->prepare("SELECT * FROM phptest WHERE a = ? ORDER BY b");
-print_4($sth1, 72);
-print_4($sth1, 71);
-$sth2 = $dbh->prepare("SELECT * FROM phptest WHERE d = ? ORDER BY b");
-print_4($sth2, '1234-56-78');
-$sth3 = $dbh->prepare("SELECT * FROM phptest WHERE cc = & ORDER BY b");
-print_4($sth3, $tmpfile);
-
-
-// 5) ASSOCIATIVE ARRAY queries
-echo "\n------------5------------\n";
-
-$sth5 = $dbh->prepare('INSERT INTO phptest (a, b, d) VALUES (?, ?, ?)');
-$array = array(
-    'foo' => 11,
-    'bar' => 'three',
-    'baz' => null,
-);
-$res = $dbh->execute($sth5, $array);
-print 'insert: ' . ($res === DB_OK ? 'okay' : 'error') . "\n";
-
-$sth6 = $dbh->prepare('SELECT a, b, d FROM phptest WHERE a = ?');
-$res = $dbh->execute($sth6, array(11));
-$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
-print "a = {$row['a']}, b = {$row['b']}, d = ";
-if ($dbh->phptype == 'msql') {
-    if (array_key_exists('d', $row)) {
-        $type = gettype($row['d']);
-        if ($type == 'NULL' || $row['d'] == '') {
-            print "got expected outcome\n";
-        } else {
-            $type = gettype($row['d']);
-            print "UN-expected outcome: $type\n";
-        }
-    } else {
-        // http://bugs.php.net/?id=31960
-        print "Prior to PHP 4.3.11 or 5.0.4, PHP's msql extension silently"
-              . " dropped columns with null values. You need to upgrade.\n";
-    }
-} else {
-    $type = gettype($row['d']);
-    if ($type == 'string') {
-        print "got expected outcome\n";
-    } else {
-        print "UN-expected outcome: $type\n";
-    }
-}
-
-/**
- * Automatically free the prepared statements and results when the script
- * terminates
- *
- * @return void
- */
-function my_shutdown() {
-    global $tmpfile, $dbh, $sth1, $sth2, $sth3, $sth4, $sth5, $sth6, $res;
-
-    switch ($dbh->phptype) {
-        case 'ibase':
-            /*
-             * Interbase doesn't allow dropping tables that have result
-             * sets still open.
-             */
-            $dbh->freePrepared($sth1);
-            $dbh->freePrepared($sth2);
-            $dbh->freePrepared($sth3);
-            $dbh->freePrepared($sth4);
-            $dbh->freePrepared($sth5);
-            $dbh->freePrepared($sth6);
-            $dbh->freeResult($res->result);
-            break;
-    }
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    unlink($tmpfile);
-}
-
-/**
- * Print out the data in test table
- *
- * @return void
- */
-function print_results() {
-    global $dbh;
-    print "results:\n";
-    $res = $dbh->query("SELECT * FROM phptest WHERE a = 72 ORDER BY b");
-    $i = 0;
-    while ($row = $res->fetchRow(DB_FETCHMODE_ORDERED)) {
-        print '|' . implode(" - ", $row) . "|\n";
-        $i++;
-    }
-    if (!$i) {
-        print "The records were not found.  Did they get inserted?\n";
-    }
-}
-
-/**
- * Execute the prepared statement and print out the data in the result
- *
- * @param resource     $sth   the statement handle to process
- * @param string|array $bind  the data that will replace the placeholders
- *
- * @return void
- */
-function print_4($sth, $bind) {
-    global $dbh;
-    $res = $dbh->execute($sth, $bind);
-    while ($row = $res->fetchRow(DB_FETCHMODE_ORDERED)) {
-        print '|' . implode(" - ", $row) . "|\n";
-    }
-    echo "~~\n";
-}
diff --git a/lib/tests/DB/tests/run.cvs b/lib/tests/DB/tests/run.cvs
deleted file mode 100644
index 3a939c450e0dd2e4740ba754eacb6649599f2a2d..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/run.cvs
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-# $Id: run.cvs,v 1.3 2004/02/20 18:57:51 danielc Exp $
-
-# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
-# PEAR DB TEST STARTER
-#
-#   To run all tests:  ./run
-#   To run one test:   ./run <test file name>
-#   Example:           ./run db_parsedsn.phpt
-#
-# Before running the tests you must adjust the
-# following three variables:
-
-#   The full path to your PHP directory:
-    DB_TEST_PHP_PATH=c:/progra~1/php
-
-#   The name of your PHP CLI executable
-#   (examples php.exe, php-cli.exe, cli/php.exe):
-    DB_TEST_PHP_CLI=php.exe
-
-#   The full path to the present directory
-#   (not using $PWD due to Cygwin):
-    DB_TEST_DIR=d:/peartest/pear/DB/tests
-
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-
-
-TEST_PHP_EXECUTABLE=$DB_TEST_PHP_PATH/$DB_TEST_PHP_CLI
-export TEST_PHP_EXECUTABLE
-
-if [ $# -gt 0 ]
-then
-    test=$1
-else
-    test=*.phpt
-fi
-
-$TEST_PHP_EXECUTABLE $DB_TEST_PHP_PATH/run-tests.php $DB_TEST_DIR/${test}
diff --git a/lib/tests/DB/tests/sequences.inc b/lib/tests/DB/tests/sequences.inc
deleted file mode 100644
index c060b07a0380240b9a973106c0174fe6952b75ec..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/sequences.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' sequence (aka auto_increment) methods
- *
- * Executed by driver/05sequences.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: sequences.inc,v 1.12 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Local error handler
- */
-function error_handler(&$obj) {
-    print "sequences.inc error_handler:\n    ";
-    print $obj->getDebugInfo() . "\n\n";
-}
-ob_implicit_flush(true);
-
-$drop = $dbh->dropSequence('test');
-if (DB::isError($drop) &&
-    $drop->getCode() != DB_ERROR_NOSUCHTABLE)
-{
-    print "Could not drop sequence...\n";
-    print $drop->getDebugInfo() . "\n\n";
-    if ($dbh->phptype == 'ibase' &&
-        $drop->getCode() == DB_ERROR_ACCESS_VIOLATION)
-    {
-        print "Use this query to provide the permissions needed:\n";
-        print '   grant all on RDB$GENERATORS to <USERNAME>';
-    }
-    exit;
-}
-
-// 1) test that sequences are not created if "ondemand" is false
-
-$e = $dbh->nextId("test", false);
-if (DB::isError($e) && $e->getCode() == DB_ERROR_NOSUCHTABLE) {
-    print "an error is the proper response here\n";
-} else {
-    if (DB::isError($e)) {
-        if ($dbh->phptype == 'ibase' && $e->getCode() == DB_ERROR_SYNTAX) {
-            print "an error is the proper response here\n";
-        } else {
-            print "test 1) we expected to get back 'DB Error: no such table'.\n";
-            print "Here is the error we got:\n";
-            print 'Code: ' . $e->getCode() . "\n";
-            print 'Message: ' . $e->getMessage() . "\n";
-            print 'Debug: ' . $e->getDebugInfo() . "\n\n";
-        }
-    } else {
-        print "test 1) we expected to get back 'DB Error: no such table'.\n";
-        print "But an error wasn't generated\n\n";
-    }
-}
-
-// 2) test that the sequence is not created but the error is
-// handled by the class error handler
-$dbh->setErrorHandling(PEAR_ERROR_PRINT,
-                       "an error cought by the error handler is good\n");
-$e = $dbh->nextId("test", false);
-if (!DB::isError($e)) {
-    print "test 2) failed!\n";
-}
-$dbh->_default_error_mode = null;
-
-// 3) test that sequences are created if "ondemand" is true, and that
-// two successive nextIds return adjacent values
-$a = $dbh->nextId("test");
-$b = $dbh->nextId("test");
-if (DB::isError($a)) {
-    print 'a: ' . $a->getDebugInfo() . "\n\n";
-} else {
-    print "a=$a\n";
-}
-if (DB::isError($b)) {
-    print 'b: ' . $b->getDebugInfo() . "\n\n";
-} else {
-    print "b=$b\n";
-}
-if (!DB::isError($a) && !DB::isError($b)) {
-    print 'b-a=' . ($b-$a) . "\n";
-}
-
-// 4) test that the user-specified error handler is really disabled
-// during nextId, with per-object handler as well as global handler
-$dbh->dropSequence("test");
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler');
-$c = $dbh->nextId("test");
-if (!DB::isError($c)) {
-    print "c=$c\n";
-}
-$dbh->dropSequence("test");
-$dbh->_default_error_mode = null;
-$d = $dbh->nextId("test");
-if (!DB::isError($d)) {
-    print "d=$d\n";
-}
-
-// 5) test that the sequence is handled right when the table is empty
-
-// Backend with real sequences may don't like that
-PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-$dbh->query('DELETE FROM test_seq');
-PEAR::popErrorHandling();
-$e = $dbh->nextID('test');
-if (DB::isError($d)) {
-    print 'e: ' . $d->getDebugInfo() . "\n\n";
-} else {
-    print "e=$d\n";
-}
-
-// final clean-up
-$dbh->dropSequence("test");
diff --git a/lib/tests/DB/tests/simplequery.inc b/lib/tests/DB/tests/simplequery.inc
deleted file mode 100644
index 77aebf70269710f28b85062bfdbb8273f7e8b837..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/simplequery.inc
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' simpleQuery() method
- *
- * Executed by driver/03simplequery.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: simplequery.inc,v 1.9 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Local error callback handler
- *
- * Drops the phptest table, prints out an error message and kills the
- * process.
- *
- * @param object  $o  PEAR error object automatically passed to this method
- * @return void
- * @see PEAR::setErrorHandling()
- */
-function pe($o) {
-    global $dbh;
-
-    $dbh->setErrorHandling(PEAR_ERROR_RETURN);
-    drop_table($dbh, 'phptest');
-
-    die($o->toString());
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-
-
-$sth = $dbh->simpleQuery("SELECT * FROM phptest");
-
-switch ($dbh->phptype) {
-    case 'mysqli':
-        if (is_a($sth, 'mysqli_result')) {
-            print "passed\n";
-        } else {
-            print "PROBLEM\n";
-        }
-        break;
-    default:
-        if (gettype($sth) == 'resource') {
-            print "passed\n";
-        } else {
-            print "PROBLEM\n";
-        }
-}
-
-
-switch ($dbh->phptype) {
-    case 'ibase':
-        /*
-         * Interbase doesn't allow dropping tables that have result
-         * sets still open.
-         */
-        $dbh->freeResult($sth);
-        break;
-}
-$dbh->setErrorHandling(PEAR_ERROR_RETURN);
-drop_table($dbh, 'phptest');
diff --git a/lib/tests/DB/tests/skipif.inc b/lib/tests/DB/tests/skipif.inc
deleted file mode 100644
index c522f0becd68b5a3aaa13726d16c9ed4890baaf6..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/skipif.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * A test to make sure PEAR DB can be found
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: skipif.inc,v 1.3 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-/**
- * Set up the include_path, error_reporting and PATH_SEPARATOR
- */
-require_once './include.inc';
-
-if (!include_once 'DB.php') {
-    print 'skip could not find DB.php';
-}
diff --git a/lib/tests/DB/tests/transactions.inc b/lib/tests/DB/tests/transactions.inc
deleted file mode 100644
index 9d1efdb5f5afeadbaeb16296656ea9c82a9489a4..0000000000000000000000000000000000000000
--- a/lib/tests/DB/tests/transactions.inc
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-
-/**
- * Tests the drivers' transaction handling methods
- *
- * Executed by driver/11transactions.phpt
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Database
- * @package    DB
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2007 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    $Id: transactions.inc,v 1.11 2007/07/06 05:19:21 aharvey Exp $
- * @link       http://pear.php.net/package/DB
- */
-
-// Testing here due to skip not working currently in head
-if (!$dbh->features['transactions']) {
-    die('this driver does not support transactions');
-}
-
-// View the table from a separate connection so we don't disturb
-// the transaction.
-$dbh2 = DB::connect($dbh->dsn);
-
-function error_handler(&$obj) {
-    print "\n" . $obj->getDebugInfo() . "\n";
-}
-
-function dumptable($expected) {
-    global $dbh, $dbh2;
-    print implode(' ', $dbh->getCol('SELECT b FROM phptest'));
-
-    if (isset($dbh->transaction_opcount)) {
-        if ($expected == $dbh->transaction_opcount) {
-            print ".  ops=ok\n";
-        } else {
-            print ".  ops=$dbh->transaction_opcount\n";
-        }
-    } else {
-        print ".  ops=ok\n";
-    }
-}
-
-$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler');
-
-
-$dbh->autoCommit(true);
-$dbh->query("INSERT INTO phptest VALUES(1, 'one', 'One', '2001-02-19')");
-
-print '1) after autocommit: ';
-dumptable(0);
-
-$dbh->autoCommit(false);
-$dbh->query("INSERT INTO phptest VALUES(2, 'two', 'Two', '2001-02-20')");
-$dbh->query("INSERT INTO phptest VALUES(3, 'three', 'Three', '2001-02-21')");
-print '2) before commit: ';
-dumptable(2);
-
-$dbh->commit();
-print '3) after commit: ';
-dumptable(0);
-
-$dbh->query("INSERT INTO phptest VALUES(4, 'four', 'Four', '2001-02-22')");
-$dbh->query("INSERT INTO phptest VALUES(5, 'five', 'Five', '2001-02-23')");
-print '4) before rollback: ';
-dumptable(2);
-
-$dbh->rollback();
-print '5) after rollback: ';
-dumptable(0);
-$dbh->rollback();
-
-$dbh->autoCommit(true);
-$dbh->query("INSERT INTO phptest VALUES(6, 'six', 'Six', '2001-02-24')");
-$dbh->query("INSERT INTO phptest VALUES(7, 'seven', 'Seven', '2001-02-25')");
-print '6) before autocommit+rollback: ';
-dumptable(0);
-
-$dbh->rollback();
-print '7) after autocommit+rollback: ';
-dumptable(0);
-
-print '8) testing that select doesn\'t disturbe opcount: ';
-$dbh->autoCommit(false);
-$dbh->simpleQuery("SELECT * FROM phptest");
-$dbh->simpleQuery("SELECT a,cc FROM phptest");
-$dbh->simpleQuery("SELECT b,d FROM phptest");
-if (empty($dbh->transaction_opcount)) {
-    print "ok\n";
-} else {
-    print "failed (count=$dbh->transaction_opcount)\n";
-}
diff --git a/lib/tests/Date/tests/bugs/bug-674.phpt b/lib/tests/Date/tests/bugs/bug-674.phpt
deleted file mode 100644
index ffaf40ce177c009ca9848392f25d18acb95128d9..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-674.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-674.phpt,v 1.1 2006/11/20 08:53:05 firman Exp $
-?>
---TEST--
-Bug #674: strange (wrong?) result of Date_Calc::endOfWeek
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: Date_Calc::endOfWeek(), Date_Calc::beginOfWeek(),
- *               Date_Calc::beginOfNextWeek() and Date_Calc::beginOfPrevWeek().
- */
-
-require_once 'Date.php';
-
-$dates = array (array(2003,3,17), array(2003,3,20), array(2003,3,23));
-foreach ($dates as $date) {
-    echo 'Parameters: ' . implode('-', array_reverse($date)) . "\n";
-    $bow = Date_Calc::endOfWeek($date[2],$date[1],$date[0]);
-    $eow = Date_Calc::beginOfWeek($date[2],$date[1],$date[0]);
-    $bonw = Date_Calc::beginOfNextWeek($date[2],$date[1],$date[0]);
-    $bopw = Date_Calc::beginOfPrevWeek($date[2],$date[1],$date[0]);
-    echo 'Begin of week = ' . $bow . ', End of week = ' . $eow . ', ' .
-         'Begin of next week = ' . $bonw . ', Begin of previous week = ' . $bopw .
-         "\n\n";
-}
-?>
---EXPECT--
-Parameters: 17-3-2003
-Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310
-
-Parameters: 20-3-2003
-Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310
-
-Parameters: 23-3-2003
-Begin of week = 20030323, End of week = 20030317, Begin of next week = 20030324, Begin of previous week = 20030310
-
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-727-1.phpt b/lib/tests/Date/tests/bugs/bug-727-1.phpt
deleted file mode 100644
index 6c833e7d478e174747154de6b993137929d1f799..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-727-1.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-727-1.phpt,v 1.1 2006/11/20 08:54:51 firman Exp $
-?>
---TEST--
-Bug #727: Date_Calc::weeksInMonth() wrong result
-Tests for weeksInMonth, february with 4 weeks
-Monday as 1st day of week
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: Date_Calc::weeksInMonth()
- */
-
-/**
- * Monday as 1st day of week
- */
-define('DATE_CALC_BEGIN_WEEKDAY', 1);
-
-require_once "Date/Calc.php";
-
-$tests = array(
-    array(1999, 2), array(2010, 2), array(2021, 2), array(2027, 2),
-    array(1937, 2), array(1943, 2), array(1802, 2), array(1813, 2),
-    array(1819, 2), array(1830, 2), array(1841, 2), array(1847, 2),
-    array(1858, 2), array(1869, 2), array(1875, 2), array(1886, 2),
-    array(1897, 2), array(1909, 2), array(1915, 2), array(1926, 2)
-);
-
-foreach ($tests as $date) {
-    list ($year, $month) = $date;
-    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
-}
-?>
---EXPECT--
-1999/2 = 4 weeks
-2010/2 = 4 weeks
-2021/2 = 4 weeks
-2027/2 = 4 weeks
-1937/2 = 4 weeks
-1943/2 = 4 weeks
-1802/2 = 4 weeks
-1813/2 = 4 weeks
-1819/2 = 4 weeks
-1830/2 = 4 weeks
-1841/2 = 4 weeks
-1847/2 = 4 weeks
-1858/2 = 4 weeks
-1869/2 = 4 weeks
-1875/2 = 4 weeks
-1886/2 = 4 weeks
-1897/2 = 4 weeks
-1909/2 = 4 weeks
-1915/2 = 4 weeks
-1926/2 = 4 weeks
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-727-2.phpt b/lib/tests/Date/tests/bugs/bug-727-2.phpt
deleted file mode 100644
index 25d830467b8235f900776b2eed56b8519e1e099a..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-727-2.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-727-2.phpt,v 1.1 2006/11/20 08:56:24 firman Exp $
-?>
---TEST--
-Bug #727: Date_Calc::weeksInMonth() wrong result
-Tests for weeksInMonth, february with 4 weeks
-Sunday as 1st day of week
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: Date_Calc::weeksInMonth()
- */
-
-/**
- * Sunday as 1st day of week
- */
-define('DATE_CALC_BEGIN_WEEKDAY', 0);
-
-require_once "Date/Calc.php";
-
-$tests = array(
-    array(2009, 2), array(2015, 2), array(2026, 2), array(2037, 2),
-    array(1931, 2), array(1942, 2), array(1801, 2), array(1807, 2),
-    array(1818, 2), array(1829, 2), array(1835, 2), array(1846, 2),
-    array(1857, 2), array(1863, 2), array(1874, 2), array(1885, 2),
-    array(1891, 2), array(1903, 2), array(1914, 2), array(1925, 2)
-);
-
-foreach ($tests as $date) {
-    list ($year, $month) = $date;
-    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
-}
-?>
---EXPECT--
-2009/2 = 4 weeks
-2015/2 = 4 weeks
-2026/2 = 4 weeks
-2037/2 = 4 weeks
-1931/2 = 4 weeks
-1942/2 = 4 weeks
-1801/2 = 4 weeks
-1807/2 = 4 weeks
-1818/2 = 4 weeks
-1829/2 = 4 weeks
-1835/2 = 4 weeks
-1846/2 = 4 weeks
-1857/2 = 4 weeks
-1863/2 = 4 weeks
-1874/2 = 4 weeks
-1885/2 = 4 weeks
-1891/2 = 4 weeks
-1903/2 = 4 weeks
-1914/2 = 4 weeks
-1925/2 = 4 weeks
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-727-3.phpt b/lib/tests/Date/tests/bugs/bug-727-3.phpt
deleted file mode 100644
index 23664e84f14b5ef496bde112a78f7ad2ae677425..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-727-3.phpt
+++ /dev/null
@@ -1,514 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-727-3.phpt,v 1.1 2006/11/20 08:57:08 firman Exp $
-?>
---TEST--
-Bug #727: Date_Calc::weeksInMonth() wrong result
-Tests for weeksInMonth "random"
-Sunday as 1st day of week
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: Date_Calc::weeksInMonth()
- */
-
-/**
- * Sunday as 1st day of week
- */
-define('DATE_CALC_BEGIN_WEEKDAY', 0);
-
-require_once "Date/Calc.php";
-
-$tests = array(
-    array(1999, 12), array(2000, 11), array(2001, 11), array(2002, 12),
-    array(2003, 12), array(2004, 12), array(2005, 12), array(2006, 11),
-    array(2007, 11), array(2008, 12), array(2009, 12), array(2010, 12),
-    array(2011, 12), array(2012, 11), array(2013, 12), array(2014, 12),
-    array(2015, 12), array(2016, 12), array(2017, 11), array(2018, 11),
-    array(2019, 12), array(2020, 12), array(2021, 12), array(2022, 12),
-    array(2023, 11), array(2024, 12), array(2025, 12), array(2026, 12),
-    array(2027, 12), array(2028, 11), array(2029, 11), array(2030, 12),
-    array(2031, 12), array(2032, 12), array(2033, 12), array(2034, 11),
-    array(2035, 11), array(2036, 12), array(2037, 12), array(1930, 12),
-    array(1931, 12), array(1932, 12), array(1933, 11), array(1934, 11),
-    array(1935, 12), array(1936, 12), array(1937, 12), array(1938, 12),
-    array(1939, 11), array(1940, 12), array(1941, 12), array(1942, 12),
-    array(1943, 12), array(1944, 11), array(1945, 11), array(1946, 12),
-    array(1947, 12), array(1948, 12), array(1949, 12), array(1800, 12),
-    array(1801, 12), array(1802, 12), array(1803, 12), array(1804, 11),
-    array(1805, 12), array(1806, 12), array(1807, 12), array(1808, 12),
-    array(1809, 11), array(1810, 11), array(1811, 12), array(1812, 12),
-    array(1813, 12), array(1814, 12), array(1815, 11), array(1816, 12),
-    array(1817, 12), array(1818, 12), array(1819, 12), array(1820, 11),
-    array(1821, 11), array(1822, 12), array(1823, 12), array(1824, 12),
-    array(1825, 12), array(1826, 11), array(1827, 11), array(1828, 12),
-    array(1829, 12), array(1830, 12), array(1831, 12), array(1832, 11),
-    array(1833, 12), array(1834, 12), array(1835, 12), array(1836, 12),
-    array(1837, 11), array(1838, 11), array(1839, 12), array(1840, 12),
-    array(1841, 12), array(1842, 12), array(1843, 11), array(1844, 12),
-    array(1845, 12), array(1846, 12), array(1847, 12), array(1848, 11),
-    array(1849, 11), array(1850, 12), array(1851, 12), array(1852, 12),
-    array(1853, 12), array(1854, 11), array(1855, 11), array(1856, 12),
-    array(1857, 12), array(1858, 12), array(1859, 12), array(1860, 11),
-    array(1861, 12), array(1862, 12), array(1863, 12), array(1864, 12),
-    array(1865, 11), array(1866, 11), array(1867, 12), array(1868, 12),
-    array(1869, 12), array(1870, 12), array(1871, 11), array(1872, 12),
-    array(1873, 12), array(1874, 12), array(1875, 12), array(1876, 11),
-    array(1877, 11), array(1878, 12), array(1879, 12), array(1880, 12),
-    array(1881, 12), array(1882, 11), array(1883, 11), array(1884, 12),
-    array(1885, 12), array(1886, 12), array(1887, 12), array(1888, 11),
-    array(1889, 12), array(1890, 12), array(1891, 12), array(1892, 12),
-    array(1893, 11), array(1894, 11), array(1895, 12), array(1896, 12),
-    array(1897, 12), array(1898, 12), array(1899, 11), array(1900, 11),
-    array(1901, 12), array(1902, 12), array(1903, 12), array(1904, 12),
-    array(1905, 11), array(1906, 11), array(1907, 12), array(1908, 12),
-    array(1909, 12), array(1910, 12), array(1911, 11), array(1912, 12),
-    array(1913, 12), array(1914, 12), array(1915, 12), array(1916, 11),
-    array(1917, 11), array(1918, 12), array(1919, 12), array(1920, 12),
-    array(1921, 12), array(1922, 11), array(1923, 11), array(1924, 12),
-    array(1925, 12), array(1926, 12), array(1927, 12), array(1928, 11),
-    array(1929, 12), array(1999, 10), array(2000, 12), array(2001, 12),
-    array(2002, 6),  array(2003, 11), array(2004, 10), array(2005, 10),
-    array(2006, 12), array(2007, 12), array(2008, 11), array(2009, 8),
-    array(2010, 10), array(2011, 10), array(2012, 12), array(2013, 6),
-    array(2014, 11), array(2015, 8),  array(2016, 10), array(2017, 12),
-    array(2018, 12), array(2019, 6),  array(2020, 8),  array(2021, 10),
-    array(2022, 10), array(2023, 12), array(2024, 6),  array(2025, 11),
-    array(2026, 8),  array(2027, 10), array(2028, 12), array(2029, 12),
-    array(2030, 6),  array(2031, 11), array(2032, 10), array(2033, 10),
-    array(2034, 12), array(2035, 12), array(2036, 11), array(2037, 8),
-    array(1930, 11), array(1931, 8),  array(1932, 10), array(1933, 12),
-    array(1934, 12), array(1935, 6),  array(1936, 8),  array(1937, 10),
-    array(1938, 10), array(1939, 12), array(1940, 6),  array(1941, 11),
-    array(1942, 8),  array(1943, 10), array(1944, 12), array(1945, 12),
-    array(1946, 6),  array(1947, 11), array(1948, 10), array(1949, 10),
-    array(1800, 11), array(1801, 8),  array(1802, 10), array(1803, 10),
-    array(1804, 12), array(1805, 6),  array(1806, 11), array(1807, 8),
-    array(1808, 10), array(1809, 12), array(1810, 12), array(1811, 6),
-    array(1812, 8),  array(1813, 10), array(1814, 10), array(1815, 12),
-    array(1816, 6),  array(1817, 11), array(1818, 8),  array(1819, 10),
-    array(1820, 12), array(1821, 12), array(1822, 6),  array(1823, 11),
-    array(1824, 10), array(1825, 10), array(1826, 12), array(1827, 12),
-    array(1828, 11), array(1829, 8),  array(1830, 10), array(1831, 10),
-    array(1832, 12), array(1833, 6),  array(1834, 11), array(1835, 8),
-    array(1836, 10), array(1837, 12), array(1838, 12), array(1839, 6),
-    array(1840, 8),  array(1841, 10), array(1842, 10), array(1843, 12),
-    array(1844, 6),  array(1845, 11), array(1846, 8),  array(1847, 10),
-    array(1848, 12), array(1849, 12), array(1850, 6),  array(1851, 11),
-    array(1852, 10), array(1853, 10), array(1854, 12), array(1855, 12),
-    array(1856, 11), array(1857, 8),  array(1858, 10), array(1859, 10),
-    array(1860, 12), array(1861, 6),  array(1862, 11), array(1863, 8),
-    array(1864, 10), array(1865, 12), array(1866, 12), array(1867, 6),
-    array(1868, 8),  array(1869, 10), array(1870, 10), array(1871, 12),
-    array(1872, 6),  array(1873, 11), array(1874, 8),  array(1875, 10),
-    array(1876, 12), array(1877, 12), array(1878, 6),  array(1879, 11),
-    array(1880, 10), array(1881, 10), array(1882, 12), array(1883, 12),
-    array(1884, 11), array(1885, 8),  array(1886, 10), array(1887, 10),
-    array(1888, 12), array(1889, 6),  array(1890, 11), array(1891, 8),
-    array(1892, 10), array(1893, 12), array(1894, 12), array(1895, 6),
-    array(1896, 8),  array(1897, 10), array(1898, 10), array(1899, 12),
-    array(1900, 12), array(1901, 6),  array(1902, 11), array(1903, 8),
-    array(1904, 10), array(1905, 12), array(1906, 12), array(1907, 6),
-    array(1908, 8),  array(1909, 10), array(1910, 10), array(1911, 12),
-    array(1912, 6),  array(1913, 11), array(1914, 8),  array(1915, 10),
-    array(1916, 12), array(1917, 12), array(1918, 6),  array(1919, 11),
-    array(1920, 10), array(1921, 10), array(1922, 12), array(1923, 12),
-    array(1924, 11), array(1925, 8),  array(1926, 10), array(1927, 10),
-    array(1928, 12), array(1929, 6)
-);
-
-foreach ($tests as $date) {
-    list ($year, $month) = $date;
-    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
-}
-?>
---EXPECT--
-1999/12 = 5 weeks
-2000/11 = 5 weeks
-2001/11 = 5 weeks
-2002/12 = 5 weeks
-2003/12 = 5 weeks
-2004/12 = 5 weeks
-2005/12 = 5 weeks
-2006/11 = 5 weeks
-2007/11 = 5 weeks
-2008/12 = 5 weeks
-2009/12 = 5 weeks
-2010/12 = 5 weeks
-2011/12 = 5 weeks
-2012/11 = 5 weeks
-2013/12 = 5 weeks
-2014/12 = 5 weeks
-2015/12 = 5 weeks
-2016/12 = 5 weeks
-2017/11 = 5 weeks
-2018/11 = 5 weeks
-2019/12 = 5 weeks
-2020/12 = 5 weeks
-2021/12 = 5 weeks
-2022/12 = 5 weeks
-2023/11 = 5 weeks
-2024/12 = 5 weeks
-2025/12 = 5 weeks
-2026/12 = 5 weeks
-2027/12 = 5 weeks
-2028/11 = 5 weeks
-2029/11 = 5 weeks
-2030/12 = 5 weeks
-2031/12 = 5 weeks
-2032/12 = 5 weeks
-2033/12 = 5 weeks
-2034/11 = 5 weeks
-2035/11 = 5 weeks
-2036/12 = 5 weeks
-2037/12 = 5 weeks
-1930/12 = 5 weeks
-1931/12 = 5 weeks
-1932/12 = 5 weeks
-1933/11 = 5 weeks
-1934/11 = 5 weeks
-1935/12 = 5 weeks
-1936/12 = 5 weeks
-1937/12 = 5 weeks
-1938/12 = 5 weeks
-1939/11 = 5 weeks
-1940/12 = 5 weeks
-1941/12 = 5 weeks
-1942/12 = 5 weeks
-1943/12 = 5 weeks
-1944/11 = 5 weeks
-1945/11 = 5 weeks
-1946/12 = 5 weeks
-1947/12 = 5 weeks
-1948/12 = 5 weeks
-1949/12 = 5 weeks
-1800/12 = 5 weeks
-1801/12 = 5 weeks
-1802/12 = 5 weeks
-1803/12 = 5 weeks
-1804/11 = 5 weeks
-1805/12 = 5 weeks
-1806/12 = 5 weeks
-1807/12 = 5 weeks
-1808/12 = 5 weeks
-1809/11 = 5 weeks
-1810/11 = 5 weeks
-1811/12 = 5 weeks
-1812/12 = 5 weeks
-1813/12 = 5 weeks
-1814/12 = 5 weeks
-1815/11 = 5 weeks
-1816/12 = 5 weeks
-1817/12 = 5 weeks
-1818/12 = 5 weeks
-1819/12 = 5 weeks
-1820/11 = 5 weeks
-1821/11 = 5 weeks
-1822/12 = 5 weeks
-1823/12 = 5 weeks
-1824/12 = 5 weeks
-1825/12 = 5 weeks
-1826/11 = 5 weeks
-1827/11 = 5 weeks
-1828/12 = 5 weeks
-1829/12 = 5 weeks
-1830/12 = 5 weeks
-1831/12 = 5 weeks
-1832/11 = 5 weeks
-1833/12 = 5 weeks
-1834/12 = 5 weeks
-1835/12 = 5 weeks
-1836/12 = 5 weeks
-1837/11 = 5 weeks
-1838/11 = 5 weeks
-1839/12 = 5 weeks
-1840/12 = 5 weeks
-1841/12 = 5 weeks
-1842/12 = 5 weeks
-1843/11 = 5 weeks
-1844/12 = 5 weeks
-1845/12 = 5 weeks
-1846/12 = 5 weeks
-1847/12 = 5 weeks
-1848/11 = 5 weeks
-1849/11 = 5 weeks
-1850/12 = 5 weeks
-1851/12 = 5 weeks
-1852/12 = 5 weeks
-1853/12 = 5 weeks
-1854/11 = 5 weeks
-1855/11 = 5 weeks
-1856/12 = 5 weeks
-1857/12 = 5 weeks
-1858/12 = 5 weeks
-1859/12 = 5 weeks
-1860/11 = 5 weeks
-1861/12 = 5 weeks
-1862/12 = 5 weeks
-1863/12 = 5 weeks
-1864/12 = 5 weeks
-1865/11 = 5 weeks
-1866/11 = 5 weeks
-1867/12 = 5 weeks
-1868/12 = 5 weeks
-1869/12 = 5 weeks
-1870/12 = 5 weeks
-1871/11 = 5 weeks
-1872/12 = 5 weeks
-1873/12 = 5 weeks
-1874/12 = 5 weeks
-1875/12 = 5 weeks
-1876/11 = 5 weeks
-1877/11 = 5 weeks
-1878/12 = 5 weeks
-1879/12 = 5 weeks
-1880/12 = 5 weeks
-1881/12 = 5 weeks
-1882/11 = 5 weeks
-1883/11 = 5 weeks
-1884/12 = 5 weeks
-1885/12 = 5 weeks
-1886/12 = 5 weeks
-1887/12 = 5 weeks
-1888/11 = 5 weeks
-1889/12 = 5 weeks
-1890/12 = 5 weeks
-1891/12 = 5 weeks
-1892/12 = 5 weeks
-1893/11 = 5 weeks
-1894/11 = 5 weeks
-1895/12 = 5 weeks
-1896/12 = 5 weeks
-1897/12 = 5 weeks
-1898/12 = 5 weeks
-1899/11 = 5 weeks
-1900/11 = 5 weeks
-1901/12 = 5 weeks
-1902/12 = 5 weeks
-1903/12 = 5 weeks
-1904/12 = 5 weeks
-1905/11 = 5 weeks
-1906/11 = 5 weeks
-1907/12 = 5 weeks
-1908/12 = 5 weeks
-1909/12 = 5 weeks
-1910/12 = 5 weeks
-1911/11 = 5 weeks
-1912/12 = 5 weeks
-1913/12 = 5 weeks
-1914/12 = 5 weeks
-1915/12 = 5 weeks
-1916/11 = 5 weeks
-1917/11 = 5 weeks
-1918/12 = 5 weeks
-1919/12 = 5 weeks
-1920/12 = 5 weeks
-1921/12 = 5 weeks
-1922/11 = 5 weeks
-1923/11 = 5 weeks
-1924/12 = 5 weeks
-1925/12 = 5 weeks
-1926/12 = 5 weeks
-1927/12 = 5 weeks
-1928/11 = 5 weeks
-1929/12 = 5 weeks
-1999/10 = 6 weeks
-2000/12 = 6 weeks
-2001/12 = 6 weeks
-2002/6 = 6 weeks
-2003/11 = 6 weeks
-2004/10 = 6 weeks
-2005/10 = 6 weeks
-2006/12 = 6 weeks
-2007/12 = 6 weeks
-2008/11 = 6 weeks
-2009/8 = 6 weeks
-2010/10 = 6 weeks
-2011/10 = 6 weeks
-2012/12 = 6 weeks
-2013/6 = 6 weeks
-2014/11 = 6 weeks
-2015/8 = 6 weeks
-2016/10 = 6 weeks
-2017/12 = 6 weeks
-2018/12 = 6 weeks
-2019/6 = 6 weeks
-2020/8 = 6 weeks
-2021/10 = 6 weeks
-2022/10 = 6 weeks
-2023/12 = 6 weeks
-2024/6 = 6 weeks
-2025/11 = 6 weeks
-2026/8 = 6 weeks
-2027/10 = 6 weeks
-2028/12 = 6 weeks
-2029/12 = 6 weeks
-2030/6 = 6 weeks
-2031/11 = 6 weeks
-2032/10 = 6 weeks
-2033/10 = 6 weeks
-2034/12 = 6 weeks
-2035/12 = 6 weeks
-2036/11 = 6 weeks
-2037/8 = 6 weeks
-1930/11 = 6 weeks
-1931/8 = 6 weeks
-1932/10 = 6 weeks
-1933/12 = 6 weeks
-1934/12 = 6 weeks
-1935/6 = 6 weeks
-1936/8 = 6 weeks
-1937/10 = 6 weeks
-1938/10 = 6 weeks
-1939/12 = 6 weeks
-1940/6 = 6 weeks
-1941/11 = 6 weeks
-1942/8 = 6 weeks
-1943/10 = 6 weeks
-1944/12 = 6 weeks
-1945/12 = 6 weeks
-1946/6 = 6 weeks
-1947/11 = 6 weeks
-1948/10 = 6 weeks
-1949/10 = 6 weeks
-1800/11 = 6 weeks
-1801/8 = 6 weeks
-1802/10 = 6 weeks
-1803/10 = 6 weeks
-1804/12 = 6 weeks
-1805/6 = 6 weeks
-1806/11 = 6 weeks
-1807/8 = 6 weeks
-1808/10 = 6 weeks
-1809/12 = 6 weeks
-1810/12 = 6 weeks
-1811/6 = 6 weeks
-1812/8 = 6 weeks
-1813/10 = 6 weeks
-1814/10 = 6 weeks
-1815/12 = 6 weeks
-1816/6 = 6 weeks
-1817/11 = 6 weeks
-1818/8 = 6 weeks
-1819/10 = 6 weeks
-1820/12 = 6 weeks
-1821/12 = 6 weeks
-1822/6 = 6 weeks
-1823/11 = 6 weeks
-1824/10 = 6 weeks
-1825/10 = 6 weeks
-1826/12 = 6 weeks
-1827/12 = 6 weeks
-1828/11 = 6 weeks
-1829/8 = 6 weeks
-1830/10 = 6 weeks
-1831/10 = 6 weeks
-1832/12 = 6 weeks
-1833/6 = 6 weeks
-1834/11 = 6 weeks
-1835/8 = 6 weeks
-1836/10 = 6 weeks
-1837/12 = 6 weeks
-1838/12 = 6 weeks
-1839/6 = 6 weeks
-1840/8 = 6 weeks
-1841/10 = 6 weeks
-1842/10 = 6 weeks
-1843/12 = 6 weeks
-1844/6 = 6 weeks
-1845/11 = 6 weeks
-1846/8 = 6 weeks
-1847/10 = 6 weeks
-1848/12 = 6 weeks
-1849/12 = 6 weeks
-1850/6 = 6 weeks
-1851/11 = 6 weeks
-1852/10 = 6 weeks
-1853/10 = 6 weeks
-1854/12 = 6 weeks
-1855/12 = 6 weeks
-1856/11 = 6 weeks
-1857/8 = 6 weeks
-1858/10 = 6 weeks
-1859/10 = 6 weeks
-1860/12 = 6 weeks
-1861/6 = 6 weeks
-1862/11 = 6 weeks
-1863/8 = 6 weeks
-1864/10 = 6 weeks
-1865/12 = 6 weeks
-1866/12 = 6 weeks
-1867/6 = 6 weeks
-1868/8 = 6 weeks
-1869/10 = 6 weeks
-1870/10 = 6 weeks
-1871/12 = 6 weeks
-1872/6 = 6 weeks
-1873/11 = 6 weeks
-1874/8 = 6 weeks
-1875/10 = 6 weeks
-1876/12 = 6 weeks
-1877/12 = 6 weeks
-1878/6 = 6 weeks
-1879/11 = 6 weeks
-1880/10 = 6 weeks
-1881/10 = 6 weeks
-1882/12 = 6 weeks
-1883/12 = 6 weeks
-1884/11 = 6 weeks
-1885/8 = 6 weeks
-1886/10 = 6 weeks
-1887/10 = 6 weeks
-1888/12 = 6 weeks
-1889/6 = 6 weeks
-1890/11 = 6 weeks
-1891/8 = 6 weeks
-1892/10 = 6 weeks
-1893/12 = 6 weeks
-1894/12 = 6 weeks
-1895/6 = 6 weeks
-1896/8 = 6 weeks
-1897/10 = 6 weeks
-1898/10 = 6 weeks
-1899/12 = 6 weeks
-1900/12 = 6 weeks
-1901/6 = 6 weeks
-1902/11 = 6 weeks
-1903/8 = 6 weeks
-1904/10 = 6 weeks
-1905/12 = 6 weeks
-1906/12 = 6 weeks
-1907/6 = 6 weeks
-1908/8 = 6 weeks
-1909/10 = 6 weeks
-1910/10 = 6 weeks
-1911/12 = 6 weeks
-1912/6 = 6 weeks
-1913/11 = 6 weeks
-1914/8 = 6 weeks
-1915/10 = 6 weeks
-1916/12 = 6 weeks
-1917/12 = 6 weeks
-1918/6 = 6 weeks
-1919/11 = 6 weeks
-1920/10 = 6 weeks
-1921/10 = 6 weeks
-1922/12 = 6 weeks
-1923/12 = 6 weeks
-1924/11 = 6 weeks
-1925/8 = 6 weeks
-1926/10 = 6 weeks
-1927/10 = 6 weeks
-1928/12 = 6 weeks
-1929/6 = 6 weeks
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-727-4.phpt b/lib/tests/Date/tests/bugs/bug-727-4.phpt
deleted file mode 100644
index d1bb859a4032a5cfb05540ee2e318b06a9f4e3c7..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-727-4.phpt
+++ /dev/null
@@ -1,514 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-727-4.phpt,v 1.1 2006/11/20 08:57:56 firman Exp $
-?>
---TEST--
-Bug #727: Date_Calc::weeksInMonth() wrong result
-Tests for weeksInMonth "random"
-Monday as 1st day of week
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: Date_Calc::weeksInMonth()
- */
-
-/**
- * Monday as 1st day of week
- */
-define('DATE_CALC_BEGIN_WEEKDAY', 1);
-
-require_once "Date/Calc.php";
-
-$tests = array(
-    array(1999, 8),  array(2000, 10), array(2001, 12), array(2002, 12),
-    array(2003, 6),  array(2004, 8),  array(2005, 10), array(2006, 10),
-    array(2007, 12), array(2008, 6),  array(2009, 11), array(2010, 8),
-    array(2011, 10), array(2012, 12), array(2013, 12), array(2014, 6),
-    array(2015, 11), array(2016, 10), array(2017, 10), array(2018, 12),
-    array(2019, 12), array(2020, 11), array(2021, 8),  array(2022, 10),
-    array(2023, 10), array(2024, 12), array(2025, 6),  array(2026, 11),
-    array(2027, 8),  array(2028, 10), array(2029, 12), array(2030, 12),
-    array(2031, 6),  array(2032, 8),  array(2033, 10), array(2034, 10),
-    array(2035, 12), array(2036, 6),  array(2037, 11), array(1930, 6),
-    array(1931, 11), array(1932, 10), array(1933, 10), array(1934, 12),
-    array(1935, 12), array(1936, 11), array(1937, 8),  array(1938, 10),
-    array(1939, 10), array(1940, 12), array(1941, 6),  array(1942, 11),
-    array(1943, 8),  array(1944, 10), array(1945, 12), array(1946, 12),
-    array(1947, 6),  array(1948, 8),  array(1949, 10), array(1800, 6),
-    array(1801, 11), array(1802, 8),  array(1803, 10), array(1804, 12),
-    array(1805, 12), array(1806, 6),  array(1807, 11), array(1808, 10),
-    array(1809, 10), array(1810, 12), array(1811, 12), array(1812, 11),
-    array(1813, 8),  array(1814, 10), array(1815, 10), array(1816, 12),
-    array(1817, 6),  array(1818, 11), array(1819, 8),  array(1820, 10),
-    array(1821, 12), array(1822, 12), array(1823, 6),  array(1824, 8),
-    array(1825, 10), array(1826, 10), array(1827, 12), array(1828, 6),
-    array(1829, 11), array(1830, 8),  array(1831, 10), array(1832, 12),
-    array(1833, 12), array(1834, 6),  array(1835, 11), array(1836, 10),
-    array(1837, 10), array(1838, 12), array(1839, 12), array(1840, 11),
-    array(1841, 8),  array(1842, 10), array(1843, 10), array(1844, 12),
-    array(1845, 6),  array(1846, 11), array(1847, 8),  array(1848, 10),
-    array(1849, 12), array(1850, 12), array(1851, 6),  array(1852, 8),
-    array(1853, 10), array(1854, 10), array(1855, 12), array(1856, 6),
-    array(1857, 11), array(1858, 8),  array(1859, 10), array(1860, 12),
-    array(1861, 12), array(1862, 6),  array(1863, 11), array(1864, 10),
-    array(1865, 10), array(1866, 12), array(1867, 12), array(1868, 11),
-    array(1869, 8),  array(1870, 10), array(1871, 10), array(1872, 12),
-    array(1873, 6),  array(1874, 11), array(1875, 8),  array(1876, 10),
-    array(1877, 12), array(1878, 12), array(1879, 6),  array(1880, 8),
-    array(1881, 10), array(1882, 10), array(1883, 12), array(1884, 6),
-    array(1885, 11), array(1886, 8),  array(1887, 10), array(1888, 12),
-    array(1889, 12), array(1890, 6),  array(1891, 11), array(1892, 10),
-    array(1893, 10), array(1894, 12), array(1895, 12), array(1896, 11),
-    array(1897, 8),  array(1898, 10), array(1899, 10), array(1900, 12),
-    array(1901, 12), array(1902, 6),  array(1903, 11), array(1904, 10),
-    array(1905, 10), array(1906, 12), array(1907, 12), array(1908, 11),
-    array(1909, 8),  array(1910, 10), array(1911, 10), array(1912, 12),
-    array(1913, 6),  array(1914, 11), array(1915, 8),  array(1916, 10),
-    array(1917, 12), array(1918, 12), array(1919, 6),  array(1920, 8),
-    array(1921, 10), array(1922, 10), array(1923, 12), array(1924, 6),
-    array(1925, 11), array(1926, 8),  array(1927, 10), array(1928, 12),
-    array(1929, 12), array(1999, 12), array(2000, 12), array(2001, 11),
-    array(2002, 11), array(2003, 12), array(2004, 12), array(2005, 12),
-    array(2006, 12), array(2007, 11), array(2008, 12), array(2009, 12),
-    array(2010, 12), array(2011, 12), array(2012, 11), array(2013, 11),
-    array(2014, 12), array(2015, 12), array(2016, 12), array(2017, 12),
-    array(2018, 11), array(2019, 11), array(2020, 12), array(2021, 12),
-    array(2022, 12), array(2023, 12), array(2024, 11), array(2025, 12),
-    array(2026, 12), array(2027, 12), array(2028, 12), array(2029, 11),
-    array(2030, 11), array(2031, 12), array(2032, 12), array(2033, 12),
-    array(2034, 12), array(2035, 11), array(2036, 12), array(2037, 12),
-    array(1930, 12), array(1931, 12), array(1932, 12), array(1933, 12),
-    array(1934, 11), array(1935, 11), array(1936, 12), array(1937, 12),
-    array(1938, 12), array(1939, 12), array(1940, 11), array(1941, 12),
-    array(1942, 12), array(1943, 12), array(1944, 12), array(1945, 11),
-    array(1946, 11), array(1947, 12), array(1948, 12), array(1949, 12),
-    array(1800, 12), array(1801, 12), array(1802, 12), array(1803, 12),
-    array(1804, 11), array(1805, 11), array(1806, 12), array(1807, 12),
-    array(1808, 12), array(1809, 12), array(1810, 11), array(1811, 11),
-    array(1812, 12), array(1813, 12), array(1814, 12), array(1815, 12),
-    array(1816, 11), array(1817, 12), array(1818, 12), array(1819, 12),
-    array(1820, 12), array(1821, 11), array(1822, 11), array(1823, 12),
-    array(1824, 12), array(1825, 12), array(1826, 12), array(1827, 11),
-    array(1828, 12), array(1829, 12), array(1830, 12), array(1831, 12),
-    array(1832, 11), array(1833, 11), array(1834, 12), array(1835, 12),
-    array(1836, 12), array(1837, 12), array(1838, 11), array(1839, 11),
-    array(1840, 12), array(1841, 12), array(1842, 12), array(1843, 12),
-    array(1844, 11), array(1845, 12), array(1846, 12), array(1847, 12),
-    array(1848, 12), array(1849, 11), array(1850, 11), array(1851, 12),
-    array(1852, 12), array(1853, 12), array(1854, 12), array(1855, 11),
-    array(1856, 12), array(1857, 12), array(1858, 12), array(1859, 12),
-    array(1860, 11), array(1861, 11), array(1862, 12), array(1863, 12),
-    array(1864, 12), array(1865, 12), array(1866, 11), array(1867, 11),
-    array(1868, 12), array(1869, 12), array(1870, 12), array(1871, 12),
-    array(1872, 11), array(1873, 12), array(1874, 12), array(1875, 12),
-    array(1876, 12), array(1877, 11), array(1878, 11), array(1879, 12),
-    array(1880, 12), array(1881, 12), array(1882, 12), array(1883, 11),
-    array(1884, 12), array(1885, 12), array(1886, 12), array(1887, 12),
-    array(1888, 11), array(1889, 11), array(1890, 12), array(1891, 12),
-    array(1892, 12), array(1893, 12), array(1894, 11), array(1895, 11),
-    array(1896, 12), array(1897, 12), array(1898, 12), array(1899, 12),
-    array(1900, 11), array(1901, 11), array(1902, 12), array(1903, 12),
-    array(1904, 12), array(1905, 12), array(1906, 11), array(1907, 11),
-    array(1908, 12), array(1909, 12), array(1910, 12), array(1911, 12),
-    array(1912, 11), array(1913, 12), array(1914, 12), array(1915, 12),
-    array(1916, 12), array(1917, 11), array(1918, 11), array(1919, 12),
-    array(1920, 12), array(1921, 12), array(1922, 12), array(1923, 11),
-    array(1924, 12), array(1925, 12), array(1926, 12), array(1927, 12),
-    array(1928, 11), array(1929, 11)
-);
-
-foreach ($tests as $date) {
-    list ($year, $month) = $date;
-    echo $year . '/' . $month . ' = ' . Date_Calc::weeksInMonth($month, $year) . ' weeks' . "\n";
-}
-?>
---EXPECT--
-1999/8 = 6 weeks
-2000/10 = 6 weeks
-2001/12 = 6 weeks
-2002/12 = 6 weeks
-2003/6 = 6 weeks
-2004/8 = 6 weeks
-2005/10 = 6 weeks
-2006/10 = 6 weeks
-2007/12 = 6 weeks
-2008/6 = 6 weeks
-2009/11 = 6 weeks
-2010/8 = 6 weeks
-2011/10 = 6 weeks
-2012/12 = 6 weeks
-2013/12 = 6 weeks
-2014/6 = 6 weeks
-2015/11 = 6 weeks
-2016/10 = 6 weeks
-2017/10 = 6 weeks
-2018/12 = 6 weeks
-2019/12 = 6 weeks
-2020/11 = 6 weeks
-2021/8 = 6 weeks
-2022/10 = 6 weeks
-2023/10 = 6 weeks
-2024/12 = 6 weeks
-2025/6 = 6 weeks
-2026/11 = 6 weeks
-2027/8 = 6 weeks
-2028/10 = 6 weeks
-2029/12 = 6 weeks
-2030/12 = 6 weeks
-2031/6 = 6 weeks
-2032/8 = 6 weeks
-2033/10 = 6 weeks
-2034/10 = 6 weeks
-2035/12 = 6 weeks
-2036/6 = 6 weeks
-2037/11 = 6 weeks
-1930/6 = 6 weeks
-1931/11 = 6 weeks
-1932/10 = 6 weeks
-1933/10 = 6 weeks
-1934/12 = 6 weeks
-1935/12 = 6 weeks
-1936/11 = 6 weeks
-1937/8 = 6 weeks
-1938/10 = 6 weeks
-1939/10 = 6 weeks
-1940/12 = 6 weeks
-1941/6 = 6 weeks
-1942/11 = 6 weeks
-1943/8 = 6 weeks
-1944/10 = 6 weeks
-1945/12 = 6 weeks
-1946/12 = 6 weeks
-1947/6 = 6 weeks
-1948/8 = 6 weeks
-1949/10 = 6 weeks
-1800/6 = 6 weeks
-1801/11 = 6 weeks
-1802/8 = 6 weeks
-1803/10 = 6 weeks
-1804/12 = 6 weeks
-1805/12 = 6 weeks
-1806/6 = 6 weeks
-1807/11 = 6 weeks
-1808/10 = 6 weeks
-1809/10 = 6 weeks
-1810/12 = 6 weeks
-1811/12 = 6 weeks
-1812/11 = 6 weeks
-1813/8 = 6 weeks
-1814/10 = 6 weeks
-1815/10 = 6 weeks
-1816/12 = 6 weeks
-1817/6 = 6 weeks
-1818/11 = 6 weeks
-1819/8 = 6 weeks
-1820/10 = 6 weeks
-1821/12 = 6 weeks
-1822/12 = 6 weeks
-1823/6 = 6 weeks
-1824/8 = 6 weeks
-1825/10 = 6 weeks
-1826/10 = 6 weeks
-1827/12 = 6 weeks
-1828/6 = 6 weeks
-1829/11 = 6 weeks
-1830/8 = 6 weeks
-1831/10 = 6 weeks
-1832/12 = 6 weeks
-1833/12 = 6 weeks
-1834/6 = 6 weeks
-1835/11 = 6 weeks
-1836/10 = 6 weeks
-1837/10 = 6 weeks
-1838/12 = 6 weeks
-1839/12 = 6 weeks
-1840/11 = 6 weeks
-1841/8 = 6 weeks
-1842/10 = 6 weeks
-1843/10 = 6 weeks
-1844/12 = 6 weeks
-1845/6 = 6 weeks
-1846/11 = 6 weeks
-1847/8 = 6 weeks
-1848/10 = 6 weeks
-1849/12 = 6 weeks
-1850/12 = 6 weeks
-1851/6 = 6 weeks
-1852/8 = 6 weeks
-1853/10 = 6 weeks
-1854/10 = 6 weeks
-1855/12 = 6 weeks
-1856/6 = 6 weeks
-1857/11 = 6 weeks
-1858/8 = 6 weeks
-1859/10 = 6 weeks
-1860/12 = 6 weeks
-1861/12 = 6 weeks
-1862/6 = 6 weeks
-1863/11 = 6 weeks
-1864/10 = 6 weeks
-1865/10 = 6 weeks
-1866/12 = 6 weeks
-1867/12 = 6 weeks
-1868/11 = 6 weeks
-1869/8 = 6 weeks
-1870/10 = 6 weeks
-1871/10 = 6 weeks
-1872/12 = 6 weeks
-1873/6 = 6 weeks
-1874/11 = 6 weeks
-1875/8 = 6 weeks
-1876/10 = 6 weeks
-1877/12 = 6 weeks
-1878/12 = 6 weeks
-1879/6 = 6 weeks
-1880/8 = 6 weeks
-1881/10 = 6 weeks
-1882/10 = 6 weeks
-1883/12 = 6 weeks
-1884/6 = 6 weeks
-1885/11 = 6 weeks
-1886/8 = 6 weeks
-1887/10 = 6 weeks
-1888/12 = 6 weeks
-1889/12 = 6 weeks
-1890/6 = 6 weeks
-1891/11 = 6 weeks
-1892/10 = 6 weeks
-1893/10 = 6 weeks
-1894/12 = 6 weeks
-1895/12 = 6 weeks
-1896/11 = 6 weeks
-1897/8 = 6 weeks
-1898/10 = 6 weeks
-1899/10 = 6 weeks
-1900/12 = 6 weeks
-1901/12 = 6 weeks
-1902/6 = 6 weeks
-1903/11 = 6 weeks
-1904/10 = 6 weeks
-1905/10 = 6 weeks
-1906/12 = 6 weeks
-1907/12 = 6 weeks
-1908/11 = 6 weeks
-1909/8 = 6 weeks
-1910/10 = 6 weeks
-1911/10 = 6 weeks
-1912/12 = 6 weeks
-1913/6 = 6 weeks
-1914/11 = 6 weeks
-1915/8 = 6 weeks
-1916/10 = 6 weeks
-1917/12 = 6 weeks
-1918/12 = 6 weeks
-1919/6 = 6 weeks
-1920/8 = 6 weeks
-1921/10 = 6 weeks
-1922/10 = 6 weeks
-1923/12 = 6 weeks
-1924/6 = 6 weeks
-1925/11 = 6 weeks
-1926/8 = 6 weeks
-1927/10 = 6 weeks
-1928/12 = 6 weeks
-1929/12 = 6 weeks
-1999/12 = 5 weeks
-2000/12 = 5 weeks
-2001/11 = 5 weeks
-2002/11 = 5 weeks
-2003/12 = 5 weeks
-2004/12 = 5 weeks
-2005/12 = 5 weeks
-2006/12 = 5 weeks
-2007/11 = 5 weeks
-2008/12 = 5 weeks
-2009/12 = 5 weeks
-2010/12 = 5 weeks
-2011/12 = 5 weeks
-2012/11 = 5 weeks
-2013/11 = 5 weeks
-2014/12 = 5 weeks
-2015/12 = 5 weeks
-2016/12 = 5 weeks
-2017/12 = 5 weeks
-2018/11 = 5 weeks
-2019/11 = 5 weeks
-2020/12 = 5 weeks
-2021/12 = 5 weeks
-2022/12 = 5 weeks
-2023/12 = 5 weeks
-2024/11 = 5 weeks
-2025/12 = 5 weeks
-2026/12 = 5 weeks
-2027/12 = 5 weeks
-2028/12 = 5 weeks
-2029/11 = 5 weeks
-2030/11 = 5 weeks
-2031/12 = 5 weeks
-2032/12 = 5 weeks
-2033/12 = 5 weeks
-2034/12 = 5 weeks
-2035/11 = 5 weeks
-2036/12 = 5 weeks
-2037/12 = 5 weeks
-1930/12 = 5 weeks
-1931/12 = 5 weeks
-1932/12 = 5 weeks
-1933/12 = 5 weeks
-1934/11 = 5 weeks
-1935/11 = 5 weeks
-1936/12 = 5 weeks
-1937/12 = 5 weeks
-1938/12 = 5 weeks
-1939/12 = 5 weeks
-1940/11 = 5 weeks
-1941/12 = 5 weeks
-1942/12 = 5 weeks
-1943/12 = 5 weeks
-1944/12 = 5 weeks
-1945/11 = 5 weeks
-1946/11 = 5 weeks
-1947/12 = 5 weeks
-1948/12 = 5 weeks
-1949/12 = 5 weeks
-1800/12 = 5 weeks
-1801/12 = 5 weeks
-1802/12 = 5 weeks
-1803/12 = 5 weeks
-1804/11 = 5 weeks
-1805/11 = 5 weeks
-1806/12 = 5 weeks
-1807/12 = 5 weeks
-1808/12 = 5 weeks
-1809/12 = 5 weeks
-1810/11 = 5 weeks
-1811/11 = 5 weeks
-1812/12 = 5 weeks
-1813/12 = 5 weeks
-1814/12 = 5 weeks
-1815/12 = 5 weeks
-1816/11 = 5 weeks
-1817/12 = 5 weeks
-1818/12 = 5 weeks
-1819/12 = 5 weeks
-1820/12 = 5 weeks
-1821/11 = 5 weeks
-1822/11 = 5 weeks
-1823/12 = 5 weeks
-1824/12 = 5 weeks
-1825/12 = 5 weeks
-1826/12 = 5 weeks
-1827/11 = 5 weeks
-1828/12 = 5 weeks
-1829/12 = 5 weeks
-1830/12 = 5 weeks
-1831/12 = 5 weeks
-1832/11 = 5 weeks
-1833/11 = 5 weeks
-1834/12 = 5 weeks
-1835/12 = 5 weeks
-1836/12 = 5 weeks
-1837/12 = 5 weeks
-1838/11 = 5 weeks
-1839/11 = 5 weeks
-1840/12 = 5 weeks
-1841/12 = 5 weeks
-1842/12 = 5 weeks
-1843/12 = 5 weeks
-1844/11 = 5 weeks
-1845/12 = 5 weeks
-1846/12 = 5 weeks
-1847/12 = 5 weeks
-1848/12 = 5 weeks
-1849/11 = 5 weeks
-1850/11 = 5 weeks
-1851/12 = 5 weeks
-1852/12 = 5 weeks
-1853/12 = 5 weeks
-1854/12 = 5 weeks
-1855/11 = 5 weeks
-1856/12 = 5 weeks
-1857/12 = 5 weeks
-1858/12 = 5 weeks
-1859/12 = 5 weeks
-1860/11 = 5 weeks
-1861/11 = 5 weeks
-1862/12 = 5 weeks
-1863/12 = 5 weeks
-1864/12 = 5 weeks
-1865/12 = 5 weeks
-1866/11 = 5 weeks
-1867/11 = 5 weeks
-1868/12 = 5 weeks
-1869/12 = 5 weeks
-1870/12 = 5 weeks
-1871/12 = 5 weeks
-1872/11 = 5 weeks
-1873/12 = 5 weeks
-1874/12 = 5 weeks
-1875/12 = 5 weeks
-1876/12 = 5 weeks
-1877/11 = 5 weeks
-1878/11 = 5 weeks
-1879/12 = 5 weeks
-1880/12 = 5 weeks
-1881/12 = 5 weeks
-1882/12 = 5 weeks
-1883/11 = 5 weeks
-1884/12 = 5 weeks
-1885/12 = 5 weeks
-1886/12 = 5 weeks
-1887/12 = 5 weeks
-1888/11 = 5 weeks
-1889/11 = 5 weeks
-1890/12 = 5 weeks
-1891/12 = 5 weeks
-1892/12 = 5 weeks
-1893/12 = 5 weeks
-1894/11 = 5 weeks
-1895/11 = 5 weeks
-1896/12 = 5 weeks
-1897/12 = 5 weeks
-1898/12 = 5 weeks
-1899/12 = 5 weeks
-1900/11 = 5 weeks
-1901/11 = 5 weeks
-1902/12 = 5 weeks
-1903/12 = 5 weeks
-1904/12 = 5 weeks
-1905/12 = 5 weeks
-1906/11 = 5 weeks
-1907/11 = 5 weeks
-1908/12 = 5 weeks
-1909/12 = 5 weeks
-1910/12 = 5 weeks
-1911/12 = 5 weeks
-1912/11 = 5 weeks
-1913/12 = 5 weeks
-1914/12 = 5 weeks
-1915/12 = 5 weeks
-1916/12 = 5 weeks
-1917/11 = 5 weeks
-1918/11 = 5 weeks
-1919/12 = 5 weeks
-1920/12 = 5 weeks
-1921/12 = 5 weeks
-1922/12 = 5 weeks
-1923/11 = 5 weeks
-1924/12 = 5 weeks
-1925/12 = 5 weeks
-1926/12 = 5 weeks
-1927/12 = 5 weeks
-1928/11 = 5 weeks
-1929/11 = 5 weeks
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-8912.phpt b/lib/tests/Date/tests/bugs/bug-8912.phpt
deleted file mode 100644
index 411399d830b8a84eafc4ad8544f5392c43448abe..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-8912.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-8912.phpt,v 1.1 2006/11/20 09:07:42 firman Exp $
-?>
---TEST--
-Bug #8912: putenv() causes crashes in DateTimeZone::inDaylightTime() under windows
---FILE--
-<?php
-/**
- * Test for: Date_TimeZone
- * Parts tested: Date_TimeZone::inDaylightTime()
- */
-
-require_once 'Date.php';
-
-$states = array(
-    'Australia/Adelaide',
-    'Australia/Canberra',
-    'Australia/Darwin',
-    'Australia/Brisbane',
-    'Australia/Hobart',
-    'Australia/Melbourne',
-    'Australia/Perth',
-    'Australia/Sydney'
-);
-
-$originalTimezone = new Date_TimeZone('Australia/Adelaide'); 
-
-foreach ($states as $state) {
-    $new_date = new Date(time());
-    print 'Original Time (Australia/Adelaide): ' . $new_date->getTime() . "\n";
-    $timezone = new Date_TimeZone($state); 
-    $new_date->setTZ($originalTimezone);
-    $new_date->convertTZ($timezone);
-    print $state . ': ' . $new_date->getTime() . "\n";
-    print "\n";
-}
-?>
---EXPECT--
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Adelaide: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Canberra: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Darwin: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Brisbane: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Hobart: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Melbourne: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Perth: (timestamp)
-
-Original Time (Australia/Adelaide): (timestamp)
-Australia/Sydney: (timestamp)
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-9213.phpt b/lib/tests/Date/tests/bugs/bug-9213.phpt
deleted file mode 100644
index af1b708e004237c91061f07d3185e929434f6f26..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-9213.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-9213.phpt,v 1.1 2006/11/20 09:08:05 firman Exp $
-?>
---TEST--
-Bug #9213: Date_Calc doesn't like including Date.php
---FILE--
-<?php
-/**
- * Test for: Date_Calc
- * Parts tested: DATE_CALC_FORMAT constant
- */
-
-require_once 'Date.php'; //Uh oh! I break things
-require_once 'Date/Calc.php';
-
-$calc = new Date_Calc();
-print $calc->beginOfWeek(1, 6, 2006) . "\n";
-print $calc->beginOfWeek(1, 6, 2006) . "\n";
-print $calc->beginOfNextWeek(1, 6, 2006) . "\n";
-print $calc->beginOfWeek() . "\n";
-
-?>
---EXPECT--
-20060529
-20060529
-20060605
-(timestamp)
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-9414.phpt b/lib/tests/Date/tests/bugs/bug-9414.phpt
deleted file mode 100644
index de29d049f6b178b18434c33a86db25dd77955ece..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-9414.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-9414.phpt,v 1.1 2006/11/22 00:19:58 firman Exp $
-?>
---TEST--
-Bug #9414: Date::addSeconds() fails to work properly with negative numbers
---FILE--
-<?php
-/**
- * Test for: Date
- * Parts tested: Date::addSeconds()
- */
-
-require_once 'Date.php';
-
-$date = new Date('2006-11-21');
-
-print "Date is now: " . $date->format("%Y-%m-%d %H:%M") . "\n";
-
-$date->addSeconds(-1 * 86400 * 7); # subtract 1 week (negative value)
-print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n";
-
-$date->subtractSeconds(-1 * 86400 * 7); # add 1 week (negative value)
-print 'After subtracting a week\'s worth of seconds, date is: ' . $date->format("%Y-%m-%d %H:%M") . "\n";
-
-?>
---EXPECT--
-Date is now: 2006-11-21 00:00
-After subtracting a week's worth of seconds, date is: 2006-11-14 00:00
-After subtracting a week's worth of seconds, date is: 2006-11-21 00:00
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/bugs/bug-967.phpt b/lib/tests/Date/tests/bugs/bug-967.phpt
deleted file mode 100644
index 0084ffae0d02c1e60a5f56ae6a90ad03e189469e..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/bugs/bug-967.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
-// CVS: $Id: bug-967.phpt,v 1.1 2006/11/20 09:07:18 firman Exp $
-?>
---TEST--
-Bug #967: Date_TimeZone uses a bad global variable
---FILE--
-<?php
-/**
- * Test for: Date_TimeZone
- * Parts tested: Date_TimeZone::setDefault() and Date_TimeZone::getDefault()
- */
-
-require_once 'Date/TimeZone.php';
-
-// Sets default timezone via a global variable.
-$_DATE_TIMEZONE_DEFAULT = 'Pacific/Chatham';
-$tz = Date_TimeZone::getDefault();
-echo 'Date_TimeZone::$id = ' . $tz->id . "\n";
-
-// Sets default timezone via Date_TimeZone::setDefault().
-Date_TimeZone::setDefault('CST');
-$default = 'EST';
-$tz = Date_TimeZone::getDefault();
-echo 'Date_TimeZone::$id = ' . $tz->id . "\n";
-echo '$GLOBALS[\'_DATE_TIMEZONE_DEFAULT\'] = ' . $_DATE_TIMEZONE_DEFAULT . "\n";
-?>
---EXPECT--
-Date_TimeZone::$id = Pacific/Chatham
-Date_TimeZone::$id = CST
-$GLOBALS['_DATE_TIMEZONE_DEFAULT'] = CST
-<?php
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
\ No newline at end of file
diff --git a/lib/tests/Date/tests/calc.php b/lib/tests/Date/tests/calc.php
deleted file mode 100644
index 814f6b1f8c52518904290f2e27e5575a0024195f..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/calc.php
+++ /dev/null
@@ -1,400 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-//
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2005 Daniel Convissor <danielc@php.net>           |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled  |
-// | with this package in the file LICENSE, and is available through      |
-// | the world-wide-web at                                                |
-// | http://www.opensource.org/licenses/bsd-license.php                   |
-// | If you did not receive a copy of the new BSDlicense and are unable   |
-// | to obtain it through the world-wide-web, please send a note to       |
-// | pear-dev@lists.php.net so we can mail you a copy immediately.        |
-// +----------------------------------------------------------------------+
-// | Author: Daniel Convissor <danielc@php.net>                           |
-// +----------------------------------------------------------------------+
-/**
- * Tests for the Date_Calc class
- *
- * Any individual tests that fail will have their name, expected result
- * and actual result printed out.  So seeing no output when executing
- * this file is a good thing.
- *
- * Can be run via CLI or a web server.
- *
- * This test senses whether it is from an installation of PEAR::Date or if
- * it's from CVS or a .tar file.  If it's an installed version, use the
- * installed version of Date_Calc.  Otherwise, use the local development
- * copy of Date_Calc.
- *
- * @category   Date and Time
- * @package    Date
- * @author     Daniel Convissor <danielc@php.net>
- * @copyright  2005 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License
- * @version    CVS: $Id: calc.php,v 1.8 2005/11/15 00:16:40 pajoye Exp $
- * @link       http://pear.php.net/package/Date
- * @since      File available since Release 1.5
- */
-
-if ('@include_path@' != '@'.'include_path'.'@') {
-    ini_set('include_path', ini_get('include_path')
-            . PATH_SEPARATOR . '.'
-    );
-} else {
-    ini_set('include_path', realpath(dirname(__FILE__) . '/../')
-            . PATH_SEPARATOR . '.' . PATH_SEPARATOR
-            . ini_get('include_path')
-    );
-}
-
-/**
- * Get the needed class
- */
-require_once 'Date/Calc.php';
-
-/**
- * Compare the test result to the expected result
- *
- * If the test fails, echo out the results.
- *
- * @param mixed  $expect     the scalar or array you expect from the test
- * @param mixed  $actual     the scalar or array results from the test
- * @param string $test_name  the name of the test
- *
- * @return void
- */
-function compare($expect, $actual, $test_name) {
-    if (is_array($expect)) {
-        if (count(array_diff($actual, $expect))) {
-            echo "$test_name failed.  Expect:\n";
-            print_r($expect);
-            echo "Actual:\n";
-            print_r($actual);
-        }
-    } else {
-        if ($expect != $actual) {
-            echo "$test_name failed.  Expect: $expect.  Actual: $actual\n";
-        }
-    }
-}
-
-if (php_sapi_name() != 'cli') {
-    echo "<pre>\n";
-}
-
-
-compare('20001122', Date_Calc::dateFormat(22, 11, 2000, '%Y%m%d'), 'dateFormat');
-compare('20001122', Date_Calc::dateFormat('22', '11', '2000', '%Y%m%d'), 'dateFormat str');
-
-compare('2001', Date_Calc::defaultCentury('1'), 'defaultCentury 1 str');
-compare('2001', Date_Calc::defaultCentury(1), 'defaultCentury 1');
-compare('1960', Date_Calc::defaultCentury(60), 'defaultCentury 2');
-compare('2010', Date_Calc::defaultCentury(10), 'defaultCentury 3');
-
-compare(2451871, Date_Calc::dateToDays('22', '11', '2000'), 'dateToDays str');
-compare(2451871, Date_Calc::dateToDays(22, 11, 2000), 'dateToDays');
-compare('20001122', Date_Calc::daysToDate(2451871), 'daysToDate');
-
-compare('2000-47-3', Date_Calc::gregorianToISO('22', '11', '2000'), 'gregorianToISO str');
-compare('2000-47-3', Date_Calc::gregorianToISO(22, 11, 2000), 'gregorianToISO');
-compare(2451716.56767, Date_Calc::dateSeason('SUMMERSOLSTICE', 2000), 'dateSeason');
-
-compare(date('Ymd'), Date_Calc::dateNow(), 'dateNow');
-compare(date('Y'), Date_Calc::getYear(), 'getYear');
-compare(date('m'), Date_Calc::getMonth(), 'getMonth');
-compare(date('d'), Date_Calc::getDay(), 'getDay');
-
-compare(327, Date_Calc::julianDate(22, 11, 2000), 'julianDate');
-compare('November', Date_Calc::getMonthFullname(11), 'getMonthFullname');
-compare('Nov', Date_Calc::getMonthAbbrname(11), 'getMonthAbbrname');
-compare('Saturday', Date_Calc::getWeekdayFullname(1, 1, 2005), 'getWeekdayFullname');
-compare('Sat', Date_Calc::getWeekdayAbbrname(1, 1, 2005), 'getWeekdayAbbrname');
-compare(11, Date_Calc::getMonthFromFullName('November'), 'getMonthFromFullName');
-
-compare(327, Date_Calc::julianDate('22', '11', '2000'), 'julianDate str');
-compare('November', Date_Calc::getMonthFullname('11'), 'getMonthFullname str');
-compare('Nov', Date_Calc::getMonthAbbrname('11'), 'getMonthAbbrname str');
-compare('Saturday', Date_Calc::getWeekdayFullname('01', '01', '2005'), 'getWeekdayFullname str');
-compare('Sat', Date_Calc::getWeekdayAbbrname('01', '01', '2005'), 'getWeekdayAbbrname str');
-
-$exp = array(
-    'January',
-    'February',
-    'March',
-    'April',
-    'May',
-    'June',
-    'July',
-    'August',
-    'September',
-    'October',
-    'November',
-    'December'
-);
-compare($exp, Date_Calc::getMonthNames(), 'getMonthNames');
-
-$exp = array(
-    'Monday',
-    'Tuesday',
-    'Wednesday',
-    'Thursday',
-    'Friday',
-    'Saturday',
-    'Sunday'
-);
-compare($exp, Date_Calc::getWeekDays(), 'getWeekDays');
-
-compare(3, Date_Calc::dayOfWeek(22, 11, 2000), 'dayOfWeek');
-compare(47, Date_Calc::weekOfYear(22, 11, 2000), 'weekOfYear');
-compare(4, Date_Calc::quarterOfYear(22, 11, 2000), 'quarterOfYear');
-
-compare(3, Date_Calc::dayOfWeek('22', '11', '2000'), 'dayOfWeek str');
-compare(47, Date_Calc::weekOfYear('22', '11', '2000'), 'weekOfYear str');
-compare(4, Date_Calc::quarterOfYear('22', '11', '2000'), 'quarterOfYear str');
-
-compare(28, Date_Calc::daysInMonth(2, 1900), 'daysInMonth 1');
-compare(29, Date_Calc::daysInMonth(2, 1996), 'daysInMonth 2');
-compare(29, Date_Calc::daysInMonth(2, 2000), 'daysInMonth 3');
-compare(28, Date_Calc::daysInMonth(2, 2001), 'daysInMonth 4');
-compare(30, Date_Calc::daysInMonth(11, 2000), 'daysInMonth 5');
-
-compare(28, Date_Calc::daysInMonth('02', 1900), 'daysInMonth 1 str');
-compare(29, Date_Calc::daysInMonth('02', 1996), 'daysInMonth 2 str');
-compare(29, Date_Calc::daysInMonth('02', 2000), 'daysInMonth 3 str');
-compare(28, Date_Calc::daysInMonth('02', 2001), 'daysInMonth 4 str');
-compare(30, Date_Calc::daysInMonth('11', '2000'), 'daysInMonth 5 str');
-
-compare(5, Date_Calc::weeksInMonth(11, 2000), 'weeksInMonth');
-compare(5, Date_Calc::weeksInMonth('11', '2000'), 'weeksInMonth str');
-
-
-$exp = array(
-    '19000226',
-    '19000227',
-    '19000228',
-    '19000301',
-    '19000302',
-    '19000303',
-    '19000304',
-);
-compare($exp, Date_Calc::getCalendarWeek(27, 2, 1900), 'getCalendarWeek 1');
-
-$exp = array(
-    '20000228',
-    '20000229',
-    '20000301',
-    '20000302',
-    '20000303',
-    '20000304',
-    '20000305',
-);
-compare($exp, Date_Calc::getCalendarWeek(28, 2, 2000), 'getCalendarWeek 2');
-
-$exp = array(
-    '20001127',
-    '20001128',
-    '20001129',
-    '20001130',
-    '20001201',
-    '20001202',
-    '20001203'
-);
-compare($exp, Date_Calc::getCalendarWeek(27, 11, 2000), 'getCalendarWeek 3');
-compare($exp, Date_Calc::getCalendarWeek('27', '11', '2000'), 'getCalendarWeek 3 str');
-
-$exp = array(
-    array(
-        '20001030',
-        '20001031',
-        '20001101',
-        '20001102',
-        '20001103',
-        '20001104',
-    ),
-    array(
-        '20001105',
-        '20001106',
-        '20001107',
-        '20001108',
-        '20001109',
-        '20001110',
-        '20001111',
-    ),
-    array(
-        '20001112',
-        '20001113',
-        '20001114',
-        '20001115',
-        '20001116',
-        '20001117',
-        '20001118',
-    ),
-    array(
-        '20001119',
-        '20001121',
-        '20001122',
-        '20001123',
-        '20001124',
-        '20001125',
-        '20001126',
-    ),
-    array(
-        '20001127',
-        '20001128',
-        '20001129',
-        '20001130',
-        '20001201',
-        '20001202',
-        '20001203'
-    )
-);
-compare($exp, Date_Calc::getCalendarMonth(11, 2000), 'getCalendarMonth');
-compare($exp, Date_Calc::getCalendarMonth('11', '2000'), 'getCalendarMonth str');
-
-// I don't feel like dealing with this right now...
-//compare('', Date_Calc::getCalendarYear(2000), 'getCalendarYear');
-
-compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay');
-compare('20001123', Date_Calc::nextDay(22, 11, 2000), 'nextDay');
-compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay str');
-compare('20001123', Date_Calc::nextDay('22', '11', '2000'), 'nextDay str');
-
-compare('20001117', Date_Calc::prevWeekday('19', '11', '2000'), 'prevWeekday 1 str');
-compare('20001117', Date_Calc::prevWeekday(19, 11, 2000), 'prevWeekday 1');
-compare('20001121', Date_Calc::prevWeekday(22, 11, 2000), 'prevWeekday 2');
-compare('20001123', Date_Calc::nextWeekday(22, 11, 2000), 'nextWeekday 1');
-compare('20001127', Date_Calc::nextWeekday(24, 11, 2000), 'nextWeekday 2');
-compare('20001127', Date_Calc::nextWeekday('24', '11', '2000'), 'nextWeekday 2 str');
-
-compare('20001121', Date_Calc::prevDayOfWeek('2', '22', '11', '2000'), 'prevDayOfWeek 1 str');
-compare('20001121', Date_Calc::prevDayOfWeek(2, 22, 11, 2000), 'prevDayOfWeek 1');
-compare('20001115', Date_Calc::prevDayOfWeek(3, 22, 11, 2000), 'prevDayOfWeek 2');
-compare('20001122', Date_Calc::prevDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'prevDayOfWeek 3');
-compare('20001122', Date_Calc::nextDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'nextDayOfWeek 1');
-compare('20001129', Date_Calc::nextDayOfWeek(3, 22, 11, 2000), 'nextDayOfWeek 2');
-compare('20001123', Date_Calc::nextDayOfWeek(4, 22, 11, 2000), 'nextDayOfWeek 3');
-compare('20001123', Date_Calc::nextDayOfWeek('4', '22', '11', '2000'), 'nextDayOfWeek 3 str');
-
-compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore('2', '22', '11', '2000'), 'prevDayOfWeekOnOrBefore 1 str');
-compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore(2, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 1');
-compare('20001122', Date_Calc::prevDayOfWeekOnOrBefore(3, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 2');
-compare('20001122', Date_Calc::nextDayOfWeekOnOrAfter(3, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 1');
-compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter(4, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 2');
-compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter('4', '22', '11', '2000'), 'nextDayOfWeekOnOrAfter 2 str');
-
-compare('20001120', Date_Calc::beginOfWeek('22', '11', '2000'), 'beginOfWeek str');
-compare('20001120', Date_Calc::beginOfWeek(22, 11, 2000), 'beginOfWeek');
-compare('20001126', Date_Calc::endOfWeek(22, 11, 2000), 'endOfWeek');
-compare('20001126', Date_Calc::endOfWeek('22', '11', '2000'), 'endOfWeek str');
-
-compare('20001113', Date_Calc::beginOfPrevWeek(22, 11, 2000), 'beginOfPrevWeek');
-compare('20001127', Date_Calc::beginOfNextWeek(22, 11, 2000), 'beginOfNextWeek');
-compare('20001113', Date_Calc::beginOfPrevWeek('22', '11', '2000'), 'beginOfPrevWeek str');
-compare('20001127', Date_Calc::beginOfNextWeek('22', '11', '2000'), 'beginOfNextWeek str');
-
-compare('20001101', Date_Calc::beginOfMonth(11, 2000), 'beginOfMonth');
-compare('20001101', Date_Calc::beginOfMonth('11', '2000'), 'beginOfMonth str');
-
-compare('20001001', Date_Calc::beginOfPrevMonth(22, 11, 2000), 'beginOfPrevMonth');
-compare('20001031', Date_Calc::endOfPrevMonth(22, 11, 2000), 'endOfPrevMonth');
-compare('20001001', Date_Calc::beginOfPrevMonth('22', '11', '2000'), 'beginOfPrevMonth str');
-compare('20001031', Date_Calc::endOfPrevMonth('22', '11', '2000'), 'endOfPrevMonth str');
-
-compare('20001201', Date_Calc::beginOfNextMonth(22, 11, 2000), 'beginOfNextMonth');
-compare('20001231', Date_Calc::endOfNextMonth(22, 11, 2000), 'endOfNextMonth');
-compare('20001201', Date_Calc::beginOfNextMonth('22', '11', '2000'), 'beginOfNextMonth str');
-compare('20001231', Date_Calc::endOfNextMonth('22', '11', '2000'), 'endOfNextMonth str');
-
-compare('19991001', Date_Calc::beginOfMonthBySpan(-13, 11, 2000), 'beginOfMonthBySpan 1');
-compare('20001001', Date_Calc::beginOfMonthBySpan(-1, 11, 2000), 'beginOfMonthBySpan 2');
-compare('20001101', Date_Calc::beginOfMonthBySpan(0, 11, 2000), 'beginOfMonthBySpan 3');
-compare('20001201', Date_Calc::beginOfMonthBySpan(1, 11, 2000), 'beginOfMonthBySpan 4');
-compare('20011201', Date_Calc::beginOfMonthBySpan(13, 11, 2000), 'beginOfMonthBySpan 5');
-
-compare('19990101', Date_Calc::beginOfMonthBySpan('-13', '02', '2000'), 'beginOfMonthBySpan 6 str');
-compare('19990101', Date_Calc::beginOfMonthBySpan(-13, 2, 2000), 'beginOfMonthBySpan 6');
-compare('20000101', Date_Calc::beginOfMonthBySpan(-1, 2, 2000), 'beginOfMonthBySpan 7');
-compare('20000201', Date_Calc::beginOfMonthBySpan(0, 2, 2000), 'beginOfMonthBySpan 8');
-compare('20000301', Date_Calc::beginOfMonthBySpan(1, 2, 2000), 'beginOfMonthBySpan 9');
-compare('20010301', Date_Calc::beginOfMonthBySpan(13, 2, 2000), 'beginOfMonthBySpan 10');
-compare('20010301', Date_Calc::beginOfMonthBySpan('13', '02', '2000'), 'beginOfMonthBySpan 10 str');
-
-compare('19991031', Date_Calc::endOfMonthBySpan(-13, 11, 2000), 'endOfMonthBySpan 1');
-compare('20001031', Date_Calc::endOfMonthBySpan(-1, 11, 2000), 'endOfMonthBySpan 2');
-compare('20001130', Date_Calc::endOfMonthBySpan(0, 11, 2000), 'endOfMonthBySpan 3');
-compare('20001231', Date_Calc::endOfMonthBySpan(1, 11, 2000), 'endOfMonthBySpan 4');
-compare('20011231', Date_Calc::endOfMonthBySpan(13, 11, 2000), 'endOfMonthBySpan 5');
-
-compare('19990131', Date_Calc::endOfMonthBySpan('-13', '02', '2000'), 'endOfMonthBySpan 6 str');
-compare('19990131', Date_Calc::endOfMonthBySpan(-13, 2, 2000), 'endOfMonthBySpan 6');
-compare('20000131', Date_Calc::endOfMonthBySpan(-1, 2, 2000), 'endOfMonthBySpan 7');
-compare('20000229', Date_Calc::endOfMonthBySpan(0, 2, 2000), 'endOfMonthBySpan 8');
-compare('20000331', Date_Calc::endOfMonthBySpan(1, 2, 2000), 'endOfMonthBySpan 9');
-compare('20010331', Date_Calc::endOfMonthBySpan(13, 2, 2000), 'endOfMonthBySpan 10');
-compare('20010331', Date_Calc::endOfMonthBySpan('13', '02', '2000'), 'endOfMonthBySpan 10 str');
-
-compare(3, Date_Calc::firstOfMonthWeekday(11, 2000), 'firstOfMonthWeekday');
-compare(3, Date_Calc::firstOfMonthWeekday('11', '2000'), 'firstOfMonthWeekday str');
-
-compare('20050101', Date_Calc::NWeekdayOfMonth(1, 6, 1, 2005), 'NWeekdayOfMonth 161');
-compare('20050102', Date_Calc::NWeekdayOfMonth(1, 0, 1, 2005), 'NWeekdayOfMonth 101');
-compare('20050103', Date_Calc::NWeekdayOfMonth(1, 1, 1, 2005), 'NWeekdayOfMonth 111');
-compare('20050104', Date_Calc::NWeekdayOfMonth(1, 2, 1, 2005), 'NWeekdayOfMonth 121');
-compare('20050105', Date_Calc::NWeekdayOfMonth(1, 3, 1, 2005), 'NWeekdayOfMonth 131');
-compare('20050106', Date_Calc::NWeekdayOfMonth(1, 4, 1, 2005), 'NWeekdayOfMonth 141');
-compare('20050107', Date_Calc::NWeekdayOfMonth(1, 5, 1, 2005), 'NWeekdayOfMonth 151');
-
-compare('20050108', Date_Calc::NWeekdayOfMonth('2', '6', '01', '2005'), 'NWeekdayOfMonth 261');
-compare('20050109', Date_Calc::NWeekdayOfMonth('2', '0', '01', '2005'), 'NWeekdayOfMonth 201');
-compare('20050110', Date_Calc::NWeekdayOfMonth('2', '1', '01', '2005'), 'NWeekdayOfMonth 211');
-compare('20050111', Date_Calc::NWeekdayOfMonth('2', '2', '01', '2005'), 'NWeekdayOfMonth 221');
-compare('20050112', Date_Calc::NWeekdayOfMonth('2', '3', '01', '2005'), 'NWeekdayOfMonth 231');
-compare('20050113', Date_Calc::NWeekdayOfMonth('2', '4', '01', '2005'), 'NWeekdayOfMonth 241');
-compare('20050114', Date_Calc::NWeekdayOfMonth('2', '5', '01', '2005'), 'NWeekdayOfMonth 251');
-
-compare('20050131', Date_Calc::NWeekdayOfMonth('last', 1, 1, 2005), 'NWeekdayOfMonth l11');
-compare('20050130', Date_Calc::NWeekdayOfMonth('last', 0, 1, 2005), 'NWeekdayOfMonth l01');
-compare('20050129', Date_Calc::NWeekdayOfMonth('last', 6, 1, 2005), 'NWeekdayOfMonth l61');
-compare('20050128', Date_Calc::NWeekdayOfMonth('last', 5, 1, 2005), 'NWeekdayOfMonth l51');
-compare('20050127', Date_Calc::NWeekdayOfMonth('last', 4, 1, 2005), 'NWeekdayOfMonth l41');
-compare('20050126', Date_Calc::NWeekdayOfMonth('last', 3, 1, 2005), 'NWeekdayOfMonth l31');
-compare('20050125', Date_Calc::NWeekdayOfMonth('last', 2, 1, 2005), 'NWeekdayOfMonth l21');
-
-compare('20050331', Date_Calc::NWeekdayOfMonth('last', 4, 3, 2005), 'NWeekdayOfMonth l43');
-compare('20050330', Date_Calc::NWeekdayOfMonth('last', 3, 3, 2005), 'NWeekdayOfMonth l33');
-compare('20050329', Date_Calc::NWeekdayOfMonth('last', 2, 3, 2005), 'NWeekdayOfMonth l23');
-compare('20050328', Date_Calc::NWeekdayOfMonth('last', 1, 3, 2005), 'NWeekdayOfMonth l13');
-compare('20050327', Date_Calc::NWeekdayOfMonth('last', 0, 3, 2005), 'NWeekdayOfMonth l03');
-compare('20050326', Date_Calc::NWeekdayOfMonth('last', 6, 3, 2005), 'NWeekdayOfMonth l63');
-compare('20050325', Date_Calc::NWeekdayOfMonth('last', 5, 3, 2005), 'NWeekdayOfMonth l53');
-
-
-compare(false, Date_Calc::isValidDate(29, 2, 1900), 'isValidDate 1');
-compare(true, Date_Calc::isValidDate(29, 2, 2000), 'isValidDate 2');
-compare(true, Date_Calc::isValidDate('29', '02', '2000'), 'isValidDate 2 str');
-
-compare(false, Date_Calc::isLeapYear(1900), 'isLeapYear 1');
-compare(true, Date_Calc::isLeapYear(1996), 'isLeapYear 2');
-compare(true, Date_Calc::isLeapYear(2000), 'isLeapYear 3');
-compare(false, Date_Calc::isLeapYear(2001), 'isLeapYear 4');
-compare(false, Date_Calc::isLeapYear('2001'), 'isLeapYear 4 str');
-
-compare(false, Date_Calc::isFutureDate('22', '11', '2000'), 'isFutureDate 1 str');
-compare(false, Date_Calc::isFutureDate(22, 11, 2000), 'isFutureDate 1');
-compare(true, Date_Calc::isFutureDate(22, 11, date('Y') + 1), 'isFutureDate 2');
-
-compare(false, Date_Calc::isPastDate(22, 11, date('Y') + 1), 'isPastDate 1');
-compare(true, Date_Calc::isPastDate(22, 11, 2000), 'isPastDate 2');
-compare(true, Date_Calc::isPastDate('22', '11', '2000'), 'isPastDate 2 str');
-
-compare(10, Date_Calc::dateDiff(22, 11, 2000, 12, 11, 2000), 'dateDiff 1');
-compare(10, Date_Calc::dateDiff(12, 11, 2000, 22, 11, 2000), 'dateDiff 2');
-compare(61, Date_Calc::dateDiff(22, 11, 2000, 22, 1, 2001), 'dateDiff 3');
-compare(61, Date_Calc::dateDiff('22', '11', '2000', '22', '01', '2001'), 'dateDiff 3 str');
-
-compare(-1, Date_Calc::compareDates(12, 11, 2000, 22, 11, 2000), 'compareDates 1');
-compare(0, Date_Calc::compareDates(22, 11, 2000, 22, 11, 2000), 'compareDates 2');
-compare(1, Date_Calc::compareDates(22, 11, 2000, 12, 11, 2000), 'compareDates 3');
-compare(1, Date_Calc::compareDates('22', '11', '2000', '12', '11', '2000'), 'compareDates 3 str');
diff --git a/lib/tests/Date/tests/test_calc.php b/lib/tests/Date/tests/test_calc.php
deleted file mode 100644
index e73cc700ba1add863111b79566080fbfd183c5c8..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/test_calc.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-require_once "Date/Calc.php";
-
-/**
- * Test dates from 1970 to 2029
- * Data from: http://www.merlyn.demon.co.uk/wknotest.txt
- * Others usefull datas available from:
- * http://www.merlyn.demon.co.uk/#dat
- */
-$failed_test_data   = false;
-$wkno   = file('wknotest.txt');
-$cnt    = sizeof($wkno);
-for( $i=0;$i<$cnt;$i++ ){
-    $parts      = explode(':',$wkno[$i]);
-    $weeksno[$parts[0]] = str_replace("\n",'',$parts[1]);
-}
-unset($wkno);
-foreach($weeksno as $date=>$iso){
-    $year       = substr($date,0,4);
-    $month      = substr($date,4,2);
-    $day        = substr($date,6);
-    $iso9601 = Date_Calc::gregorianToISO($day,$month,$year);
-    if($iso9601!=$iso){
-        $failed_test_data   = true;
-        echo $date . '(' . $iso . ') =>' . $year.'-'.$month.'-'.$day .'=>' . $iso9601 . " : failed\n";
-    }
-}
-
-/**
- * Bugs #19788
- */
-$failed_test_19788  = false;
-$pass1  = 2==Date_Calc::weekOfYear(5,1,1998)?true:false;
-$pass2  = 2==Date_Calc::weekOfYear(6,1,1998)?true:false;
-$pass3  = 2==Date_Calc::weekOfYear(5,1,2004)?true:false;
-$pass4  = 2==Date_Calc::weekOfYear(6,1,2004)?true:false;
-if( !($pass1 && $pass2 && $pass3 && $pass4) ){
-    $failed_test_19788   = true;
-}
-
-if($failed_test_19788 || $failed_test_data){
-    echo "Bug #19788: failed\n";
-} else {
-    echo "Bug #19788: OK\n";
-}
-?>
diff --git a/lib/tests/Date/tests/test_date_methods_span.php b/lib/tests/Date/tests/test_date_methods_span.php
deleted file mode 100644
index 75373c054cae54f69a382cc9c90bd3ff6a07a926..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/test_date_methods_span.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-//
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2005  Leandro Lucarella                           |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled  |
-// | with this package in the file LICENSE, and is available through      |
-// | the world-wide-web at                                                |
-// | http://www.opensource.org/licenses/bsd-license.php                   |
-// | If you did not receive a copy of the new BSDlicense and are unable   |
-// | to obtain it through the world-wide-web, please send a note to       |
-// | pear-dev@lists.php.net so we can mail you a copy immediately.        |
-// +----------------------------------------------------------------------+
-// | Author: Leandro Lucarella <llucax@php.net>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: test_date_methods_span.php,v 1.2 2005/11/15 00:16:40 pajoye Exp $
-//
-
-
-require_once 'Date.php';
-require_once 'Date/Span.php';
-
-$date = new Date();
-$tmp = new Date($date);
-
-printf("Actual date: %s\n", $date->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->subtractSpan(new Date_Span('0:00:00:05'));
-printf("Subtracting 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->subtractSpan(new Date_Span('0:00:20:00'));
-printf("Subtracting 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->subtractSpan(new Date_Span('0:10:00:00'));
-printf("Subtracting 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->subtractSpan(new Date_Span('3:00:00:00'));
-printf("Subtracting 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->subtractSpan(new Date_Span('3:10:20:05'));
-printf("Subtracting 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->addSpan(new Date_Span('0:00:00:05'));
-printf("Adding 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->addSpan(new Date_Span('0:00:20:00'));
-printf("Adding 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->addSpan(new Date_Span('0:10:00:00'));
-printf("Adding 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->addSpan(new Date_Span('3:00:00:00'));
-printf("Adding 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-$tmp->copy($date);
-$tmp->addSpan(new Date_Span('3:10:20:05'));
-printf("Adding 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
-
-?>
diff --git a/lib/tests/Date/tests/testunit.php b/lib/tests/Date/tests/testunit.php
deleted file mode 100644
index 9e35e01ccff637b467f728e3184127026b162910..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/testunit.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2005  Marshall Roch                               |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled  |
-// | with this package in the file LICENSE, and is available through      |
-// | the world-wide-web at                                                |
-// | http://www.opensource.org/licenses/bsd-license.php                   |
-// | If you did not receive a copy of the new BSDlicense and are unable   |
-// | to obtain it through the world-wide-web, please send a note to       |
-// | pear-dev@lists.php.net so we can mail you a copy immediately.        |
-// +----------------------------------------------------------------------+
-// | Authors: Marshall Roch <mroch@php.net>                               |
-// +----------------------------------------------------------------------+
-//
-// $Id: testunit.php,v 1.2 2005/11/15 00:16:40 pajoye Exp $
-
-/**
- * Displays all test cases on the same page
- *
- * @package Date
- * @author Marshall Roch <mroch@php.net>
- */
-
-
-echo "<pre>";
-require_once 'PHPUnit.php';
-require_once 'testunit_date.php';
-require_once 'testunit_date_span.php';
-echo "</pre>";
-?>
diff --git a/lib/tests/Date/tests/testunit_date.php b/lib/tests/Date/tests/testunit_date.php
deleted file mode 100644
index 67f3a7f4be741d496b1cf4e8162e262ca78dbb3f..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/testunit_date.php
+++ /dev/null
@@ -1,279 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 Marshall Roch                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled  |
-// | with this package in the file LICENSE, and is available through      |
-// | the world-wide-web at                                                |
-// | http://www.opensource.org/licenses/bsd-license.php                   |
-// | If you did not receive a copy of the new BSDlicense and are unable   |
-// | to obtain it through the world-wide-web, please send a note to       |
-// | pear-dev@lists.php.net so we can mail you a copy immediately.        |
-// +----------------------------------------------------------------------+
-// | Author: Marshall Roch <mroch@php.net>                                |
-// +----------------------------------------------------------------------+
-//
-// $Id: testunit_date.php,v 1.3 2005/11/15 00:16:40 pajoye Exp $
-//
-
-require_once 'Date.php';
-require_once 'PHPUnit.php';
-
-class myDate extends Date {
-    function myDate($date)
-    {
-        $this->Date($date);
-    }
-}
-
-/**
- * Test case for Date
- *
- * @package Date
- * @author Marshall Roch <mroch@php.net>
- */
-class Date_Test extends PHPUnit_TestCase {
-
-    var $time;
-
-    function Date_Test($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
-
-    function setUp()
-    {
-        $this->time = new Date("2003-10-04 14:03:24");
-    }
-
-    function tearDown()
-    {
-        unset($this->time);
-    }
-
-    function testDateNull()
-    {
-        $time = new Date();
-        $this->assertEquals(
-            date('Y-m-d H:i:s'),
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $time->year, $time->month, $time->day,
-                $time->hour, $time->minute, $time->second)
-        );
-    }
-
-    function testAbstraction()
-    {
-        $d = new Date();
-        $my = new myDate($d);
-        $this->assertEquals($d->getDate(),$my->getDate());
-    }
-
-    function testDateCopy()
-    {
-        $temp = new Date($this->time);
-        $this->assertEquals($temp, $this->time);
-    }
-
-    function testDateISO()
-    {
-        $temp = new Date("2003-10-04 14:03:24");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $temp->year, $temp->month, $temp->day,
-                $temp->hour, $temp->minute, $temp->second)
-        );
-    }
-
-    function testDateISOBasic()
-    {
-        $temp = new Date("20031004T140324");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $temp->year, $temp->month, $temp->day,
-                $temp->hour, $temp->minute, $temp->second)
-        );
-    }
-
-    function testDateISOExtended()
-    {
-        $temp = new Date("2003-10-04T14:03:24");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $temp->year, $temp->month, $temp->day,
-                $temp->hour, $temp->minute, $temp->second)
-        );
-    }
-
-    function testDateISOTimestamp()
-    {
-        $temp = new Date("20031004140324");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $temp->year, $temp->month, $temp->day,
-                $temp->hour, $temp->minute, $temp->second)
-        );
-    }
-
-    function testDateUnixtime()
-    {
-        $temp = new Date(strtotime("2003-10-04 14:03:24"));
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $temp->year, $temp->month, $temp->day,
-                $temp->hour, $temp->minute, $temp->second)
-        );
-    }
-
-    function testSetDateISO()
-    {
-        $this->time->setDate("2003-10-04 14:03:24");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $this->time->year, $this->time->month, $this->time->day,
-                $this->time->hour, $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetDateISOBasic()
-    {
-        $this->time->setDate("20031004T140324");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $this->time->year, $this->time->month, $this->time->day,
-                $this->time->hour, $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetDateISOExtended()
-    {
-        $this->time->setDate("2003-10-04T14:03:24");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $this->time->year, $this->time->month, $this->time->day,
-                $this->time->hour, $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetDateTimestamp()
-    {
-        $this->time->setDate("20031004140324");
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $this->time->year, $this->time->month, $this->time->day,
-                $this->time->hour, $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetDateUnixtime()
-    {
-        $this->time->setDate(strtotime("2003-10-04 14:03:24"));
-        $this->assertEquals(
-            '2003-10-04 14:03:24',
-            sprintf('%04d-%02d-%02d %02d:%02d:%02d',
-                $this->time->year, $this->time->month, $this->time->day,
-                $this->time->hour, $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testGetDateISO()
-    {
-        $date = $this->time->getDate(DATE_FORMAT_ISO);
-        $this->assertEquals('2003-10-04 14:03:24', $date);
-    }
-
-    function testGetDateISOBasic()
-    {
-        $date = $this->time->getDate(DATE_FORMAT_ISO_BASIC);
-        $this->assertEquals('20031004T140324Z', $date);
-    }
-
-    function testGetDateISOExtended()
-    {
-        $date = $this->time->getDate(DATE_FORMAT_ISO_EXTENDED);
-        $this->assertEquals('2003-10-04T14:03:24Z', $date);
-    }
-
-    function testGetDateTimestamp()
-    {
-        $date = $this->time->getDate(DATE_FORMAT_TIMESTAMP);
-        $this->assertEquals('20031004140324', $date);
-    }
-
-    function testGetDateUnixtime()
-    {
-        $date = $this->time->getDate(DATE_FORMAT_UNIXTIME);
-        $this->assertEquals(strtotime('2003-10-04 14:03:24'), $date);
-    }
-
-    function testFormat()
-    {
-        $codes = array(
-            'a' => 'Sat',
-            'A' => 'Saturday',
-            'b' => 'Oct',
-            'B' => 'October',
-            'C' => '20',
-            'd' => '04',
-            'D' => '10/04/2003',
-            'e' => '4',
-            'H' => '14',
-            'I' => '02',
-            'j' => '277',
-            'm' => '10',
-            'M' => '03',
-            'n' => "\n",
-            'O' => '+00:00',
-            'o' => '+00:00',
-            'p' => 'pm',
-            'P' => 'PM',
-            'r' => '02:03:24 PM',
-            'R' => '14:03',
-            'S' => '24',
-            't' => "\t",
-            'T' => '14:03:24',
-            'w' => '6',
-            'U' => '40',
-            'y' => '03',
-            'Y' => '2003',
-            '%' => '%'
-        );
-
-        foreach ($codes as $code => $expected) {
-            $this->assertEquals(
-                "$code: $expected", $this->time->format("$code: %$code")
-            );
-        }
-    }
-
-    function testToUTCbyOffset()
-    {
-        $this->time->setTZbyID('EST');
-        $this->time->toUTC();
-        $temp = new Date("2003-10-04 14:03:24");
-        $temp->toUTCbyOffset("-05:00");
-
-        $this->assertEquals($temp, $this->time);
-    }
-
-}
-
-// runs the tests
-$suite = new PHPUnit_TestSuite("Date_Test");
-$result = PHPUnit::run($suite);
-// prints the tests
-echo $result->toString();
-
-?>
diff --git a/lib/tests/Date/tests/testunit_date_span.php b/lib/tests/Date/tests/testunit_date_span.php
deleted file mode 100644
index c7b75a7435f8abd79355ab621d07073ceb3b5090..0000000000000000000000000000000000000000
--- a/lib/tests/Date/tests/testunit_date_span.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 Leandro Lucarella                            |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled  |
-// | with this package in the file LICENSE, and is available through      |
-// | the world-wide-web at                                                |
-// | http://www.opensource.org/licenses/bsd-license.php                   |
-// | If you did not receive a copy of the new BSDlicense and are unable   |
-// | to obtain it through the world-wide-web, please send a note to       |
-// | pear-dev@lists.php.net so we can mail you a copy immediately.        |
-// +----------------------------------------------------------------------+
-// | Author: Leandro Lucarella <llucax@php.net>                           |
-// +----------------------------------------------------------------------+
-//
-// $Id: testunit_date_span.php,v 1.4 2005/11/15 00:16:40 pajoye Exp $
-//
-
-require_once 'Date.php';
-require_once 'Date/Span.php';
-require_once 'PHPUnit.php';
-
-/**
- * Test case for Date_Span
- *
- * @package Date
- * @author Leandro Lucarella <llucax@php.net>
- */
-class Date_SpanTest extends PHPUnit_TestCase {
-
-    var $time;
-
-    function Date_SpanTest($name) {
-        $this->PHPUnit_TestCase($name);
-    }
-
-    function setUp() {
-        $this->time = new Date_Span(97531);
-    }
-
-    function tearDown() {
-        unset($this->time);
-    }
-
-    function testSetFromArray() {
-        $this->time->setFromArray(array(5, 48.5, 28.5, 31));
-        $this->assertEquals(
-            '7:0:59:1',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromString() {
-        $this->time->setFromString('5:00:59:31');
-        $this->assertEquals(
-            '5:0:59:31',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromSeconds() {
-        $this->time->setFromSeconds(434344);
-        $this->assertEquals(
-            '5:0:39:4',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromMinutes() {
-        $this->time->setFromMinutes(7860.0166666666);
-        $this->assertEquals(
-            '5:11:0:1',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromHours() {
-        $this->time->setFromHours(50.12345);
-        $this->assertEquals(
-            '2:2:7:24',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromDays() {
-        $this->time->setFromDays(pi());
-        $this->assertEquals(
-            '3:3:23:54',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testSetFromDateDiff() {
-        $this->time->setFromDateDiff(
-            new Date('2004-03-10 01:15:59'),
-            new Date('2003-03-10 00:10:50')
-        );
-        $this->assertEquals(
-            '366:1:5:9',
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second)
-        );
-    }
-
-    function testCopy() {
-        $time = new Date_Span();
-        $time->copy($this->time);
-        $this->assertEquals(
-            sprintf('%d:%d:%d:%d', $this->time->day, $this->time->hour,
-                $this->time->minute, $this->time->second),
-            sprintf('%d:%d:%d:%d', $time->day, $time->hour,
-                $time->minute, $time->second)
-        );
-    }
-
-    function testFormat() {
-        $codes = array(
-            'C' => '1, 03:05:31',
-            'd' => '1.1288310185185',
-            'D' => '1',
-            'e' => '27.091944444444',
-            'f' => '1625.5166666667',
-            'g' => '97531',
-            'h' => '3',
-            'H' => '03',
-            'i' => '3',
-            'I' => '03',
-            'm' => '5',
-            'M' => '05',
-            'n' => "\n",
-            'p' => 'am',
-            'P' => 'AM',
-            'r' => '03:05:31 am',
-            'R' => '03:05',
-            's' => '31',
-            'S' => '31',
-            't' => "\t",
-            'T' => '03:05:31',
-            '%' => '%',
-        );
-        foreach ($codes as $code => $expected) {
-            $this->assertEquals(
-                "$code: $expected", $this->time->format("$code: %$code")
-            );
-        }
-    }
-
-    function testAdd() {
-        $this->time->add(new Date_Span(6000));
-        $result = $this->time->toSeconds();
-        $expected = 103531;
-        $this->assertEquals($expected, $result);
-    }
-
-    function testSubtract() {
-        $this->time->subtract(new Date_Span(6000));
-        $result = $this->time->toSeconds();
-        $expected = 91531;
-        $this->assertEquals($expected, $result);
-    }
-
-}
-
-// runs the tests
-$suite = new PHPUnit_TestSuite("Date_SpanTest");
-$result = PHPUnit::run($suite);
-// prints the tests
-echo $result->toString();
-
-?>
diff --git a/lib/tests/MDB2/tests/Console_TestListener.php b/lib/tests/MDB2/tests/Console_TestListener.php
deleted file mode 100644
index 1556ee647557d62bb966acaf148a58475b1ffab9..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/Console_TestListener.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-class Console_TestListener extends PHPUnit_TestListener {
-    function addError(&$test, &$t) {
-        $this->_errors += 1;
-        echo(" Error $this->_errors in ".$test->getName()." : $t\n");
-    }
-
-    function addFailure(&$test, &$t) {
-        $this->_fails += 1;
-        if ($this->_fails == 1) {
-            echo("\n");
-        }
-        echo("Failure $this->_fails : $t\n");
-    }
-
-    function endTest(&$test) {
-        if ($this->_fails == 0 && $this->_errors == 0) {
-            echo(' Test passed');
-        } else {
-            echo("There were $this->_fails failures for ".$test->getName()."\n");
-            echo("There were $this->_errors errors for ".$test->getName()."\n");
-        }
-        echo("\n");
-    }
-
-    function startTest(&$test) {
-        $this->_fails = 0;
-        $this->_errors = 0;
-        echo(get_class($test).' : Starting '.$test->getName().' ...');
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/HTML_TestListener.php b/lib/tests/MDB2/tests/HTML_TestListener.php
deleted file mode 100644
index c514d20c53d438884724b0214abd99b83e75d2e4..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/HTML_TestListener.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class HTML_TestListener extends PHPUnit_TestListener {
-    function addError(&$test, &$t) {
-        $this->_errors += 1;
-        echo("<div class=\"error\"> Error $this->_errors in ".$test->getName()." : $t</div>");
-    }
-
-    function addFailure(&$test, &$t) {
-        $this->_fails += 1;
-        if ($this->_fails == 1) {
-            echo("\n<div class=\"failure\">");
-        }
-        echo("Failure $this->_fails : $t<br>\n");
-    }
-
-    function endTest(&$test) {
-        if ($this->_fails == 0 && $this->_errors == 0) {
-            echo(' Test passed');
-        } else {
-            echo("There were $this->_fails failures for ".$test->getName()."</br>\n");
-            echo("There were $this->_errors errors for ".$test->getName()."</div>\n");
-        }
-        echo('</div>');
-    }
-
-    function startTest(&$test) {
-        $this->_fails = 0;
-        $this->_errors = 0;
-        echo("\n<div class=\"testcase\">".get_class($test).' : Starting '.$test->getName().' ...');
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_Connect_Test.php b/lib/tests/MDB2/tests/MDB2_Connect_Test.php
deleted file mode 100644
index 0f12339af3fea3fc56a8a14a599cc5f70303b1e2..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_Connect_Test.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-// {{{ MDB2_Connect_Test
-/**
- * This is just a dummy class to perform the tests.
- */
-class MDB2_Connect_Test
-{
-    var $_dsn;
-    var $dbc;
-
-    // {{{ constructor php5 valid
-    /**
-     * Straightforward? The constructor
-     */
-    function __construct()
-    {
-        require_once 'MDB2.php';
-        require_once 'config.php';
-
-        $this->_dsn = array(
-                'phptype'  => DSN_PHPTYPE,
-                'username' => DSN_USERNAME,
-                'password' => DSN_PASSWORD,
-                'hostspec' => DSN_HOSTNAME,
-                'database' => DSN_DATABASE,
-        );
-
-    }
-    // }}}
-    // {{{ PHP4 constructor..
-    function MDB2_Connect_Test()
-    {
-        $this->__construct($connect);
-    }
-    // }}}
-    // {{{ connect
-    function connect()
-    {
-        // connect to database
-        $options = array(
-            'portability' => (MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL),
-        );
-
-        $this->dbc =& MDB2::singleton($this->_dsn, $options);
-        if (PEAR::isError($this->dbc)) {
-            return $this->dbc;
-        }
-    }
-    // }}}
-}
-// }}}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_api_testcase.php b/lib/tests/MDB2/tests/MDB2_api_testcase.php
deleted file mode 100644
index 3e5cb08429653475d7884d5c69b717bf5c8f77d7..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_api_testcase.php
+++ /dev/null
@@ -1,321 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_api_testcase.php,v 1.24 2007/10/15 21:57:42 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Api_TestCase extends MDB2_TestCase {
-    var $clear_tables = false;
-
-    function testParseDSN() {
-        $expected = array (
-            'phptype'  => 'phptype',
-            'dbsyntax' => 'phptype',
-            'username' => 'username',
-            'password' => 'password',
-            'protocol' => 'protocol',
-            'hostspec' => false,
-            'port'     => '110',
-            'socket'   => false,
-            'database' => '/usr/db_file.db',
-            'mode'     => false,
-        );
-        $original = 'phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644';
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype(dbsyntax)://username:password@hostspec/database_name';
-        $expected = array (
-            'phptype'  => 'phptype',
-            'dbsyntax' => 'dbsyntax',
-            'username' => 'username',
-            'password' => 'password',
-            'protocol' => 'tcp',
-            'hostspec' => 'hostspec',
-            'port'     => false,
-            'socket'   => false,
-            'database' => 'database_name',
-            'mode'     => false,
-        );
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype://username:password@hostspec/database_name';
-        $expected['dbsyntax'] = 'phptype';
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype://username:password@hostspec';
-        $expected['database'] = false;
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype://username@hostspec';
-        $expected['password'] = false;
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype://hostspec/database';
-        $expected['username'] = false;
-        $expected['database'] = 'database';
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        $original = 'phptype(dbsyntax)';
-        $expected['database'] = false;
-        $expected['hostspec'] = false;
-        $expected['protocol'] = false;
-        $expected['dbsyntax'] = 'dbsyntax';
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        //oracle's "Easy Connect" syntax (Oracle 10g, @see Bug #4854)
-        $original = 'oci8://scott:tiger@//localhost/XE';
-        $expected = array (
-            'phptype'  => 'oci8',
-            'dbsyntax' => 'oci8',
-            'username' => 'scott',
-            'password' => 'tiger',
-            'protocol' => 'tcp',
-            'hostspec' => '//localhost/XE',
-            'port'     => false,
-            'socket'   => false,
-            'database' => false,
-            'mode'     => false,
-        );
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        //ibase dbname+path on windows
-        $original = 'ibase://user:pwd@localhost/C:\\PATH_TO_DB\\TEST.FDB';
-        $expected = array (
-            'phptype'  => 'ibase',
-            'dbsyntax' => 'ibase',
-            'username' => 'user',
-            'password' => 'pwd',
-            'protocol' => 'tcp',
-            'hostspec' => 'localhost',
-            'port'     => false,
-            'socket'   => false,
-            'database' => 'C:\\PATH_TO_DB\\TEST.FDB',
-            'mode'     => false,
-        );
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-
-        // ---------------------------------------------------------------------
-
-        //sqlite dbname+path on unix
-        $original = 'sqlite:////full/unix/path/to/file.db?mode=0666';
-        $expected = array (
-            'phptype'  => 'sqlite',
-            'dbsyntax' => 'sqlite',
-            'username' => false,
-            'password' => false,
-            'protocol' => 'tcp',
-            'hostspec' => '',
-            'port'     => false,
-            'socket'   => false,
-            'database' => '/full/unix/path/to/file.db',
-            'mode'     => false,
-        );
-        $this->assertEquals($expected, MDB2::parseDSN($original));
-    }
-
-    //test stuff in common.php
-    function testConnect() {
-        $db =& MDB2::factory($this->dsn, $this->options);
-        if (PEAR::isError($db)) {
-            $this->assertTrue(false, 'Connect failed bailing out - ' .$db->getMessage() . ' - ' .$db->getUserInfo());
-        }
-        if (PEAR::isError($this->db)) {
-            exit;
-        }
-    }
-
-    function testGetOption() {
-        if (!$this->methodExists($this->db, 'getOption')) {
-            return;
-        }
-        $option = $this->db->getOption('persistent');
-        $this->assertEquals($option, $this->db->options['persistent']);
-    }
-
-    function testSetOption() {
-        if (!$this->methodExists($this->db, 'setOption')) {
-            return;
-        }
-        $option = $this->db->getOption('persistent');
-        $this->db->setOption('persistent', !$option);
-        $this->assertEquals(!$option, $this->db->getOption('persistent'));
-        $this->db->setOption('persistent', $option);
-    }
-
-    function testLoadModule() {
-        if (!$this->methodExists($this->db, 'loadModule')) {
-            return;
-        }
-        $this->assertTrue(!PEAR::isError($this->db->loadModule('Manager', null, true)));
-    }
-
-    // test of the driver
-    // helper function so that we don't have to write out a query a million times
-    function standardQuery() {
-        $query = 'SELECT * FROM users';
-        // run the query and get a result handler
-        if (!PEAR::isError($this->db)) {
-            return $this->db->query($query);
-        }
-        return false;
-    }
-
-    function testQuery() {
-        if (!$this->methodExists($this->db, 'query')) {
-            return;
-        }
-        $result = $this->standardQuery();
-        $this->assertTrue(MDB2::isResult($result), 'query: $result returned is not a resource');
-        $this->assertTrue(MDB2::isResultCommon($result), 'query: $result returned is not a resource');
-    }
-
-    function testExec() {
-        if (!$this->methodExists($this->db, 'exec')) {
-            return;
-        }
-        $result = $this->db->exec('UPDATE users SET user_name = user_name WHERE user_id = user_id');
-        $this->assertFalse(PEAR::isError($result), 'exec: $result returned is an error');
-        $this->assertEquals(0, $result, 'exec: incorrect number of affected rows returned');
-    }
-
-    function testPrepare() {
-        if (!$this->methodExists($this->db, 'prepare')) {
-            return;
-        }
-        $stmt = $this->db->prepare('SELECT user_name FROM users WHERE user_id = ?', array('integer'), MDB2_PREPARE_RESULT);
-        $this->assertTrue(MDB2::isStatement($stmt));
-        $stmt->free();
-    }
-
-    function testFetchRow() {
-        $result = $this->standardQuery();
-        if (!$this->methodExists($result, 'fetchRow')) {
-            return;
-        }
-        $err = $result->fetchRow();
-        $result->free();
-
-        if (PEAR::isError($err)) {
-            $this->assertTrue(false, 'Error testFetch: '.$err->getMessage().' - '.$err->getUserInfo());
-        }
-    }
-
-    function testNumRows() {
-        $result = $this->standardQuery();
-        if (!$this->methodExists($result, 'numRows')) {
-            return;
-        }
-        $numrows = $result->numRows();
-        $this->assertTrue(!PEAR::isError($numrows) && is_int($numrows));
-        $result->free();
-    }
-
-    function testNumCols() {
-        $result = $this->standardQuery();
-        if (!$this->methodExists($result, 'numCols')) {
-            return;
-        }
-        $numcols = $result->numCols();
-        $this->assertTrue(!PEAR::isError($numcols) && $numcols > 0);
-        $result->free();
-    }
-
-    function testSingleton() {
-        $db =& MDB2::singleton();
-        $this->assertTrue(MDB2::isConnection($db));
-
-        // should have a different database name set
-        $db =& MDB2::singleton($this->dsn, $this->options);
-
-        $this->assertTrue($db->db_index != $this->db->db_index);
-    }
-
-    function testGetServerVersion() {
-        $server_info = $this->db->getServerVersion(true);
-        if (PEAR::isError($server_info)) {
-            $this->assertTrue(false, 'Error: '.$server_info->getMessage().' - '.$server_info->getUserInfo());
-        } else {
-            $this->assertTrue(is_string($server_info), 'Error: Server info is not returned as a string: '. serialize($server_info));
-        }
-        $server_info = $this->db->getServerVersion();
-        if (PEAR::isError($server_info)) {
-            $this->assertTrue(false, 'Error: '.$server_info->getMessage().' - '.$server_info->getUserInfo());
-        } else {
-            $this->assertTrue(is_array($server_info), 'Error: Server info is not returned as an array: '. serialize($server_info));
-        }
-    }
-
-    function testQuoteIdentifier() {
-        if ($this->db->phptype != 'ibase') {
-            $start = $this->db->identifier_quoting['start'];
-            $end = $this->db->identifier_quoting['end'];
-
-            $string = 'test';
-            $expected = $start . $string . $end;
-            $this->assertEquals($expected, $this->db->quoteIdentifier($string, false), 'Error: identifier not quoted properly');
-
-            $string = 'test.test';
-            $expected = $start . 'test' . $end . '.' . $start . 'test' . $end;
-            $this->assertEquals($expected, $this->db->quoteIdentifier($string, false), 'Error: identifier not quoted properly');
-        }
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_bugs_testcase.php b/lib/tests/MDB2/tests/MDB2_bugs_testcase.php
deleted file mode 100644
index 611b8af19b64c572de1cc5ced7766cac3f6b05fe..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_bugs_testcase.php
+++ /dev/null
@@ -1,291 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_bugs_testcase.php,v 1.31 2006/12/09 16:58:16 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Bugs_TestCase extends MDB2_TestCase {
-    /**
-     *
-     */
-    function testFetchModeBug() {
-        $data = array();
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $data['user_name'] = 'user_=';
-        $data['user_password'] = 'somepass';
-        $data['subscribed'] = true;
-        $data['user_id'] = 0;
-        $data['quota'] = sprintf("%.2f", strval(2/100));
-        $data['weight'] = sqrt(0);
-        $data['access_date'] = MDB2_Date::mdbToday();
-        $data['access_time'] = MDB2_Date::mdbTime();
-        $data['approved'] = MDB2_Date::mdbNow();
-
-        $result = $stmt->execute(array_values($data));
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query '.$result->getMessage());
-        }
-
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users ORDER BY user_name';
-        $result =& $this->db->query($query);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        }
-
-        $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-
-        $firstRow = $result->fetchRow();
-        $this->assertEquals($firstRow['user_name'], $data['user_name'], 'The data returned does not match that expected');
-
-        $result =& $this->db->query('SELECT user_name, user_id, quota FROM users ORDER BY user_name');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        }
-        $this->db->setFetchMode(MDB2_FETCHMODE_ORDERED);
-
-        $value = $result->fetchOne();
-        $this->assertEquals($data['user_name'], $value, 'The data returned does not match that expected');
-        $result->free();
-    }
-
-    /**
-     * @see http://bugs.php.net/bug.php?id=22328
-     */
-    function testBug22328() {
-        $result =& $this->db->query('SELECT * FROM users');
-        $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
-        $result2 = $this->db->query('SELECT * FROM foo');
-
-        $data = $result->fetchRow();
-        $this->db->popErrorHandling();
-        $this->assertFalse(PEAR::isError($data), 'Error messages for a query affect result reading of other queries');
-    }
-
-    /**
-     * @see http://pear.php.net/bugs/bug.php?id=670
-     */
-    function testBug670() {
-        $data['user_name'] = null;
-        $data['user_password'] = 'somepass';
-        $data['subscribed'] = true;
-        $data['user_id'] = 1;
-        $data['quota'] = sprintf("%.2f",strval(3/100));
-        $data['weight'] = sqrt(1);
-        $data['access_date'] = MDB2_Date::mdbToday();
-        $data['access_time'] = MDB2_Date::mdbTime();
-        $data['approved'] = MDB2_Date::mdbNow();
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-
-        $result =& $this->db->query('SELECT user_name FROM users');
-        $col = $result->fetchCol('user_name');
-        if (PEAR::isError($col)) {
-            $this->assertTrue(false, 'Error when fetching column first first row as NULL: '.$col->getMessage());
-        }
-
-        $data['user_name'] = "user_1";
-        $data['user_id'] = 2;
-
-        $result = $stmt->execute(array_values($data));
-
-        $result =& $this->db->query('SELECT user_name FROM users');
-        $col = $result->fetchCol('user_name');
-        if (PEAR::isError($col)) {
-            $this->assertTrue(false, 'Error when fetching column: '.$col->getMessage());
-        }
-
-        $data['user_name'] = null;
-
-        $stmt->free();
-    }
-
-    /**
-     * @see http://pear.php.net/bugs/bug.php?id=681
-     */
-    function testBug681() {
-        $result =& $this->db->query('SELECT * FROM users WHERE 1=0');
-
-        $numrows = $result->numRows();
-        $this->assertEquals(0, $numrows, 'Numrows is not returning 0 for empty result sets');
-
-        $data = $this->getSampleData(1);
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-
-        $result =& $this->db->query('SELECT * FROM users');
-        $numrows = $result->numRows();
-        $this->assertEquals(1, $numrows, 'Numrows is not returning proper value');
-
-        $stmt->free();
-    }
-
-    /**
-     * @see http://pear.php.net/bugs/bug.php?id=718
-     */
-    function testBug718() {
-        $data = $this->getSampleData(1);
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-
-        $row = $this->db->queryRow('SELECT a.user_id, b.user_id FROM users a, users b where a.user_id = b.user_id', array('integer', 'integer'), MDB2_FETCHMODE_ORDERED);
-        $this->assertEquals(2, count($row), "Columns with the same name get overwritten in ordered mode");
-
-        $stmt->free();
-    }
-
-    /**
-     * @see http://pear.php.net/bugs/bug.php?id=946
-     */
-    function testBug946() {
-        $data = array();
-        $total_rows = 5;
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-
-        $this->db->setLimit(3, 1);
-        $result =& $this->db->query($query);
-        $numrows = $result->numRows();
-        while ($row = $result->fetchRow()) {
-            if (PEAR::isError($row)) {
-                $this->assertTrue(false, 'Error fetching a row: '.$row->getMessage());
-            }
-        }
-        $result->free();
-
-        $result =& $this->db->query($query);
-        $numrows = $result->numRows();
-        while ($row = $result->fetchRow()) {
-            if (PEAR::isError($row)) {
-                $this->assertTrue(false, 'Error fetching a row: '.$row->getMessage());
-            }
-        }
-        $result->free();
-    }
-
-    /**
-     * @see http://pear.php.net/bugs/bug.php?id=3146
-     */
-    function testBug3146() {
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-
-            $result = $stmt->execute(array_values($data[$row]));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users ORDER BY user_id';
-        $result =& $this->db->query($query, $this->fields);
-
-        $numrows = $result->numRows($result);
-
-        $this->verifyFetchedValues($result, 0, $data[0]);
-        $this->verifyFetchedValues($result, 2, $data[2]);
-        $this->verifyFetchedValues($result, null, $data[3]);
-        $this->verifyFetchedValues($result, 1, $data[1]);
-
-        $result->free();
-    }
-
-    /**
-     * Strong typing query result misbehaves when $n_columns > $n_types
-     * @see http://pear.php.net/bugs/bug.php?id=9502
-     */
-    function testBug9502() {
-        $row = 5;
-        $data = $this->getSampleData($row);
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        //provide an incomplete and scrambled types array
-        $types = array();
-        $types['subscribed'] = $this->fields['subscribed'];
-        $types['user_name']  = $this->fields['user_name'];
-        $types['weight']     = $this->fields['weight'];
-        
-        $query = 'SELECT weight, user_name, user_id, quota, subscribed FROM users WHERE user_id = '.$row;
-        $result =& $this->db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing query: '.$result->getMessage() .' - '. $result->getUserInfo());
-        } else {
-            $this->assertTrue(is_bool($result['subscribed']));
-            $this->assertTrue(is_numeric($result['user_id']));
-            $this->assertTrue(is_float($result['weight']));
-            $this->assertFalse(is_bool($result['user_name']));
-        }
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_datatype_testcase.php b/lib/tests/MDB2/tests/MDB2_datatype_testcase.php
deleted file mode 100644
index 3504560d2752d17d0504275acb69331b0b8be50a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_datatype_testcase.php
+++ /dev/null
@@ -1,885 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Lukas Smith, Lorenzo Alberton                |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l dot alberton at quipo dot it>            |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_datatype_testcase.php,v 1.22 2008/02/23 09:38:22 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-/**
- * A test callback function to be used in the test class below for
- * ensuring that custom datatype callback features are handled
- * correctly.
- *
- * @param MDB2   $db         The MDB2 database resource object.
- * @param string $method     The name of the MDB2_Driver_Datatype_Common method
- *                           the callback function was called from. One of
- *                           "getValidTypes", "convertResult", "getDeclaration",
- *                           "compareDefinition", "quote" and "mapPrepareDatatype".
- *                           See {@link MDB2_Driver_Datatype_Common} for the 
- *                           details of what each method does.
- * @param array $aParameters An array of parameters, being the parameters that
- *                           were passed to the method calling the callback
- *                           function.
- * @return mixed Returns the appropriate value depending on the method that
- *               called the function. See {@link MDB2_Driver_Datatype_Common}
- *               for details of the expected return values of the five possible
- *               calling methods.
- */
-function datatype_test_callback(&$db, $method, $aParameters)
-{
-    // Ensure the datatype module is loaded
-    if (is_null($db->datatype)) {
-        $db->loadModule('Datatype', null, true);
-    }
-    // Lowercase method names for PHP4/PHP5 compatibility
-    $method = strtolower($method);
-    switch($method) {
-        // For all cases, return a string that identifies that the
-        // callback method was able to call to the appropriate point
-        case 'getvalidtypes':
-            return 'datatype_test_callback::getvalidtypes';
-        case 'convertresult':
-            return 'datatype_test_callback::convertresult';
-        case 'getdeclaration':
-            return 'datatype_test_callback::getdeclaration';
-        case 'comparedefinition':
-            return 'datatype_test_callback::comparedefinition';
-        case 'quote':
-            return 'datatype_test_callback::quote';
-        case 'mappreparedatatype':
-            return 'datatype_test_callback::mappreparedatatype';
-    }
-}
-
-/**
- * A test callback function to be used in the test class below for
- * ensuring that custom nativetype to datatype mapping is handled
- * correctly.
- *
- * @param MDB2 $db       The MDB2 database reource object.
- * @param array $aFields The standard array of fields produced from the
- *                       MySQL command "SHOW COLUMNS". See
- *                       {@link http://dev.mysql.com/doc/refman/5.0/en/describe.html}
- *                       for more details on the format of the fields.
- *                          "type"      The nativetype column type
- *                          "null"      "YES" or "NO"
- *                          "key"       "PRI", "UNI", "MUL", or null
- *                          "default"   The default value of the column
- *                          "extra"     "auto_increment", or null
- * @return array Returns an array of the following items:
- *                  0 => An array of possible MDB2 datatypes. As this is
- *                       a custom type, always has one entry, "test".
- *                  1 => The length of the type, if defined by the nativetype,
- *                       otherwise null.
- *                  2 => A boolean value indicating the "unsigned" nature of numeric
- *                       fields. Always null in this case, as this custom test
- *                       type is not numeric.
- *                  3 => A boolean value indicating the "fixed" nature of text
- *                       fields. Always bull in this case, as this custom test
- *                       type is not textual.
- */
-function nativetype_test_callback(&$db, $aFields)
-{
-    // Prepare the type array
-    $aType = array();
-    $aType[] = 'test';
-    // Can the length of the field be found?
-    $length = null;
-    $start = strpos($aFields['type'], '(');
-    $end = strpos($aFields['type'], ')');
-    if ($start && $end) {
-        $start++;
-        $chars = $end - $start;
-        $length = substr($aFields['type'], $start, $chars);
-    }
-    // No unsigned value needed
-    $unsigned = null;
-    // No fixed value needed
-    $fixed = null;
-    return array($aType, $length, $unsigned, $fixed);
-}
-
-class MDB2_Datatype_TestCase extends MDB2_TestCase
-{
-    // Test table name (it is dynamically created/dropped)
-    var $table = 'datatypetable';
-
-    function setUp() {
-        parent::setUp();
-        $this->db->loadModule('Manager', null, true);
-        $this->fields = array(
-            'id' => array(
-                'type'       => 'integer',
-                'unsigned'   => true,
-                'notnull'    => true,
-                'default'    => 0,
-            ),
-            'textfield'      => array(
-                'type'       => 'text',
-                'length'     => 12,
-            ),
-            'booleanfield'   => array(
-                'type'       => 'boolean',
-            ),
-            'decimalfield'   => array(
-                'type'       => 'decimal',
-            ),
-            'floatfield'     => array(
-                'type'       => 'float',
-            ),
-            'datefield'      => array(
-                'type'       => 'date',
-            ),
-            'timefield'      => array(
-                'type'       => 'time',
-            ),
-            'timestampfield' => array(
-                'type'       => 'timestamp',
-            ),
-        );
-        if (!$this->tableExists($this->table)) {
-            $this->db->manager->createTable($this->table, $this->fields);
-        }
-    }
-
-    /**
-     * The teardown method to clean up the testing environment.
-     */
-    function tearDown() {
-        if ($this->tableExists($this->table)) {
-            $this->db->manager->dropTable($this->table);
-        }
-        $this->db->popExpect();
-        unset($this->dsn);
-        if (!PEAR::isError($this->db->manager)) {
-            $this->db->disconnect();
-        }
-        unset($this->db);
-    }
-
-    /**
-     * Get the types of each field given its name
-     *
-     * @param array $names list of field names
-     * @return array $types list of matching field types
-     */
-    function getFieldTypes($names) {
-        $types = array();
-        foreach ($names as $name) {
-            foreach ($this->fields as $fieldname => $field) {
-                if ($name == $fieldname) {
-                    $types[$name] = $field['type'];
-                }
-            }
-        }
-        return $types;
-    }
-
-    /**
-     * Insert the values into the sample table
-     *
-     * @param array $values associative array (name => value)
-     */
-    function insertValues($values) {
-        $types = $this->getFieldTypes(array_keys($values));
-
-        $result = $this->db->exec('DELETE FROM '.$this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error emptying table: '.$result->getMessage());
-        }
-
-        $query = sprintf('INSERT INTO %s (%s) VALUES (%s)',
-            $this->table,
-            implode(', ', array_keys($values)),
-            implode(', ', array_fill(0, count($values), '?'))
-        );
-        $stmt = $this->db->prepare($query, array_values($types), MDB2_PREPARE_MANIP);
-        if (PEAR::isError($stmt)) {
-            $this->assertTrue(false, 'Error creating prepared query: '.$stmt->getMessage());
-        }
-        $result = $stmt->execute(array_values($values));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $stmt->free();
-    }
-
-    /**
-     * Select the inserted row from the db and check the inserted values
-     * @param array $values associative array (name => value) of inserted data
-     */
-    function selectAndCheck($values) {
-        $types = $this->getFieldTypes(array_keys($values));
-
-        $query = 'SELECT '. implode (', ', array_keys($values)). ' FROM '.$this->table;
-        $result = $this->db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
-        foreach ($values as $name => $value) {
-            $this->assertEquals($result[$name], $values[$name], 'Error in '.$types[$name].' value: incorrect conversion');
-        }
-    }
-
-    /**
-     * Test the TEXT datatype for incorrect conversions
-     */
-    function testTextDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'        => 1,
-            'textfield' => 'test',
-        );
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testTextDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the DECIMAL datatype for incorrect conversions
-     */
-    function testDecimalDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'           => 1,
-            'decimalfield' => 10.35,
-        );
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        $old_locale = setlocale(LC_NUMERIC, 0);
-        if (OS_UNIX) {
-            setlocale(LC_NUMERIC, 'de_DE@euro', 'de_DE', 'de', 'ge');
-        } else {
-            setlocale(LC_NUMERIC, 'de_DE@euro', 'de_DE', 'deu_deu');
-        }
-
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        setlocale(LC_NUMERIC, $old_locale);
-
-        $expected = 10.35;
-
-        $actual = $this->db->quote($expected, 'decimal');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = number_format($expected, 2, ',', '');
-        $actual = $this->db->quote($non_us, 'decimal');
-        $this->assertEquals($expected, $actual);
-
-        $expected = 1000.35;
-
-        $non_us = '1,000.35';
-        $actual = $this->db->quote($non_us, 'decimal');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = '1000,35';
-        $actual = $this->db->quote($non_us, 'decimal');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = '1.000,35';
-        $actual = $this->db->quote($non_us, 'decimal');
-        $this->assertEquals($expected, $actual);
-
-        // test quoting with invalid chars
-        $val = '100.3abc";d@a[\\';
-        $this->assertEquals(100.3, $this->db->quote($val, 'decimal'));
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testDecimalDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the FLOAT datatype for incorrect conversions
-     */
-    function testFloatDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'         => 1,
-            'floatfield' => 10.35,
-        );
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        $old_locale = setlocale(LC_NUMERIC, 0);
-        if (OS_UNIX) {
-            setlocale(LC_NUMERIC, 'de_DE@euro', 'de_DE', 'de', 'ge');
-        } else {
-            setlocale(LC_NUMERIC, 'de_DE@euro', 'de_DE', 'deu_deu');
-        }
-
-
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        setlocale(LC_NUMERIC, $old_locale);
-
-        $data['floatfield'] = '1.035e+1';
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        $data['floatfield'] = '1.035E+01';
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        $expected = '1.035E+01';
-        $non_us = '1,035e+1';
-        $actual = $this->db->quote($non_us, 'float');
-        $this->assertEquals($expected, $actual);
-
-        $expected = 10.35;
-
-        $actual = $this->db->quote($expected, 'float');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = number_format($expected, 2, ',', '');
-        $actual = $this->db->quote($non_us, 'float');
-        $this->assertEquals($expected, $actual);
-
-        $expected = 1000.35;
-
-        $non_us = '1,000.35';
-        $actual = $this->db->quote($non_us, 'float');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = '1000,35';
-        $actual = $this->db->quote($non_us, 'float');
-        $this->assertEquals($expected, $actual);
-
-        $non_us = '1.000,35';
-        $actual = $this->db->quote($non_us, 'float');
-        $this->assertEquals($expected, $actual);
-
-        // test quoting with invalid chars
-        $val = '100.3abc";d@a[\\';
-        $this->assertEquals(100.3, $this->db->quote($val, 'float'));
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testFloatDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the BOOLEAN datatype for incorrect conversions
-     */
-    function testBooleanDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'          => 1,
-            'booleanfield' => true,
-        );
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        $data['booleanfield'] = false;
-        $this->insertValues($data);
-        $this->selectAndCheck($data);
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testBooleanDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the DATE datatype for incorrect conversions
-     */
-    function testDateDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'        => 1,
-            'datefield' => date('Y-m-d'),
-        );
-        $this->insertValues($data, 'date');
-        $this->selectAndCheck($data);
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testDateDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the TIME datatype for incorrect conversions
-     */
-    function testTimeDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'        => 1,
-            'timefield' => date('H:i:s'),
-        );
-        $this->insertValues($data, 'time');
-        $this->selectAndCheck($data);
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testTimeDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Test the TIMESTAMP datatype for incorrect conversions
-     */
-    function testTimestampDataType($emulate_prepared = false) {
-        if ($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', true);
-        }
-
-        $data = array(
-            'id'            => 1,
-            'timestampfield' => date('Y-m-d H:i:s'),
-        );
-        $this->insertValues($data, 'timestamp');
-        $this->selectAndCheck($data);
-
-        if (!$emulate_prepared && !$this->db->getOption('emulate_prepared')) {
-            $this->testTimestampDataType(true);
-        } elseif($emulate_prepared) {
-            $this->db->setOption('emulate_prepared', false);
-        }
-    }
-
-    /**
-     * Tests escaping of text values with special characters
-     */
-    function testEscapeSequences() {
-        $test_strings = array(
-            "'",
-            "\"",
-            "\\",
-            "%",
-            "_",
-            "''",
-            "\"\"",
-            "\\\\",
-            "\\'\\'",
-            "\\\"\\\""
-        );
-
-        $this->clearTables();
-        foreach($test_strings as $key => $string) {
-            $value = $this->db->quote($string, 'text');
-            $query = "INSERT INTO users (user_name,user_id) VALUES ($value, $key)";
-            $result = $this->db->exec($query);
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing insert query'.$result->getMessage());
-            }
-
-            $query = 'SELECT user_name FROM users WHERE user_id = '.$key;
-            $value = $this->db->queryOne($query, 'text');
-
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error executing select query'.$value->getMessage());
-            }
-
-            $this->assertEquals($string, $value, "the value retrieved for field \"user_name\" doesn't match what was stored");
-        }
-    }
-
-    /**
-     * Tests escaping of text pattern strings with special characters
-     */
-    function testPatternSequences() {
-        $test_strings = array(
-            "Foo",
-            "FOO",
-            "foo",
-        );
-
-        $this->clearTables();
-        foreach($test_strings as $key => $string) {
-            $value = $this->db->quote($string, 'text');
-            $query = "INSERT INTO users (user_name,user_id) VALUES ($value, $key)";
-            $result = $this->db->exec($query);
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing insert query'.$result->getMessage());
-            }
-        }
-
-        $query = 'SELECT user_name FROM users WHERE '.$this->db->datatype->matchPattern(array('F', '%'), 'LIKE', 'user_name');
-        $values = $this->db->queryCol($query, 'text');
-        $this->assertEquals(2, count($values), "case sensitive search was expected to return 2 rows but returned: ".count($values));
-
-        $query = 'SELECT user_name FROM users WHERE '.$this->db->datatype->matchPattern(array('foo'), 'ILIKE', 'user_name');
-        $values = $this->db->queryCol($query, 'text');
-        $this->assertEquals(3, count($values), "case insensitive search was expected to return 3 rows but returned: ".count($values));
-
-        $query = 'SELECT user_name FROM users WHERE '.$this->db->datatype->matchPattern(array(1 => '_', 'o', '%'), 'LIKE', 'user_name');
-        $values = $this->db->queryCol($query, 'text');
-        $this->assertEquals(2, count($values), "case sensitive search was expected to return 2 rows but returned: ".count($values));
-
-        $query = 'SELECT user_name FROM users WHERE '.$this->db->datatype->matchPattern(array(1 => '_', 'o', '%'), 'ILIKE', 'user_name');
-        $values = $this->db->queryCol($query, 'text');
-        $this->assertEquals(3, count($values), "case insensitive search was expected to return 3 rows but returned: ".count($values));
-    }
-
-    /**
-     * Tests escaping of text pattern strings with special characters
-     */
-    function testEscapePatternSequences() {
-        if (!$this->supported('pattern_escaping')) {
-            return;
-        }
-
-        $test_strings = array(
-            "%",
-            "_",
-            "%_",
-            "_%",
-            "%Foo%",
-            "%Foo_",
-            "Foo%123",
-            "Foo_123",
-            "_Foo%",
-            "_Foo_",
-            "%'",
-            "_'",
-            "'%",
-            "'_",
-            "'%'",
-            "'_'",
-        );
-
-        $this->clearTables();
-        foreach($test_strings as $key => $string) {
-            $value = $this->db->quote($string, 'text');
-            $query = "INSERT INTO users (user_name,user_id) VALUES ($value, $key)";
-            $result = $this->db->exec($query);
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing insert query'.$result->getMessage());
-            }
-
-            $query = 'SELECT user_name FROM users WHERE user_name LIKE '.$this->db->quote($string, 'text', true, true);
-            $value = $this->db->queryOne($query, 'text');
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error executing select query'.$value->getMessage());
-            }
-
-            $this->assertEquals($string, $value, "the value retrieved for field \"user_name\" doesn't match what was stored");
-        }
-
-        $this->db->loadModule('Datatype', null, true);
-        $query = 'SELECT user_name FROM users WHERE user_name LIKE '.$this->db->datatype->matchPattern(array('Foo%', '_', '23'));
-        $value = $this->db->queryOne($query, 'text');
-        $this->assertEquals('Foo%123', $value, "the value retrieved for field \"user_name\" doesn't match what was stored");
-
-        $query = 'SELECT user_name FROM users WHERE user_name LIKE '.$this->db->datatype->matchPattern(array(1 => '_', 'oo', '%'));
-        $value = $this->db->queryOne($query, 'text');
-        $this->assertEquals('Foo', substr($value, 0, 3), "the value retrieved for field \"user_name\" doesn't match what was stored");
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::getValidTypes()
-     * method returns the correct data array.
-     */
-    function testGetValidTypes()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with just the default MDB2 datatypes.
-        $aExpected = $this->db->datatype->valid_default_values;
-        $aResult = $this->db->datatype->getValidTypes();
-        $this->assertEquals($aExpected, $aResult, 'getValidTypes');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $aExpected = array_merge(
-            $this->db->datatype->valid_default_values,
-            array('test' => 'datatype_test_callback::getvalidtypes')
-        );
-        $aResult = $this->db->datatype->getValidTypes();
-        $this->assertEquals($aExpected, $aResult, 'getValidTypes');
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::convertResult()
-     * method returns correctly converted column data.
-     */
-    function testConvertResult()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with an MDB2 datatype, eg. "text"
-        $value = 'text';
-        $type = 'text';
-        $result = $this->db->datatype->convertResult($value, $type);
-        $this->assertEquals($value, $result, 'convertResult');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $value = 'text';
-        $type = 'test';
-        $result = $this->db->datatype->convertResult($value, $type);
-        $this->assertEquals('datatype_test_callback::convertresult', $result, 'mapPrepareDatatype');
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::getDeclaration()
-     * method returns correctly formatted SQL for declaring columns.
-     */
-    function testGetDeclaration()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with an MDB2 datatype, eg. "integer"
-        $name = 'column';
-        $type = 'integer';
-        $field = array('type' => 'integer');
-        $result = $this->db->datatype->getDeclaration($type, $name, $field);
-        $actual_type = $this->db->phptype == 'sqlite' ? 'INTEGER' : 'INT';
-        $default = $this->db->phptype == 'mssql' ? ' NULL' : '';
-        $this->assertEquals('column '.$actual_type.$default, $result, 'getDeclaration');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $name = 'column';
-        $type = 'test';
-        $field = array('type' => 'test');
-        $result = $this->db->datatype->getDeclaration($type, $name, $field);
-        $this->assertEquals('datatype_test_callback::getdeclaration', $result, 'getDeclaration');
-
-        // Test with a custom datatype without datatype_map_callback function #1
-        $name = 'address';
-        $type = 'text';
-        $field = array(
-            'name'    => 'company_addr',
-            'type'    => 'text',
-            'notnull' => 'true'
-        );
-        $this->db->setOption('datatype_map', array($name => $type));
-        $result = $this->db->datatype->getDeclaration($field['type'], $field['name'], $field);
-        $notnull = ' NOT NULL';
-        $expected = $field['name'].' '.$this->db->datatype->getTypeDeclaration(array('type' => $type)).$notnull;
-        $this->assertEquals($expected, $result);
-
-        // Test with a custom datatype without datatype_map_callback function #2
-        $name = 'address';
-        $type = 'text';
-        $field = array(
-            'name' => 'company_addr',
-            'type' => 'address',
-        );
-        $this->db->setOption('datatype_map', array($name => $type));
-        $result = $this->db->datatype->getDeclaration($field['type'], $field['name'], $field);
-        $default = $this->db->phptype == 'mssql' ? ' NULL' : '';
-        $expected = $field['name'].' '.$this->db->datatype->getTypeDeclaration(array('type' => $type)).$default;
-        $this->assertEquals($expected, $result);
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-    }
-    
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::compareDefinition()
-     * method
-     */
-    function testCompareDefinition()
-    {
-        // Test with an MDB2 datatype, eg. "text"
-        $aPrevious = array(
-            'type'   => 'text',
-            'length' => 4
-        );
-        $aCurrent = array(
-            'type'   => 'text',
-            'length' => 5
-        );
-        $aResult = $this->db->datatype->compareDefinition($aCurrent, $aPrevious);
-        $this->assertTrue(is_array($aResult), 'compareDefinition');
-        $this->assertEquals(1, count($aResult), 'compareDefinition');
-        $this->assertTrue($aResult['length'], 'compareDefinition');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $aPrevious = array(
-            'type'   => 'test'
-        );
-        $aCurrent = array(
-            'type'   => 'test'
-        );
-        $result = $this->db->datatype->compareDefinition($aCurrent, $aPrevious);
-        $this->assertEquals('datatype_test_callback::comparedefinition', $result, 'compareDefinition');
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::quote()
-     * method returns correctly quoted column data.
-     */
-    function testQuote()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with an MDB2 datatype, eg. "text"
-        $value = 'text';
-        $type = 'text';
-        $result = $this->db->datatype->quote($value, $type);
-        $this->assertEquals("'$value'", $result, 'quote');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $value = 'text';
-        $type = 'test';
-        $result = $this->db->datatype->quote($value, $type);
-        $this->assertEquals('datatype_test_callback::quote', $result, 'quote');
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::mapPrepareDatatype()
-     * method returns the correct data type.
-     */
-    function testMapPrepareDatatype()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with an MDB2 datatype, eg. "text"
-        $type = 'text';
-        $result = $this->db->datatype->mapPrepareDatatype($type);
-        if ($this->db->phptype == 'mysqli') {
-            $type = 's';
-        }
-        $this->assertEquals($type, $result, 'mapPrepareDatatype');
-
-        // Test with a custom datatype
-        $this->db->setOption('datatype_map', array('test' => 'test'));
-        $this->db->setOption('datatype_map_callback', array('test' => 'datatype_test_callback'));
-        $type = 'test';
-        $result = $this->db->datatype->mapPrepareDatatype($type);
-        $this->assertEquals('datatype_test_callback::mappreparedatatype', $result, 'mapPrepareDatatype');
-        unset($this->db->options['datatype_map']);
-        unset($this->db->options['datatype_map_callback']);
-    }
-
-    /**
-     * A method to test that the MDB2_Driver_Datatype_Common::mapNativeDatatype()
-     * method returns the correct MDB2 datatype from a given nativetype.
-     */
-    function testMapNativeDatatype()
-    {
-        $this->db->loadModule('Datatype', null, true);
-        // Test with an common nativetype, eg. "text"
-        $field = array(
-            'type'   => 'int',
-            'length' => 8
-        );
-        if (in_array($this->db->phptype, array('ibase', 'oci8'))) {
-            $field['type'] = 'integer';
-        }
-        $expected_length = 8;
-        if (in_array($this->db->phptype, array('mysql', 'mysqli', 'pgsql', 'sqlite', 'mssql'))) {
-            $expected_length = 4;
-        }
-        $result = $this->db->datatype->mapNativeDatatype($field);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'mapNativeDatatype: '.$result->getUserInfo());
-        } else {
-            $this->assertTrue(is_array($result), 'mapNativeDatatype');
-            $this->assertEquals(4, count($result), 'mapNativeDatatype');
-            $this->assertEquals('integer', $result[0][0], 'mapNativeDatatype');
-            $this->assertEquals($expected_length, $result[1], 'mapNativeDatatype');
-        }
-
-        // Test with a custom nativetype mapping
-        $this->db->setOption('nativetype_map_callback', array('test' => 'nativetype_test_callback'));
-        $field = array(
-            'type'   => 'test'
-        );
-        $result = $this->db->datatype->mapNativeDatatype($field);
-        $this->assertTrue(is_array($result), 'mapNativeDatatype');
-        $this->assertEquals(4, count($result), 'mapNativeDatatype');
-        $this->assertEquals('test', $result[0][0], 'mapNativeDatatype');
-        $this->assertNull($result[1], 'mapNativeDatatype');
-        $this->assertNull($result[2], 'mapNativeDatatype');
-        $this->assertNull($result[3], 'mapNativeDatatype');
-        $field = array(
-            'type'   => 'test(10)'
-        );
-        $result = $this->db->datatype->mapNativeDatatype($field);
-        $this->assertTrue(is_array($result), 'mapNativeDatatype');
-        $this->assertEquals(count($result), 4, 'mapNativeDatatype');
-        $this->assertEquals($result[0][0], 'test', 'mapNativeDatatype');
-        $this->assertEquals($result[1], 10, 'mapNativeDatatype');
-        $this->assertNull($result[2], 'mapNativeDatatype');
-        $this->assertNull($result[3], 'mapNativeDatatype');
-        unset($this->db->options['nativetype_map_callback']);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_extended_testcase.php b/lib/tests/MDB2/tests/MDB2_extended_testcase.php
deleted file mode 100644
index b0ffff79c69ba164c5df2a3ee10bfb5b895d2021..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_extended_testcase.php
+++ /dev/null
@@ -1,580 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Paul Cooper, Lukas Smith, Lorenzo Alberton   |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Authors: Paul Cooper <pgc@ucecom.com>                                |
-// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_extended_testcase.php,v 1.13 2007/02/28 12:15:26 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Extended_TestCase extends MDB2_TestCase
-{
-    /**
-     *
-     */
-    function testAutoExecute()
-    {
-        $data = $this->getSampleData();
-        $select_query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-        $result = $this->db->extended->autoExecute('users', $data, MDB2_AUTOQUERY_INSERT, null, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error auto executing insert: '.$result->getMessage());
-        }
-
-        $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-        $result =& $this->db->query($select_query, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        } else {
-            $this->verifyFetchedValues($result, null, $data);
-            $result->free();
-        }
-
-        $where = 'user_id = '.$this->db->quote($data['user_id'], 'integer');
-        $result = $this->db->extended->autoExecute('users', null, MDB2_AUTOQUERY_SELECT, $where, null, true, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error auto executing select: '.$result->getMessage());
-        } else {
-            $this->verifyFetchedValues($result, null, $data);
-            $result->free();
-        }
-
-        $where = 'user_id = '.$this->db->quote($data['user_id'], 'integer');
-        $result = $this->db->extended->autoExecute('users', null, MDB2_AUTOQUERY_SELECT, $where, null, true, MDB2_PREPARE_RESULT);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error auto executing select: '.$result->getMessage());
-        } else {
-            $result->setResultTypes($this->fields);
-            $this->verifyFetchedValues($result, null, $data);
-            $result->free();
-        }
-
-        $update_data = array();
-        $data['user_name'] = $update_data['user_name'] = 'foo';
-
-        $where = 'user_id = '.$this->db->quote($data['user_id'], 'integer');
-        $result = $this->db->extended->autoExecute('users', $update_data, MDB2_AUTOQUERY_UPDATE, $where, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error auto executing insert: '.$result->getMessage());
-        }
-
-        $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-        $result =& $this->db->query($select_query, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        } else {
-            $this->verifyFetchedValues($result, null, $data);
-            $result->free();
-        }
-
-        $where = array($where, 'user_name = '.$this->db->quote($data['user_name'], 'text'));
-        $result = $this->db->extended->autoExecute('users', null, MDB2_AUTOQUERY_DELETE, $where, null);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error auto executing insert: '.$result->getMessage());
-        }
-
-        $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-        $result =& $this->db->query($select_query, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        } else {
-            $this->assertEquals(0, $result->numRows(), 'No rows were expected to be returned');
-            $result->free();
-        }
-    }
-
-    /**
-     * Test getAssoc()
-     *
-     * Test fetching two columns from a resultset. Return them as (key,value) pairs.
-     */
-    function testGetAssoc()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = $this->getSampleData(1234);
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        //test getAssoc() with query parameters
-        $query = 'SELECT user_id, user_name FROM users WHERE user_id=?';
-        $result = $this->db->extended->getAssoc($query, array('integer', 'text'), array(1234), array('integer'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$result->getMessage());
-        }
-        $this->assertTrue(array_key_exists($data['user_id'], $result), 'Unexpected returned key');
-        $this->assertEquals($data['user_name'], $result[$data['user_id']], 'Unexpected returned value');
-        
-        //test getAssoc() without query parameters
-        $query = 'SELECT user_id, user_name FROM users WHERE user_id=1234';
-        $result = $this->db->extended->getAssoc($query, array('integer', 'text'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$result->getMessage());
-        } else {
-            $this->assertTrue(array_key_exists($data['user_id'], $result), 'Unexpected returned key');
-            $this->assertEquals($data['user_name'], $result[$data['user_id']], 'Unexpected returned value');
-        }
-        
-        //add another record to the db
-        $data2 = $this->getSampleData(4321);
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data2));
-        $stmt->free();
-
-        //test getAssoc() with $force_array=true
-        $query = 'SELECT user_id, user_name FROM users ORDER BY user_id';
-        $values = $this->db->extended->getAssoc($query, array('integer', 'text'), null, null, MDB2_FETCHMODE_ASSOC, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$values->getMessage());
-        } else {
-            $this->assertEquals(2, count($values), 'Error: incorrect number of returned rows');
-            list($id, $value) = each($values);
-            $this->assertEquals($data['user_id'],   $id,                 'Unexpected returned value');
-            $this->assertEquals($data['user_name'], $value['user_name'], 'Unexpected returned value');
-            list($id, $value) = each($values);
-            $this->assertEquals($data2['user_id'],   $id,                 'Unexpected returned value');
-            $this->assertEquals($data2['user_name'], $value['user_name'], 'Unexpected returned value');
-        }
-
-
-        //test getAssoc() with $force_array=false and $group=true
-        $query = 'SELECT user_id, user_name FROM users ORDER BY user_id';
-        $values = $this->db->extended->getAssoc($query, array('integer', 'text'), null, null, MDB2_FETCHMODE_ASSOC, false, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$values->getMessage());
-        } else {
-            //@todo: check if MDB2_FETCHMODE_ASSOC is behaving correctly in this case
-            $this->assertEquals(2, count($values), 'Error: incorrect number of returned rows');
-            list($id, $value) = each($values);
-            $this->assertEquals($data['user_id'],   $id,       'Unexpected returned value');
-            $this->assertEquals($data['user_name'], $value[0], 'Unexpected returned value');
-            list($id, $value) = each($values);
-            $this->assertEquals($data2['user_id'],   $id,       'Unexpected returned value');
-            $this->assertEquals($data2['user_name'], $value[0], 'Unexpected returned value');
-
-        }
-        
-        //test $group=true with 3 fields
-        $query = 'SELECT user_password, user_id, user_name FROM users ORDER BY user_id';
-        $values = $this->db->extended->getAssoc($query, array('integer', 'text', 'text'), null, null, MDB2_FETCHMODE_ASSOC, false, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$values->getMessage());
-        } else {
-            //the 2 values for user_password are equals, so they are collapsed in the same array
-            $this->assertEquals(1, count($values), 'Error: incorrect number of returned rows');
-            $values = $values[0];
-            //there are 2 records
-            $this->assertEquals(2, count($values), 'Error: incorrect number of returned rows');
-            $value = array_shift($values);
-            $this->assertEquals($data['user_id'],   $value['user_id'], 'Unexpected returned value');
-            $this->assertEquals($data['user_name'], $value['user_name'], 'Unexpected returned value');
-            $value = array_shift($values);
-            $this->assertEquals($data2['user_id'],   $value['user_id'], 'Unexpected returned value');
-            $this->assertEquals($data2['user_name'], $value['user_name'], 'Unexpected returned value');
-        }
-        
-        //test $group=false with 3 fields
-        $values = $this->db->extended->getAssoc($query, array('integer', 'text', 'text'), null, null, MDB2_FETCHMODE_ASSOC, false, false);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error executing getAssoc(): '.$values->getMessage());
-        } else {
-            //the 2 values for user_password are equals, so the first record is overwritten
-            $this->assertEquals(1, count($values), 'Error: incorrect number of returned rows');
-            $values = $values[0];
-            $this->assertEquals($data2['user_id'],   $value['user_id'], 'Unexpected returned value');
-            $this->assertEquals($data2['user_name'], $value['user_name'], 'Unexpected returned value');
-        }
-    }
-
-    /**
-     * Test getOne()
-     *
-     * Test fetching a single value
-     */
-    function testGetOne()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = $this->getSampleData(1234);
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        //test getOne() with query parameters
-        $query = 'SELECT user_name FROM users WHERE user_id=?';
-        $result = $this->db->extended->getOne($query, 'text', array(1234), array('integer'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getOne(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_name'], $result, 'Unexpected returned value');
-
-        //test getOne() without query parameters
-        $query = 'SELECT user_name FROM users WHERE user_id=1234';
-        $result = $this->db->extended->getOne($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getOne(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_name'], $result, 'Unexpected returned value');
-
-        //test getOne() with column number (resultset: 0-based array)
-        $query = 'SELECT user_id, user_name, approved FROM users WHERE user_id=1234';
-        $result = $this->db->extended->getOne($query, 'text', null, null, 1); //get the 2nd column
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getOne(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_name'], $result, 'Unexpected returned value');
-    }
-
-    /**
-     * Test getCol()
-     *
-     * Test fetching a column of result data.
-     */
-    function testGetCol()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = array(
-            0 => $this->getSampleData(1234),
-            1 => $this->getSampleData(4321),
-        );
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data[0]));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $result = $stmt->execute(array_values($data[1]));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $stmt->free();
-
-        //test getCol() with query parameters
-        $query = 'SELECT user_name FROM users WHERE user_id>?';
-        $result = $this->db->extended->getCol($query, 'text', array(1), array('integer'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getCol(): '.$result->getMessage());
-        }
-        $expected = array(
-            $data[0]['user_name'],
-            $data[1]['user_name'],
-        );
-        $this->assertEquals($expected, $result, 'Unexpected returned value');
-
-        //test getCol() without query parameters
-        $query = 'SELECT user_name FROM users';
-        $result = $this->db->extended->getCol($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getCol(): '.$result->getMessage());
-        }
-        $this->assertEquals($expected, $result, 'Unexpected returned value');
-
-        //test getCol() with column number (resultset: 0-based array)
-        $query = 'SELECT user_id, user_name, approved FROM users';
-        $result = $this->db->extended->getCol($query, 'text', null, null, 1); //get the 2nd column
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getCol(): '.$result->getMessage());
-        }
-        $this->assertEquals($expected, $result, 'Unexpected returned value');
-    }
-
-    /**
-     * Test getRow()
-     *
-     * Test fetching a row of result data.
-     */
-    function testGetRow()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = $this->getSampleData(1234);
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $stmt->free();
-
-        //test getRow() with query parameters
-        $query = 'SELECT user_id, user_name, user_password FROM users WHERE user_id=?';
-        $result = $this->db->extended->getRow($query, array('integer', 'text', 'text'), array(1234), array('integer'), MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getRow(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_id'],       $result['user_id'],       'Unexpected returned value');
-        $this->assertEquals($data['user_name'],     $result['user_name'],     'Unexpected returned value');
-        $this->assertEquals($data['user_password'], $result['user_password'], 'Unexpected returned value');
-
-        //test getRow() without query parameters
-        $query = 'SELECT user_id, user_name, user_password FROM users';
-        $result = $this->db->extended->getRow($query, array('integer', 'text', 'text'), null, null, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getRow(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_id'],       $result['user_id'],       'Unexpected returned value');
-        $this->assertEquals($data['user_name'],     $result['user_name'],     'Unexpected returned value');
-        $this->assertEquals($data['user_password'], $result['user_password'], 'Unexpected returned value');
-    }
-
-    /**
-     * Test getAll()
-     *
-     * Test fetching result data all at once.
-     */
-    function testGetAll()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = array();
-        $total_rows = 5;
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')', array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $stmt->free();
-
-        //test getAll() with query parameters
-        $query = 'SELECT user_id, user_name, user_password FROM users WHERE user_id > ? ORDER BY user_id';
-        $values = $this->db->extended->getAll($query, array('integer', 'text', 'text'), array(2), array('integer'), MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set: '.$values->getMessage());
-        } else {
-            $this->assertEquals(2, count($values), 'Error: incorrect number of returned rows');
-            for ($i=0; $i<2; $i++) {
-                $this->assertEquals($data[$i+3]['user_id'],       $values[$i]['user_id'],       'Unexpected returned value');
-                $this->assertEquals($data[$i+3]['user_name'],     $values[$i]['user_name'],     'Unexpected returned value');
-                $this->assertEquals($data[$i+3]['user_password'], $values[$i]['user_password'], 'Unexpected returned value');
-            }
-        }
-
-        //test getAll() without query parameters
-        $query = 'SELECT user_id, user_name, user_password FROM users ORDER BY user_id';
-        $values = $this->db->extended->getAll($query, array('integer', 'text', 'text'), null, null, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set: '.$values->getMessage());
-        } else {
-            $this->assertEquals($total_rows, count($values), 'Error: incorrect number of returned rows');
-            for ($i=0; $i<$total_rows; $i++) {
-                $this->assertEquals($data[$i]['user_id'],       $values[$i]['user_id'],       'Unexpected returned value');
-                $this->assertEquals($data[$i]['user_name'],     $values[$i]['user_name'],     'Unexpected returned value');
-                $this->assertEquals($data[$i]['user_password'], $values[$i]['user_password'], 'Unexpected returned value');
-            }
-        }
-    }
-
-    /**
-     * Test limitQuery()
-     *
-     * Test fetching a limited resultset.
-     */
-    function testLimitQuery()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = array();
-        $total_rows = 5;
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')', array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $stmt->free();
-        
-        $query = 'SELECT user_id, user_name, user_password FROM users ORDER BY user_id';
-        $types = array('integer', 'text', 'text');
-
-        //test limitQuery() with offset = 0
-        $result = $this->db->extended->limitQuery($query, $types, 2);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing limitQuery(): '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            $this->assertEquals(2, count($values), 'Error: incorrect number of returned rows');
-            for ($i=0; $i<2; $i++) {
-                $this->assertEquals($data[$i]['user_id'],       $values[$i]['user_id'],       'Unexpected returned value');
-                $this->assertEquals($data[$i]['user_name'],     $values[$i]['user_name'],     'Unexpected returned value');
-                $this->assertEquals($data[$i]['user_password'], $values[$i]['user_password'], 'Unexpected returned value');
-            }
-        }
-        $result->free();
-
-        //test limitQuery() with offset > 0
-        $result = $this->db->extended->limitQuery($query, $types, 3, 2);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing limitQuery(): '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            $this->assertEquals(3, count($values), 'Error: incorrect number of returned rows');
-            for ($i=0; $i<3; $i++) {
-                $this->assertEquals($data[$i+2]['user_id'],       $values[$i]['user_id'],       'Unexpected returned value');
-                $this->assertEquals($data[$i+2]['user_name'],     $values[$i]['user_name'],     'Unexpected returned value');
-                $this->assertEquals($data[$i+2]['user_password'], $values[$i]['user_password'], 'Unexpected returned value');
-            }
-        }
-        $result->free();
-    }
-
-    /**
-     * Test execParam()
-     *
-     * Test executing a query with parameters
-     */
-    function testExecParam()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-        
-        $data = $this->getSampleData(1234);
-        
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        
-        $result = $this->db->extended->execParam($query, array_values($data), $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing execParam(): '.$result->getMessage());
-        }
-        
-        $query = 'SELECT user_id, user_name, user_password FROM users WHERE user_id=?';
-        $result = $this->db->extended->getRow($query, array('integer', 'text', 'text'), array(1234), array('integer'), MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing getRow(): '.$result->getMessage());
-        }
-        $this->assertEquals($data['user_id'],       $result['user_id'],       'Unexpected returned value');
-        $this->assertEquals($data['user_name'],     $result['user_name'],     'Unexpected returned value');
-        $this->assertEquals($data['user_password'], $result['user_password'], 'Unexpected returned value');
-    }
-
-    /**
-     * Test executeMultiple()
-     *
-     * Test executing multiple prepared queries
-     */
-    function testExecuteMultiple()
-    {
-        $result = $this->db->loadModule('Extended');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error loading "Extended" module: '.$result->getMessage());
-        }
-
-        $data = array();
-        $total_rows = 5;
-        
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = array_values($this->getSampleData($row));
-        }
-
-        $stmt = $this->db->prepare('INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')');
-        $result = $this->db->extended->executeMultiple($stmt, $data);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing executeMultiple(): '.$result->getMessage());
-        }
-        $stmt->free();
-        
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $values = $this->db->queryAll($query, $this->fields, MDB2_FETCHMODE_ORDERED);
-        
-        $n_fields = count($this->fields);
-        for ($i=0; $i<$total_rows; $i++) {
-            for ($field=0; $field<$n_fields; $field++) {
-                $this->assertEquals(strval($data[$i][$field]), strval($values[$i][$field]), 'Unexpected returned value');
-            }
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_function_testcase.php b/lib/tests/MDB2/tests/MDB2_function_testcase.php
deleted file mode 100644
index d778b8737e8e1a24b689386244f4eb878ec75a6f..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_function_testcase.php
+++ /dev/null
@@ -1,313 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Lukas Smith, Lorenzo Alberton                |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l dot alberton at quipo dot it>            |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_function_testcase.php,v 1.24 2008/02/17 18:54:08 quipo Exp $
-
-class MDB2_Function_TestCase extends MDB2_TestCase
-{
-    function setUp() {
-        parent::setUp();
-        $this->db->loadModule('Function', null, true);
-    }
-
-    /**
-     * Test functionTable()
-     */
-    function testFunctionTable()
-    {
-        if (!$this->methodExists($this->db->function, 'functionTable')) {
-            return;
-        }
-
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT 1 '.$functionTable_clause;
-        $result = $this->db->queryOne($query);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error fetching from function table');
-        } else {
-            $this->assertEquals('1', $result, 'Error fetching value from function table');
-        }
-    }
-
-    /**
-     * Test now()
-     */
-    function testNow()
-    {
-        if (!$this->methodExists($this->db->function, 'now')) {
-            return;
-        }
-
-        $tests = array(
-            'timestamp' => '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/',
-            'date' => '/^\d{4}-\d{2}-\d{2}$/',
-            'time' => '/^\d{2}:\d{2}:\d{2}$/',
-        );
-
-        foreach ($tests as $type => $regexp) {
-            $functionTable_clause = $this->db->function->functionTable();
-            $now_clause = $this->db->function->now($type);
-            $query = 'SELECT '.$now_clause . $functionTable_clause;
-            $result = $this->db->queryOne($query, $type);
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error getting '.$type);
-            } else {
-                $this->assertRegExp($regexp, $result, 'Error: not a proper '.$type);
-            }
-        }
-    }
-
-    /**
-     * Test substring()
-     */
-    function testSubstring()
-    {
-        if (!$this->methodExists($this->db->function, 'substring')) {
-            return;
-        }
-        $data = $this->getSampleData(1234);
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query'.$result->getMessage());
-        }
-
-        $substring_clause = $this->db->function->substring('user_name', 1, 4);
-        $query = 'SELECT '.$substring_clause .' FROM users';
-        $result = $this->db->queryOne($query);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting substring');
-        } else {
-            $this->assertEquals('user', $result, 'Error: substrings not equals');
-        }
-
-        $substring_clause = $this->db->function->substring('user_name', 5, 1);
-        $query = 'SELECT '.$substring_clause .' FROM users';
-        $result = $this->db->queryOne($query);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting substring');
-        } else {
-            $this->assertEquals('_', $result, 'Error: substrings not equals');
-        }
-
-        //test NULL 2nd parameter
-        $substring_clause = $this->db->function->substring('user_name', 6);
-        $query = 'SELECT '.$substring_clause .' FROM users';
-        $result = $this->db->queryOne($query);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting substring');
-        } else {
-            $this->assertEquals('1234', $result, 'Error: substrings not equals');
-        }
-    }
-
-    /**
-     * Test concat()
-     */
-    function testConcat()
-    {
-        if (!$this->methodExists($this->db->function, 'concat')) {
-            return;
-        }
-
-        $functionTable_clause = $this->db->function->functionTable();
-        $concat_clause = $this->db->function->concat($this->db->quote('time', 'text'), $this->db->quote('stamp', 'text'));
-        $query = 'SELECT '.$concat_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting concat');
-        } else {
-            $this->assertEquals('timestamp', $result, 'Error: could not concatenate "time+stamp"');
-        }
-    }
-
-    /**
-     * Test random()
-     */
-    function testRandom()
-    {
-        if (!$this->methodExists($this->db->function, 'random')) {
-            return;
-        }
-
-        $rand_clause = $this->db->function->random();
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$rand_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query, 'float');
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting random value:'. $result->getMessage());
-        } else {
-            $this->assertTrue(($result >= 0 && $result <= 1), 'Error: could not get random value between 0 and 1: '.$result);
-        }
-    }
-
-    /**
-     * Test lower()
-     */
-    function testLower()
-    {
-        if (!$this->methodExists($this->db->function, 'lower')) {
-            return;
-        }
-        $string = $this->db->quote('FoO');
-        $lower_clause = $this->db->function->lower($string);
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$lower_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting lower case value:'. $result->getMessage());
-        } else {
-            $this->assertTrue(($result === 'foo'), 'Error: could not lower case "FoO": '.$result);
-        }
-    }
-
-    /**
-     * Test upper()
-     */
-    function testUpper()
-    {
-        if (!$this->methodExists($this->db->function, 'upper')) {
-            return;
-        }
-        $string = $this->db->quote('FoO');
-        $upper_clause = $this->db->function->upper($string);
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$upper_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting upper case value:'. $result->getMessage());
-        } else {
-            $this->assertTrue(($result === 'FOO'), 'Error: could not upper case "FoO": '.$result);
-        }
-    }
-
-    /**
-     * Test length()
-     */
-    function testLenght()
-    {
-        if (!$this->methodExists($this->db->function, 'length')) {
-            return;
-        }
-        $string = $this->db->quote('foo');
-        $length_clause = $this->db->function->length($string);
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$length_clause . $functionTable_clause;
-        $len = $this->db->queryOne($query, 'integer');
-        if (PEAR::isError($len)) {
-            $this->assertFalse(true, 'Error getting upper case value:'. $len->getMessage());
-        } else {
-            $this->assertEquals(3, $len, 'Error: incorrect length for "foo" string: '.$len);
-        }
-    }
-
-    /**
-     * Test replace()
-     */
-    function testReplace()
-    {
-        if (!$this->methodExists($this->db->function, 'replace')) {
-            return;
-        }
-
-        $string  = $this->db->quote('so what');
-        $search  = $this->db->quote('o');
-        $replace = $this->db->quote('ay');
-        $replace_clause = $this->db->function->replace($string, $search, $replace);
-        $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
-        $this->db->expectError(MDB2_ERROR_UNSUPPORTED);
-        $replace_clause = $this->db->function->replace($string, $search, $replace);
-        $this->db->popExpect();
-        $this->db->popErrorHandling();
-        if (PEAR::isError($replace_clause) && $replace_clause->getCode() == MDB2_ERROR_UNSUPPORTED) {
-            return;
-        }
-
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$replace_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting replaced value:'. $result->getMessage());
-        } else {
-            $this->assertEquals('say what', $result, 'Error: could not get replace string: '.$result);
-        }
-    }
-
-    /**
-     * Test unixtimestamp()
-     */
-    function testUnixtimestamp()
-    {
-        if (!$this->methodExists($this->db->function, 'unixtimestamp')) {
-            return;
-        }
-
-        $datetime = '2008-01-01 00:00:00';
-        $quoted_dt = $this->db->quote($datetime, 'timestamp');
-        $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
-        $this->db->expectError(MDB2_ERROR_UNSUPPORTED);
-        $unixts_clause = $this->db->function->unixtimestamp($quoted_dt);
-        $this->db->popExpect();
-        $this->db->popErrorHandling();
-        if (PEAR::isError($unixts_clause) && $unixts_clause->getCode() == MDB2_ERROR_UNSUPPORTED) {
-            return;
-        }
-
-        $expected = strtotime($datetime);
-
-        $functionTable_clause = $this->db->function->functionTable();
-        $query = 'SELECT '.$unixts_clause . $functionTable_clause;
-        $result = $this->db->queryOne($query, 'text');
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting UNIX timestamp:'. $result->getMessage() . ' :: ' . $result->getUserInfo());
-        } else {
-            $this->assertEquals($expected, $result, 'Error: could not get correct UNIX timestamp: '.$result);
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_internals_testcase.php b/lib/tests/MDB2/tests/MDB2_internals_testcase.php
deleted file mode 100644
index bf0035a357c13dded2c2b23df473e3b7bb7784bf..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_internals_testcase.php
+++ /dev/null
@@ -1,628 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2008 m3 Media Services Ltd.                            |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Monique Szpak <monique.szpak@openads.org>                    |
-// |         Andrew Hill <andrew.hill@openads.org>                        |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_internals_testcase.php,v 1.4 2008/06/12 11:10:43 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Internals_TestCase extends MDB2_TestCase {
-
-    var $clear_tables = false;
-
-    /**
-     * Tests that the MDB2::apiVersion() method returns an API version number.
-     */
-    function test_apiVersion()
-    {
-        $result = MDB2::apiVersion();
-        $this->assertNotNull($result, 'apiVersion');
-        $result = strtok($result, '.');
-        $this->assertTrue(is_numeric($result), 'apiVersion');
-        $result = strtok('.');
-        $this->assertTrue(is_numeric($result), 'apiVersion');
-        $result = strtok('.');
-        $this->assertTrue(is_numeric($result), 'apiVersion');
-    }
-
-    /**
-     * Tests that the MDB2::classExists() method correctly tests for
-     * existence of a class.
-     */
-    function test_classExists()
-    {
-        $this->assertFalse(MDB2::classExists('null'), 'classExists');
-        $this->assertTrue(MDB2::classExists('MDB2'), 'classExists');
-    }
-
-    /**
-     * Tests that the MDB2::loadClass() method correctly loads classes.
-     */
-    function test_loadClass()
-    {
-        $this->assertTrue(MDB2::loadClass('MDB2', false), 'loadClass');
-        // Suppress handling of PEAR errors while testing next case
-        PEAR::pushErrorHandling(null);
-        $result = MDB2::loadClass('null', false);
-        $this->assertTrue(is_a($result, 'pear_error'), 'loadClass');
-        PEAR::popErrorHandling();
-    }
-
-    /**
-     * Tests that the MDB2::factory() method correctly connects to a
-     * database.
-     */
-    function test_factory()
-    {
-        $db =& MDB2::factory($this->dsn);
-        $this->assertTrue(MDB2::isConnection($db), 'factory');
-        // Suppress handling of PEAR errors while preparing the
-        // next test case database connection
-        PEAR::pushErrorHandling(null);
-        $db =& MDB2::factory(null);
-        PEAR::popErrorHandling();
-        $this->assertFalse(MDB2::isConnection($db), 'factory');
-    }
-
-    /**
-     * Tests that the MDB2::loadFile() method returns the expected
-     * filename.
-     */
-    function test_loadFile()
-    {
-        $filename = 'Extended';
-        $this->assertEquals('MDB2'.DIRECTORY_SEPARATOR.$filename.'.php', MDB2::loadFile($filename), 'loadFile');
-    }
-
-    /**
-     * Tests that the MDB2::isConnection() method correctly reports
-     * connections.
-     */
-    function test_isConnection()
-    {
-        $this->assertTrue(MDB2::isConnection($this->db), 'isConnection');
-        $this->assertFalse(MDB2::isConnection(null), 'isConnection');
-    }
-
-    /**
-     * Tests that the MDB2::isResult() method correctly identifies
-     * results.
-     */
-    function test_isResult()
-    {
-        $obj = new MDB2_Result();
-        $this->assertTrue(MDB2::isResult($obj), 'isResult');
-        $obj = null;
-        $this->assertFalse(MDB2::isResult($obj), 'isResult');
-    }
-
-    /**
-     * Tests that the MDB2::isResultCommon() method correctly identifies
-     * common results.
-     */
-    function test_isResultCommon()
-    {
-        $result = null;
-        $obj = new MDB2_Result_Common($this->db, $result);
-        $this->assertTrue(MDB2::isResultCommon($obj), 'isResultCommon');
-        $obj = null;
-        $this->assertFalse(MDB2::isResultCommon($obj), 'isResultCommon');
-    }
-
-    /**
-     * Tests that the MDB2::parseDSN() method works.
-     */
-    function test_parseDSN()
-    {
-        $dsn = $this->dsn;
-        $result = MDB2::parseDSN($dsn);
-        $this->assertEquals($dsn['phptype'],$result['dbsyntax'],'parseDSN');
-
-        $dsn = "mydbms://myname:mypassword@localhost";
-        $result = MDB2::parseDSN($dsn);
-        $this->assertEquals('mydbms', $result['phptype'],'parseDSN');
-        $this->assertEquals('mydbms',$result['dbsyntax'],'parseDSN');
-        $this->assertEquals('tcp',$result['protocol'],'parseDSN');
-        $this->assertEquals('localhost',$result['hostspec'],'parseDSN');
-        $this->assertEquals(false,$result['port'],'parseDSN');
-        $this->assertEquals(false,$result['socket'],'parseDSN');
-        $this->assertEquals('myname',$result['username'],'parseDSN');
-        $this->assertEquals('mypassword',$result['password'],'parseDSN');
-        $this->assertEquals(false,$result['database'],'parseDSN');
-
-        $dsn = "somesql://myname:mypassword@localhost:1234/mydb";
-        $result = MDB2::parseDSN($dsn);
-        $this->assertEquals('somesql',$result['phptype'],'parseDSN');
-        $this->assertEquals('somesql',$result['dbsyntax'],'parseDSN');
-        $this->assertEquals('tcp',$result['protocol'],'parseDSN');
-        $this->assertEquals('localhost',$result['hostspec'],'parseDSN');
-        $this->assertEquals('1234',$result['port'],'parseDSN');
-        $this->assertEquals(false,$result['socket'],'parseDSN');
-        $this->assertEquals('myname',$result['username'],'parseDSN');
-        $this->assertEquals('mypassword',$result['password'],'parseDSN');
-        $this->assertEquals('mydb',$result['database'],'parseDSN');
-
-        $dsn = "dbms1://myname@unix(opts)/mydb?param1=value1";
-        $result = MDB2::parseDSN($dsn);
-        $this->assertEquals('dbms1',$result['phptype'],'parseDSN');
-        $this->assertEquals('dbms1',$result['dbsyntax'],'parseDSN');
-        $this->assertEquals('unix',$result['protocol'],'parseDSN');
-        $this->assertEquals(false,$result['hostspec'],'parseDSN');
-        $this->assertEquals(false,$result['port'],'parseDSN');
-        $this->assertEquals('opts',$result['socket'],'parseDSN');
-        $this->assertEquals('myname',$result['username'],'parseDSN');
-        $this->assertEquals(false,$result['password'],'parseDSN');
-        $this->assertEquals('mydb',$result['database'],'parseDSN');
-        $this->assertEquals('value1',$result['param1'],'parseDSN');
-    }
-
-    /**
-     * Tests that the MDB2::fileExists() method correctly identifies
-     * existing/non-existing files.
-     */
-    function test_fileExists()
-    {
-        $this->assertTrue(MDB2::fileExists('PEAR.php'), 'fileExists');
-        $this->assertFalse(MDB2::fileExists('itIsHopedThatNoOneHasAFileWithThisName.php'), 'fileExists');
-    }
-
-    /**
-     * Tests that the MDB2::__toString() method returns the expected
-     * string result.
-     */
-    function test__toString()
-    {
-        $expected = "MDB2_Driver_{$this->dsn['phptype']}: (phptype = {$this->dsn['phptype']}, dbsyntax = {$this->db->dbsyntax})";
-        if (version_compare(PHP_VERSION, "5.0.0", "<")) {
-            $expected = strtolower($expected);
-        }
-        $this->assertEquals($expected ,$this->db->__toString(), '__toString');
-    }
-
-    /**
-     * Tests that the MDB2::setFetchMode() method correctly sets the
-     * fetch mode.
-     */
-    function test_setFetchMode()
-    {
-        $tmp = $this->db->fetchmode;
-        $this->db->setFetchMode(MDB2_FETCHMODE_OBJECT);
-        $this->assertEquals('stdClass', $this->db->options['fetch_class'], 'setFetchMode');
-        $this->db->setFetchMode(MDB2_FETCHMODE_ORDERED);
-        $this->assertEquals(MDB2_FETCHMODE_ORDERED, $this->db->fetchmode, 'setFetchMode');
-        $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-        $this->assertEquals(MDB2_FETCHMODE_ASSOC, $this->db->fetchmode, 'setFetchMode');
-        $this->db->fetchmode = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::escape() method correctly escapes strings.
-     */
-    function test_escape()
-    {
-        $tmp = $this->db->string_quoting;
-        $this->string_quoting['escape'] = '\\';
-        $this->string_quoting['end'] = '"';
-        $text = 'xxx"z"xxx';
-        $this->assertEquals('xxx\"z\"xxx', MDB2_Driver_Common::escape($text), 'escape');
-        $this->db->string_quoting = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::quoteIdentifier() method correctly quotes strings.
-     */
-    function test_quoteIdentifier()
-    {
-        if ($this->db->phptype == 'ibase') {
-            return;
-        }
-        $tmp = $this->db->identifier_quoting;
-        $this->db->identifier_quoting['start'] = '"';
-        $this->db->identifier_quoting['end'] = '`';
-        $this->db->identifier_quoting['escape'] = '/';
-        $text = 'my`identifier';
-        $this->assertEquals('"my/`identifier`', $this->db->quoteIdentifier($text), 'quoteIdentifier');
-        $this->db->identifier_quoting = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::getAsKeyword() method correctly returns
-     * the set "as" keyword.
-     */
-    function test_getAsKeyword()
-    {
-        $tmp = $this->db->as_keyword;
-        $this->db->as_keyword = 'ALIAS';
-        $this->assertEquals('ALIAS', $this->db->getAsKeyword(), 'getAsKeyword');
-        $this->db->as_keyword = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::getConnection() method correctly returns
-     * a database resource.
-     */
-    function test_getConnection()
-    {
-        $result = $this->db->getConnection();
-        $this->assertTrue(is_resource($result), 'getConnection');
-    }
-
-    /**
-     * A private method to return a defined "row" of data for use
-     * in the next set of tests.
-     *
-     * @access private
-     * @return array The array of "row" data.
-     */
-    function _fetchRowData()
-    {
-        return array(
-            0         => '',
-            1         => 'notnull',
-            2         => 'length7   ',
-            '1?2:3.4' => 'assoc'
-        );
-    }
-
-    /**
-     * A private method to test results from the MDB2::_fixResultArrayValues()
-     * method when the $mode parameter was set to MDB2_PORTABILITY_EMPTY_TO_NULL.
-     *
-     * @access private
-     * @param array $row The result of the call to MDB2::_fixResultArrayValues().
-     */
-    function _fixResultArrayValues_Test_EmptyToNull($row)
-    {
-        $this->assertNull($row[0], '_fixResultArrayValues');
-        $this->assertNotNull($row[1], '_fixResultArrayValues');
-        $this->assertNotNull($row[2], '_fixResultArrayValues');
-    }
-
-    /**
-     * A private method to test results from the MDB2::_fixResultArrayValues()
-     * method when the $mode parameter was set to MDB2_PORTABILITY_RTRIM.
-     *
-     * @access private
-     * @param array $row The result of the call to MDB2::_fixResultArrayValues().
-     */
-    function _fixResultArrayValues_Test_Rtrim($row)
-    {
-        $this->assertEquals(strlen($row[0]), 0, '_fixResultArrayValues');
-        $this->assertEquals(strlen($row[1]), 7, '_fixResultArrayValues');
-        $this->assertEquals(strlen($row[2]), 7, '_fixResultArrayValues');
-    }
-
-    /**
-     * A private method to test results from the MDB2::_fixResultArrayValues()
-     * method when the $mode parameter was set to MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES.
-     *
-     * @access private
-     * @param array $row The result of the call to MDB2::_fixResultArrayValues().
-     */
-    function _fixResultArrayValues_Test_FixAssocFieldNames($row)
-    {
-        $this->assertTrue(array_key_exists(4, $row), '_fixResultArrayValues');
-        $this->assertTrue($row[4] == 'assoc', '_fixResultArrayValues');
-    }
-
-    /**
-     * Tests that the MDB2::_fixResultArrayValues() method fixes array
-     * values when used with various $mode parameters.
-     */
-    function test__fixResultArrayValues()
-    {
-        $mode = MDB2_PORTABILITY_EMPTY_TO_NULL;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_EmptyToNull($row);
-
-        $mode = MDB2_PORTABILITY_RTRIM;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_Rtrim($row);
-
-        $mode = MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_FixAssocFieldNames($row);
-
-        $mode = MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_RTRIM;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_EmptyToNull($row);
-        $this->_fixResultArrayValues_Test_Rtrim($row);
-
-        $mode = MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_EmptyToNull($row);
-        $this->_fixResultArrayValues_Test_FixAssocFieldNames($row);
-
-        $mode = MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_Rtrim($row);
-        $this->_fixResultArrayValues_Test_FixAssocFieldNames($row);
-
-        $mode = MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES;
-        $row = $this->_fetchRowData();
-        $this->db->_fixResultArrayValues($row, $mode);
-        $this->_fixResultArrayValues_Test_EmptyToNull($row);
-        $this->_fixResultArrayValues_Test_Rtrim($row);
-        $this->_fixResultArrayValues_Test_FixAssocFieldNames($row);
-    }
-
-    /**
-     * Tests that the MDB2::transaction() method returns expected values
-     * when starting or rolling back a transaction, and for testing if
-     * the connection is in a transaction.
-     */
-    function test_transaction()
-    {
-        if (!$this->db->supports('transactions'))
-        {
-            $this->assertTrue($this->db->beginTransaction(), 'transaction');
-            $this->assertTrue($this->db->in_transaction, 'transaction');
-            $this->assertTrue($this->db->rollback(), 'transaction');
-            $this->assertFalse($this->db->in_transaction, 'transaction');
-
-            $this->assertTrue($this->db->beginTransaction(), 'transaction');
-            $this->assertTrue($this->db->in_transaction, 'transaction');
-            $this->assertTrue($this->db->commit(), 'transaction');
-            $this->assertFalse($this->db->in_transaction, 'transaction');
-        }
-    }
-
-    // Nested transactions are not yet tested, due to a MySQL 5 problem with
-    // savepoints causing netsted transactions to fail.
-    //
-    // See http://bugs.mysql.com/bug.php?id=26288
-
-    /**
-     * Tests that the MDB2::setDatabase() and MDB2::getDatabase() methods
-     * correctly set and get the database name.
-     */
-    function test_setGetDatabase()
-    {
-        $old_name = $this->db->database_name;
-        $this->assertEquals($old_name, $this->db->setDatabase('test_database'), 'setDatabase');
-        $this->assertEquals('test_database', $this->db->database_name, 'setDatabase');
-        $this->assertEquals('test_database', $this->db->getDatabase(), 'getDatabase');
-        $this->db->database_name = $old_name;
-    }
-
-    /**
-     * Tests that the MDB2::setDSN() method correctly sets the DSN.
-     */
-    function test_setDSN()
-    {
-        $dsn = "mydbms://myname:mypassword@localhost";
-        $result = $this->db->setDSN($dsn);
-        $dsn_set = $this->db->dsn;
-
-        $this->assertEquals('mydbms', $dsn_set['phptype'],'setDSN');
-        $this->assertEquals('mydbms',$dsn_set['dbsyntax'],'setDSN');
-        $this->assertEquals('tcp',$dsn_set['protocol'],'setDSN');
-        $this->assertEquals('localhost',$dsn_set['hostspec'],'setDSN');
-        $this->assertEquals(false,$dsn_set['port'],'setDSN');
-        $this->assertEquals(false,$dsn_set['socket'],'setDSN');
-        $this->assertEquals('myname',$dsn_set['username'],'setDSN');
-        $this->assertEquals('mypassword',$dsn_set['password'],'setDSN');
-        $this->assertEquals(false,$dsn_set['database'],'setDSN');
-    }
-
-    /**
-     * Tests that the MDB2::getDSN() method correctly gets the DSN.
-     */
-    function test_getDSN()
-    {
-        $dsn_set = "mydbms://myname:mypassword@localhost";
-        $result = $this->db->setDSN($dsn_set);
-        $dsn_get = $this->db->getDSN();
-        $dsn_rex = "/(([\w]+)\(mydbms\):\/\/myname:mypassword@localhost\/)/";
-        //preg_match($dsn_rex, $dsn_get, $matches);
-        $this->assertRegExp($dsn_rex, $dsn_get, 'testGetDSN');
-        $dsn_rex = "/{$this->dsn['phptype']}[\w\W]+/";
-        $this->assertRegExp($dsn_rex, $dsn_get, 'testGetDSN');
-
-        $dsn_set = "mydbms://myname:mypassword@localhost";
-        $result = $this->db->setDSN($dsn_set);
-        $dsn_get = $this->db->getDSN('string', true);
-        $dsn_rex = "/(([\w]+)\(mydbms\):\/\/myname:1@localhost\/)/";
-        $this->assertRegExp($dsn_rex, $dsn_get, 'testGetDSN');
-        $dsn_rex = "/{$this->dsn['phptype']}[\w\W]+/";
-        $this->assertRegExp($dsn_rex, $dsn_get, 'testGetDSN');
-    }
-
-    /**
-     * Tests that the 'new_link' DSN option is read correctly
-     */
-    function test_isNewLinkSet()
-    {
-        $dsn = array(
-            'phptype'  => 'mydbms',
-            'host'     => 'localhost',
-            'database' => 'dbname',
-            'username' => 'myname',
-            'password' => 'mypassword',
-        );
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = true;
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        $dsn['new_link'] = false;
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 'true';
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 'false';
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 1;
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 0;
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = '1';
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        $dsn['new_link'] = '0';
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 'True';
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 'TRUE';
-        $this->db->setDSN($dsn);
-        $this->assertTrue($this->db->_isNewLinkSet());
-        //now test some invalid values...
-        $dsn['new_link'] = new StdClass;
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = '';
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-        $dsn['new_link'] = 'blah';
-        $this->db->setDSN($dsn);
-        $this->assertFalse($this->db->_isNewLinkSet());
-    }
-
-    /**
-     * Tests that the MDB2::setLimit() method correctly sets the limit
-     * and offset values.
-     */
-    function test_setLimit()
-    {
-        if (!$this->db->supports('limit_queries'))
-        {
-            $this->db->limit = null;
-            $this->db->offset = null;
-            $this->db->setLimit(100, 50);
-            $this->assertEquals(100, $this->db->limit , 'setLimit');
-            $this->assertEquals( 50, $this->db->offset, 'setLimit');
-        }
-    }
-
-    /**
-     * Tests that the MDB2::supports() method correctly finds keys
-     * in the "supports" array.
-     */
-    function test_supports()
-    {
-        $this->db->supports['testkey'] = true;
-        $this->assertTrue($this->db->supports('testkey'), 'supports');
-        unset($this->db->supports['testkey']);
-    }
-
-    /**
-     * Tests that the MDB2::getSequenceName() method correctly gets
-     * sequence names.
-     */
-    function test_getSequenceName()
-    {
-        $tmp = $this->db->options['seqname_format'];
-        $this->db->options['seqname_format'] = '%s_seq';
-        $this->assertEquals('test_seq', strtolower($this->db->getSequenceName('test')), 'getSequenceName');
-        $this->db->options['seqname_format'] = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::getIndexName() method correctly gets index names.
-     */
-    function test_getIndexName()
-    {
-        $tmp = $this->db->options['idxname_format'];
-        $this->db->options['idxname_format'] = 'idx_%s';
-        $this->assertEquals('idx_test', $this->db->getIndexName('test'), 'getIndexName');
-        $this->db->options['idxname_format'] = $tmp;
-    }
-
-    /**
-     * Tests that the MDB2::disconnect() method correctly disconnects.
-     */
-    function test_disconnect()
-    {
-        $this->assertTrue($this->db->disconnect(), 'disconnect');
-        $this->assertEquals(0, $this->db->connection, 'disconnect');
-        $this->assertEquals(array(), $this->db->connected_dsn, 'disconnect');
-        $this->assertEquals('', $this->db->connected_database_name, 'disconnect');
-        $this->assertNull($this->db->opened_persistent, 'disconnect');
-        $this->assertEquals('', $this->db->connected_server_info, 'disconnect');
-        $this->assertNull($this->db->in_transaction, 'disconnect');
-        $this->assertNull($this->db->nested_transaction_counter, 'disconnect');
-    }
-    
-    /**
-     * Test that the MDB2::_skipDelimitedStrings() method correctly recognizes
-     * parameter placeholders from quoted strings
-     */
-    function test_skipDelimitedStrings() {
-        $query = "UPDATE tbl SET fld='' WHERE fld2=:param AND fld3=':fakeparam' AND fld3=:param2";
-        $this->assertEquals(0, $this->db->_skipDelimitedStrings($query, 0, 0));
-        $this->assertEquals(18, $this->db->_skipDelimitedStrings($query, 18, 19));
-        $this->assertEquals(20, $this->db->_skipDelimitedStrings($query, 20, 20));
-        $this->assertEquals(21, $this->db->_skipDelimitedStrings($query, 19, 21));
-        $this->assertEquals(30, $this->db->_skipDelimitedStrings($query, 30, 33));
-        $this->assertEquals(30, $this->db->_skipDelimitedStrings($query, 30, 34));
-        $this->assertEquals(33, $this->db->_skipDelimitedStrings($query, 33, 33));
-        $this->assertEquals(50, $this->db->_skipDelimitedStrings($query, 50, 50));
-        $this->assertEquals(61, $this->db->_skipDelimitedStrings($query, 49, 51));
-        $this->assertEquals(52, $this->db->_skipDelimitedStrings($query, 52, 52));
-        $this->assertEquals(70, $this->db->_skipDelimitedStrings($query, 70, 72));
-        $this->assertEquals(71, $this->db->_skipDelimitedStrings($query, 71, 72));
-        $this->assertEquals(72, $this->db->_skipDelimitedStrings($query, 72, 72));
-
-        //be careful about SQL comments that are not comments (because within quotes)
-        $query = "UPDATE tbl SET fld='--some text' WHERE col2=?";
-        $this->assertEquals(0, $this->db->_skipDelimitedStrings($query, 0, 0));
-        $this->assertEquals(18, $this->db->_skipDelimitedStrings($query, 18, 19));
-        $this->assertEquals(20, $this->db->_skipDelimitedStrings($query, 20, 20));
-        $this->assertEquals(32, $this->db->_skipDelimitedStrings($query, 19, 21));
-    }
-
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_manager_testcase.php b/lib/tests/MDB2/tests/MDB2_manager_testcase.php
deleted file mode 100644
index f4571a31d4ab5ea7974c14db6e4be038c5d9513a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_manager_testcase.php
+++ /dev/null
@@ -1,919 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Paul Cooper, Lorenzo Alberton  |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Authors: Paul Cooper <pgc@ucecom.com>                                |
-// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_manager_testcase.php,v 1.65 2008/03/08 14:04:15 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Manager_TestCase extends MDB2_TestCase {
-    //test table name (it is dynamically created/dropped)
-    var $table = 'newtable';
-
-    function setUp() {
-        parent::setUp();
-        $this->db->loadModule('Manager', null, true);
-        $this->fields = array(
-            'id' => array(
-                'type'     => 'integer',
-                'unsigned' => true,
-                'notnull'  => true,
-                'default'  => 0,
-            ),
-            'somename' => array(
-                'type'     => 'text',
-                'length'   => 12,
-            ),
-            'somedescription'  => array(
-                'type'     => 'text',
-                'length'   => 12,
-            ),
-            'sex' => array(
-                'type'     => 'text',
-                'length'   => 1,
-                'default'  => 'M',
-            ),
-        );
-        $options = array();
-        if ('mysql' == substr($this->db->phptype, 0, 5)) {
-            $options['type'] = 'innodb';
-        }
-        if (!$this->tableExists($this->table)) {
-            $result = $this->db->manager->createTable($this->table, $this->fields, $options);
-            $this->assertFalse(PEAR::isError($result), 'Error creating table');
-            $this->assertEquals(MDB2_OK, $result, 'Invalid return value for createTable()');
-        }
-    }
-
-    function tearDown() {
-        if ($this->tableExists($this->table)) {
-            $result = $this->db->manager->dropTable($this->table);
-            $this->assertFalse(PEAR::isError($result), 'Error dropping table');
-        }
-        $this->db->popExpect();
-        unset($this->dsn);
-        if (!PEAR::isError($this->db->manager)) {
-            $this->db->disconnect();
-        }
-        unset($this->db);
-    }
-
-    /**
-     * Create a sample table, test the new fields, and drop it.
-     */
-    function testCreateTable() {
-        if (!$this->methodExists($this->db->manager, 'createTable')) {
-            return;
-        }
-        if ($this->tableExists($this->table)) {
-            $this->db->manager->dropTable($this->table);
-        }
-
-        $result = $this->db->manager->createTable($this->table, $this->fields);
-        $this->assertFalse(PEAR::isError($result), 'Error creating table');
-    }
-
-    /**
-     * Create a sample table, test the new fields, and drop it.
-     */
-    function testCreateAutoIncrementTable() {
-        if (!$this->methodExists($this->db->manager, 'createTable')) {
-            return;
-        }
-        if ($this->tableExists($this->table)) {
-            $this->db->manager->dropTable($this->table);
-        }
-        $seq_name = $this->table;
-        if ('ibase' == $this->db->phptype) {
-            $seq_name .= '_id';
-        }
-        //remove existing PK sequence
-        $sequences = $this->db->manager->listSequences();
-        if (in_array($seq_name, $sequences)) {
-            $this->db->manager->dropSequence($seq_name);
-        }
-
-        $fields = $this->fields;
-        $fields['id']['autoincrement'] = true;
-        $result = $this->db->manager->createTable($this->table, $fields);
-        $this->assertFalse(PEAR::isError($result), 'Error creating table');
-        $this->assertEquals(MDB2_OK, $result, 'Error creating table: unexpected return value');
-        $query = 'INSERT INTO '.$this->db->quoteIdentifier($this->table, true);
-        $query.= ' (somename, somedescription)';
-        $query.= ' VALUES (:somename, :somedescription)';
-        $stmt =& $this->db->prepare($query, array('text', 'text'), MDB2_PREPARE_MANIP);
-        if (PEAR::isError($stmt)) {
-            $this->assertFalse(true, 'Preparing insert');
-            return;
-        }
-        $values = array(
-            'somename' => 'foo',
-            'somedescription' => 'bar',
-        );
-        $rows = 5;
-        for ($i =0; $i < $rows; ++$i) {
-            $result = $stmt->execute($values);
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error executing autoincrementing insert number: '.$i);
-                return;
-            }
-        }
-        $stmt->free();
-        $query = 'SELECT id FROM '.$this->table;
-        $data = $this->db->queryCol($query, 'integer');
-        if (PEAR::isError($data)) {
-            $this->assertFalse(true, 'Error executing select: ' . $data->getMessage());
-            return;
-        }
-        for ($i =0; $i < $rows; ++$i) {
-            if (!isset($data[$i])) {
-                $this->assertFalse(true, 'Error in data returned by select');
-                return;
-            }
-            if ($data[$i] !== ($i+1)) {
-                $this->assertFalse(true, 'Error executing autoincrementing insert');
-                return;
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    function testListTableFields() {
-        if (!$this->methodExists($this->db->manager, 'listTableFields')) {
-            return;
-        }
-        $this->assertEquals(
-            array_keys($this->fields),
-            $this->db->manager->listTableFields($this->table),
-            'Error creating table: incorrect fields'
-        );
-    }
-
-    /**
-     *
-     */
-    function testCreateIndex() {
-        if (!$this->methodExists($this->db->manager, 'createIndex')) {
-            return;
-        }
-        $index = array(
-            'fields' => array(
-                'somename' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-        );
-        $name = 'simpleindex';
-        $result = $this->db->manager->createIndex($this->table, $name, $index);
-        $this->assertFalse(PEAR::isError($result), 'Error creating index');
-    }
-
-    /**
-     *
-     */
-    function testDropIndex() {
-        if (!$this->methodExists($this->db->manager, 'dropIndex')) {
-            return;
-        }
-        $index = array(
-            'fields' => array(
-                'somename' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-        );
-        $name = 'simpleindex';
-        $result = $this->db->manager->createIndex($this->table, $name, $index);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error creating index');
-        } else {
-            $result = $this->db->manager->dropIndex($this->table, $name);
-            $this->assertFalse(PEAR::isError($result), 'Error dropping index');
-            $indices = $this->db->manager->listTableIndexes($this->table);
-            $this->assertFalse(PEAR::isError($indices), 'Error listing indices');
-            $this->assertFalse(in_array($name, $indices), 'Error dropping index');
-        }
-    }
-
-    /**
-     *
-     */
-    function testListIndexes() {
-        if (!$this->methodExists($this->db->manager, 'listTableIndexes')) {
-            return;
-        }
-        $index = array(
-            'fields' => array(
-                'somename' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-        );
-        $name = 'simpleindex';
-        $result = $this->db->manager->createIndex($this->table, $name, $index);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error creating index');
-        } else {
-            $indices = $this->db->manager->listTableIndexes($this->table);
-            $this->assertFalse(PEAR::isError($indices), 'Error listing indices');
-            $this->assertTrue(in_array($name, $indices), 'Error listing indices');
-        }
-    }
-
-    /**
-     *
-     */
-    function testCreatePrimaryKey() {
-        if (!$this->methodExists($this->db->manager, 'createConstraint')) {
-            return;
-        }
-        $constraint = array(
-            'fields' => array(
-                'id' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-            'primary' => true,
-        );
-        $name = 'pkindex';
-        $result = $this->db->manager->createConstraint($this->table, $name, $constraint);
-        $this->assertFalse(PEAR::isError($result), 'Error creating primary key constraint');
-    }
-
-    /**
-     *
-     */
-    function testCreateUniqueConstraint() {
-        if (!$this->methodExists($this->db->manager, 'createConstraint')) {
-            return;
-        }
-        $constraint = array(
-            'fields' => array(
-                'somename' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-            'unique' => true,
-        );
-        $name = 'uniqueindex';
-        $result = $this->db->manager->createConstraint($this->table, $name, $constraint);
-        $this->assertFalse(PEAR::isError($result), 'Error creating unique constraint');
-    }
-
-    /**
-     *
-     */
-    function testCreateForeignKeyConstraint() {
-        if (!$this->methodExists($this->db->manager, 'createConstraint')) {
-            return;
-        }
-        $constraint = array(
-            'fields' => array(
-                'id' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-            'foreign' => true,
-            'references' => array(
-                'table' => 'users',
-                'fields' => array(
-                    'user_id' => array(
-                        'position' => 1,
-                    ),
-                ),
-            ),
-            'initiallydeferred' => false,
-            'deferrable' => false,
-            'match' => 'SIMPLE',
-            'onupdate' => 'CASCADE',
-            'ondelete' => 'CASCADE',
-        );
-        $constraint_name = 'fkconstraint';
-        $result = $this->db->manager->createConstraint($this->table, $constraint_name, $constraint);
-        $this->assertFalse(PEAR::isError($result), 'Error creating FOREIGN KEY constraint');
-
-        //see if it was created successfully
-        $constraints = $this->db->manager->listTableConstraints($this->table);
-        $this->assertTrue(!PEAR::isError($constraints), 'Error listing table constraints');
-        $constraint_name_idx = $this->db->getIndexName($constraint_name);
-        $this->assertTrue(in_array($constraint_name_idx, $constraints) || in_array($constraint_name, $constraints), 'Error, FK constraint not found');
-
-        //now check that it is enforced...
-
-        //insert a row in the primary table
-        $result = $this->db->exec('INSERT INTO users (user_id) VALUES (1)');
-        $this->assertTrue(!PEAR::isError($result), 'Insert failed');
-
-        //insert a row in the FK table with an id that references
-        //the newly inserted row on the primary table: should not fail
-        $query = 'INSERT INTO '.$this->db->quoteIdentifier($this->table, true)
-                .' ('.$this->db->quoteIdentifier('id', true).') VALUES (1)';
-        $result = $this->db->exec($query);
-        $this->assertTrue(!PEAR::isError($result), 'Insert failed');
-
-        //try to insert a row into the FK table with an id that does not
-        //exist in the primary table: should fail
-        $query = 'INSERT INTO '.$this->db->quoteIdentifier($this->table, true)
-                .' ('.$this->db->quoteIdentifier('id', true).') VALUES (123456)';
-        $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
-        $this->db->expectError('*');
-        $result = $this->db->exec($query);
-        $this->db->popExpect();
-        $this->db->popErrorHandling();
-        $this->assertTrue(PEAR::isError($result), 'Foreign Key constraint is not enforced for INSERT query');
-
-        //try to update the first row of the FK table with an id that does not
-        //exist in the primary table: should fail
-        $query = 'UPDATE '.$this->db->quoteIdentifier($this->table, true)
-                .' SET '.$this->db->quoteIdentifier('id', true).' = 123456 '
-                .' WHERE '.$this->db->quoteIdentifier('id', true).' = 1';
-        $this->db->expectError('*');
-        $result = $this->db->exec($query);
-        $this->db->popExpect();
-        $this->assertTrue(PEAR::isError($result), 'Foreign Key constraint is not enforced for UPDATE query');
-
-        $numrows_query = 'SELECT COUNT(*) FROM '. $this->db->quoteIdentifier($this->table, true);
-        $numrows = $this->db->queryOne($numrows_query, 'integer');
-        $this->assertEquals(1, $numrows, 'Invalid number of rows in the FK table');
-
-        //update the PK value of the primary table: the new value should be
-        //propagated to the FK table (ON UPDATE CASCADE)
-        $result = $this->db->exec('UPDATE users SET user_id = 2');
-        $this->assertTrue(!PEAR::isError($result), 'Update failed');
-
-        $numrows = $this->db->queryOne($numrows_query, 'integer');
-        $this->assertEquals(1, $numrows, 'Invalid number of rows in the FK table');
-
-        $query = 'SELECT id FROM '.$this->db->quoteIdentifier($this->table, true);
-        $newvalue = $this->db->queryOne($query, 'integer');
-        $this->assertEquals(2, $newvalue, 'The value of the FK field was not updated (CASCADE failed)');
-
-        //delete the row of the primary table: the row in the FK table should be
-        //deleted automatically (ON DELETE CASCADE)
-        $result = $this->db->exec('DELETE FROM users');
-        $this->assertTrue(!PEAR::isError($result), 'Delete failed');
-
-        $numrows = $this->db->queryOne($numrows_query, 'integer');
-        $this->assertEquals(0, $numrows, 'Invalid number of rows in the FK table (CASCADE failed)');
-
-        //cleanup
-        $result = $this->db->manager->dropConstraint($this->table, $constraint_name);
-        $this->assertTrue(!PEAR::isError($result), 'Error dropping the constraint');
-    }
-
-    /**
-     *
-     */
-    function testDropPrimaryKey() {
-        if (!$this->methodExists($this->db->manager, 'dropConstraint')) {
-            return;
-        }
-        $index = array(
-            'fields' => array(
-                'id' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-            'primary' => true,
-        );
-        $name = 'pkindex';
-        $result = $this->db->manager->createConstraint($this->table, $name, $index);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error creating primary index');
-        } else {
-            $result = $this->db->manager->dropConstraint($this->table, $name, true);
-            $this->assertFalse(PEAR::isError($result), 'Error dropping primary key index');
-        }
-    }
-
-    /**
-     *
-     */
-    function testListDatabases() {
-        if (!$this->methodExists($this->db->manager, 'listDatabases')) {
-            return;
-        }
-        $result = $this->db->manager->listDatabases();
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error listing databases ('.$result->getMessage().')');
-        } else {
-            $this->assertTrue(in_array(strtolower($this->database), $result), 'Error listing databases');
-        }
-    }
-
-    /**
-     *
-     */
-    function testListConstraints() {
-        if (!$this->methodExists($this->db->manager, 'listTableConstraints')) {
-            return;
-        }
-        $index = array(
-            'fields' => array(
-                'id' => array(
-                    'sorting' => 'ascending',
-                ),
-            ),
-            'unique' => true,
-        );
-        $name = 'uniqueindex';
-        $result = $this->db->manager->createConstraint($this->table, $name, $index);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error creating unique constraint');
-        } else {
-            $constraints = $this->db->manager->listTableConstraints($this->table);
-            $this->assertFalse(PEAR::isError($constraints), 'Error listing constraints');
-            $this->assertTrue(in_array($name, $constraints), 'Error listing unique key index');
-        }
-    }
-
-    /**
-     *
-     */
-    function testListTables() {
-        if (!$this->methodExists($this->db->manager, 'listTables')) {
-            return;
-        }
-        $this->assertTrue($this->tableExists($this->table), 'Error listing tables');
-    }
-
-    /**
-     *
-     */
-    function testAlterTable() {
-        if (!$this->methodExists($this->db->manager, 'alterTable')) {
-            return;
-        }
-        $newer = 'newertable';
-        if ($this->tableExists($newer)) {
-            $this->db->manager->dropTable($newer);
-        }
-        $changes = array(
-            'add' => array(
-                'quota' => array(
-                    'type' => 'integer',
-                    'unsigned' => 1,
-                ),
-                'note' => array(
-                    'type' => 'text',
-                    'length' => '20',
-                ),
-            ),
-            'rename' => array(
-                'sex' => array(
-                    'name' => 'gender',
-                    'definition' => array(
-                        'type' => 'text',
-                        'length' => 1,
-                        'default' => 'M',
-                    ),
-                ),
-            ),
-            'change' => array(
-                'id' => array(
-                    'unsigned' => false,
-                    'definition' => array(
-                        'type'     => 'integer',
-                        'notnull'  => false,
-                        'default'  => 0,
-                    ),
-                ),
-                'somename' => array(
-                    'length' => '20',
-                    'definition' => array(
-                        'type' => 'text',
-                        'length' => 20,
-                    ),
-                )
-            ),
-            'remove' => array(
-                'somedescription' => array(),
-            ),
-            'name' => $newer,
-        );
-
-        $this->db->expectError(MDB2_ERROR_CANNOT_ALTER);
-        $result = $this->db->manager->alterTable($this->table, $changes, true);
-        $this->db->popExpect();
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Cannot alter table');
-        } else {
-            $result = $this->db->manager->alterTable($this->table, $changes, false);
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error altering table');
-            } else {
-                $this->db->manager->dropTable($newer);
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    function testAlterTable2() {
-        if (!$this->methodExists($this->db->manager, 'alterTable')) {
-            return;
-        }
-        $newer = 'newertable2';
-        if ($this->tableExists($newer)) {
-            $this->db->manager->dropTable($newer);
-        }
-        $changes_all = array(
-            'add' => array(
-                'quota' => array(
-                    'type' => 'integer',
-                    'unsigned' => 1,
-                ),
-            ),
-            'rename' => array(
-                'sex' => array(
-                    'name' => 'gender',
-                    'definition' => array(
-                        'type' => 'text',
-                        'length' => 1,
-                        'default' => 'M',
-                    ),
-                ),
-            ),
-            'change' => array(
-                'somename' => array(
-                    'length' => '20',
-                    'definition' => array(
-                        'type' => 'text',
-                        'length' => 20,
-                    ),
-                )
-            ),
-            'remove' => array(
-                'somedescription' => array(),
-            ),
-            'name' => $newer,
-        );
-
-        foreach ($changes_all as $type => $change) {
-            $changes = array($type => $change);
-            $this->db->expectError(MDB2_ERROR_CANNOT_ALTER);
-            $result = $this->db->manager->alterTable($this->table, $changes, true);
-            $this->db->popExpect();
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Cannot alter table: '.$type);
-                return;
-            }
-            $result = $this->db->manager->alterTable($this->table, $changes, false);
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error altering table: '.$type);
-            } else {
-                switch ($type) {
-                case 'add':
-                    $altered_table_fields = $this->db->manager->listTableFields($this->table);
-                    foreach ($change as $newfield => $dummy) {
-                        $this->assertTrue(in_array($newfield, $altered_table_fields), 'Error: new field "'.$newfield.'" not added');
-                    }
-                    break;
-                case 'rename':
-                    $altered_table_fields = $this->db->manager->listTableFields($this->table);
-                    foreach ($change as $oldfield => $newfield) {
-                        $this->assertFalse(in_array($oldfield, $altered_table_fields), 'Error: field "'.$oldfield.'" not renamed');
-                        $this->assertTrue(in_array($newfield['name'], $altered_table_fields), 'Error: field "'.$oldfield.'" not renamed correctly');
-                    }
-                    break;
-                case 'change':
-                    break;
-                case 'remove':
-                    $altered_table_fields = $this->db->manager->listTableFields($this->table);
-                    foreach ($change as $newfield => $dummy) {
-                        $this->assertFalse(in_array($newfield, $altered_table_fields), 'Error: field "'.$newfield.'" not removed');
-                    }
-                    break;
-                case 'name':
-                    if ($this->tableExists($newer)) {
-                        $this->db->manager->dropTable($newer);
-                    } else {
-                        $this->assertFalse(true, 'Error: table "'.$this->table.'" not renamed');
-                    }
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    function testTruncateTable() {
-        if (!$this->methodExists($this->db->manager, 'truncateTable')) {
-            return;
-        }
-
-        $query = 'INSERT INTO '.$this->table;
-        $query.= ' (id, somename, somedescription)';
-        $query.= ' VALUES (:id, :somename, :somedescription)';
-        $stmt =& $this->db->prepare($query, array('integer', 'text', 'text'), MDB2_PREPARE_MANIP);
-        if (PEAR::isError($stmt)) {
-            $this->assertFalse(true, 'Error preparing INSERT');
-            return;
-        }
-        $rows = 5;
-        for ($i=1; $i<=$rows; ++$i) {
-            $values = array(
-                'id' => $i,
-                'somename' => 'foo'.$i,
-                'somedescription' => 'bar'.$i,
-            );
-            $result = $stmt->execute($values);
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error executing insert number: '.$i);
-                return;
-            }
-        }
-        $stmt->free();
-        $count = $this->db->queryOne('SELECT COUNT(*) FROM '.$this->table, 'integer');
-        if (PEAR::isError($count)) {
-            $this->assertFalse(true, 'Error executing SELECT');
-            return;
-        }
-        $this->assertEquals($rows, $count, 'Error: invalid number of rows returned');
-
-        $result = $this->db->manager->truncateTable($this->table);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error truncating table');
-        }
-
-        $count = $this->db->queryOne('SELECT COUNT(*) FROM '.$this->table, 'integer');
-        if (PEAR::isError($count)) {
-            $this->assertFalse(true, 'Error executing SELECT');
-            return;
-        }
-        $this->assertEquals(0, $count, 'Error: invalid number of rows returned');
-    }
-
-    /**
-     *
-     */
-    function testDropTable() {
-        if (!$this->methodExists($this->db->manager, 'dropTable')) {
-            return;
-        }
-        $result = $this->db->manager->dropTable($this->table);
-        $this->assertFalse(PEAR::isError($result), 'Error dropping table');
-    }
-
-    /**
-     *
-     */
-    function testListTablesNoTable() {
-        if (!$this->methodExists($this->db->manager, 'listTables')) {
-            return;
-        }
-        $result = $this->db->manager->dropTable($this->table);
-        $this->assertFalse($this->tableExists($this->table), 'Error listing tables');
-    }
-
-    /**
-     *
-     */
-    function testSequences() {
-        if (!$this->methodExists($this->db->manager, 'createSequence')) {
-            return;
-        }
-        $seq_name = 'testsequence';
-        $result = $this->db->manager->createSequence($seq_name);
-        $this->assertFalse(PEAR::isError($result), 'Error creating a sequence');
-        $this->assertTrue(in_array($seq_name, $this->db->manager->listSequences()), 'Error listing sequences');
-        $result = $this->db->manager->dropSequence($seq_name);
-        $this->assertFalse(PEAR::isError($result), 'Error dropping a sequence');
-        $this->assertFalse(in_array($seq_name, $this->db->manager->listSequences()), 'Error listing sequences');
-    }
-
-    /**
-     * Test listTableTriggers($table)
-     */
-    function testListTableTriggers() {
-        //setup
-        $trigger_name = 'test_newtrigger';
-
-        include_once 'MDB2_nonstandard.php';
-        $nonstd =& MDB2_nonstandard::factory($this->db, $this);
-        if (PEAR::isError($nonstd)) {
-            $this->assertTrue(false, 'Cannot instanciate MDB2_nonstandard object: '.$nonstd->getMessage());
-            return;
-        }
-
-        $result = $nonstd->createTrigger($trigger_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Cannot create trigger: '.$result->getMessage());
-            return;
-        }
-
-        //test
-        $triggers = $this->db->manager->listTableTriggers($this->table);
-        if (PEAR::isError($triggers)) {
-            $this->assertTrue(false, 'Error listing the table triggers: '.$triggers->getMessage());
-        } else {
-            $this->assertTrue(in_array($trigger_name, $triggers), 'Error: trigger not found');
-            //check that only the triggers referencing the given table are returned
-            $triggers = $this->db->manager->listTableTriggers('fake_table');
-            $this->assertFalse(in_array($trigger_name, $triggers), 'Error: trigger found');
-        }
-
-
-        //cleanup
-        $result = $nonstd->dropTrigger($trigger_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error dropping the trigger: '.$result->getMessage());
-        }
-    }
-
-    /**
-     * Test listTableViews($table)
-     */
-    function testListTableViews() {
-        //setup
-        $view_name = 'test_newview';
-
-        include_once 'MDB2_nonstandard.php';
-        $nonstd =& MDB2_nonstandard::factory($this->db, $this);
-        if (PEAR::isError($nonstd)) {
-            $this->assertTrue(false, 'Cannot instanciate MDB2_nonstandard object: '.$nonstd->getMessage());
-            return;
-        }
-
-        $result = $nonstd->createView($view_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Cannot create view: '.$result->getMessage());
-            return;
-        }
-
-        //test
-        $views = $this->db->manager->listTableViews($this->table);
-        if (PEAR::isError($views)) {
-            $this->assertTrue(false, 'Error listing the table views: '.$views->getMessage());
-        } else {
-            $this->assertTrue(in_array($view_name, $views), 'Error: view not found');
-            //check that only the views referencing the given table are returned
-            $views = $this->db->manager->listTableViews('fake_table');
-            $this->assertFalse(in_array($view_name, $views), 'Error: view found');
-        }
-
-
-        //cleanup
-        $result = $nonstd->dropView($view_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error dropping the view: '.$result->getMessage());
-        }
-    }
-
-    /**
-     * Test listViews()
-     */
-    function testListViews() {
-        //setup
-        $view_name = 'test_brandnewview';
-
-        include_once 'MDB2_nonstandard.php';
-        $nonstd =& MDB2_nonstandard::factory($this->db, $this);
-        if (PEAR::isError($nonstd)) {
-            $this->assertTrue(false, 'Cannot instanciate MDB2_nonstandard object: '.$nonstd->getMessage());
-            return;
-        }
-
-        $result = $nonstd->createView($view_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Cannot create view: '.$result->getMessage());
-            return;
-        }
-
-        //test
-        $views = $this->db->manager->listViews();
-        if (PEAR::isError($views)) {
-            $this->assertTrue(false, 'Error listing the views: '.$views->getMessage());
-        } else {
-            $this->assertTrue(in_array($view_name, $views), 'Error: view not found');
-        }
-
-        //cleanup
-        $result = $nonstd->dropView($view_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error dropping the view: '.$result->getMessage());
-        }
-    }
-
-    /**
-     * Test listUsers()
-     */
-    function testListUsers() {
-        $users = $this->db->manager->listUsers();
-        if (PEAR::isError($users)) {
-            $this->assertTrue(false, 'Error listing the users: '.$users->getMessage());
-        } else {
-            $users = array_map('strtolower', $users);
-            $this->assertTrue(in_array(strtolower($this->db->dsn['username']), $users), 'Error: user not found');
-        }
-    }
-
-    /**
-     * Test listFunctions()
-     */
-    function testListFunctions() {
-        //setup
-        $function_name = 'test_add';
-
-        include_once 'MDB2_nonstandard.php';
-        $nonstd =& MDB2_nonstandard::factory($this->db, $this);
-        if (PEAR::isError($nonstd)) {
-            $this->assertTrue(false, 'Cannot instanciate MDB2_nonstandard object: '.$nonstd->getMessage());
-            return;
-        }
-
-        $result = $nonstd->createFunction($function_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Cannot create function: '.$result->getMessage().' :: '.$result->getUserInfo());
-            return;
-        }
-
-        //test
-        $functions = $this->db->manager->listFunctions();
-        if (PEAR::isError($functions)) {
-            $this->assertTrue(false, 'Error listing the functions: '.$functions->getMessage());
-        } else {
-            $this->assertTrue(in_array($function_name, $functions), 'Error: function not found');
-        }
-
-        //cleanup
-        $result = $nonstd->dropFunction($function_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error dropping the function: '.$result->getMessage());
-        }
-    }
-
-    /**
-     * Test vacuum
-     */
-    function testVacuum() {
-        //vacuum table
-        $result = $this->db->manager->vacuum($this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error: cannot vacuum table: ' . $result->getMessage());
-        }
-
-        //vacuum and analyze table
-        $options = array(
-            'analyze' => true,
-            'full'    => true,
-            'freeze'  => true,
-        );
-        $result = $this->db->manager->vacuum($this->table, $options);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error: cannot vacuum table: ' . $result->getMessage());
-        }
-
-        //vacuum all tables
-        $result = $this->db->manager->vacuum();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error: cannot vacuum table: ' . $result->getMessage());
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_native_testcase.php b/lib/tests/MDB2/tests/MDB2_native_testcase.php
deleted file mode 100644
index 1ce3d8180b484f48a7ac26036fe027da18abfbbd..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_native_testcase.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Lukas Smith, Lorenzo Alberton                |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l dot alberton at quipo dot it>            |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_native_testcase.php,v 1.12 2006/03/01 12:15:38 lsmith Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Native_TestCase extends MDB2_TestCase
-{
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard.php b/lib/tests/MDB2/tests/MDB2_nonstandard.php
deleted file mode 100644
index 3fa4d6f6a77bf8ad7c81145d5847bda067f78c8c..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard.php,v 1.5 2007/03/04 21:26:52 quipo Exp $
-
-class MDB2_nonstandard {
-    //contains the MDB2 object of the db once we have connected
-    var $db;
-    
-    //contains the PHPUnit_TestCase object
-    var $test;
-    
-    /**
-     * Returns a driver-specific object
-     */
-    function factory($db, $test) {
-        $classname = 'MDB2_nonstandard_'.$db->phptype;
-        include_once $classname.'.php';
-        if (class_exists($classname)) {
-            $obj =& new $classname();
-            $obj->db =& $db;
-            $obj->test =& $test;
-            return $obj;
-        }
-        return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
-            'not capable', __FUNCTION__);
-    }
-    
-    /**
-     * Create a TRIGGER
-     */
-    function createTrigger($trigger_name, $table_name) {
-        return $this->db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null,
-            'not capable', __FUNCTION__);
-    }
-
-    /**
-     * Check if getTriggerDefinition() returns the correct definition for the trigger
-     */
-    function checkTrigger($trigger_name, $table_name, $def) {
-        $this->test->assertEquals(strtoupper($trigger_name), strtoupper($def['trigger_name']), 'Error getting trigger definition (name)');
-        $this->test->assertEquals(strtoupper($table_name),  strtoupper($def['table_name']),   'Error getting trigger definition (table)');
-        $this->test->assertEquals('AFTER',  $def['trigger_type'], 'Error getting trigger definition (type)');
-        $this->test->assertEquals('UPDATE', $def['trigger_event'], 'Error getting trigger definition (event)');
-        $this->test->assertTrue(is_string($def['trigger_body']), 'Error getting trigger definition (body)');
-        $this->test->assertTrue($def['trigger_enabled'], 'Error getting trigger definition (enabled)');
-        //$this->test->assertTrue(empty($def['trigger_comment']),  'Error getting trigger definition (comment)');
-    }
-
-    /**
-     * Drop a TRIGGER
-     */
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null,
-            'not capable', __FUNCTION__);
-    }
-    
-    /**
-     * Create a VIEW
-     */
-    function createView($view_name, $table_name) {
-        $query = 'CREATE VIEW '. $this->db->quoteIdentifier($view_name, true)
-                .' (id) AS SELECT id FROM '
-                . $this->db->quoteIdentifier($table_name, true) .' WHERE id > 1';
-        return $this->db->exec($query);
-    }
-
-    /**
-     * Drop a VIEW
-     */
-    function dropView($view_name) {
-        return $this->db->exec('DROP VIEW '.$view_name);
-    }
-
-    /**
-     * Create a FUNCTION
-     */
-    function createFunction($name) {
-        return $this->db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null,
-            'not capable', __FUNCTION__);
-    }
-
-    /**
-     * Drop a FUNCTION
-     */
-    function dropFunction($name) {
-        return $this->db->exec('DROP FUNCTION '.$name);
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_ibase.php b/lib/tests/MDB2/tests/MDB2_nonstandard_ibase.php
deleted file mode 100644
index 3e4d126e91a78ef375299a184f1ae1ea67865bd4..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_ibase.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_ibase.php,v 1.5 2007/03/04 21:32:31 quipo Exp $
-
-class MDB2_nonstandard_ibase extends MDB2_nonstandard {
-
-    var $trigger_body = 'AS
-BEGIN
-  NEW.somedescription = OLD.somename;
-END';
-
-    function createTrigger($trigger_name, $table_name) {
-        $query = 'CREATE OR ALTER TRIGGER '. $trigger_name .' FOR '. $table_name .'
-                  AFTER UPDATE '. $this->trigger_body .';';
-        return $this->db->exec($query);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->exec('DROP TRIGGER '.$trigger_name);
-    }
-
-    function createFunction($name) {
-        $query = 'CREATE PROCEDURE '.$name.'(N1 DECIMAL(6,2), N2 DECIMAL(6,2))
-RETURNS (
-  res DECIMAL(6,2)
-)
-AS
-BEGIN
-  FOR
-    SELECT (:N1 + :N2) FROM RDB$DATABASE INTO :res
-  DO
-    BEGIN
-      SUSPEND;
-    END
-END';
-        return $this->db->exec($query);
-    }
-
-    function dropFunction($name) {
-        return $this->db->exec('DROP PROCEDURE '.$name);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_mssql.php b/lib/tests/MDB2/tests/MDB2_nonstandard_mssql.php
deleted file mode 100644
index 3e6096b47f28e491d9c3edc08faac8d65a98de71..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_mssql.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006 Lorenzo Alberton                                  |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_mssql.php,v 1.2 2007/03/04 21:27:44 quipo Exp $
-
-class MDB2_nonstandard_mssql extends MDB2_nonstandard {
-
-    var $trigger_body = '';
-
-    function createTrigger($trigger_name, $table_name) {
-        $this->trigger_body = 'CREATE TRIGGER '. $trigger_name .' ON '. $table_name .'
-FOR UPDATE AS
-DECLARE @oldName VARCHAR(100)
-DECLARE @newId INTEGER
-SELECT @oldName = (SELECT somename FROM Deleted)
-SELECT @newId = (SELECT id FROM Inserted)
-BEGIN
-  UPDATE '. $table_name .' SET somedescription = @oldName WHERE id = @newId;
-END;';
-
-        return $this->db->exec($this->trigger_body);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-        echo '<pre>';
-        var_dump($this->trigger_body);
-        var_dump($def['trigger_body']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->exec('DROP TRIGGER '.$trigger_name);
-    }
-    
-    function createFunction($name) {
-        $query = 'CREATE FUNCTION '.$name.'(@Number1 Decimal(6,2), @Number2 Decimal(6,2))
-RETURNS Decimal(6,2)
-BEGIN
-    DECLARE @Result Decimal(6,2)
-    SET @Result = @Number1 + @Number2
-    RETURN @Result
-END';
-        return $this->db->exec($query);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_mysql.php b/lib/tests/MDB2/tests/MDB2_nonstandard_mysql.php
deleted file mode 100644
index 77c9cd2e8ba115d85a04db19386fcf05bf979e5f..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_mysql.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_mysql.php,v 1.4 2007/03/04 22:51:06 quipo Exp $
-
-class MDB2_nonstandard_mysql extends MDB2_nonstandard {
-
-    var $trigger_body = '';
-
-    function createTrigger($trigger_name, $table_name) {
-        $this->trigger_body = 'BEGIN
-  UPDATE '. $table_name .' SET somedescription = OLD.somename WHERE id = NEW.id;
-END';
-        $query = 'CREATE TRIGGER '. $trigger_name .' AFTER UPDATE ON '. $table_name .'
-                  FOR EACH ROW '. $this->trigger_body .';';
-        return $this->db->exec($query);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->exec('DROP TRIGGER '.$trigger_name);
-    }
-
-    function createFunction($name) {
-        $query = 'CREATE FUNCTION '.$name.'(a INT, b INT) RETURNS INT
-RETURN a + b;';
-        return $this->db->exec($query);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_mysqli.php b/lib/tests/MDB2/tests/MDB2_nonstandard_mysqli.php
deleted file mode 100644
index 8779aa2860b170ee4837b94ed2825c523934ac4a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_mysqli.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006 Lorenzo Alberton                                  |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_mysqli.php,v 1.1 2006/12/09 14:31:54 quipo Exp $
-
-require_once 'MDB2_nonstandard_mysql.php';
-
-class MDB2_nonstandard_mysqli extends MDB2_nonstandard_mysql {
-
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_oci8.php b/lib/tests/MDB2/tests/MDB2_nonstandard_oci8.php
deleted file mode 100644
index 222a56674362b94af61fbe212f29c9bb6d1ab7cb..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_oci8.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_oci8.php,v 1.5 2007/03/04 22:28:23 quipo Exp $
-
-class MDB2_nonstandard_oci8 extends MDB2_nonstandard {
-
-    var $trigger_body = '';
-    var $when_clause = 'new.id > 0';
-
-    function createTrigger($trigger_name, $table_name) {
-        $this->trigger_body = 'BEGIN INSERT INTO '.$table_name
-            .' (id, somename, somedescription) VALUES'
-            .' (:new.id+1, :new.somename, :new.somedescription); END '. $trigger_name .';';
-        $query = 'CREATE OR REPLACE TRIGGER '. $trigger_name
-                .' AFTER UPDATE ON '. $table_name
-                .' FOR EACH ROW WHEN ('.$this->when_clause.') '
-                . $this->trigger_body;
-        return $this->db->exec($query);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-        $this->test->assertEquals($this->when_clause, $def['when_clause']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->exec('DROP TRIGGER '.$trigger_name);
-    }
-
-    function createFunction($name) {
-        $query = 'CREATE FUNCTION '.$name.'(a IN INT, b IN INT)
-RETURN INT AS
-BEGIN
-    RETURN a + b;
-END;';
-        return $this->db->exec($query);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_pgsql.php b/lib/tests/MDB2/tests/MDB2_nonstandard_pgsql.php
deleted file mode 100644
index b405ac0bd29b86a613e0869d721eb00ff0be9806..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_pgsql.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_pgsql.php,v 1.5 2007/03/04 21:36:08 quipo Exp $
-
-class MDB2_nonstandard_pgsql extends MDB2_nonstandard {
-
-    var $trigger_body = '';
-
-    function createTrigger($trigger_name, $table_name) {
-        $this->trigger_body = 'EXECUTE PROCEDURE '.$trigger_name.'_func();';
-        $table_name = $this->db->quoteIdentifier($table_name);
-        $sql = 'CREATE OR REPLACE FUNCTION '.$trigger_name.'_func() RETURNS trigger AS \'
-                DECLARE
-                    id_number INTEGER;
-                BEGIN
-                    SELECT INTO id_number id FROM '. $table_name .' WHERE id = NEW.id;
-                    RETURN NEW;
-                END;
-                \' LANGUAGE \'plpgsql\';';
-        $res = $this->db->exec($sql);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-    
-        $query = 'CREATE TRIGGER '. $trigger_name .' AFTER UPDATE ON '. $table_name .'
-                  FOR EACH ROW ' .$this->trigger_body;
-        return $this->db->exec($query);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->exec('DROP TRIGGER '.$trigger_name .' ON '. $table_name);
-    }
-
-    function createFunction($name) {
-        $query = "CREATE FUNCTION $name (Decimal(6,2), Decimal(6,2)) RETURNS Decimal(6,2)
-AS 'select $1 + $2;'
-LANGUAGE SQL
-IMMUTABLE
-RETURNS NULL ON NULL INPUT";
-        return $this->db->exec($query);
-    }
-
-    function dropFunction($name) {
-        return $this->db->exec('DROP FUNCTION '.$name.' (Decimal(6,2), Decimal(6,2))');
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_nonstandard_sqlite.php b/lib/tests/MDB2/tests/MDB2_nonstandard_sqlite.php
deleted file mode 100644
index 63b27d1b65b354a0bdef2b5dba27a6cdd3958fd9..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_nonstandard_sqlite.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006-2007 Lorenzo Alberton                             |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_sqlite.php,v 1.5 2007/03/05 21:35:54 quipo Exp $
-
-class MDB2_nonstandard_sqlite extends MDB2_nonstandard {
-
-    var $trigger_body = '';
-
-    function createTrigger($trigger_name, $table_name) {
-        $this->trigger_body = 'CREATE TRIGGER '. $trigger_name .' AFTER UPDATE ON '. $table_name .'
-BEGIN
-    UPDATE '. $table_name .' SET somedescription = new.somename WHERE id = old.id;
-END';
-        return $this->db->standaloneQuery($this->trigger_body);
-    }
-
-    function checkTrigger($trigger_name, $table_name, $def) {
-        parent::checkTrigger($trigger_name, $table_name, $def);
-        $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
-    }
-
-    function dropTrigger($trigger_name, $table_name) {
-        return $this->db->standaloneQuery('DROP TRIGGER '.$trigger_name);
-    }
-    
-    function createView($view_name, $table_name) {
-        $query = 'CREATE VIEW '. $this->db->quoteIdentifier($view_name, true)
-                .' AS SELECT id FROM '
-                . $this->db->quoteIdentifier($table_name, true) .' WHERE id > 1';
-        return $this->db->exec($query);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_reverse_testcase.php b/lib/tests/MDB2/tests/MDB2_reverse_testcase.php
deleted file mode 100644
index fb9cc3b0a01889bd265636c62f8124756891c0bb..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_reverse_testcase.php
+++ /dev/null
@@ -1,671 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Lukas Smith, Lorenzo Alberton                |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l dot alberton at quipo dot it>            |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_reverse_testcase.php,v 1.50 2008/02/17 15:44:05 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Reverse_TestCase extends MDB2_TestCase
-{
-    //test table name (it is dynamically created/dropped)
-    var $table       = 'testtable';
-    var $fields      = array();
-    var $indices     = array();
-    var $constraints = array();
-
-    var $table2      = 'testtable2';
-    var $fields2      = array();
-    var $indices2     = array();
-    var $constraints2 = array();
-
-    function setUp() {
-        parent::setUp();
-        $this->db->loadModule('Reverse', null, true);
-        $this->db->loadModule('Manager', null, true);
-
-        //Table structure
-        $this->fields = array(
-            'id' => array(  //PK
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-                'length'  => 4,
-            ),
-            'id2' => array( //UNIQUE_MULTIFIELD(1/2)
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-            'id3' => array( //UNIQUE_MULTIFIELD(2/2)
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-            'id4' => array( //UNIQUE
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-            'somename' => array( //NORMAL INDEX
-                'type'   => 'text',
-                'length' => 12,
-            ),
-            'somedescription' => array( //INDEX_MULTIFIELD(1/2)
-                'type'   => 'text',
-                'length' => 12,
-            ),
-            'sex' => array( //INDEX_MULTIFIELD(2/2)
-                'type' => 'text',
-                'length' => 1,
-                'default' => 'M',
-            ),
-        );
-
-        $options = array();
-        if ('mysql' == substr($this->db->phptype, 0, 5)) {
-            $options['type'] = 'innodb';
-        }
-
-        if (!$this->tableExists($this->table)) {
-            $this->db->manager->createTable($this->table, $this->fields, $options);
-        }
-
-        //Table2 structure
-        $this->fields2 = array(
-            'ext_id' => array(  //SINGLE_FK
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-            'ext_id2' => array( //MULTI_FK(1/2)
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-            'ext_id3' => array( //MULTI_FK(2/2)
-                'type'     => 'integer',
-                'unsigned' => 1,
-                'notnull'  => 1,
-                'default'  => 0,
-            ),
-        );
-
-        if (!$this->tableExists($this->table2)) {
-            $this->db->manager->createTable($this->table2, $this->fields2, $options);
-        }
-    }
-
-    function tearDown() {
-        if ($this->tableExists($this->table2)) {
-            $this->db->manager->dropTable($this->table2);
-        }
-        if ($this->tableExists($this->table)) {
-            $this->db->manager->dropTable($this->table);
-        }
-        $this->db->popExpect();
-        unset($this->dsn);
-        if (!PEAR::isError($this->db->manager)) {
-            $this->db->disconnect();
-        }
-        unset($this->db);
-    }
-
-    function setUpIndices()
-    {
-        //Indices definition
-        $this->indices = array(
-            'sometestindex' => array(
-                'fields' => array(
-                    'somename' => array(
-                        'sorting' => 'ascending',
-                    ),
-                ),
-                'unique' => false,
-            ),
-            'multipletestindex' => array(
-                'fields' => array(
-                    'somedescription' => array(
-                        'sorting' => 'ascending',
-                    ),
-                    'sex' => array(
-                        'sorting' => 'ascending',
-                    ),
-                ),
-            ),
-        );
-        foreach ($this->indices as $index_name => $index) {
-            $result = $this->db->manager->createIndex($this->table, $index_name, $index);
-            $this->assertFalse(PEAR::isError($result), 'Error creating index: '.$index_name);
-            if (PEAR::isError($result)) {
-                break;
-            }
-        }
-        return PEAR::isError($result);
-    }
-
-    function setUpConstraints()
-    {
-        //Constraints definition
-        $this->constraints = array(
-            'pkfield' => array(
-                'fields' => array(
-                    'id' => array(
-                        'sorting' => 'ascending',
-                    ),
-                ),
-                'primary' => true,
-            ),
-            'multipleunique' => array(
-                'fields' => array(
-                    'id2' => array(
-                        'sorting' => 'ascending',
-                    ),
-                    'id3' => array(
-                        'sorting' => 'ascending',
-                    ),
-                ),
-                'unique' => true,
-            ),
-            'singleunique' => array(
-                'fields' => array(
-                    'id4' => array(
-                        'sorting' => 'ascending',
-                    ),
-                ),
-                'unique' => true,
-            ),
-        );
-        $failed1 = false;
-        foreach ($this->constraints as $constraint_name => $constraint) {
-            //$this->db->manager->dropConstraint($this->table, $constraint_name);
-            $result = $this->db->manager->createConstraint($this->table, $constraint_name, $constraint);
-            $this->assertFalse(PEAR::isError($result), 'Error creating constraint: '.$constraint_name);
-            if (PEAR::isError($result)) {
-                $failed1 = true;
-                break;
-            }
-        }
-
-        $this->fk_constraint1_name = $this->table2.'_fk_'.$this->table.'_id';
-        //$this->fk_constraint2_name = $this->table2.'_fk_'.$this->table.'_id2_id3';
-        $this->fk_constraint2_name = $this->table2.'_fk_'.$this->table.'_2f';
-        $this->constraints2 = array(
-            $this->fk_constraint1_name => array(
-                'primary' => false,
-                'unique'  => false,
-                'foreign' => true,
-                'check'   => false,
-                'fields' => array(
-                    'ext_id' => array(
-                        'position' => 1,
-                        'sorting' => 'ascending',
-                    ),
-                ),
-                'references' => array(
-                    'table'  => $this->table,
-                    'fields' => array(
-                        'id' => array(
-                            'position' => 1,
-                        ),
-                    ),
-                ),
-                'onupdate' => 'CASCADE',
-                'ondelete' => 'CASCADE',
-                'match'    => 'FULL',
-                'deferrable'        => false,
-                'initiallydeferred' => false,
-            ),
-            $this->fk_constraint2_name => array(
-                'primary' => false,
-                'unique'  => false,
-                'foreign' => true,
-                'check'   => false,
-                'fields' => array(
-                    'ext_id2' => array(
-                        'position' => 1,
-                        'sorting'  => 'ascending',
-                    ),
-                    'ext_id3' => array(
-                        'position' => 2,
-                        'sorting'  => 'ascending',
-                    ),
-                ),
-                'references' => array(
-                    'table'  => $this->table,
-                    'fields' => array(
-                        'id2' => array(
-                            'position' => 1,
-                        ),
-                        'id3' => array(
-                            'position' => 2,
-                        ),
-                    ),
-                ),
-                'onupdate' => 'NO ACTION',
-                'ondelete' => 'NO ACTION',
-                'match'    => 'FULL',
-                'deferrable'        => false,
-                'initiallydeferred' => false,
-            ),
-        );
-        $failed2 = false;
-        foreach ($this->constraints2 as $constraint_name => $constraint) {
-            //$this->db->manager->dropConstraint($this->table, $constraint_name);
-            $result = $this->db->manager->createConstraint($this->table2, $constraint_name, $constraint);
-            $this->assertFalse(PEAR::isError($result), 'Error creating constraint: '.$constraint_name);
-            if (PEAR::isError($result)) {
-                $failed2 = true;
-                break;
-            }
-        }
-
-        return !($failed1 || $failed2);
-    }
-
-    /**
-     * Test tableInfo('table_name')
-     */
-    function testTableInfo()
-    {
-        if (!$this->methodExists($this->db->reverse, 'tableInfo')) {
-            return;
-        }
-
-        $table_info = $this->db->reverse->tableInfo($this->table);
-        if (PEAR::isError($table_info)) {
-            $this->assertTrue(false, 'Error in tableInfo(): '.$table_info->getMessage().' :: '.$table_info->getUserInfo());
-        } else {
-            $this->assertEquals(count($this->fields), count($table_info), 'The number of fields retrieved is different from the expected one');
-            foreach ($table_info as $field_info) {
-                $this->assertEquals($this->table, $field_info['table'], 'the table name is not correct');
-                if (!array_key_exists(strtolower($field_info['name']), $this->fields)) {
-                    $this->assertTrue(false, 'Field names do not match ('.$field_info['name'].' is unknown)');
-                }
-                //expand test, for instance adding a check on types...
-            }
-        }
-
-        if (!$this->supported('result_introspection')) {
-            return;
-        }
-
-        $result = $this->db->query('SELECT * FROM '.$this->table);
-        $table_info = $this->db->reverse->tableInfo($result);
-        if (PEAR::isError($table_info)) {
-            $this->assertTrue(false, 'Error in tableInfo(): '.$table_info->getMessage().' :: '.$table_info->getUserInfo());
-        } else {
-            $this->assertEquals(count($this->fields), count($table_info), 'The number of fields retrieved is different from the expected one');
-            foreach ($table_info as $field_info) {
-                //not all the drivers are capable of returning the table name,
-                //and may return an empty value
-                if (!empty($field_info['table'])) {
-                    $this->assertEquals($this->table, $field_info['table'], 'the table name is not correct');
-                }
-                if (!array_key_exists(strtolower($field_info['name']), $this->fields)) {
-                    $this->assertTrue(false, 'Field names do not match ('.$field_info['name'].' is unknown)');
-                }
-                //expand test, for instance adding a check on types...
-            }
-        }
-        $result->free();
-    }
-
-    /**
-     * Test getTableFieldDefinition($table, $field_name)
-     */
-    function testGetTableFieldDefinition()
-    {
-        if (!$this->methodExists($this->db->reverse, 'getTableFieldDefinition')) {
-            return;
-        }
-
-        //test integer not null
-        $field_info = $this->db->reverse->getTableFieldDefinition($this->table, 'id');
-        if (PEAR::isError($field_info)) {
-            $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage());
-        } else {
-            $field_info = array_shift($field_info);
-            $this->assertEquals('integer', $field_info['type'], 'The field type is different from the expected one');
-            $expected_length = ($this->db->phptype == 'oci8') ? 10 : 4;
-            $this->assertEquals($expected_length, $field_info['length'], 'The field length is different from the expected one');
-            $this->assertTrue($field_info['notnull'], 'The field can be null unlike it was expected');
-            $this->assertEquals('0', $field_info['default'], 'The field default value is different from the expected one');
-        }
-
-        //test blob
-        $field_info = $this->db->reverse->getTableFieldDefinition('files', 'picture');
-        if (PEAR::isError($field_info)) {
-            $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage().' :: '.$field_info->getUserInfo());
-        } else {
-            $field_info = array_shift($field_info);
-            $this->assertEquals($field_info['type'], 'blob', 'The field type is different from the expected one');
-            $this->assertFalse($field_info['notnull'], 'The field cannot be null unlike it was expected');
-        }
-
-        //test varchar(100) not null
-        $field_info = $this->db->reverse->getTableFieldDefinition('users', 'user_name');
-        if (PEAR::isError($field_info)) {
-            $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage());
-        } else {
-            $field_info = array_shift($field_info);
-            $this->assertEquals('text', $field_info['type'], 'The field type is different from the expected one');
-            $this->assertEquals(12, $field_info['length'], 'The field length is different from the expected one');
-            $this->assertFalse($field_info['notnull'], 'The field can be null unlike it was expected');
-            $this->assertNull($field_info['default'], 'The field default value is different from the expected one');
-            $this->assertFalse($field_info['fixed'], 'The field fixed value is different from the expected one');
-        }
-
-        //test decimal
-        $field_info = $this->db->reverse->getTableFieldDefinition('users', 'quota');
-        if (PEAR::isError($field_info)) {
-            $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage());
-        } else {
-            $field_info = array_shift($field_info);
-            $this->assertEquals('decimal', $field_info['type'], 'The field type is different from the expected one');
-            $expected_length = ($this->db->phptype == 'oci8') ? '22,2' : '18,2';
-            $this->assertEquals($expected_length, $field_info['length'], 'The field length is different from the expected one');
-        }
-
-        $field_info = $this->db->reverse->getTableFieldDefinition('users', 'user_name');
-        if (PEAR::isError($field_info)) {
-            $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage());
-        } else {
-            $field_info = array_shift($field_info);
-            $this->assertEquals('text', $field_info['type'], 'The field type is different from the expected one');
-            $this->assertEquals(12, $field_info['length'], 'The field length is different from the expected one');
-            $this->assertFalse($field_info['notnull'], 'The field can be null unlike it was expected');
-            $this->assertNull($field_info['default'], 'The field default value is different from the expected one');
-            $this->assertFalse($field_info['fixed'], 'The field fixed value is different from the expected one');
-        }
-    }
-
-    /**
-     * Test getTableIndexDefinition($table, $index_name)
-     */
-    function testGetTableIndexDefinition()
-    {
-        if (!$this->methodExists($this->db->reverse, 'getTableIndexDefinition')) {
-            return;
-        }
-
-        $this->setUpIndices();
-
-        //test index names
-        foreach ($this->indices as $index_name => $index) {
-            $index_info = $this->db->reverse->getTableIndexDefinition($this->table, $index_name);
-            if (PEAR::isError($index_info)) {
-                $this->assertFalse(true, 'Error getting table index definition');
-            } else {
-                $field_names = array_keys($index['fields']);
-                $this->assertEquals($field_names, array_keys($index_info['fields']), 'Error listing index fields');
-            }
-        }
-
-        //test INDEX
-        $index_name = 'sometestindex';
-        $index_info = $this->db->reverse->getTableIndexDefinition($this->table, $index_name);
-        if (PEAR::isError($index_info)) {
-            $this->assertTrue(false, 'Error in getTableIndexDefinition(): '.$index_info->getMessage());
-        } else {
-            $this->assertEquals(1, count($index_info['fields']), 'The INDEX is not on one field unlike it was expected');
-            $expected_fields = array_keys($this->indices[$index_name]['fields']);
-            $actual_fields = array_keys($index_info['fields']);
-            $this->assertEquals($expected_fields, $actual_fields, 'The INDEX field names don\'t match');
-            $this->assertEquals(1, $index_info['fields'][$expected_fields[0]]['position'], 'The field position in the INDEX is not correct');
-        }
-
-        //test INDEX on MULTIPLE FIELDS
-        $index_name = 'multipletestindex';
-        $index_info = $this->db->reverse->getTableIndexDefinition($this->table, $index_name);
-        if (PEAR::isError($index_info)) {
-            $this->assertTrue(false, 'Error in getTableIndexDefinition(): '.$index_info->getMessage());
-        } else {
-            $this->assertEquals(2, count($index_info['fields']), 'The INDEX is not on two fields unlike it was expected');
-            $expected_fields = array_keys($this->indices[$index_name]['fields']);
-            $actual_fields = array_keys($index_info['fields']);
-            $this->assertEquals($expected_fields, $actual_fields, 'The INDEX field names don\'t match');
-            $this->assertEquals(1, $index_info['fields'][$expected_fields[0]]['position'], 'The field position in the INDEX is not correct');
-            $this->assertEquals(2, $index_info['fields'][$expected_fields[1]]['position'], 'The field position in the INDEX is not correct');
-        }
-
-        if (!$this->setUpConstraints()) {
-            return;
-        }
-        //constraints should NOT be listed
-        foreach (array_keys($this->constraints) as $constraint_name) {
-            $this->db->expectError(MDB2_ERROR_NOT_FOUND);
-            $result = $this->db->reverse->getTableIndexDefinition($this->table, $constraint_name);
-            $this->assertTrue(PEAR::isError($result), 'Error listing index definition, this is a CONSTRAINT');
-        }
-
-        //test index created WITHOUT using MDB2 (i.e. without the "_idx" suffix)
-        //NB: MDB2 > v.2.3.0 provides a fallback mechanism
-    }
-
-    /**
-     * Test testGetTableConstraintDefinition($table, $constraint_name)
-     */
-    function testGetTableConstraintDefinition()
-    {
-        if (!$this->methodExists($this->db->reverse, 'getTableConstraintDefinition')) {
-            return;
-        }
-
-        if (!$this->setUpConstraints()) {
-            return;
-        }
-
-        //test constraint names
-        foreach ($this->constraints as $constraint_name => $constraint) {
-            $this->db->expectError(MDB2_ERROR_NOT_FOUND);
-            $result = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name);
-            $this->db->popExpect();
-            if (PEAR::isError($result) && isset($constraint['primary']) && $constraint['primary']) {
-                echo 'Error reading primary constraint, trying with name "primary" instead .. ';
-                $constraint_name = 'primary';
-                $result = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name);
-            }
-            if (PEAR::isError($result)) {
-                $this->assertFalse(true, 'Error getting table constraint definition ('.$constraint_name.')');
-            } else {
-                $constraint_names = array_keys($constraint['fields']);
-                $this->assertEquals($constraint_names, array_keys($result['fields']), 'Error listing constraint fields');
-            }
-        }
-
-        $this->setUpIndices();
-        //indices should NOT be listed
-        foreach (array_keys($this->indices) as $index_name) {
-            $this->db->expectError(MDB2_ERROR_NOT_FOUND);
-            $result = $this->db->reverse->getTableConstraintDefinition($this->table, $index_name);
-            $this->db->popExpect();
-            $this->assertTrue(PEAR::isError($result), 'Error listing constraint definition, this is a normal INDEX');
-        }
-
-        //test PK
-        $this->db->expectError(MDB2_ERROR_NOT_FOUND);
-        $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, 'pkfield');
-        $this->db->popExpect();
-        if (PEAR::isError($constraint_info)) {
-            echo 'Error reading primary constraint, trying with name "primary" instead .. ';
-            $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, 'primary');
-        }
-        if (PEAR::isError($constraint_info)) {
-            $this->assertTrue(false, 'Error in getTableConstraintDefinition(): '.$constraint_info->getMessage());
-        } else {
-            $this->assertTrue($constraint_info['primary'], 'The field is not a PK unlike it was expected');
-        }
-
-        //test UNIQUE
-        $constraint_name = 'singleunique';
-        $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name);
-        if (PEAR::isError($constraint_info)) {
-            $this->assertTrue(false, 'Error in getTableConstraintDefinition(): '.$constraint_info->getMessage());
-        } else {
-            $this->assertTrue($constraint_info['unique'], 'The field is not a PK unlike it was expected');
-            $this->assertTrue(empty($constraint_info['primary']), 'The field is a PK unlike it was expected');
-            $this->assertEquals(1, count($constraint_info['fields']), 'The UNIQUE INDEX is not on one field unlike it was expected');
-            $expected_fields = array_keys($this->constraints[$constraint_name]['fields']);
-            $actual_fields = array_keys($constraint_info['fields']);
-            $this->assertEquals($expected_fields, $actual_fields, 'The UNIQUE INDEX field names don\'t match');
-            $this->assertEquals(1, $constraint_info['fields'][$expected_fields[0]]['position'], 'The field position in the INDEX is not correct');
-        }
-
-        //test UNIQUE on MULTIPLE FIELDS
-        $constraint_name = 'multipleunique';
-        $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name);
-        if (PEAR::isError($constraint_info)) {
-            $this->assertTrue(false, 'Error in getTableConstraintDefinition(): '.$constraint_info->getMessage());
-        } else {
-            $this->assertTrue($constraint_info['unique'], 'The field is not a PK unlike it was expected');
-            $this->assertTrue(empty($constraint_info['primary']), 'The field is a PK unlike it was expected');
-            $this->assertEquals(2, count($constraint_info['fields']), 'The UNIQUE INDEX is not on two fields unlike it was expected');
-            $expected_fields = array_keys($this->constraints[$constraint_name]['fields']);
-            $actual_fields = array_keys($constraint_info['fields']);
-            $this->assertEquals($expected_fields, $actual_fields, 'The UNIQUE INDEX field names don\'t match');
-            $this->assertEquals(1, $constraint_info['fields'][$expected_fields[0]]['position'], 'The field position in the INDEX is not correct');
-            $this->assertEquals(2, $constraint_info['fields'][$expected_fields[1]]['position'], 'The field position in the INDEX is not correct');
-        }
-
-        //test FOREIGN KEYs
-        foreach (array_keys($this->constraints2) as $constraint_name) {
-            $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table2, $constraint_name);
-            if (PEAR::isError($constraint_info)) {
-                $this->assertTrue(false, 'Error in getTableConstraintDefinition():'. $constraint_info->getMessage());
-            } else {
-                $this->_compareFKdefinitions($this->constraints2[$constraint_name], $constraint_info);
-            }
-        }
-    }
-
-    /**
-     * Check the original FK constraint definition against the reverse engineered one.
-     *
-     * Ideally, the retrieved FK constraint definition should be equal to the
-     * one used to create the constraint, but not all the DBMS support all the
-     * parameters, so check the common base and do some generic checks for the
-     * other patameters.
-     */
-    function _compareFKdefinitions($expected, $actual) {
-        //ideal case: all the parameters are supported by all the DBMS:
-        //$this->assertEquals($expected, $actual);
-
-        $this->assertEquals($expected['primary'], $actual['primary']);
-        $this->assertEquals($expected['unique'],  $actual['unique']);
-        $this->assertEquals($expected['foreign'], $actual['foreign']);
-        $this->assertEquals($expected['check'],   $actual['check']);
-        $this->assertEquals(array_keys($expected['fields']), array_keys($actual['fields']));
-        $this->assertEquals($expected['references'],   $actual['references']);
-        $this->assertEquals($expected['deferrable'],   $actual['deferrable']);
-        $this->assertEquals($expected['initiallydeferred'],   $actual['initiallydeferred']);
-        $this->assertTrue(!empty($actual['match']));
-        $this->assertTrue(!empty($actual['onupdate']));
-        $this->assertTrue(!empty($actual['ondelete']));
-    }
-
-    /**
-     * Test getSequenceDefinition($sequence)
-     */
-    function testGetSequenceDefinition() {
-        //setup
-        $this->db->loadModule('Manager', null, true);
-        $sequence = 'test_sequence';
-        $sequences = $this->db->manager->listSequences();
-        if (!in_array($sequence, $sequences)) {
-            $result = $this->db->manager->createSequence($sequence);
-            $this->assertFalse(PEAR::isError($result), 'Error creating a sequence');
-        }
-
-        //test
-        $start = $this->db->nextId($sequence);
-        $def = $this->db->reverse->getSequenceDefinition($sequence);
-        $this->assertEquals($start+1, (isset($def['start']) ? $def['start'] : 1), 'Error getting sequence definition');
-
-        //cleanup
-        $result = $this->db->manager->dropSequence($sequence);
-        $this->assertFalse(PEAR::isError($result), 'Error dropping a sequence');
-    }
-
-    /**
-     * Test getTriggerDefinition($trigger)
-     */
-    function testGetTriggerDefinition() {
-        //setup
-        $trigger_name = 'test_trigger';
-
-        include_once 'MDB2_nonstandard.php';
-        $nonstd =& MDB2_nonstandard::factory($this->db, $this);
-        if (PEAR::isError($nonstd)) {
-            $this->assertTrue(false, 'Cannot create trigger: '.$nonstd->getMessage());
-            return;
-        }
-
-        $result = $nonstd->createTrigger($trigger_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Cannot create trigger: '.$result->getMessage());
-            return;
-        }
-
-        //test
-        $def = $this->db->reverse->getTriggerDefinition($trigger_name);
-        if (PEAR::isError($def)) {
-            $this->assertTrue(false, 'getTriggerDefinition: '.$def->getMessage());
-        } else {
-            $nonstd->checkTrigger($trigger_name, $this->table, $def);
-        }
-
-        //cleanup
-        $result = $nonstd->dropTrigger($trigger_name, $this->table);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error dropping the trigger: '.$result->getMessage());
-            return;
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_testcase.php b/lib/tests/MDB2/tests/MDB2_testcase.php
deleted file mode 100644
index 145bf9900f0d4bfc5cc108b3f10a2f51b5fab0ed..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_testcase.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_testcase.php,v 1.18 2006/12/19 15:04:53 quipo Exp $
-
-class MDB2_TestCase extends PHPUnit_TestCase {
-    //contains the dsn of the database we are testing
-    var $dsn;
-    //contains the options that should be used during testing
-    var $options;
-    //contains the name of the database we are testing
-    var $database;
-    //contains the MDB2 object of the db once we have connected
-    var $db;
-    // contains field names from the test table
-    var $fields;
-    // if the tables should be cleared in the setUp() and tearDown() methods
-    var $clear_tables = true;
-
-    function MDB2_TestCase($name) {
-        $this->PHPUnit_TestCase($name);
-    }
-
-    function setUp() {
-        $this->dsn = $GLOBALS['dsn'];
-        $this->options  = $GLOBALS['options'];
-        $this->database = $GLOBALS['database'];
-        $this->db =& MDB2::factory($this->dsn, $this->options);
-        $this->db->setDatabase($this->database);
-        $this->db->expectError(MDB2_ERROR_UNSUPPORTED);
-        $this->fields = array(
-            'user_name' => 'text',
-            'user_password' => 'text',
-            'subscribed' => 'boolean',
-            'user_id' => 'integer',
-            'quota' => 'decimal',
-            'weight' => 'float',
-            'access_date' => 'date',
-            'access_time' => 'time',
-            'approved' => 'timestamp',
-        );
-        $this->clearTables();
-    }
-
-    function tearDown() {
-        $this->clearTables();
-        $this->db->popExpect();
-        unset($this->dsn);
-        if (!PEAR::isError($this->db)) {
-            $this->db->disconnect();
-        }
-        unset($this->db);
-    }
-
-    function clearTables() {
-        if (!$this->clear_tables) {
-            return;
-        }
-        if (PEAR::isError($this->db->exec('DELETE FROM users'))) {
-            $this->assertTrue(false, 'Error deleting from table users');
-        }
-        if (PEAR::isError($this->db->exec('DELETE FROM files'))) {
-            $this->assertTrue(false, 'Error deleting from table users');
-        }
-    }
-
-    function supported($feature) {
-        if (!$this->db->supports($feature)) {
-            $this->assertTrue(false, 'This database does not support '.$feature);
-            return false;
-        }
-        return true;
-    }
-
-    function verifyFetchedValues(&$result, $rownum, $data) {
-        //$row = $result->fetchRow(MDB2_FETCHMODE_DEFAULT, $rownum);
-        $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC, $rownum);
-        if (!is_array($row)) {
-            $this->assertTrue(false, 'Error result row is not an array');
-            return;
-        }
-        //reset($row);
-        foreach ($this->fields as $field => $type) {
-            //$value = current($row);
-            $value = $row[$field];
-            if ($type == 'float') {
-                $delta = 0.0000000001;
-            } else {
-                $delta = 0;
-            }
-
-            $this->assertEquals($data[$field], $value, "the value retrieved for field \"$field\" doesn't match what was stored into the rownum $rownum", $delta);
-            //next($row);
-        }
-    }
-
-    function getSampleData($row = 1) {
-        $data = array();
-        $data['user_name']     = 'user_' . $row;
-        $data['user_password'] = 'somepass';
-        $data['subscribed']    = $row % 2 ? true : false;
-        $data['user_id']       = $row;
-        $data['quota']         = strval($row/100);
-        $data['weight']        = sqrt($row);
-        $data['access_date']   = MDB2_Date::mdbToday();
-        $data['access_time']   = MDB2_Date::mdbTime();
-        $data['approved']      = MDB2_Date::mdbNow();
-        return $data;
-    }
-
-    function methodExists(&$class, $name) {
-        if (is_object($class)
-            && in_array(strtolower($name), array_map('strtolower', get_class_methods($class)))
-        ) {
-            return true;
-        }
-        $this->assertTrue(false, 'method '. $name.' not implemented in '.get_class($class));
-        return false;
-    }
-
-    function tableExists($table) {
-        $this->db->loadModule('Manager', null, true);
-        $tables = $this->db->manager->listTables();
-        return in_array(strtolower($table), array_map('strtolower', $tables));
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/MDB2_usage_testcase.php b/lib/tests/MDB2/tests/MDB2_usage_testcase.php
deleted file mode 100644
index d45716ffd35c77cd2ea2fd4932a5153d37b90561..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/MDB2_usage_testcase.php
+++ /dev/null
@@ -1,1853 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_usage_testcase.php,v 1.108 2008/03/01 14:02:29 quipo Exp $
-
-require_once 'MDB2_testcase.php';
-
-class MDB2_Usage_TestCase extends MDB2_TestCase {
-    /**
-     * Test typed data storage and retrieval
-     *
-     * This tests typed data storage and retrieval by executing a single
-     * prepared query and then selecting the data back from the database
-     * and comparing the results
-     */
-    function testStorage() {
-        $data = $this->getSampleData(1234);
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query, $this->fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $this->verifyFetchedValues($result, 0, $data);
-    }
-
-    /**
-     * Test fetchOne()
-     *
-     * This test bulk fetching of result data by using a prepared query to
-     * insert an number of rows of data and then retrieving the data columns
-     * one by one
-     */
-    function testFetchOne() {
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-
-        $stmt->free();
-
-        foreach ($this->fields as $field => $type) {
-            for ($row = 0; $row < $total_rows; $row++) {
-                $result =& $this->db->query('SELECT '.$field.' FROM users WHERE user_id='.$row, $type);
-                $value = $result->fetchOne();
-                if (PEAR::isError($value)) {
-                    $this->assertTrue(false, 'Error fetching row '.$row.' for field '.$field.' of type '.$type);
-                } else {
-                    $this->assertEquals(strval($data[$row][$field]), strval(trim($value)), 'the query field '.$field.' of type '.$type.' for row '.$row);
-                    $result->free();
-                }
-            }
-        }
-    }
-
-    /**
-     * Test fetchCol()
-     *
-     * Test fetching a column of result data. Two different columns are retrieved
-     */
-    function testFetchCol() {
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-
-        $stmt->free();
-
-        $first_col = array();
-        for ($row = 0; $row < $total_rows; $row++) {
-            $first_col[$row] = "user_$row";
-        }
-
-        $second_col = array();
-        for ($row = 0; $row < $total_rows; $row++) {
-            $second_col[$row] = $row;
-        }
-
-        $query = 'SELECT user_name, user_id FROM users ORDER BY user_name';
-        $result =& $this->db->query($query, array('text', 'integer'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchCol(0);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching first column');
-        } else {
-            $this->assertEquals($first_col, $values);
-        }
-        $result->free();
-
-        $query = 'SELECT user_name, user_id FROM users ORDER BY user_name';
-        $result =& $this->db->query($query, array('text', 'integer'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchCol(1);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching second column');
-        } else {
-            $this->assertEquals($second_col, $values);
-        }
-        $result->free();
-    }
-
-    /**
-     * Test fetchAll()
-     *
-     * Test fetching an entire result set in one shot.
-     */
-    function testFetchAll() {
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $fields = array_keys($data[0]);
-        $query = 'SELECT '. implode (', ', $fields). ' FROM users ORDER BY user_name';
-
-        $stmt->free();
-
-        $result =& $this->db->query($query, $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: ' .$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            for ($i=0; $i<$total_rows; $i++) {
-                foreach ($data[$i] as $key => $val) {
-                    $this->assertEquals(strval($val), strval($values[$i][$key]), 'Row #'.$i.' ['.$key.']');
-                }
-            }
-        }
-        $result->free();
-        
-        //test $rekey=true
-        $result =& $this->db->query('SELECT user_id, user_name FROM users ORDER BY user_id', $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            for ($i=0; $i<$total_rows; $i++) {
-                list($id, $name) = each($values);
-                $this->assertEquals($data[$i]['user_id'],   $id,   'Row #'.$i.' ["user_id"]');
-                $this->assertEquals($data[$i]['user_name'], $name, 'Row #'.$i.' ["user_name"]');
-            }
-        }
-        $result->free();
-
-
-        //test $rekey=true, $force_array=true
-        $result =& $this->db->query('SELECT user_id, user_name FROM users ORDER BY user_id', $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC, true, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            for ($i=0; $i<$total_rows; $i++) {
-                list($id, $value) = each($values);
-                $this->assertEquals($data[$i]['user_id'],   $id,                 'Row #'.$i.' ["user_id"]');
-                $this->assertEquals($data[$i]['user_name'], $value['user_name'], 'Row #'.$i.' ["user_name"]');
-            }
-        }
-        $result->free();
-
-        //test $rekey=true, $force_array=true, $group=true
-        $result =& $this->db->query('SELECT user_password, user_name FROM users ORDER BY user_name', $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC, true, true, true);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            //all the records have the same user_password value
-            $this->assertEquals(1, count($values), 'Error: incorrect number of returned rows');
-            $values = $values[$data[0]['user_password']];
-            for ($i=0; $i<$total_rows; $i++) {
-                $this->assertEquals($data[$i]['user_name'], $values[$i]['user_name'], 'Row #'.$i.' ["user_name"]');
-            }
-        }
-        $result->free();
-
-        //test $rekey=true, $force_array=true, $group=false (with non unique key)
-        $result =& $this->db->query('SELECT user_password, user_name FROM users ORDER BY user_name', $this->fields);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error during query: '.$result->getMessage());
-        }
-        $values = $result->fetchAll(MDB2_FETCHMODE_ASSOC, true, true, false);
-        if (PEAR::isError($values)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            //all the records have the same user_password value, they are overwritten
-            $this->assertEquals(1, count($values), 'Error: incorrect number of returned rows');
-            $key = $data[0]['user_password'];
-            $this->assertEquals(1, count($values[$key]), 'Error: incorrect number of returned rows');
-            $this->assertEquals($data[4]['user_name'], $values[$key]['user_name']);
-        }
-        $result->free();
-    }
-
-    /**
-     * Test different fetch modes
-     *
-     * Test fetching results using different fetch modes
-     * NOTE: several tests still missing
-     */
-    function testFetchModes() {
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-
-        $stmt->free();
-
-        // test ASSOC
-        $query = 'SELECT A.user_name FROM users A, users B WHERE A.user_id = B.user_id';
-        $value = $this->db->queryRow($query, array($this->fields['user_name']), MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($value)) {
-            $this->assertTrue(false, 'Error fetching the result set');
-        } else {
-            $this->assertTrue(!empty($value['user_name']), 'Error fetching the associative result set from join');
-        }
-    }
-
-    /**
-     * Test multi_query option
-     *
-     * This test attempts to send multiple queries at once using the multi_query
-     * option and then retrieves each result.
-     */
-    function testMultiQuery() {
-        $multi_query_orig = $this->db->getOption('multi_query');
-        if (PEAR::isError($multi_query_orig)) {
-            $this->assertTrue(false, 'Error getting multi_query option value: '.$multi_query_orig->getMessage());
-            return;
-        }
-
-        $this->db->setOption('multi_query', true);
-
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-
-        $stmt->free();
-
-        $query = '';
-        for ($row = 0; $row < $total_rows; $row++) {
-            $query.= 'SELECT user_name FROM users WHERE user_id='.$row.';';
-        }
-        $result =& $this->db->query($query, 'text');
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $value = $result->fetchOne();
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error fetching row '.$row);
-            } else {
-                $this->assertEquals(strval($data[$row]['user_name']), strval(trim($value)), 'the query field username of type "text" for row '.$row);
-            }
-            if (PEAR::isError($result->nextResult())) {
-                $this->assertTrue(false, 'Error moving result pointer');
-            }
-        }
-
-        $result->free();
-        $this->db->setOption('multi_query', $multi_query_orig);
-    }
-
-    /**
-     * Test prepared queries
-     *
-     * Tests prepared queries, making sure they correctly deal with ?, !, and '
-     */
-    function testPreparedQueries() {
-        $data = array(
-            array(
-                'user_name' => 'Sure!',
-                'user_password' => 'Do work?',
-                'user_id' => 1,
-            ),
-            array(
-                'user_name' => 'For Sure!',
-                'user_password' => "Doesn't?",
-                'user_id' => 2,
-            ),
-        );
-
-        $query = "INSERT INTO users (user_name, user_password, user_id) VALUES (?, ?, ?)";
-        $stmt = $this->db->prepare($query, array('text', 'text', 'integer'), MDB2_PREPARE_MANIP);
-
-        $text = $data[0]['user_name'];
-        $question = $data[0]['user_password'];
-        $userid = $data[0]['user_id'];
-
-        // bind out of order
-        $stmt->bindParam(0, $text);
-        $stmt->bindParam(2, $userid);
-        $stmt->bindParam(1, $question);
-
-        $result = $stmt->execute();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(true, 'Could not execute prepared query with question mark placeholders. Error: '.$error);
-        }
-
-        $text = $data[1]['user_name'];
-        $question = $data[1]['user_password'];
-        $userid = $data[1]['user_id'];
-
-        $result = $stmt->execute();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(true, 'Could not execute prepared query with bound parameters. Error: '.$error);
-        }
-        $stmt->free();
-        $this->clearTables();
-
-        $query = "INSERT INTO users (user_name, user_password, user_id) VALUES (:text, :question, :userid)";
-        $stmt = $this->db->prepare($query, array('text', 'text', 'integer'), MDB2_PREPARE_MANIP);
-        if (PEAR::isError($stmt)) {
-            $this->assertTrue(false, 'Error preparing query: ' . $stmt->getMessage. ' :: '.$stmt->getUserInfo());
-        }
-
-        $stmt->bindValue('text', $data[0]['user_name']);
-        $stmt->bindValue('question', $data[0]['user_password']);
-        $stmt->bindValue('userid', $data[0]['user_id']);
-
-        $result = $stmt->execute();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(true, 'Could not execute prepared query with named placeholders. Error: '.$error);
-        }
-        $stmt->free();
-
-        $query = "INSERT INTO users (user_name, user_password, user_id) VALUES (".$this->db->quote($data[1]['user_name'], 'text').", :question, :userid)";
-        $stmt = $this->db->prepare($query, array('text', 'integer'), MDB2_PREPARE_MANIP);
-
-        $stmt->bindValue('question', $data[1]['user_password']);
-        $stmt->bindValue('userid', $data[1]['user_id']);
-
-        $result = $stmt->execute();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(true, 'Could not execute prepared query with named placeholders and a quoted text value in front. Error: '.$result->getMessage());
-        }
-        $stmt->free();
-
-        $query = 'SELECT user_name, user_password, user_id FROM users WHERE user_id=:user_id';
-        $stmt = $this->db->prepare($query, array('integer'), array('text', 'text', 'integer'));
-        foreach ($data as $row_data) {
-            $result =& $stmt->execute(array('user_id' => $row_data['user_id']));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared. Error: '.$result->getUserinfo());
-                break;
-            }
-            $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-            if (!is_array($row)) {
-                $this->assertTrue(false, 'Prepared SELECT failed');
-            } else {
-                $diff = (array)array_diff($row, $row_data);
-                $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff)));
-            }
-        }
-        $stmt->free();
-
-        $row_data = reset($data);
-        $query = 'SELECT user_name, user_password, user_id FROM users WHERE user_id='.$this->db->quote($row_data['user_id'], 'integer');
-        $stmt = $this->db->prepare($query, null, array('text', 'text', 'integer'));
-        $result =& $stmt->execute(array());
-        if (PEAR::isError($result)) {
-            $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared statement with no placeholders. Error: '.$result->getUserinfo());
-            break;
-        }
-        $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-        if (!is_array($row)) {
-            $this->assertTrue(false, 'Prepared SELECT failed');
-        } else {
-            $diff = (array)array_diff($row, $row_data);
-            $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff)));
-        }
-        $stmt->free();
-
-        $row_data = reset($data);
-        $query = 'SELECT user_name, user_password, user_id FROM users WHERE user_name='.$this->db->quote($row_data['user_name'], 'text').' AND user_id = ? AND user_password='.$this->db->quote($row_data['user_password'], 'text');
-        $stmt = $this->db->prepare($query, array('integer'), array('text', 'text', 'integer'));
-        $result =& $stmt->execute(array($row_data['user_id']));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared with quoted text fields around a placeholder. Error: '.$result->getUserinfo());
-            break;
-        }
-        $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-        if (!is_array($row)) {
-            $this->assertTrue(false, 'Prepared SELECT failed');
-        } else {
-            $diff = (array)array_diff($row, $row_data);
-            $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff)));
-        }
-        $stmt->free();
-
-        foreach ($this->db->sql_comments as $comment) {
-            $query = 'SELECT user_name, user_password, user_id FROM users WHERE '.$comment['start'].' maps to class::foo() '.$comment['end'].' user_name=:username';
-            $row_data = reset($data);
-            $stmt = $this->db->prepare($query, array('text'), array('text', 'text', 'integer'));
-            $result =& $stmt->execute(array('username' => $row_data['user_name']));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared where a name parameter is contained in an SQL comment ('.$comment['start'].'). Error: '.$result->getUserinfo());
-                break;
-            }
-            $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-            if (!is_array($row)) {
-                $this->assertTrue(false, 'Prepared SELECT failed');
-            } else {
-                $diff = (array)array_diff($row, $row_data);
-                $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff)));
-            }
-            $stmt->free();
-        }
-        
-        $row_data = reset($data);
-        $query = 'SELECT user_name, user_password, user_id FROM users WHERE user_name=:username OR user_password=:username';
-        $stmt = $this->db->prepare($query, array('text'), array('text', 'text', 'integer'));
-        $result =& $stmt->execute(array('username' => $row_data['user_name']));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared where the same named parameter is used twice. Error: '.$result->getUserinfo());
-            break;
-        }
-        $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-        if (!is_array($row)) {
-            $this->assertTrue(false, 'Prepared SELECT failed');
-        } else {
-            $diff = (array)array_diff($row, $row_data);
-            $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff)));
-        }
-        $stmt->free();
-    }
-
-    /**
-     * Test _skipDelimitedStrings(), used by prepare()
-     *
-     * If the placeholder is contained within a delimited string, it must be skipped,
-     * and the cursor position must be advanced
-     */
-    function testSkipDelimitedStrings() {
-        //test correct placeholder
-        $query = 'SELECT what FROM tbl WHERE x = ?';
-        $position = 0;
-        $p_position = strpos($query, '?');
-        $this->assertEquals($position, $this->db->_skipDelimitedStrings($query, $position, $p_position), 'Error: the cursor position has changed');
-
-        //test placeholder within a quoted string
-        $query = 'SELECT what FROM tbl WHERE x = '. $this->db->string_quoting['start'] .'blah?blah'. $this->db->string_quoting['end'] .' AND y = ?';
-        $position = 0;
-        $p_position = strpos($query, '?');
-        $new_pos = $this->db->_skipDelimitedStrings($query, $position, $p_position);
-        $this->assertTrue($position !=$new_pos, 'Error: the cursor position was not advanced');
-
-        //test placeholder within a comment
-        foreach ($this->db->sql_comments as $comment) {
-            $query = 'SELECT what FROM tbl WHERE x = '. $comment['start'] .'blah?blah'. $comment['end'] .' AND y = ?';
-            $position = 0;
-            $p_position = strpos($query, '?');
-            $new_pos = $this->db->_skipDelimitedStrings($query, $position, $p_position);
-            $this->assertTrue($position != $new_pos, 'Error: the cursor position was not advanced');
-        }
-
-        //add some tests for named placeholders and for identifier_quoting
-    }
-
-    /**
-     * Test retrieval of result metadata
-     *
-     * This tests the result metadata by executing a prepared query and
-     * select the data, and checking the result contains the correct
-     * number of columns and that the column names are in the correct order
-     */
-    function testMetadata() {
-        $data = $this->getSampleData(1234);
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query, $this->fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $numcols = $result->numCols();
-
-        $this->assertEquals(count($this->fields), $numcols, "The query result returned an incorrect number of columns unlike expected");
-
-        $column_names = $result->getColumnNames();
-        $fields = array_keys($this->fields);
-        for ($column = 0; $column < $numcols; $column++) {
-            $this->assertEquals($column, $column_names[$fields[$column]], "The query result column \"".$fields[$column]."\" was returned in an incorrect position");
-        }
-
-    }
-
-    /**
-     * Test storage and retrieval of nulls
-     *
-     * This tests null storage and retrieval by successively inserting,
-     * selecting, and testing a number of null / not null values
-     */
-    function testNulls() {
-        $portability = $this->db->getOption('portability');
-        if ($portability & MDB2_PORTABILITY_EMPTY_TO_NULL) {
-            $nullisempty = true;
-        } else {
-            $nullisempty = false;
-        }
-        $test_values = array(
-            array('test', false),
-            array('NULL', false),
-            array('null', false),
-            array('', $nullisempty),
-            array(null, true)
-        );
-
-        for ($test_value = 0; $test_value <= count($test_values); $test_value++) {
-            if ($test_value == count($test_values)) {
-                $value = 'NULL';
-                $is_null = true;
-            } else {
-                $value = $this->db->quote($test_values[$test_value][0], 'text');
-                $is_null = $test_values[$test_value][1];
-            }
-
-            $this->clearTables();
-
-            $result = $this->db->exec("INSERT INTO users (user_name,user_password,user_id) VALUES ($value,$value,0)");
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing insert query: '.$result->getMessage());
-            }
-
-            $result =& $this->db->query('SELECT user_name,user_password FROM users', array('text', 'text'));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing select query: '.$result->getMessage());
-            }
-
-            if ($is_null) {
-                $error_message = 'A query result column is not NULL unlike what was expected';
-            } else {
-                $error_message = 'A query result column is NULL even though it was expected to be different';
-            }
-
-            $row = $result->fetchRow();
-            $this->assertTrue((is_null($row[0]) == $is_null), $error_message);
-            $this->assertTrue((is_null($row[1]) == $is_null), $error_message);
-
-            $result->free();
-        }
-
-        $methods = array('fetchOne', 'fetchRow');
-
-        foreach ($methods as $method) {
-            $result =& $this->db->query('SELECT user_name FROM users WHERE user_id=123', array('text'));
-            $value = $result->$method();
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error fetching non existent row');
-            } else {
-                $this->assertNull($value, 'selecting non existent row with "'.$method.'()" did not return NULL');
-                $result->free();
-            }
-        }
-
-        $methods = array('fetchCol', 'fetchAll');
-
-        foreach ($methods as $method) {
-            $result =& $this->db->query('SELECT user_name FROM users WHERE user_id=123', array('text'));
-            $value = $result->$method();
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error fetching non existent row');
-            } else {
-                $this->assertTrue((is_array($value) && empty($value)), 'selecting non existent row with "'.$method.'()" did not return empty array');
-                $result->free();
-            }
-        }
-
-        $methods = array('queryOne', 'queryRow');
-
-        foreach ($methods as $method) {
-            $value = $this->db->$method('SELECT user_name FROM users WHERE user_id=123', array('text'));
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error fetching non existent row');
-            } else {
-                $this->assertNull($value, 'selecting non existent row with "'.$method.'()" did not return NULL');
-                $result->free();
-            }
-        }
-
-        $methods = array('queryCol', 'queryAll');
-
-        foreach ($methods as $method) {
-            $value = $this->db->$method('SELECT user_name FROM users WHERE user_id=123', array('text'));
-            if (PEAR::isError($value)) {
-                $this->assertTrue(false, 'Error fetching non existent row');
-            } else {
-                $this->assertTrue((is_array($value) && empty($value)), 'selecting non existent row with "'.$method.'()" did not return empty array');
-                $result->free();
-            }
-        }
-    }
-
-    /**
-     * Test paged queries
-     *
-     * Test the use of setLimit to return paged queries
-     */
-    function testRanges() {
-        if (!$this->supported('limit_queries')) {
-            return;
-        }
-
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-
-        $stmt->free();
-
-        for ($rows = 2, $start_row = 0; $start_row < $total_rows; $start_row += $rows) {
-
-            $this->db->setLimit($rows, $start_row);
-
-            $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users ORDER BY user_name';
-            $result =& $this->db->query($query, $this->fields);
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing select query: '.$result->getMessage());
-            }
-
-            for ($row = 0; $row < $rows && ($row + $start_row < $total_rows); $row++) {
-                $this->verifyFetchedValues($result, $row, $data[$row + $start_row]);
-            }
-        }
-
-        $this->assertFalse($result->valid(), "The query result did not seem to have reached the end of result as expected starting row $start_row after fetching upto row $row");
-
-        $result->free();
-
-        for ($rows = 2, $start_row = 0; $start_row < $total_rows; $start_row += $rows) {
-
-            $this->db->setLimit($rows, $start_row);
-
-            $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users ORDER BY user_name';
-            $result =& $this->db->query($query, $this->fields);
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing select query: '.$result->getMessage());
-            }
-
-            $result_rows = $result->numRows();
-
-            $expected = ($start_row == ($total_rows-1)) ? 1 : $rows;
-            $this->assertEquals($expected, $result_rows, 'invalid number of rows returned');
-            $this->assertTrue(($result_rows <= $rows), 'expected a result of no more than '.$rows.' but the returned number of rows is '.$result_rows);
-
-            for ($row = 0; $row < $result_rows; $row++) {
-                $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result at row '.$row.' that is before '.$result_rows.' as expected');
-                $this->verifyFetchedValues($result, $row, $data[$row + $start_row]);
-            }
-        }
-
-        $this->assertTrue(!$result->valid(), "The query result did not seem to have reached the end of result as expected starting row $start_row after fetching upto row $row");
-
-        $result->free();
-    }
-
-    /**
-     * Test the handling of sequences
-     */
-    function testSequences() {
-        if (!$this->supported('sequences')) {
-           return;
-        }
-
-        $this->db->loadModule('Manager', null, true);
-
-        for ($start_value = 1; $start_value < 4; $start_value++) {
-            $sequence_name = "test_sequence_$start_value";
-
-            $result = $this->db->manager->createSequence($sequence_name, $start_value);
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, "Error creating sequence $sequence_name with start value $start_value: ".$result->getMessage());
-            } else {
-                for ($sequence_value = $start_value; $sequence_value < ($start_value + 4); $sequence_value++) {
-                    $value = $this->db->nextID($sequence_name, false);
-
-                    $this->assertEquals($sequence_value, $value, "The returned sequence value for $sequence_name is not expected with sequence start value with $start_value");
-                }
-
-                $result = $this->db->manager->dropSequence($sequence_name);
-
-                if (PEAR::isError($result)) {
-                    $this->assertTrue(false, "Error dropping sequence $sequence_name : ".$result->getMessage());
-                }
-            }
-        }
-
-        // Test ondemand creation of sequences
-        $sequence_name = 'test_ondemand';
-        $this->db->expectError(MDB2_ERROR_NOSUCHTABLE);
-        $this->db->manager->dropSequence($sequence_name);
-        $this->db->popExpect();
-
-        for ($sequence_value = 1; $sequence_value < 4; $sequence_value++) {
-            $value = $this->db->nextID($sequence_name);
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, "Error creating with ondemand sequence: ".$result->getMessage());
-            } else {
-                $this->assertEquals($sequence_value, $value, "Error in ondemand sequences. The returned sequence value is not expected value");
-            }
-        }
-
-        $result = $this->db->manager->dropSequence($sequence_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, "Error dropping sequence $sequence_name : ".$result->getMessage());
-        }
-
-        // Test currId()
-        $sequence_name = 'test_currid';
-
-        $next = $this->db->nextID($sequence_name);
-        $curr = $this->db->currID($sequence_name);
-
-        if (PEAR::isError($curr)) {
-            $this->assertTrue(false, "Error getting the current value of sequence $sequence_name : ".$curr->getMessage());
-        } else {
-            if ($next != $curr) {
-                if ($next+1 == $curr) {
-                    $this->assertTrue(false, "Warning: currID() is using nextID() instead of a native implementation");
-                } else {
-                    $this->assertEquals($next, $curr, "return value if currID() does not match the previous call to nextID()");
-                }
-            }
-        }
-        $result = $this->db->manager->dropSequence($sequence_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, "Error dropping sequence $sequence_name : ".$result->getMessage());
-        }
-
-        // Test lastInsertid()
-        if (!$this->db->supports('new_link')) {
-           return;
-        }
-
-        $sequence_name = 'test_lastinsertid';
-
-        $dsn = MDB2::parseDSN($this->dsn);
-        $dsn['new_link'] = true;
-        $dsn['database'] = $this->database;
-        $db =& MDB2::connect($dsn, $this->options);
-
-        $next = $this->db->nextID($sequence_name);
-        $next2 = $db->nextID($sequence_name);
-        $last = $this->db->lastInsertID($sequence_name);
-
-        if (PEAR::isError($last)) {
-            $this->assertTrue(false, "Error getting the last value of sequence $sequence_name : ".$last->getMessage());
-        } else {
-            $this->assertEquals($next, $last, "return value if lastInsertID() does not match the previous call to nextID()");
-        }
-        $result = $this->db->manager->dropSequence($sequence_name);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, "Error dropping sequence $sequence_name : ".$result->getMessage());
-        }
-    }
-
-    /**
-     * Test replace query
-     *
-     * The replace method emulates the replace query of mysql
-     */
-    function testReplace() {
-        if (!$this->supported('replace')) {
-            return;
-        }
-
-        $row = 1234;
-        $data = $this->getSampleData($row);
-
-        $fields = array(
-            'user_name' => array(
-                'value' => "user_$row",
-                'type' => 'text'
-            ),
-            'user_password' => array(
-                'value' => $data['user_password'],
-                'type' => 'text'
-            ),
-            'subscribed' => array(
-                'value' => $data['subscribed'],
-                'type' => 'boolean'
-            ),
-            'user_id' => array(
-                'value' => $data['user_id'],
-                'type' => 'integer',
-                'key' => 1
-            ),
-            'quota' => array(
-                'value' => $data['quota'],
-                'type' => 'decimal'
-            ),
-            'weight' => array(
-                'value' => $data['weight'],
-                'type' => 'float'
-            ),
-            'access_date' => array(
-                'value' => $data['access_date'],
-                'type' => 'date'
-            ),
-            'access_time' => array(
-                'value' => $data['access_time'],
-                'type' => 'time'
-            ),
-            'approved' => array(
-                'value' => $data['approved'],
-                'type' => 'timestamp'
-            )
-        );
-
-        $result = $this->db->replace('users', $fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Replace failed');
-        }
-
-        if ($this->db->supports('affected_rows')) {
-            $affected_rows = $result;
-            $this->assertEquals(1, $result, "replacing a row in an empty table returned incorrect value");
-        } else {
-            $this->assertTrue(false, '"affected_rows" is not supported');
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query, $this->fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $this->verifyFetchedValues($result, 0, $data);
-
-        $row = 4321;
-        $fields['user_name']['value']     = $data['user_name']     = 'user_'.$row;
-        $fields['user_password']['value'] = $data['user_password'] = 'somepass';
-        $fields['subscribed']['value']    = $data['subscribed']    = $row % 2 ? true : false;
-        $fields['quota']['value']         = $data['quota']         = strval($row/100);
-        $fields['weight']['value']        = $data['weight']        = sqrt($row);
-        $fields['access_date']['value']   = $data['access_date']   = MDB2_Date::mdbToday();
-        $fields['access_time']['value']   = $data['access_time']   = MDB2_Date::mdbTime();
-        $fields['approved']['value']      = $data['approved']      = MDB2_Date::mdbNow();
-
-        $result = $this->db->replace('users', $fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Replace failed');
-        }
-        if ($this->db->supports('affected_rows')) {
-            $this->assertEquals(2, $result, "replacing a row returned incorrect result");
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query, $this->fields);
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $this->verifyFetchedValues($result, 0, $data);
-
-        $this->assertTrue(!$result->valid(), 'the query result did not seem to have reached the end of result as expected');
-
-        $result->free();
-    }
-
-    /**
-     * Test affected rows methods
-     */
-    function testAffectedRows() {
-        if (!$this->supported('affected_rows')) {
-            return;
-        }
-
-        $data = array();
-        $total_rows = 7;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-
-            $this->assertEquals(1, $result, "Inserting the row $row returned incorrect affected row count");
-        }
-
-        $stmt->free();
-
-        $query = 'UPDATE users SET user_password=? WHERE user_id < ?';
-        $stmt = $this->db->prepare($query, array('text', 'integer'), MDB2_PREPARE_MANIP);
-
-        for ($row = 0; $row < $total_rows; $row++) {
-            $password = "pass_$row";
-            if ($row == 0) {
-                $stmt->bindParam(0, $password);
-                $stmt->bindParam(1, $row);
-            }
-
-            $result = $stmt->execute();
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-
-            $this->assertEquals($row, $result, "Updating the $row rows returned incorrect affected row count");
-        }
-
-        $stmt->free();
-
-        $query = 'DELETE FROM users WHERE user_id >= ?';
-        $stmt = $this->db->prepare($query, array('integer'), MDB2_PREPARE_MANIP);
-
-        $row = intval($total_rows / 2);
-        $stmt->bindParam(0, $row);
-        for ($row = $total_rows; $total_rows; $total_rows = $row) {
-            $row = intval($total_rows / 2);
-
-            $result = $stmt->execute();
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-
-            $this->assertEquals(($total_rows - $row), $result, 'Deleting rows returned incorrect affected row count');
-
-        }
-
-        $stmt->free();
-    }
-
-    /**
-     * Testing transaction support - Test ROLLBACK
-     */
-    function testTransactionsRollback() {
-        if (!$this->supported('transactions')) {
-            return;
-        }
-
-        $data = $this->getSampleData(0);
-
-        $this->db->beginTransaction();
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data));
-        $this->db->rollback();
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $this->assertTrue(!$result->valid(), 'Transaction rollback did not revert the row that was inserted');
-        $result->free();
-    }
-
-    /**
-     * Testing transaction support - Test COMMIT
-     */
-    function testTransactionsCommit() {
-        if (!$this->supported('transactions')) {
-            return;
-        }
-
-        $data = $this->getSampleData(1);
-
-        $this->db->beginTransaction();
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data));
-        $this->db->commit();
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $this->assertTrue($result->valid(), 'Transaction commit did not make permanent the row that was inserted');
-        $result->free();
-    }
-
-    /**
-     * Testing transaction support - Test COMMIT and ROLLBACK
-     */
-    function testTransactionsBoth()
-    {
-        if (!$this->supported('transactions')) {
-            return;
-        }
-
-        $data = $this->getSampleData(0);
-
-        $this->db->beginTransaction();
-        $result = $this->db->exec('DELETE FROM users');
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error deleting from users'.$result->getMessage());
-            $this->db->rollback();
-        } else {
-            $this->db->commit();
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $this->assertTrue(!$result->valid(), 'Transaction end with implicit commit when re-enabling auto-commit did not make permanent the rows that were deleted');
-        $result->free();
-    }
-
-    /**
-     * Testing emulated nested transaction support
-     */
-    function testNestedTransactions() {
-        if (!$this->supported('transactions')) {
-            return;
-        }
-
-        $data = array(
-            1 => $this->getSampleData(1234),
-            2 => $this->getSampleData(4321),
-        );
-
-        $this->db->beginNestedTransaction();
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data[1]));
-
-        $this->db->beginNestedTransaction();
-
-        $result = $stmt->execute(array_values($data[2]));
-        $stmt->free();
-
-        $result = $this->db->completeNestedTransaction();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Inner transaction was not committed: '.$result->getMessage());
-        }
-
-        $result = $this->db->completeNestedTransaction();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Outer transaction was not committed: '.$result->getMessage());
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->query($query);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $this->assertTrue($result->valid(), 'Transaction commit did not make permanent the row that was inserted');
-        $result->free();
-    }
-
-    /**
-     * Testing savepoints
-     */
-    function testSavepoint() {
-        if (!$this->supported('savepoints')) {
-            return;
-        }
-
-        $savepoint = 'test_savepoint';
-
-        $data = array(
-            1 => $this->getSampleData(1234),
-            2 => $this->getSampleData(4321),
-        );
-
-        $this->db->beginTransaction();
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-
-        $result = $stmt->execute(array_values($data[1]));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        $result = $this->db->beginTransaction($savepoint);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error setting savepoint: '.$result->getMessage());
-        }
-
-        $result = $stmt->execute(array_values($data[2]));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $stmt->free();
-
-        $result = $this->db->rollback($savepoint);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error rolling back to savepoint: '.$result->getMessage());
-        }
-
-        $result = $this->db->commit();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Transaction not committed: '.$result->getMessage());
-        }
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result = $this->db->queryAll($query);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $rows_inserted = count($result);
-        $this->assertEquals(1, $rows_inserted, 'Error during transaction, invalid number of records inserted');
-
-        // test release savepoint
-        $this->db->beginTransaction();
-        $result = $this->db->beginTransaction($savepoint);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error setting savepoint: '.$result->getMessage());
-        }
-        $result = $this->db->commit($savepoint);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error setting savepoint: '.$result->getMessage());
-        }
-        $result = $this->db->commit();
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Transaction not committed: '.$result->getMessage());
-        }
-    }
-
-    /**
-     * Testing LOB storage
-     *
-     * N.B. for the mssql driver: if this test fails, use an higher limit in these
-     * two php.ini settings: "mssql.textlimit" and "mssql.textsize"
-     */
-    function testLOBStorage() {
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        $query = 'INSERT INTO files (ID, document, picture) VALUES (1, ?, ?)';
-        $stmt = $this->db->prepare($query, array('clob', 'blob'), MDB2_PREPARE_MANIP, array('document', 'picture'));
-        if (PEAR::isError($stmt)) {
-            $this->assertTrue(false, 'Failed prepared statement to insert LOB values: '.$stmt->getUserInfo());
-        }
-
-        $character_lob = '';
-        $binary_lob = '';
-
-        for ($i = 0; $i < 1000; $i++) {
-            for ($code = 32; $code <= 127; $code++) {
-                $character_lob.= chr($code);
-            }
-            for ($code = 0; $code <= 255; $code++) {
-                $binary_lob.= chr($code);
-            }
-        }
-
-        $stmt->bindValue(0, $character_lob);
-        $stmt->bindValue(1, $binary_lob);
-
-        $result = $stmt->execute();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getUserInfo());
-        }
-
-        $stmt->free();
-
-        $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from files'.$result->getMessage());
-        }
-
-        $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.');
-
-        $row = $result->fetchRow();
-        $clob = $row[0];
-        if (!PEAR::isError($clob) && is_resource($clob)) {
-            $value = '';
-            while (!feof($clob)) {
-                $data = fread($clob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read CLOB');
-                $value.= $data;
-            }
-            $this->db->datatype->destroyLOB($clob);
-            $this->assertEquals($character_lob, $value, 'Retrieved character LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving CLOB result');
-        }
-
-        $blob = $row[1];
-        if (!PEAR::isError($blob) && is_resource($blob)) {
-            $value = '';
-            while (!feof($blob)) {
-                $data = fread($blob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read BLOB');
-                $value.= $data;
-            }
-
-            $this->db->datatype->destroyLOB($blob);
-            $this->assertEquals($binary_lob, $value, 'Retrieved binary LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving BLOB result');
-        }
-        $result->free();
-    }
-
-    /**
-     * Test LOB reading of multiple records both buffered and unbuffered. See bug #8793 for why this must be tested.
-     */
-    function testLOBRead() {
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        for ($i = 20; $i < 30; ++$i) {
-            $query = 'INSERT INTO files (ID, document, picture) VALUES (?, ?, ?)';
-            $stmt = $this->db->prepare($query, array('integer', 'clob', 'blob'), MDB2_PREPARE_MANIP, array(1 => 'document', 2 => 'picture'));
-            $character_lob = $binary_lob = $i;
-            $stmt->bindValue(1, $character_lob);
-            $stmt->bindValue(2, $binary_lob);
-
-            $result = $stmt->execute(array($i));
-
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getUserInfo());
-            }
-            $stmt->free();
-        }
-
-        $oldBuffered = $this->db->getOption('result_buffering');
-        foreach (array(true, false) as $buffered) {
-            $this->db->setOption('result_buffering', $buffered);
-            $msgPost = ' with result_buffering = '.($buffered ? 'true' : 'false');
-            $result =& $this->db->query('SELECT id, document, picture FROM files WHERE id >= 20 AND id <= 30 ORDER BY id ASC', array('integer', 'clob', 'blob'));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error selecting from files'.$msgPost.$result->getMessage());
-            } else {
-                if ($buffered) {
-                    $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon'.$msgPost);
-                    $this->assertEquals('mdb2_bufferedresult_', strtolower(substr(get_class($result), 0, 20)), 'Error: not a buffered result');
-                } else {
-                    $this->assertEquals('mdb2_result_', strtolower(substr(get_class($result), 0, 12)), 'Error: an unbuffered result was expected');
-                }
-                for ($i = 1; $i <= ($buffered ? 2 : 1); ++$i) {
-                    $result->seek(0);
-                    while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) {
-                        foreach (array('document' => 'clob', 'picture' => 'blob') as $field => $type) {
-                            $lob = $row[$field];
-                            if (is_a($lob, 'oci-lob')) {
-                                $lob = $lob->load();
-                            } elseif (is_resource($lob)) {
-                                $lob = fread($lob, 1000);
-                            }
-                            $this->assertEquals($lob, $row['id'], 'LOB ('.$type.') field ('.$field.') not equal to expected value ('.$row['id'].')'.$msgPost.' on run-through '.$i);
-                        }
-                    }
-                }
-                $result->free();
-            }
-        }
-        $this->db->setOption('result_buffering', $oldBuffered);
-    }
-
-    /**
-     * Test for lob storage from and to files
-     */
-    function testLOBFiles() {
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        $query = 'INSERT INTO files (ID, document, picture) VALUES (1, :document, :picture)';
-        $stmt = $this->db->prepare($query, array('document' => 'clob', 'picture' => 'blob'), MDB2_PREPARE_MANIP);
-
-        $character_data_file = 'character_data';
-        $file = fopen($character_data_file, 'w');
-        $this->assertTrue(((bool)$file), 'Error creating clob file to read from');
-        $character_data = '';
-        for ($i = 0; $i < 1000; $i++) {
-            for ($code = 32; $code <= 127; $code++) {
-                $character_data.= chr($code);
-            }
-        }
-        $this->assertTrue((fwrite($file, $character_data, strlen($character_data)) == strlen($character_data)), 'Error creating clob file to read from');
-        fclose($file);
-
-        $binary_data_file = 'binary_data';
-        $file = fopen($binary_data_file, 'wb');
-        $this->assertTrue(((bool)$file), 'Error creating blob file to read from');
-        $binary_data = '';
-        for ($i = 0; $i < 1000; $i++) {
-            for ($code = 0; $code <= 255; $code++) {
-                $binary_data.= chr($code);
-            }
-        }
-        $this->assertTrue((fwrite($file, $binary_data, strlen($binary_data)) == strlen($binary_data)), 'Error creating blob file to read from');
-        fclose($file);
-
-        $character_data_file_tmp = 'file://'.$character_data_file;
-        $stmt->bindParam('document', $character_data_file_tmp);
-        $binary_data_file_tmp = 'file://'.$binary_data_file;
-        $stmt->bindParam('picture', $binary_data_file_tmp);
-
-        $result = $stmt->execute();
-        $this->assertTrue(!PEAR::isError($result), 'Error executing prepared query - inserting LOB from files');
-
-        $stmt->free();
-
-        $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from files'.$result->getMessage());
-        }
-
-        $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.');
-
-        $row = $result->fetchRow();
-        $clob = $row[0];
-        if (!PEAR::isError($clob) && is_resource($clob)) {
-            unlink($character_data_file);
-            $res = $this->db->datatype->writeLOBToFile($clob, $character_data_file);
-            $this->db->datatype->destroyLOB($clob);
-
-            if (PEAR::isError($res)) {
-                $this->assertTrue(false, 'Error writing character LOB in a file');
-            } else {
-                $file = fopen($character_data_file, 'r');
-                $this->assertTrue($file, "Error opening character data file: $character_data_file");
-                $value = '';
-                while (!feof($file)) {
-                    $value.= fread($file, 8192);
-                }
-                $this->assertEquals('string', gettype($value), "Could not read from character LOB file: $character_data_file");
-                fclose($file);
-
-                $this->assertEquals($character_data, $value, "retrieved character LOB value is different from what was stored");
-            }
-        } else {
-            $this->assertTrue(false, 'Error creating character LOB in a file');
-        }
-
-        $blob = $row[1];
-        if (!PEAR::isError($blob) && is_resource($blob)) {
-            unlink($binary_data_file);
-            $res = $this->db->datatype->writeLOBToFile($blob, $binary_data_file);
-            $this->db->datatype->destroyLOB($blob);
-
-            if (PEAR::isError($res)) {
-                $this->assertTrue(false, 'Error writing binary LOB in a file');
-            } else {
-                $file = fopen($binary_data_file, 'rb');
-                $this->assertTrue($file, "Error opening binary data file: $binary_data_file");
-                $value = '';
-                while (!feof($file)) {
-                    $value.= fread($file, 8192);
-                }
-                $this->assertEquals('string', gettype($value), "Could not read from binary LOB file: $binary_data_file");
-                fclose($file);
-
-                $this->assertEquals($binary_data, $value, "retrieved binary LOB value is different from what was stored");
-            }
-        } else {
-            $this->assertTrue(false, 'Error creating binary LOB in a file');
-        }
-
-        $result->free();
-    }
-
-    /**
-     * Test handling of lob nulls
-     */
-    function testLOBNulls() {
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        $query = 'INSERT INTO files (ID, document, picture) VALUES (1, :document, :picture)';
-        $stmt = $this->db->prepare($query, array('document' => 'clob', 'picture' => 'blob'), MDB2_PREPARE_MANIP);
-
-        $null = null;
-        $stmt->bindParam('document', $null);
-        $stmt->bindParam('picture', $null);
-
-        $result = $stmt->execute();
-        $this->assertTrue(!PEAR::isError($result), 'Error executing prepared query - inserting NULL lobs');
-
-        $stmt->free();
-
-        $result =& $this->db->query('SELECT document, picture FROM files', array('clob', 'blob'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from files'.$result->getMessage());
-        }
-
-        $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.');
-
-        $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
-        $this->assertTrue(is_null($row['document']), 'A query result large object column document is not NULL unlike what was expected');
-        $this->assertTrue(is_null($row['picture']), 'A query result large object column picture is not NULL unlike what was expected');
-
-        $result->free();
-    }
-
-    function testLOBUpdate() {
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        $query = 'INSERT INTO files (ID, document, picture) VALUES (1, ?, ?)';
-        $stmt = $this->db->prepare($query, array('clob', 'blob'), MDB2_PREPARE_MANIP, array('document', 'picture'));
-
-        $character_lob = '';
-        $binary_lob = '';
-
-        for ($i = 0; $i < 1000; $i++) {
-            for ($code = 32; $code <= 127; ++$code) {
-                $character_lob .= chr($code);
-            }
-            for ($code = 0; $code <= 255; ++$code) {
-                $binary_lob .= chr($code);
-            }
-        }
-
-        $stmt->bindValue(0, $character_lob);
-        $stmt->bindValue(1, $binary_lob);
-
-        $result = $stmt->execute();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getUserInfo());
-        }
-
-        $stmt->free();
-
-        $query = 'UPDATE files SET document = ?, picture = ? WHERE ID = 1';
-        $stmt = $this->db->prepare($query, array('clob', 'blob'), MDB2_PREPARE_MANIP, array('document', 'picture'));
-
-        $character_lob = '';
-        $binary_lob = '';
-
-        for ($i = 0; $i < 999; $i++) {
-            for ($code = 127; $code >= 32; --$code) {
-                $character_lob .= chr($code);
-            }
-            for ($code = 255; $code >= 0; --$code) {
-                $binary_lob .= chr($code);
-            }
-        }
-
-        $stmt->bindValue(0, $character_lob);
-        $stmt->bindValue(1, $binary_lob);
-
-        $result = $stmt->execute();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getUserInfo());
-        }
-
-        $stmt->free();
-
-        $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from files'.$result->getMessage());
-        }
-
-        $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.');
-
-        $row = $result->fetchRow();
-        $clob = $row[0];
-        if (!PEAR::isError($clob) && is_resource($clob)) {
-            $value = '';
-            while (!feof($clob)) {
-                $data = fread($clob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read CLOB');
-                $value.= $data;
-            }
-            $this->db->datatype->destroyLOB($clob);
-            $this->assertEquals($character_lob, $value, 'Retrieved character LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving CLOB result');
-        }
-
-        $blob = $row[1];
-        if (!PEAR::isError($blob) && is_resource($blob)) {
-            $value = '';
-            while (!feof($blob)) {
-                $data = fread($blob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read BLOB');
-                $value.= $data;
-            }
-
-            $this->db->datatype->destroyLOB($blob);
-            $this->assertEquals($binary_lob, $value, 'Retrieved binary LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving BLOB result');
-        }
-        $result->free();
-    }
-
-    /**
-     * Test retrieval of result metadata
-     *
-     * This tests the result metadata by executing a prepared query and
-     * select the data, and checking the result contains the correct
-     * number of columns and that the column names are in the correct order
-     */
-    function testConvertEmpty2Null() {
-#$this->db->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
-
-        $data = $this->getSampleData(1234);
-        $data['user_password'] = '';
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-
-        $row = $this->db->queryRow('SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users WHERE user_password IS NULL', $this->fields);
-
-        if (PEAR::isError($row)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-
-        $this->assertEquals(count($this->fields), count($row), "The query result returned a number of columns unlike ".count($this->fields) .' as expected');
-    }
-
-    function testPortabilityOptions() {
-        // MDB2_PORTABILITY_DELETE_COUNT
-        $data = array();
-        $total_rows = 5;
-
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        for ($row = 0; $row < $total_rows; $row++) {
-            $data[$row] = $this->getSampleData($row);
-            $result = $stmt->execute(array_values($data[$row]));
-            if (PEAR::isError($result)) {
-                $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-            }
-        }
-        $stmt->free();
-
-        $this->db->setOption('portability', MDB2_PORTABILITY_NONE | MDB2_PORTABILITY_DELETE_COUNT);
-        $affected_rows = $this->db->exec('DELETE FROM users');
-        if (PEAR::isError($affected_rows)) {
-            $this->assertTrue(false, 'Error executing query: '.$affected_rows->getMessage());
-        }
-        $this->assertEquals($total_rows, $affected_rows, 'MDB2_PORTABILITY_DELETE_COUNT not working');
-
-        // MDB2_PORTABILITY_FIX_CASE
-        $fields = array_keys($this->fields);
-        $this->db->setOption('portability', MDB2_PORTABILITY_NONE | MDB2_PORTABILITY_FIX_CASE);
-        $this->db->setOption('field_case', CASE_UPPER);
-
-        $data = $this->getSampleData(1234);
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $result = $stmt->execute(array_values($data));
-        $stmt->free();
-
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->queryRow($query, $this->fields, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $field = reset($fields);
-        foreach (array_keys($result) as $fieldname) {
-            $this->assertEquals(strtoupper($field), $fieldname, 'MDB2_PORTABILITY_FIX_CASE CASE_UPPER not working');
-            $field = next($fields);
-        }
-
-        $this->db->setOption('field_case', CASE_LOWER);
-        $query = 'SELECT ' . implode(', ', array_keys($this->fields)) . ' FROM users';
-        $result =& $this->db->queryRow($query, $this->fields, MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users'.$result->getMessage());
-        }
-        $field = reset($fields);
-        foreach (array_keys($result) as $fieldname) {
-            $this->assertEquals(strtolower($field), $fieldname, 'MDB2_PORTABILITY_FIX_CASE CASE_LOWER not working');
-            $field = next($fields);
-        }
-
-        // MDB2_PORTABILITY_RTRIM
-        $this->db->setOption('portability', MDB2_PORTABILITY_NONE | MDB2_PORTABILITY_RTRIM);
-        $value = 'rtrim   ';
-        $query = 'INSERT INTO users (user_id, user_password) VALUES (1, ' . $this->db->quote($value, 'text') .')';
-        $res = $this->db->exec($query);
-        if (PEAR::isError($res)) {
-            $this->assertTrue(false, 'Error executing query: '.$res->getMessage());
-        }
-        $query = 'SELECT user_password FROM users WHERE user_id = 1';
-        $result = $this->db->queryOne($query, array('text'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        }
-        $this->assertEquals(rtrim($value), $result, '"MDB2_PORTABILITY_RTRIM = on" not working');
-
-        $this->db->setOption('portability', MDB2_PORTABILITY_NONE | MDB2_PORTABILITY_RTRIM);
-        $value = ' ';
-        $query = 'INSERT INTO users (user_id, user_name) VALUES (2, ' . $this->db->quote($value, 'text') .')';
-        $res = $this->db->exec($query);
-        if (PEAR::isError($res)) {
-            $this->assertTrue(false, 'Error executing query: '.$res->getMessage());
-        }
-        $query = 'SELECT user_name FROM users WHERE user_id = 2';
-        $result = $this->db->queryOne($query, array('text'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from users: '.$result->getMessage());
-        }
-        $this->assertEquals(0, strlen($result), '"MDB2_PORTABILITY_RTRIM = on" not working');
-
-        if (!$this->supported('LOBs')) {
-            return;
-        }
-
-        $query = 'INSERT INTO files (ID, document, picture) VALUES (1, ?, ?)';
-        $stmt = $this->db->prepare($query, array('clob', 'blob'), MDB2_PREPARE_MANIP, array('document', 'picture'));
-
-        $character_lob = '';
-        $binary_lob = '';
-
-        for ($i = 0; $i < 999; $i++) {
-            for ($code = 127; $code >= 32; --$code) {
-                $character_lob .= chr($code);
-            }
-            for ($code = 255; $code >= 0; --$code) {
-                $binary_lob .= chr($code);
-            }
-        }
-
-        $stmt->bindValue(0, $character_lob);
-        $stmt->bindValue(1, $binary_lob);
-
-        $result = $stmt->execute();
-
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getUserInfo());
-        }
-
-        $stmt->free();
-
-        $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob'));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error selecting from files'.$result->getMessage());
-        }
-
-        $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.');
-
-        $row = $result->fetchRow();
-        $clob = $row[0];
-        if (!PEAR::isError($clob) && is_resource($clob)) {
-            $value = '';
-            while (!feof($clob)) {
-                $data = fread($clob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read CLOB');
-                $value.= $data;
-            }
-            $this->db->datatype->destroyLOB($clob);
-            $this->assertEquals($character_lob, $value, '"MDB2_PORTABILITY_RTRIM = on" Retrieved character LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving CLOB result');
-        }
-
-        $blob = $row[1];
-        if (!PEAR::isError($blob) && is_resource($blob)) {
-            $value = '';
-            while (!feof($blob)) {
-                $data = fread($blob, 8192);
-                $this->assertTrue(strlen($data) >= 0, 'Could not read BLOB');
-                $value.= $data;
-            }
-
-            $this->db->datatype->destroyLOB($blob);
-            $this->assertEquals($binary_lob, $value, '"MDB2_PORTABILITY_RTRIM = on" Retrieved binary LOB value is different from what was stored');
-        } else {
-            $this->assertTrue(false, 'Error retrieving BLOB result');
-        }
-        $result->free();
-    }
-
-    /**
-     * Test getAsKeyword()
-     */
-    function testgetAsKeyword()
-    {
-        $query = 'INSERT INTO users (' . implode(', ', array_keys($this->fields)) . ') VALUES ('.implode(', ', array_fill(0, count($this->fields), '?')).')';
-        $stmt = $this->db->prepare($query, array_values($this->fields), MDB2_PREPARE_MANIP);
-        $data = $this->getSampleData(1);
-        $result = $stmt->execute(array_values($data));
-        if (PEAR::isError($result)) {
-            $this->assertTrue(false, 'Error executing prepared query: '.$result->getMessage());
-        }
-        $stmt->free();
-
-        $query = 'SELECT user_id'.$this->db->getAsKeyword().'foo FROM users';
-        $result = $this->db->queryRow($query, array('integer'), MDB2_FETCHMODE_ASSOC);
-        if (PEAR::isError($result)) {
-            $this->assertFalse(true, 'Error getting alias column: '. $result->getMessage());
-        } else {
-            $this->assertTrue((array_key_exists('foo', $result)), 'Error: could not alias "user_id" with "foo" : '.var_export($result, true));
-        }
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/README b/lib/tests/MDB2/tests/README
deleted file mode 100644
index 8d2ee39b58288cba71376ef87ca71e73339e0bcc..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/README
+++ /dev/null
@@ -1,55 +0,0 @@
-This is a test framework for MDB2 built using PHPUnit.
-These tests directly access the MDB2 API - hopefully this framework
-should give better feedback as to where or what caused when error are encountered.
-
-Usage:
-In order for the tests to work they need to access a database called
-"driver_test". This database is created using the MDB2_Schema test or
-running the import.schema.php script (edit the db DSN information).
-If you have problems running these test or the driver you are using does not yet
-provide the necessary methods you may create the "driver_test" database manually:
-
-CREATE TABLE "files" (
-  "id" int(11) NOT NULL default '0',
-  "document" longtext,
-  "picture" longblob,
-  UNIQUE KEY "lob_id_index_idx" ("id")
-);
-
-CREATE TABLE "users" (
-  "user_name" varchar(12) default NULL,
-  "user_password" char(8) default NULL,
-  "subscribed" tinyint(1) default '1',
-  "user_id" int(11) NOT NULL default '0',
-  "quota" decimal(18,2) default '0.00',
-  "weight" double default '0',
-  "access_date" date default '1970-01-01',
-  "access_time" time default '00:00:00',
-  "approved" datetime default '1970-01-01 00:00:00',
-  UNIQUE KEY "users_id_index_idx" ("user_id")
-);
-
-To setup the tests
-
-* requires PHPUnit to be installed
-
-* requires MDB2 (with the given driver) to be installed
-  in a php include path.
-
-* copy the file test_setup.php.dist to test_setup.php
-
-* edit test_setup.php. The array $testarray specifies which testcases
-  to carry out. $dbarray is an array of databases to test.
-
-* point your browser at test.php or your CLI at clitest.php for the results,
-  and then fix the bugs!
-
-* by default test.php/clitest.php will use all tests in the testcases - if
-  you want to pick specific tests, use testchoose.php to pick just the
-  tests you want to run
-
-Writing tests:
-
-The tests are written using PHPUnit from pear so first make sure you
-have the latest stable release, and have read the docs,
-http://pear.php.net/manual/en/packages.phpunit.php
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/basic.phpt b/lib/tests/MDB2/tests/basic.phpt
deleted file mode 100644
index 1a21ef8c2522c5956e73dcd3bdd131912559d943..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/basic.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-MDB2: Basic connectivity
---FILE--
-<?php
-
-require_once 'MDB2_Connect_Test.php';
-require_once 'config.php';
-
-if (! ($dbc =& new MDB2_Connect_Test(true)))
-{
-	die("Unable to instantiate MDB2 object\n");
-}
-$e = $dbc->connect();
-
-if (PEAR::isError($e)) {
-    print $e->getMessage() . "\n";
-}
-
-die();
-
-
-?>
-echo 'Success!';
-
---EXPECT--
-Success!
diff --git a/lib/tests/MDB2/tests/clitest.php b/lib/tests/MDB2/tests/clitest.php
deleted file mode 100644
index 6335e62794befbcba2b97e85a1277f001c5d8404..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/clitest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: clitest.php,v 1.15 2006/10/20 16:36:32 lsmith Exp $
-
-/*
- This is a small test suite for MDB2 using PHPUnit
-
- This is the command line version and should be used like so;
-
- php -q clitest.php
-
- This will run through all tests in all testcases (as defined in
- test_setup.php). To run individual tests add their names to the command
- line and all testcases will be searched for matching test names, e.g.
-
- php -q clitest.php teststorage testreplace
-*/
-
-require_once 'test_setup.php';
-require_once 'PHPUnit.php';
-require_once 'testUtils.php';
-require_once 'MDB2.php';
-require_once 'Console_TestListener.php';
-
-MDB2::loadFile('Date');
-
-foreach ($testcases as $testcase) {
-    include_once $testcase.'.php';
-}
-
-$database = 'driver_test';
-
-$inputMethods = $argv;
-
-if ($argc > 1) {
-    array_shift($inputMethods);
-    $exclude = false;
-    if ($inputMethods[0] == '-exclude') {
-        array_shift($inputMethods);
-        $exclude = true;
-    }
-    foreach ($testcases as $testcase) {
-        $possibleMethods = getTests($testcase);
-        if ($exclude) {
-            $intersect = array_diff($possibleMethods, $inputMethods);
-        } else {
-            $intersect = array_intersect($possibleMethods, $inputMethods);
-        }
-        if (count($intersect) > 0) {
-            $testmethods[$testcase] = array_flip($intersect);
-        }
-    }
-}
-
-$database = 'driver_test';
-
-if (!isset($testmethods) || !is_array($testmethods)) {
-    foreach ($testcases as $testcase) {
-        $testmethods[$testcase] = array_flip(getTests($testcase));
-    }
-}
-
-foreach ($dbarray as $db) {
-    $dsn = $db['dsn'];
-    $options = !empty($db['options']) ? $db['options'] : array();
-    $GLOBALS['_show_silenced'] = !empty($options['debug']) ? $options['debug'] : false;
-
-    $display_dsn = $dsn['phptype'] . "://" . $dsn['username'] . ":XXX@" . $dsn['hostspec'] . "/" . $database;
-    echo "=== Start test of $display_dsn on ".PHP_VERSION." ===\n";
-
-    $suite = new PHPUnit_TestSuite();
-
-    foreach ($testcases as $testcase) {
-        if (is_array($testmethods[$testcase])) {
-            $methods = array_keys($testmethods[$testcase]);
-            foreach ($methods as $method) {
-                $suite->addTest(new $testcase($method));
-            }
-        }
-    }
-
-    $result = new PHPUnit_TestResult;
-    $result->addListener(new Console_TestListener);
-
-    $suite->run($result);
-    $count = $result->runCount();
-    $failed = $result->failureCount();
-
-    echo "=== Summary: $failed failed assertions in $count tests ===\n\n";
-    echo "=== End test of $display_dsn ===\n\n";
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/config.php b/lib/tests/MDB2/tests/config.php
deleted file mode 100644
index 3523058385eb2f01664bf728a4f834f4e8238958..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/config.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-// {{{ error reporting
-error_reporting(E_ERROR);
-// }}}
-// {{{ DSN Constants
-/**
- * Constants used in PackageName_MDB2
- */
-define ('DSN_PHPTYPE',  'mysql');
-define ('DSN_USERNAME', 'username');
-define ('DSN_PASSWORD', 'password');
-define ('DSN_HOSTNAME', 'hostname');
-define ('DSN_DATABASE', 'databasename');
-// }}}
-
-//uncomment the following to run tests in a checkout
-//set_include_path(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.get_include_path());
-
-?>
diff --git a/lib/tests/MDB2/tests/driver_test.schema.xml b/lib/tests/MDB2/tests/driver_test.schema.xml
deleted file mode 100644
index ef4a439d055b53c21b1d979a9929d778511cfdab..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/driver_test.schema.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!--
-     driver_test.schema
-
-     @(#) $Header: /repository/pear/MDB2/tests/driver_test.schema.xml,v 1.2 2008/03/02 16:11:27 quipo Exp $
-
--->
-
-<database>
-
- <name><variable>name</variable></name>
- <create><variable>create</variable></create>
- 
-
- <table>
-  <name>users</name>
-  <declaration>
-   <field> <name>user_name</name>     <type>text</type>      <length>12</length> <fixed>false</fixed>  </field>
-   <field> <name>user_password</name> <type>text</type>      <length>8</length>  <fixed>true</fixed>   </field>
-   <field> <name>subscribed</name>    <type>boolean</type>                                             </field>
-   <field> <name>user_id</name>       <type>integer</type>   <default>0</default> <notnull>1</notnull> <unsigned>1</unsigned> </field>
-   <field> <name>quota</name>         <type>decimal</type>                                             </field>
-   <field> <name>weight</name>        <type>float</type>                                               </field>
-   <field> <name>access_date</name>   <type>date</type>                                                </field>
-   <field> <name>access_time</name>   <type>time</type>                                                </field>
-   <field> <name>approved</name>      <type>timestamp</type>                                           </field>
-   <index>
-    <name>users_id_index</name>
-    <unique>1</unique>
-    <field> <name>user_id</name> </field>
-   </index>
-  </declaration>
- </table>
- 
- <table>
-  <name>files</name>
-  <declaration>
-   <field> <name>id</name>       <type>integer</type> <default>0</default> <notnull>1</notnull> </field>
-   <field> <name>document</name> <type>clob</type>                                              </field>
-   <field> <name>picture</name>  <type>blob</type>                                              </field>
-   <index>
-    <name>lob_id_index</name>
-    <unique>1</unique>
-    <field> <name>id</name> </field>
-   </index>
-  </declaration>
- </table>
-
-</database>
diff --git a/lib/tests/MDB2/tests/import.schema.php b/lib/tests/MDB2/tests/import.schema.php
deleted file mode 100644
index bb9f3c1113a4a4f1d0ce7c8ccb902f1b14f08ab4..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/import.schema.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-require_once 'MDB2/Schema.php';
-
-$dsn = array(
-    'phptype'  => 'mysql',
-    'username' => 'username',
-    'password' => 'password',
-    'hostspec' => 'host',
-);
-$db_options = array();
-
-
-$file = dirname(__FILE__).DIRECTORY_SEPARATOR.'driver_test.schema.xml';
-$variables = array(
-    'name'   => 'driver_test',
-    'create' => true,
-);
-
-$options = array(
-    'log_line_break'   => '<br />',
-    'idxname_format'   => '%s',
-    'debug'            => true,
-    'quote_identifier' => true,
-    'force_defaults'   => false,
-    'portability'      => false
-);
-$options = array_merge($options, $db_options);
-
-$schema =& MDB2_Schema::factory($dsn, $options);
-if (PEAR::isError($schema)) {
-    echo $schema->getMessage() . ' ' . $schema->getUserInfo();
-    exit;
-}
-
-$definition = $schema->parseDatabaseDefinitionFile($file, $variables, true, true);
-if (PEAR::isError($definition)) {
-    echo $definition->getMessage() . ' - ' . $definition->getUserInfo();
-} else {
-    $operation = $schema->createDatabase($definition);
-    if (PEAR::isError($operation)) {
-        echo $operation->getMessage() . ' ' . $operation->getUserInfo();
-    }
-}
-?>
-DONE!
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/test.php b/lib/tests/MDB2/tests/test.php
deleted file mode 100644
index c615b912a45899b4ac4ab88596589a2469acd10b..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/test.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Paul Cooper                    |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com>                                 |
-// +----------------------------------------------------------------------+
-//
-// $Id: test.php,v 1.18 2006/10/20 16:36:32 lsmith Exp $
-
-/*
- This is a small test suite for MDB2 using PHPUnit
- */
-
-require_once 'test_setup.php';
-require_once 'PHPUnit.php';
-require_once 'testUtils.php';
-require_once 'MDB2.php';
-require_once 'HTML_TestListener.php';
-
-function htmlErrorHandler($errno, $errstr, $errfile, $errline)
-{
-    if ((!$GLOBALS['_show_silenced'] && !error_reporting()) || $errno == 2048) {
-        return;
-    }
-    echo '<pre>';
-    errorHandler($errno, $errstr, $errfile, $errline);
-    echo '</pre>';
-}
-set_error_handler('htmlErrorHandler');
-
-function htmlErrorHandlerPEAR($error_obj)
-{
-    echo '<pre>';
-    errorHandlerPEAR($error_obj);
-    echo '</pre>';
-}
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'htmlErrorHandlerPEAR');
-
-MDB2::loadFile('Date');
-
-foreach ($testcases as $testcase) {
-    include_once $testcase.'.php';
-}
-
-$database = 'driver_test';
-
-$testmethods = !empty($_POST['testmethods']) ? $_POST['testmethods'] : null;
-
-if (!is_array($testmethods)) {
-    foreach ($testcases as $testcase) {
-        $testmethods[$testcase] = array_flip(getTests($testcase));
-    }
-}
-
-?>
-<html>
-<head>
-<title>MDB2 Tests</title>
-<link href="tests.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-<?php
-
-foreach ($dbarray as $db) {
-    $dsn = $db['dsn'];
-    $options = !empty($db['options']) ? $db['options'] : array();
-    $GLOBALS['_show_silenced'] = !empty($options['debug']) ? $options['debug'] : false;
-
-    $display_dsn = $dsn['phptype'] . "://" . $dsn['username'] . ":XXX@" . $dsn['hostspec'] . "/" . $database;
-    echo "<div class=\"test\">\n";
-    echo "<div class=\"title\">Testing $display_dsn on ".PHP_VERSION."</div>\n";
-
-    $suite = new PHPUnit_TestSuite();
-
-    foreach ($testcases as $testcase) {
-        if (isset($testmethods[$testcase]) && is_array($testmethods[$testcase])) {
-            $methods = array_keys($testmethods[$testcase]);
-            foreach ($methods as $method) {
-                $suite->addTest(new $testcase($method));
-            }
-        }
-    }
-
-    $result = new PHPUnit_TestResult;
-    $result->addListener(new HTML_TestListener);
-    $suite->run($result);
-    $count = $result->runCount();
-    $failed = $result->failureCount();
-
-    echo "<div class=\"title\">Summary: $failed failed assertions in $count tests</div>\n";
-    echo "\n</div>\n";
-}
-?>
-</body>
-</html>
diff --git a/lib/tests/MDB2/tests/testUtils.php b/lib/tests/MDB2/tests/testUtils.php
deleted file mode 100644
index 0c1a251b1690c3a3f06bd07bebdfa3b098e7195a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/testUtils.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/* Some utility functions for the test scripts */
-
-/**
- * this is used (with array filter) to filter out the test*
- * methods from a PHPUnit testcase
- */
-function grepForTest($var)
-{
-    return preg_match('/\btest.*/', $var);
-}
-
-/**
- * given a class name it returns an array of test* methods
- *
- * @param $class text classname
- * @return array of methods beginning with test
- */
-function getTests($class)
-{
-    $methods = array_map('strtolower', get_class_methods($class));
-    return array_filter($methods, 'grepForTest');
-}
-
-/**
- * Little helper function that outputs check for boxes with suitable names
- */
-function testCheck($testcase, $testmethod)
-{
-    return "<input type=\"checkbox\" name=\"testmethods[$testcase][$testmethod]\" value=\"1\">$testmethod <br>\n";
-}
-
-/**
- * Little helper function that gets a backtrace if available
- */
-function getBacktrace($errline = 0)
-{
-    $message = '';
-    if (!function_exists('debug_backtrace')) {
-        $message.= 'function debug_backtrace does not exists'."\n";
-    }
-
-    $debug_backtrace = debug_backtrace();
-    array_shift($debug_backtrace);
-    $message.= 'Debug backtrace:'."\n";
-
-    foreach ($debug_backtrace as $trace_item) {
-        $message.= "\t" . '    @ ';
-        if (!empty($trace_item['file'])) {
-            $message.= basename($trace_item['file']) . ':' . $trace_item['line'];
-        } else {
-            $message.= '- PHP inner-code - ';
-        }
-        $message.= ' -- ';
-        if (!empty($trace_item['class'])) {
-            $message.= $trace_item['class'] . $trace_item['type'];
-        }
-        $message.= $trace_item['function'];
-
-        if (!empty($trace_item['args']) && is_array($trace_item['args'])) {
-            $args = array();
-            foreach ($trace_item['args'] as $arg) {
-              $args[] = is_scalar($arg) ? $arg : (is_object($arg) ? get_class($arg) : gettype($arg));
-            }
-            $message.= '('.implode(', ', $args).')';
-        } else {
-            $message.= '()';
-        }
-        $message.= "\n";
-    }
-
-    return $message;
-}
-
-require_once 'PEAR.php';
-function errorHandlerPEAR($error_obj)
-{
-    $message = "-- PEAR-Error --\n";
-    $message.= $error_obj->getMessage().': '.$error_obj->getUserinfo()."\n";
-    $message.= getBacktrace();
-
-    print_r($message);
-}
-
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errorHandlerPEAR');
-
-$GLOBALS['_show_silenced'] = false;
-function errorHandler($errno, $errstr, $errfile, $errline)
-{
-    if ((!$GLOBALS['_show_silenced'] && !error_reporting()) || $errno == 2048) {
-        return;
-    }
-    $message = "\n";
-    switch ($errno) {
-    case E_USER_ERROR:
-        $message.= "FATAL [$errno] $errstr\n";
-        $message.= "  Fatal error in line $errline of file $errfile";
-        $message.= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
-        $message.= "Aborting...\n";
-        die($message);
-        break;
-    case E_USER_WARNING:
-        $message.= "ERROR [$errno] $errstr in line $errline of file $errfile\n";
-        break;
-    case E_USER_NOTICE:
-        $message.= "WARNING [$errno] $errstr in line $errline of file $errfile\n";
-        break;
-    default:
-        $message.= "Unkown error type: [$errno] $errstr in line $errline of file $errfile\n";
-        break;
-    }
-
-    $message.= getBacktrace($errline);
-
-    print_r($message);
-}
-
-set_error_handler('errorHandler');
-if (function_exists('xdebug_disable')) {
-    xdebug_disable();
-}
-?>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/test_setup.php.dist b/lib/tests/MDB2/tests/test_setup.php.dist
deleted file mode 100644
index 35980bd2eb964eceaceede52a336b3d6bb3d5c69..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/test_setup.php.dist
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-// uncomment this line if you want to run both MDB2 from a CVS checkout
-#ini_set('include_path', '..'.PATH_SEPARATOR.ini_get('include_path'));
-
-$testcases = array(
-    'MDB2_api_testcase',
-    'MDB2_usage_testcase',
-    'MDB2_bugs_testcase',
-    'MDB2_extended_testcase',
-    'MDB2_datatype_testcase',
-    'MDB2_manager_testcase',
-    'MDB2_reverse_testcase',
-    'MDB2_function_testcase',
-    'MDB2_native_testcase',
-    'MDB2_internals_testcase',
-);
-
-// use a user that has full permissions on a database named "driver_test"
-$mysql = array(
-    'dsn' => array(
-        'phptype' => 'mysql',
-        'username' => 'username',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    ),
-    'options' => array(
-        'use_transactions' => true
-    )
-);
-
-$pgsql = array(
-    'dsn' => array(
-        'phptype' => 'pgsql',
-        'username' => 'username',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    )
-);
-
-$oci8 = array(
-    'dsn' => array(
-        'phptype' => 'oci8',
-        'username' => '',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    ),
-    'options' => array(
-        'DBA_username' => 'username',
-        'DBA_password' => 'password'
-    )
-);
-
-$sqlite = array(
-    'dsn' => array(
-        'phptype' => 'sqlite',
-        'username' => '',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    ),
-    'options' => array(
-        'database_path' => '',
-        'database_extension' => '',
-    )
-);
-
-// must be a user with system administrator privileges
-$mssql = array(
-    'dsn' => array(
-        'phptype' => 'mssql',
-        'username' => 'username',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    )
-);
-
-$fbsql = array(
-    'dsn' => array(
-        'phptype' => 'fbsql',
-        'username' => 'username',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    )
-);
-
-
-$ibase = array(
-    'dsn' => array(
-        'phptype' => 'ibase',
-        'username' => 'username',
-        'password' => 'password',
-        'hostspec' => 'hostname',
-    )
-);
-
-$dbarray = array();
-#$dbarray[] = $mysql;
-#$dbarray[] = $pgsql;
-#$dbarray[] = $oci8;
-#$dbarray[] = $sqlite;
-#$dbarray[] = $mssql;
-#$dbarray[] = $fbsql;
-#$dbarray[] = $ibase;
-
-// you may need to uncomment the line and modify the multiplier as you see fit
-#set_time_limit(60*count($dbarray));
-
-//if uncommented, the following will drop and recreate the test database when running the test
-// the paths assumes that MDB2_Schema is checked out in the same parent directory as MDB2
-/*
-require_once('MDB2/Schema.php');
-$schema_path = '../../MDB2_Schema/tests/';
-
-function pe($e) {
-    die($e->getMessage().' '.$e->getUserInfo());
-}
-PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
-foreach ($dbarray as $dbtype) {
-    // Work around oci8 problems with dropping the connected user
-    $dsn = $dbtype['dsn'];
-    if ($dbtype['dsn']['phptype'] == 'oci8') {
-        $dsn['username'] = $dbtype['options']['DBA_username'];
-        $dsn['password'] = $dbtype['options']['DBA_password'];
-        $dsn['database'] = $dbtype['options']['DBA_username'];
-    }
-    $db =& MDB2::connect($dsn, $dbtype['options']);
-    $db->loadModule('Manager');
-    if (in_array('driver_test', $db->manager->listDatabases())) {
-        $db->manager->dropDatabase('driver_test');
-    }
-    // Work around oci8 problems with dropping the connected user
-    if ($dbtype['dsn']['phptype'] == 'oci8') {
-        $db->query('CREATE USER '.$dbtype['dsn']['username'].' IDENTIFIED BY '.$dbtype['dsn']['password'].' DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS');
-        $db->query('GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER to '.$dbtype['dsn']['username']);
-    }
-    $schema =& MDB2_Schema::factory($dbtype['dsn'], $dbtype['options']);
-    $schema->updateDatabase(
-                            '../../MDB2_Schema/tests/driver_test.schema',
-                            false,
-                            array('create' => '1', 'name' => 'driver_test')
-                            );
-    $schema->updateDatabase(
-                            '../../MDB2_Schema/tests/lob_test.schema',
-                            false,
-                            array('create' => '1', 'name' => 'driver_test')
-                            );
-}
-PEAR::popErrorHandling();
-*/
-
-?>
diff --git a/lib/tests/MDB2/tests/testchoose.php b/lib/tests/MDB2/tests/testchoose.php
deleted file mode 100644
index 70c1805747be6fa6f6c022a603297fbe680bbd6a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/testchoose.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-// BC hack to define PATH_SEPARATOR for version of PHP prior 4.3
-if (!defined('PATH_SEPARATOR')) {
-    if (defined('DIRECTORY_SEPARATOR') && DIRECTORY_SEPARATOR == "\\") {
-        define('PATH_SEPARATOR', ';');
-    } else {
-        define('PATH_SEPARATOR', ':');
-    }
-}
-ini_set('include_path', '..'.PATH_SEPARATOR.ini_get('include_path'));
-
-require_once 'PHPUnit.php';
-require_once 'test_setup.php';
-require_once 'testUtils.php';
-
-$output = '';
-foreach ($testcases as $testcase) {
-    include_once $testcase.'.php';
-    $output.= '<fieldset>'."\n";
-    $output.= '<legend><input type="checkbox" id="selectAll_'.$testcase.'" onclick="return checkAll(\''.$testcase.'\');" /> <b>TestCase : '.$testcase.'</b></legend>'."\n";
-    $testmethods[$testcase] = getTests($testcase);
-    foreach ($testmethods[$testcase] as $method) {
-        $output.= testCheck($testcase, $method);
-    }
-    $output.= "</fieldset><br />\n\n";
-    $output.= "<input name=\"submit\" type=\"submit\"><br /> <br />\n\n";
-}
-
-?>
-<html>
-<head>
-<title>MDB2 Tests</title>
-<link href="tests.css" rel="stylesheet" type="text/css">
-<script language="javascript" type="text/javascript">
-<!--
-function checkAll(testcase)
-{
-    var boolValue = document.getElementById('selectAll_'+testcase).checked;
-    var substr_name = "testmethods[" + testcase + "]";
-    var substr_len = substr_name.length;
-    for (var i=0; i<document.getElementsByTagName('input').length; i++)
-    {
-        var e = document.getElementsByTagName('input').item(i);
-        if (e.getAttribute('type') == 'checkbox') {
-            if (e.name.substr(0, substr_len) == substr_name) {
-                e.checked = boolValue;
-            }
-        }
-    }
-}
-// -->
-</script>
-</head>
-<body>
-
-<form id="testchooseForm" name="testchooseForm" method="post" action="test.php">
-<?php
-echo($output);
-?>
-
-</form>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/tests/MDB2/tests/tests.css b/lib/tests/MDB2/tests/tests.css
deleted file mode 100644
index 447eb7f2ce30b6e2449ed94a0bc8f91932de553f..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2/tests/tests.css
+++ /dev/null
@@ -1,37 +0,0 @@
-<!-- CSS attributes for the HTML test output -->
-
-body {
-    background-color: #ffffff;
-    color: #000000;
-}
-
-div.failure {
-    border: 2px #FF0000 solid;
-    margin : 1em;
-}
-
-h1 {
-   font-size: x-small
-}
-
-div.test {
-  border : 1px #000000 solid;
-  width : 100%;
-  margin-top : 1em;
-  padding : 2px;
-}
-
-.title {
-  top : 0px;
-  left : 0px;
-  text-align : center;
-  background : #000000;
-  color : #FFFFFF;
-  padding : 4px;
-}
-
-div.testlineup {
-   border: 2px #000000 solid;
-}
-
-
diff --git a/lib/tests/MDB2_Driver_mysqli/tests/MDB2_nonstandard_mysqli.php b/lib/tests/MDB2_Driver_mysqli/tests/MDB2_nonstandard_mysqli.php
deleted file mode 100644
index 8779aa2860b170ee4837b94ed2825c523934ac4a..0000000000000000000000000000000000000000
--- a/lib/tests/MDB2_Driver_mysqli/tests/MDB2_nonstandard_mysqli.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5                                                 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2006 Lorenzo Alberton                                  |
-// | All rights reserved.                                                 |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
-// | API as well as database abstraction for PHP applications.            |
-// | This LICENSE is in the BSD license style.                            |
-// |                                                                      |
-// | Redistribution and use in source and binary forms, with or without   |
-// | modification, are permitted provided that the following conditions   |
-// | are met:                                                             |
-// |                                                                      |
-// | Redistributions of source code must retain the above copyright       |
-// | notice, this list of conditions and the following disclaimer.        |
-// |                                                                      |
-// | Redistributions in binary form must reproduce the above copyright    |
-// | notice, this list of conditions and the following disclaimer in the  |
-// | documentation and/or other materials provided with the distribution. |
-// |                                                                      |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission.                                                  |
-// |                                                                      |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
-// | POSSIBILITY OF SUCH DAMAGE.                                          |
-// +----------------------------------------------------------------------+
-// | Author: Lorenzo Alberton <l.alberton@quipo.it>                       |
-// +----------------------------------------------------------------------+
-//
-// $Id: MDB2_nonstandard_mysqli.php,v 1.1 2006/12/09 14:31:54 quipo Exp $
-
-require_once 'MDB2_nonstandard_mysql.php';
-
-class MDB2_nonstandard_mysqli extends MDB2_nonstandard_mysql {
-
-}
-
-?>
\ No newline at end of file
diff --git a/lib/tests/Structures_Graph/tests/README b/lib/tests/Structures_Graph/tests/README
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/lib/tests/Structures_Graph/tests/all-tests.php b/lib/tests/Structures_Graph/tests/all-tests.php
deleted file mode 100644
index 7790ecd430e9f849550d152290f658901dc217de..0000000000000000000000000000000000000000
--- a/lib/tests/Structures_Graph/tests/all-tests.php
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/php
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-
-// Place development Structures_Graph ahead in the include_path
-ini_set('include_path', realpath(dirname(__FILE__) . "/..") . ":.:" . ini_get('include_path'));
-
-require_once 'testCase/BasicGraph.php';
-require_once 'PHPUnit.php';
-
-$suite  = new PHPUnit_TestSuite();
-$suite->addTest(new PHPUnit_TestSuite('BasicGraph'));
-$result = PHPUnit::run($suite);
-
-echo $result->toString();
-?>
diff --git a/lib/tests/Structures_Graph/tests/testCase/BasicGraph.php b/lib/tests/Structures_Graph/tests/testCase/BasicGraph.php
deleted file mode 100644
index 6678587d4ef0cb7d9ebda83c0d92ccfd6829d65d..0000000000000000000000000000000000000000
--- a/lib/tests/Structures_Graph/tests/testCase/BasicGraph.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-// +-----------------------------------------------------------------------------+
-// | Copyright (c) 2003 S�rgio Gon�alves Carvalho                                |
-// +-----------------------------------------------------------------------------+
-// | This file is part of Structures_Graph.                                      |
-// |                                                                             |
-// | Structures_Graph is free software; you can redistribute it and/or modify    |
-// | it under the terms of the GNU Lesser General Public License as published by |
-// | the Free Software Foundation; either version 2.1 of the License, or         |
-// | (at your option) any later version.                                         |
-// |                                                                             |
-// | Structures_Graph is distributed in the hope that it will be useful,         |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
-// | GNU Lesser General Public License for more details.                         |
-// |                                                                             |
-// | You should have received a copy of the GNU Lesser General Public License    |
-// | along with Structures_Graph; if not, write to the Free Software             |
-// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
-// | 02111-1307 USA                                                              |
-// +-----------------------------------------------------------------------------+
-// | Author: S�rgio Carvalho <sergio.carvalho@portugalmail.com>                  |
-// +-----------------------------------------------------------------------------+
-//
-
-require_once 'Structures/Graph.php';
-require_once 'PHPUnit.php';
-
-/**
- * @access private
- */
-class BasicGraph extends PHPUnit_TestCase
-{
-    var $_graph = null;
-
-    // constructor of the test suite
-    function StringTest($name) {
-       $this->PHPUnit_TestCase($name);
-    }
-
-    function setUp() {
-    }
-
-    function tearDown() {
-    }
-
-    function test_create_graph() {
-        $this->_graph = new Structures_Graph();
-        $this->assertTrue(is_a($this->_graph, 'Structures_Graph')); 
-    }
-
-    function test_add_node() {
-        $this->_graph = new Structures_Graph();
-        $data = 1;
-        $node = new Structures_Graph_Node($data);
-        $this->_graph->addNode($node);
-        $node = new Structures_Graph_Node($data);
-        $this->_graph->addNode($node);
-        $node = new Structures_Graph_Node($data);
-        $this->_graph->addNode($node);
-    }
-
-    function test_connect_node() {
-        $this->_graph = new Structures_Graph();
-        $data = 1;
-        $node1 = new Structures_Graph_Node($data);
-        $node2 = new Structures_Graph_Node($data);
-        $this->_graph->addNode($node1);
-        $this->_graph->addNode($node2);
-        $node1->connectTo($node2);
-
-        $node =& $this->_graph->getNodes();
-        $node =& $node[0];
-        $node = $node->getNeighbours();
-        $node =& $node[0];
-        /* 
-         ZE1 == and === operators fail on $node,$node2 because of the recursion introduced
-         by the _graph field in the Node object. So, we'll use the stupid method for reference
-         testing
-        */
-        $node = true;
-        $this->assertTrue($node2);
-        $node = false;
-        $this->assertFalse($node2);
-    }
-
-    function test_data_references() {
-        $this->_graph = new Structures_Graph();
-        $data = 1;
-        $node = new Structures_Graph_Node();
-        $node->setData(&$data);
-        $this->_graph->addNode($node);
-        $data = 2;
-        $dataInNode =& $this->_graph->getNodes();
-        $dataInNode =& $dataInNode[0];
-        $dataInNode =& $dataInNode->getData();
-        $this->assertTrue($data === $dataInNode);
-    }
-
-    function test_metadata_references() {
-        $this->_graph = new Structures_Graph();
-        $data = 1;
-        $node = new Structures_Graph_Node();
-        $node->setMetadata('5', &$data);
-        $data = 2;
-        $dataInNode =& $node->getMetadata('5');
-        $this->assertTrue($data === $dataInNode);
-    }
-   
-    function test_metadata_key_exists() {
-        $this->_graph = new Structures_Graph();
-        $data = 1;
-        $node = new Structures_Graph_Node();
-        $node->setMetadata('5', $data);
-        $this->assertTrue($node->metadataKeyExists('5'));
-        $this->assertFalse($node->metadataKeyExists('1'));
-    }
-
-    function test_directed_degree() {
-        $this->_graph = new Structures_Graph(true);
-        $node = array();
-        $node[] = new Structures_Graph_Node();
-        $node[] = new Structures_Graph_Node();
-        $node[] = new Structures_Graph_Node();
-        $this->_graph->addNode($node[0]);
-        $this->_graph->addNode($node[1]);
-        $this->_graph->addNode($node[2]);
-        $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs');
-        $this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs');
-        $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs');
-        $this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs');
-        $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs');
-        $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs');
-        $node[0]->connectTo($node[1]);
-        $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc');
-        $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc');
-        $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc');
-        $this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc');
-        $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc');
-        $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc');
-        $node[0]->connectTo($node[2]);
-        $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs');
-        $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs');
-        $this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs');
-        $this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs');
-        $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs');
-        $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs');
-    }
-
-    function test_undirected_degree() {
-        $this->_graph = new Structures_Graph(false);
-        $node = array();
-        $node[] = new Structures_Graph_Node();
-        $node[] = new Structures_Graph_Node();
-        $node[] = new Structures_Graph_Node();
-        $this->_graph->addNode($node[0]);
-        $this->_graph->addNode($node[1]);
-        $this->_graph->addNode($node[2]);
-        $this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs');
-        $this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs');
-        $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs');
-        $this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs');
-        $this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs');
-        $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs');
-        $node[0]->connectTo($node[1]);
-        $this->assertEquals(1, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc');
-        $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc');
-        $this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc');
-        $this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc');
-        $this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc');
-        $this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc');
-        $node[0]->connectTo($node[2]);
-        $this->assertEquals(2, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs');
-        $this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs');
-        $this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs');
-        $this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs');
-        $this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs');
-        $this->assertEquals(1, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs');
-    }
-}
-?>
diff --git a/lib/tests/XML_Util/XML/tests/AllTests.php b/lib/tests/XML_Util/XML/tests/AllTests.php
deleted file mode 100644
index 7a21a842f4904041c232165f6bce79e1c332c027..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/AllTests.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-
-/**
- * Master Unit Test Suite file for XML_Util
- * 
- * This top-level test suite file organizes 
- * all class test suite files, 
- * so that the full suite can be run 
- * by PhpUnit or via "pear run-tests -u". 
- *
- * PHP version 5
- *
- * @category   XML
- * @package    XML_Util
- * @subpackage UnitTesting
- * @author     Chuck Burgess <ashnazg@php.net>
- * @license    http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: AllTests.php,v 1.5 2008/05/30 11:53:09 ashnazg Exp $
- * @link       http://pear.php.net/package/XML_Util
- * @since      1.2.0a1
- */
-
-
-/**
- * Check PHP version... PhpUnit v3+ requires at least PHP v5.1.4
- */
-if (version_compare(PHP_VERSION, "5.1.4") < 0) {
-    // Cannnot run test suites
-    echo 'Cannot run test suite via PhpUnit... requires at least PHP v5.1.4.' . PHP_EOL;
-    echo 'Use "pear run-tests -p xml_util" to run the PHPT tests directly.' . PHP_EOL
-;
-    exit(1);
-}
-
-
-/**
- * Derive the "main" method name
- * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD
- *           to make this usage meet the PEAR CS... we cannot rename it here.
- */
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'XML_Util_AllTests::main');
-}
-
-
-/*
- * Files needed by PhpUnit
- */
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-require_once 'PHPUnit/Extensions/PhptTestSuite.php';
-
-/*
- * You must add each additional class-level test suite file here
- */
-// there are no PhpUnit test files... only PHPTs.. so nothing is listed here
-
-/**
- * directory where PHPT tests are located
- */
-define('XML_UTIL_DIR_PHPT', dirname(__FILE__));
-
-/**
- * Master Unit Test Suite class for XML_Util
- * 
- * This top-level test suite class organizes 
- * all class test suite files, 
- * so that the full suite can be run 
- * by PhpUnit or via "pear run-tests -up xml_util". 
- *
- * @category   XML
- * @package    XML_Util
- * @subpackage UnitTesting
- * @author     Chuck Burgess <ashnazg@php.net>
- * @license    http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/XML_Util
- * @since      1.2.0a1
- */
-class XML_Util_AllTests
-{
-
-    /**
-     * Launches the TextUI test runner
-     *
-     * @return void
-     * @uses PHPUnit_TextUI_TestRunner
-     */
-    public static function main()
-    {
-        PHPUnit_TextUI_TestRunner::run(self::suite());
-    }
-
-
-    /**
-     * Adds all class test suites into the master suite
-     *
-     * @return PHPUnit_Framework_TestSuite a master test suite
-     *                                     containing all class test suites
-     * @uses PHPUnit_Framework_TestSuite
-     */ 
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite(
-            'XML_Util Full Suite of Unit Tests');
-
-        /*
-         * You must add each additional class-level test suite name here
-         */
-        // there are no PhpUnit test files... only PHPTs.. so nothing is listed here
-
-        /*
-         * add PHPT tests
-         */
-        $phpt = new PHPUnit_Extensions_PhptTestSuite(XML_UTIL_DIR_PHPT);
-        $suite->addTestSuite($phpt);
-
-        return $suite;
-    }
-}
-
-/**
- * Call the main method if this file is executed directly
- * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD
- *           to make this usage meet the PEAR CS... we cannot rename it here.
- */
-if (PHPUnit_MAIN_METHOD == 'XML_Util_AllTests::main') {
-    XML_Util_AllTests::main();
-}
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-?>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_apiVersion.phpt b/lib/tests/XML_Util/XML/tests/testBasic_apiVersion.phpt
deleted file mode 100644
index 649e290e4fc8594a37d50b4c5b06af405abe7003..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_apiVersion.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-XML_Util::apiVersion() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::apiVersion() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic apiVersion() call" . PHP_EOL;
-echo XML_Util::apiVersion() . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::apiVersion() basic tests=====
-
-TEST:  basic apiVersion() call
-1.1
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_attributesToString.phpt b/lib/tests/XML_Util/XML/tests/testBasic_attributesToString.phpt
deleted file mode 100644
index 51c81d30697c7cd296d94e2690eedabcf3d6149e..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_attributesToString.phpt
+++ /dev/null
@@ -1,118 +0,0 @@
---TEST--
-XML_Util::attributesToString() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::attributesToString() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$att = array("foo" => "bar", "boo" => "baz");
-$sort1 = array(
-    'multiline' => true, 
-    'indent'    => '----', 
-    'linebreak' => "^", 
-    'entities'  => XML_UTIL_ENTITIES_XML, 
-    'sort'      => true
-);
-$sort2 = array(
-    'multiline' => true, 
-    'indent'    => '----', 
-    'linebreak' => "^", 
-    'entities'  => XML_UTIL_ENTITIES_XML, 
-);
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::attributesToString($att) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$sort = true" . PHP_EOL;
-echo XML_Util::attributesToString($att, true) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$sort = false" . PHP_EOL;
-echo XML_Util::attributesToString($att, false) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$multiline = false" . PHP_EOL;
-echo XML_Util::attributesToString($att, true, false) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$multiline = true" . PHP_EOL;
-echo XML_Util::attributesToString($att, true, true) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$indent = '        ' (8 spaces)" . PHP_EOL;
-echo XML_Util::attributesToString($att, true, true, '        ') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  explicit \$linebreak = '^' (some dummy char)" . PHP_EOL;
-echo XML_Util::attributesToString($att, true, true, '^') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  passing \$sort array of options that includes 'sort'" . PHP_EOL;
-echo XML_Util::attributesToString($att, $sort1) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  passing \$sort array of options that doesn't include 'sort'" . PHP_EOL;
-echo XML_Util::attributesToString($att, $sort2) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  do not replace entities" . PHP_EOL;
-$arr = array("foo" => "b@&r", "boo" => "b><z");
-echo XML_Util::attributesToString($arr, true, false, '    ', PHP_EOL, 
-    XML_UTIL_ENTITIES_NONE) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  replace all XML entities" . PHP_EOL;
-$arr = array("foo" => "b@&r", "boo" => "b><z");
-echo XML_Util::attributesToString($arr, true, false, '    ', PHP_EOL, 
-    XML_UTIL_ENTITIES_XML) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  replace only required XML entities" . PHP_EOL;
-$arr = array("foo" => "b@&r", "boo" => "b><z");
-echo XML_Util::attributesToString($arr, true, false, '    ', PHP_EOL, 
-    XML_UTIL_ENTITIES_XML_REQUIRED) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  replace HTML entities" . PHP_EOL;
-$arr = array("foo" => "b@&r", "boo" => "b><z");
-echo XML_Util::attributesToString($arr, true, false, '    ', PHP_EOL, 
-    XML_UTIL_ENTITIES_HTML) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::attributesToString() basic tests=====
-
-TEST:  basic usage
- boo="baz" foo="bar"
-
-TEST:  explicit $sort = true
- boo="baz" foo="bar"
-
-TEST:  explicit $sort = false
- foo="bar" boo="baz"
-
-TEST:  explicit $multiline = false
- boo="baz" foo="bar"
-
-TEST:  explicit $multiline = true
- boo="baz"
-    foo="bar"
-
-TEST:  explicit $indent = '        ' (8 spaces)
- boo="baz"
-        foo="bar"
-
-TEST:  explicit $linebreak = '^' (some dummy char)
- boo="baz"
-^foo="bar"
-
-TEST:  passing $sort array of options that includes 'sort'
- boo="baz"
-----foo="bar"
-
-TEST:  passing $sort array of options that doesn't include 'sort'
- boo="baz"
-----foo="bar"
-
-TEST:  do not replace entities
- boo="b><z" foo="b@&r"
-
-TEST:  replace all XML entities
- boo="b&gt;&lt;z" foo="b@&amp;r"
-
-TEST:  replace only required XML entities
- boo="b>&lt;z" foo="b@&amp;r"
-
-TEST:  replace HTML entities
- boo="b&gt;&lt;z" foo="b@&amp;r"
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_collapseEmptyTags.phpt b/lib/tests/XML_Util/XML/tests/testBasic_collapseEmptyTags.phpt
deleted file mode 100644
index dcc1c4f4f40d175b15f69fc50c264dcaf4602c27..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_collapseEmptyTags.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-XML_Util::collapseEmptyTags() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::collapseEmptyTags() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$emptyTag = "<foo></foo>";
-$otherTag = "<bar>baz</bar>";
-$xhtmlTag = "<b></b>";
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage alongside non-empty tag" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag . $otherTag) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  one empty tag, with COLLAPSE_ALL set" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag, XML_UTIL_COLLAPSE_ALL) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  one empty tag alongside non-empty tag, with COLLAPSE_ALL set" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag . $otherTag, XML_UTIL_COLLAPSE_ALL) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  one empty tag, with COLLAPSE_XHTML_ONLY set" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag, XML_UTIL_COLLAPSE_XHTML_ONLY) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  one empty tag alongside non-empty tag, with COLLAPSE_XHTML_ONLY set" . PHP_EOL;
-echo XML_Util::collapseEmptyTags($emptyTag . $xhtmlTag . $otherTag, XML_UTIL_COLLAPSE_XHTML_ONLY) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::collapseEmptyTags() basic tests=====
-
-TEST:  basic usage
-<foo />
-
-TEST:  basic usage alongside non-empty tag
-<foo /><bar>baz</bar>
-
-TEST:  one empty tag, with COLLAPSE_ALL set
-<foo />
-
-TEST:  one empty tag alongside non-empty tag, with COLLAPSE_ALL set
-<foo /><bar>baz</bar>
-
-TEST:  one empty tag, with COLLAPSE_XHTML_ONLY set
-<foo></foo>
-
-TEST:  one empty tag alongside non-empty tag, with COLLAPSE_XHTML_ONLY set
-<foo></foo><b></b><bar>baz</bar>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createCDataSection.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createCDataSection.phpt
deleted file mode 100644
index 8616ce5f93e77b79515e27939b71fc3437468431..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createCDataSection.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-XML_Util::createCDataSection() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createCDataSection() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::createCDataSection("I am content.") . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createCDataSection() basic tests=====
-
-TEST:  basic usage
-<![CDATA[I am content.]]>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createComment.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createComment.phpt
deleted file mode 100644
index 94e56c848019beca6122c02dd9a1176227a62c9d..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createComment.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-XML_Util::createComment() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createComment() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::createComment("I am comment.") . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createComment() basic tests=====
-
-TEST:  basic usage
-<!-- I am comment. -->
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createEndElement.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createEndElement.phpt
deleted file mode 100644
index cde66fd9ebfd33c7e4c64623e08c08ac4b5dc4c4..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createEndElement.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-XML_Util::createEndElement() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createEndElement() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage (myTag)" . PHP_EOL;
-echo XML_Util::createEndElement("myTag") . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a namespaced tag (myNs:myTag)" . PHP_EOL;
-echo XML_Util::createEndElement("myNs:myTag") . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createEndElement() basic tests=====
-
-TEST:  basic usage (myTag)
-</myTag>
-
-TEST:  basic usage with a namespaced tag (myNs:myTag)
-</myNs:myTag>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createStartElement.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createStartElement.phpt
deleted file mode 100644
index 8587bbf1b076ae08fbf82a123b5cec89953a7a20..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createStartElement.phpt
+++ /dev/null
@@ -1,124 +0,0 @@
---TEST--
-XML_Util::createStartElement() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createStartElement() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag only" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag"
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar")
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag only, passing '' as attribute arg" . PHP_EOL;
-echo XML_Util::createStartElement(
-    'myNs:myTag',
-    ''
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes and namespace" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar"),
-    "http://www.w3c.org/myNs#"
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with empty attributes, whose namespaceUri is not a full namespace" . PHP_EOL;
-echo XML_Util::createStartElement(
-    'myTag',
-    '',
-    'foo'
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes, namespace, and multiline = true" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar"),
-    "http://www.w3c.org/myNs#",
-    true
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes, namespace, multiline = true, and indent = (2 spaces only)" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar"),
-    "http://www.w3c.org/myNs#",
-    true,
-    '  '
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), and linebreak = '^'" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar"),
-    "http://www.w3c.org/myNs#",
-    true,
-    '  ',
-    '^'
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = true" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar", "boo" => "baz"),
-    "http://www.w3c.org/myNs#",
-    true,
-    '  ',
-    '^',
-    true
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = false" . PHP_EOL;
-echo XML_Util::createStartElement(
-    "myNs:myTag", 
-    array("foo" => "bar", "boo" => "baz"),
-    "http://www.w3c.org/myNs#",
-    true,
-    '  ',
-    '^',
-    false
-) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createStartElement() basic tests=====
-
-TEST:  tag only
-<myNs:myTag>
-
-TEST:  tag with attributes
-<myNs:myTag foo="bar">
-
-TEST:  tag only, passing '' as attribute arg
-<myNs:myTag>
-
-TEST:  tag with attributes and namespace
-<myNs:myTag foo="bar" xmlns:myNs="http://www.w3c.org/myNs#">
-
-TEST:  tag with empty attributes, whose namespaceUri is not a full namespace
-<myTag xmlns="foo">
-
-TEST:  tag with attributes, namespace, and multiline = true
-<myNs:myTag foo="bar"
-            xmlns:myNs="http://www.w3c.org/myNs#">
-
-TEST:  tag with attributes, namespace, multiline = true, and indent = (2 spaces only)
-<myNs:myTag foo="bar"
-  xmlns:myNs="http://www.w3c.org/myNs#">
-
-TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), and linebreak = '^'
-<myNs:myTag foo="bar"^  xmlns:myNs="http://www.w3c.org/myNs#">
-
-TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = true
-<myNs:myTag boo="baz"^  foo="bar"^  xmlns:myNs="http://www.w3c.org/myNs#">
-
-TEST:  tag with attributes, namespace, multiline = true, indent = (2 spaces only), linebreak = '^', and sortAttributes = false
-<myNs:myTag foo="bar"^  boo="baz"^  xmlns:myNs="http://www.w3c.org/myNs#">
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createTag.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createTag.phpt
deleted file mode 100644
index 6a114e9213a055f90c612c78969151501bfaa3b1..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createTag.phpt
+++ /dev/null
@@ -1,155 +0,0 @@
---TEST--
-XML_Util::createTag() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createTag() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar")
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute and content" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag"
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, and namespace" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag",
-    "http://www.w3c.org/myNs#"
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, and REPLACE_ENTITIES" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, and CDATA_SECTION" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_CDATA_SECTION
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, and multiline = false" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    false
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, and multiline = true" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    true
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, and indent = (2 spaces)" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    true,
-    '  '
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), and linebreak = '^'" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    true,
-    '  ',
-    '^'
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = true" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar", "boo" => "baz"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    true,
-    '  ',
-    '^',
-    true
-) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false" . PHP_EOL;
-echo XML_Util::createTag(
-    "myNs:myTag", 
-    array("foo" => "bar", "boo" => "baz"), 
-    "This is inside the tag and has < & @ > in it",
-    "http://www.w3c.org/myNs#",
-    XML_UTIL_REPLACE_ENTITIES,
-    true,
-    '  ',
-    '^',
-    false
-) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createTag() basic tests=====
-
-TEST:  tag with attribute
-<myNs:myTag foo="bar" />
-
-TEST:  tag with attribute and content
-<myNs:myTag foo="bar">This is inside the tag</myNs:myTag>
-
-TEST:  tag with attribute, content, and namespace
-<myNs:myTag foo="bar" xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, and REPLACE_ENTITIES
-<myNs:myTag foo="bar" xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, and CDATA_SECTION
-<myNs:myTag foo="bar" xmlns:myNs="http://www.w3c.org/myNs#"><![CDATA[This is inside the tag and has < & @ > in it]]></myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, and multiline = false
-<myNs:myTag foo="bar" xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, and multiline = true
-<myNs:myTag foo="bar"
-            xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, and indent = (2 spaces)
-<myNs:myTag foo="bar"
-  xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), and linebreak = '^'
-<myNs:myTag foo="bar"^  xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = true
-<myNs:myTag boo="baz"^  foo="bar"^  xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
-
-TEST:  tag with attribute, content, namespace, REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false
-<myNs:myTag foo="bar"^  boo="baz"^  xmlns:myNs="http://www.w3c.org/myNs#">This is inside the tag and has &lt; &amp; @ &gt; in it</myNs:myTag>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_createTagFromArray.phpt b/lib/tests/XML_Util/XML/tests/testBasic_createTagFromArray.phpt
deleted file mode 100644
index 9b8887a133e761dcda988ebe651f99f270bfd37b..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_createTagFromArray.phpt
+++ /dev/null
@@ -1,203 +0,0 @@
---TEST--
-XML_Util::createTagFromArray() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::createTagFromArray() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$bad = array(
-    "foo" => "bar",
-);
-$tag1 = array(
-    "qname"        => "foo:bar",
-);
-$tag2 = array(
-    "qname"        => "foo:bar",
-    "namespaceUri" => "http://foo.com",
-);
-$tag3 = array(
-    "qname"        => "foo:bar",
-    "namespaceUri" => "http://foo.com",
-    "attributes"   => array( "key" => "value", "argh" => "fruit&vegetable" ),
-);
-$tag4 = array(
-    "qname"        => "foo:bar",
-    "namespaceUri" => "http://foo.com",
-    "attributes"   => array( "key" => "value", "argh" => "fruit&vegetable" ),
-    "content"      => "I'm inside the tag",
-);
-$tag5 = array(
-    "qname"        => "foo:bar",
-    "attributes"   => array( "key" => "value", "argh" => "fruit&vegetable" ),
-    "content"      => "I'm inside the tag",
-);
-$tag6 = array(
-    "qname"        => "foo:bar",
-    "namespaceUri" => "http://foo.com",
-    "content"      => "I'm inside the tag",
-);
-$tag7 = array(
-    "namespaceUri" => "http://foo.com",
-    "attributes"   => array( "key" => "value", "argh" => "fruit&vegetable" ),
-    "content"      => "I'm inside the tag",
-);
-
-$tag8 = array(
-    'content'      => array('foo', 'bar')
-);
-
-$tag9 = array(
-    'qname'        => 'foo:bar',
-    'namespaces'   => array('ns1' => 'uri1', 'ns2' => 'uri2')
-);
-
-$tag10 = array(
-    'namespace'    => 'http://foo.org',
-    'localPart'    => 'bar'
-);
-
-$tag11 = array(
-    'namespace'    => '',
-    'localPart'    => 'bar'
-);
-
-$tag12 = array(
-    'localPart'    => 'foo',
-    'namespaceUri' => 'http://bar.org'
-);
-
-echo "TEST:  basic usage with an invalid array" . PHP_EOL;
-echo XML_Util::createTagFromArray($bad) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname only)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag1) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname and namespaceUri)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag2) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, and attributes)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag3) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, attributes, and content)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag5) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, and content)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag6) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (namespaceUri, attributes, and content)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag7) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), plus REPLACE_ENTITIES" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), plus ENTITIES_NONE" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_ENTITIES_NONE) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, and multiline = false" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, false) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, and multiline = true" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, true) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, and indent = (2 spaces)" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, true, '  ') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), and linebreak = '^'" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, true, '  ', '^') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = true" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, true, '  ', '^', true) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false" . PHP_EOL;
-echo XML_Util::createTagFromArray($tag4, XML_UTIL_REPLACE_ENTITIES, true, '  ', '^', false) . PHP_EOL . PHP_EOL;
-
-echo 'TEST:  cause a non-scalar error on the content tag' . PHP_EOL;
-echo XML_Util::createTagFromArray($tag8) . PHP_EOL . PHP_EOL;
-
-echo 'TEST:  handle an array of namespaces being passed' . PHP_EOL;
-echo XML_Util::createTagFromArray($tag9) . PHP_EOL . PHP_EOL;
-
-echo 'TEST:  qname is derived from namespace + localPart' . PHP_EOL;
-echo XML_Util::createTagFromArray($tag10) . PHP_EOL . PHP_EOL;
-
-echo 'TEST:  qname is derived from localPart only' . PHP_EOL;
-echo XML_Util::createTagFromArray($tag11) . PHP_EOL . PHP_EOL;
-
-echo 'TEST:  namespaceUri is given, but namespace is not' . PHP_EOL;
-echo XML_Util::createTagFromArray($tag12) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::createTagFromArray() basic tests=====
-
-TEST:  basic usage with an invalid array
-You must either supply a qualified name (qname) or local tag name (localPart).
-
-TEST:  basic usage with a valid array (qname only)
-<foo:bar />
-
-TEST:  basic usage with a valid array (qname and namespaceUri)
-<foo:bar xmlns:foo="http://foo.com" />
-
-TEST:  basic usage with a valid array (qname, namespaceUri, and attributes)
-<foo:bar argh="fruit&amp;vegetable" key="value" xmlns:foo="http://foo.com" />
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content)
-<foo:bar argh="fruit&amp;vegetable" key="value" xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, attributes, and content)
-<foo:bar argh="fruit&amp;vegetable" key="value">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, and content)
-<foo:bar xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (namespaceUri, attributes, and content)
-You must either supply a qualified name (qname) or local tag name (localPart).
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), plus REPLACE_ENTITIES
-<foo:bar argh="fruit&amp;vegetable" key="value" xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), plus ENTITIES_NONE
-<foo:bar argh="fruit&vegetable" key="value" xmlns:foo="http://foo.com">I'm inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, and multiline = false
-<foo:bar argh="fruit&amp;vegetable" key="value" xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, and multiline = true
-<foo:bar argh="fruit&amp;vegetable"
-         key="value"
-         xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, and indent = (2 spaces)
-<foo:bar argh="fruit&amp;vegetable"
-  key="value"
-  xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), and linebreak = '^'
-<foo:bar argh="fruit&amp;vegetable"^  key="value"^  xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = true
-<foo:bar argh="fruit&amp;vegetable"^  key="value"^  xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  basic usage with a valid array (qname, namespaceUri, attributes, and content), REPLACE_ENTITIES, multiline = true, indent = (2 spaces), linebreak = '^', and sortAttributes = false
-<foo:bar key="value"^  argh="fruit&amp;vegetable"^  xmlns:foo="http://foo.com">I&apos;m inside the tag</foo:bar>
-
-TEST:  cause a non-scalar error on the content tag
-Supplied non-scalar value as tag content
-
-TEST:  handle an array of namespaces being passed
-<foo:bar xmlns:ns1="uri1" xmlns:ns2="uri2" />
-
-TEST:  qname is derived from namespace + localPart
-<http://foo.org:bar />
-
-TEST:  qname is derived from localPart only
-<bar />
-
-TEST:  namespaceUri is given, but namespace is not
-<foo xmlns="http://bar.org" />
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_getDocTypeDeclaration.phpt b/lib/tests/XML_Util/XML/tests/testBasic_getDocTypeDeclaration.phpt
deleted file mode 100644
index f623dc97c552ca42bb9786b1344f5f2c3bbfd2e3..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_getDocTypeDeclaration.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-XML_Util::getDocTypeDeclaration() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::getDocTypeDeclaration() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using root only" . PHP_EOL;
-echo XML_Util::getDocTypeDeclaration("rootTag") . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using root and a string URI" . PHP_EOL;
-echo XML_Util::getDocTypeDeclaration("rootTag", "myDocType.dtd") . PHP_EOL . PHP_EOL;
-
-$uri = array(
-    'uri' => 'http://pear.php.net/dtd/package-1.0',
-    'id' => '-//PHP//PEAR/DTD PACKAGE 0.1'
-);
-$dtdEntry = '<!ELEMENT additionalInfo (#PCDATA)>';
-
-echo "TEST:  using root and an array URI" . PHP_EOL;
-echo XML_Util::getDocTypeDeclaration("rootTag", $uri) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using root and an array URI and an internal DTD entry" . PHP_EOL;
-echo XML_Util::getDocTypeDeclaration("rootTag", $uri, $dtdEntry) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::getDocTypeDeclaration() basic tests=====
-
-TEST:  using root only
-<!DOCTYPE rootTag>
-
-TEST:  using root and a string URI
-<!DOCTYPE rootTag SYSTEM "myDocType.dtd">
-
-TEST:  using root and an array URI
-<!DOCTYPE rootTag PUBLIC "-//PHP//PEAR/DTD PACKAGE 0.1" "http://pear.php.net/dtd/package-1.0">
-
-TEST:  using root and an array URI and an internal DTD entry
-<!DOCTYPE rootTag PUBLIC "-//PHP//PEAR/DTD PACKAGE 0.1" "http://pear.php.net/dtd/package-1.0" [
-<!ELEMENT additionalInfo (#PCDATA)>
-]>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_getXmlDeclaration.phpt b/lib/tests/XML_Util/XML/tests/testBasic_getXmlDeclaration.phpt
deleted file mode 100644
index 93e3842bc836c0711b88861f70ea802443cf80f4..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_getXmlDeclaration.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-XML_Util::getXmlDeclaration() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::getXmlDeclaration() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using version only" . PHP_EOL;
-echo XML_Util::getXMLDeclaration("1.0") . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using version and encoding" . PHP_EOL;
-echo XML_Util::getXMLDeclaration("1.0", "UTF-8") . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using version, encoding, and standalone flag" . PHP_EOL;
-echo XML_Util::getXMLDeclaration("1.0", "UTF-8", true) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  using version and standalone flag" . PHP_EOL;
-echo XML_Util::getXMLDeclaration("1.0", null, true) . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::getXmlDeclaration() basic tests=====
-
-TEST:  using version only
-<?xml version="1.0"?>
-
-TEST:  using version and encoding
-<?xml version="1.0" encoding="UTF-8"?>
-
-TEST:  using version, encoding, and standalone flag
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-TEST:  using version and standalone flag
-<?xml version="1.0" standalone="yes"?>
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_isValidName.phpt b/lib/tests/XML_Util/XML/tests/testBasic_isValidName.phpt
deleted file mode 100644
index 2abd2e7418011330b255468a40c20770b8a42876..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_isValidName.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-XML_Util::isValidName() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::isValidName() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  valid tag" . PHP_EOL;
-$result = XML_Util::isValidName("alpha-x_y_z.123");
-if (is_a($result, 'PEAR_Error')) {
-    print "Invalid XML name: " . $result->getMessage() . PHP_EOL . PHP_EOL;
-} else {
-    print "Valid XML name." . PHP_EOL . PHP_EOL;
-}
-
-echo "TEST:  invalid tag" . PHP_EOL;
-$result = XML_Util::isValidName("invalidTag?");
-if (is_a($result, 'PEAR_Error')) {
-    print "Invalid XML name: " . $result->getMessage() . PHP_EOL . PHP_EOL;
-} else {
-    print "Valid XML name." . PHP_EOL . PHP_EOL;
-}
-
-echo "TEST:  invalid tag that doesn't start with a letter" . PHP_EOL;
-$result = XML_Util::isValidName("1234five");
-if (is_a($result, 'PEAR_Error')) {
-    print "Invalid XML name: " . $result->getMessage() . PHP_EOL . PHP_EOL;
-} else {
-    print "Valid XML name." . PHP_EOL . PHP_EOL;
-}
-
-?>
---EXPECT--
-=====XML_Util::isValidName() basic tests=====
-
-TEST:  valid tag
-Valid XML name.
-
-TEST:  invalid tag
-Invalid XML name: XML names may only contain alphanumeric chars, period, hyphen, colon and underscores
-
-TEST:  invalid tag that doesn't start with a letter
-Invalid XML name: XML names may only start with letter or underscore
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_raiseError.phpt b/lib/tests/XML_Util/XML/tests/testBasic_raiseError.phpt
deleted file mode 100644
index 84f6b1865d2a013383502b6d29da1688d4978a0c..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_raiseError.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-XML_Util::raiseError() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::raiseError() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$error = XML_Util::raiseError("I am an error", 12345);
-if (is_a($error, 'PEAR_Error')) {
-    print "PEAR Error: " . $error->getMessage() . PHP_EOL;
-}
-?>
---EXPECT--
-=====XML_Util::raiseError() basic tests=====
-
-PEAR Error: I am an error
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_replaceEntities.phpt b/lib/tests/XML_Util/XML/tests/testBasic_replaceEntities.phpt
deleted file mode 100644
index 17fc28541de2a3fcc4ab5db107ecfe645a74e34b..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_replaceEntities.phpt
+++ /dev/null
@@ -1,82 +0,0 @@
---TEST--
-XML_Util::replaceEntities() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::replaceEntities() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$data = 'This string contains < & >.';
-$utf8 = 'This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê';
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::replaceEntities($data) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage but with bogus \$replaceEntities arg" . PHP_EOL;
-echo XML_Util::replaceEntities($data, 'I_AM_BOGUS') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_XML) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_XML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_XML and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($utf8, XML_UTIL_ENTITIES_XML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML_REQUIRED" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_XML_REQUIRED) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML_REQUIRED and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_XML_REQUIRED, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_XML_REQUIRED and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($utf8, XML_UTIL_ENTITIES_XML_REQUIRED, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_HTML" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_HTML) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_HTML and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_HTML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_HTML and UTF-8" . PHP_EOL;
-echo XML_Util::replaceEntities($utf8, XML_UTIL_ENTITIES_HTML, 'UTF-8') . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::replaceEntities() basic tests=====
-
-TEST:  basic usage
-This string contains &lt; &amp; &gt;.
-
-TEST:  basic usage but with bogus $replaceEntities arg
-This string contains < & >.
-
-TEST:  basic usage with ENTITIES_XML
-This string contains &lt; &amp; &gt;.
-
-TEST:  basic usage with ENTITIES_XML and UTF-8
-This string contains &lt; &amp; &gt;.
-
-TEST:  utf8 usage with ENTITIES_XML and UTF-8
-This data contains special chars like &lt;, &gt;, &amp; and &quot; as well as ä, ö, ß, à and ê
-
-TEST:  basic usage with ENTITIES_XML_REQUIRED
-This string contains &lt; &amp; >.
-
-TEST:  basic usage with ENTITIES_XML_REQUIRED and UTF-8
-This string contains &lt; &amp; >.
-
-TEST:  utf8 usage with ENTITIES_XML_REQUIRED and UTF-8
-This data contains special chars like &lt;, >, &amp; and &quot; as well as ä, ö, ß, à and ê
-
-TEST:  basic usage with ENTITIES_HTML
-This string contains &lt; &amp; &gt;.
-
-TEST:  basic usage with ENTITIES_HTML and UTF-8
-This string contains &lt; &amp; &gt;.
-
-TEST:  utf8 usage with ENTITIES_HTML and UTF-8
-This data contains special chars like &lt;, &gt;, &amp; and &quot; as well as &auml;, &ouml;, &szlig;, &agrave; and &ecirc;
-
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_reverseEntities.phpt b/lib/tests/XML_Util/XML/tests/testBasic_reverseEntities.phpt
deleted file mode 100644
index 167171676fcffc91dab9399c7c5f66274442e330..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_reverseEntities.phpt
+++ /dev/null
@@ -1,81 +0,0 @@
---TEST--
-XML_Util::reverseEntities() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::reverseEntities() basic tests=====' . PHP_EOL . PHP_EOL;
-
-$data = 'This string contains &lt; &amp; &gt;.';
-$utf8 = 'This data contains special chars like &lt;, &gt;, &amp; and &quot; as well as &auml;, &ouml;, &szlig;, &agrave; and &ecirc;';
-
-echo "TEST:  basic usage" . PHP_EOL;
-echo XML_Util::reverseEntities($data) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage but with bogus \$replaceEntities arg" . PHP_EOL;
-echo XML_Util::reverseEntities($data, 'I_AM_BOGUS') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_XML) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_XML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_XML and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($utf8, XML_UTIL_ENTITIES_XML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML_REQUIRED" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_XML_REQUIRED) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_XML_REQUIRED and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_XML_REQUIRED, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_XML_REQUIRED and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($utf8, XML_UTIL_ENTITIES_XML_REQUIRED, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_HTML" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_HTML) . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage with ENTITIES_HTML and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($data, XML_UTIL_ENTITIES_HTML, 'UTF-8') . PHP_EOL . PHP_EOL;
-
-echo "TEST:  utf8 usage with ENTITIES_HTML and UTF-8" . PHP_EOL;
-echo XML_Util::reverseEntities($utf8, XML_UTIL_ENTITIES_HTML, 'UTF-8') . PHP_EOL . PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::reverseEntities() basic tests=====
-
-TEST:  basic usage
-This string contains < & >.
-
-TEST:  basic usage but with bogus $replaceEntities arg
-This string contains &lt; &amp; &gt;.
-
-TEST:  basic usage with ENTITIES_XML
-This string contains < & >.
-
-TEST:  basic usage with ENTITIES_XML and UTF-8
-This string contains < & >.
-
-TEST:  utf8 usage with ENTITIES_XML and UTF-8
-This data contains special chars like <, >, & and " as well as &auml;, &ouml;, &szlig;, &agrave; and &ecirc;
-
-TEST:  basic usage with ENTITIES_XML_REQUIRED
-This string contains < & &gt;.
-
-TEST:  basic usage with ENTITIES_XML_REQUIRED and UTF-8
-This string contains < & &gt;.
-
-TEST:  utf8 usage with ENTITIES_XML_REQUIRED and UTF-8
-This data contains special chars like <, &gt;, & and " as well as &auml;, &ouml;, &szlig;, &agrave; and &ecirc;
-
-TEST:  basic usage with ENTITIES_HTML
-This string contains < & >.
-
-TEST:  basic usage with ENTITIES_HTML and UTF-8
-This string contains < & >.
-
-TEST:  utf8 usage with ENTITIES_HTML and UTF-8
-This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê
diff --git a/lib/tests/XML_Util/XML/tests/testBasic_splitQualifiedName.phpt b/lib/tests/XML_Util/XML/tests/testBasic_splitQualifiedName.phpt
deleted file mode 100644
index 0008f72695454351adaacaa13c9a1d81d0f3c321..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBasic_splitQualifiedName.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-XML_Util::splitQualifiedName() basic tests
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util::splitQualifiedName() basic tests=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  basic usage without namespace" . PHP_EOL;
-$return = XML_Util::splitQualifiedName("xslt:stylesheet");
-echo "namespace => " . $return['namespace'] . PHP_EOL;
-echo "localPart => " . $return['localPart'] . PHP_EOL;
-echo PHP_EOL;
-
-echo "TEST:  basic usage with namespace" . PHP_EOL;
-$return = XML_Util::splitQualifiedName("stylesheet", "myNs");
-echo "namespace => " . $return['namespace'] . PHP_EOL;
-echo "localPart => " . $return['localPart'] . PHP_EOL;
-echo PHP_EOL;
-?>
---EXPECT--
-=====XML_Util::splitQualifiedName() basic tests=====
-
-TEST:  basic usage without namespace
-namespace => xslt
-localPart => stylesheet
-
-TEST:  basic usage with namespace
-namespace => myNs
-localPart => stylesheet
diff --git a/lib/tests/XML_Util/XML/tests/testBug_4950.phpt b/lib/tests/XML_Util/XML/tests/testBug_4950.phpt
deleted file mode 100644
index 049e51abb6dd9bd86e59dba75ce3de562f0a6980..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBug_4950.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-XML_Util tests for Bug #4950 "Incorrect CDATA serializing"
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util tests for Bug #4950 "Incorrect CDATA serializing"=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  test case provided in bug report" . PHP_EOL;
-echo XML_Util::createTag("test", array(), "Content ]]></test> here!",
-    null, XML_UTIL_CDATA_SECTION) . PHP_EOL;
-
-?>
---EXPECT--
-=====XML_Util tests for Bug #4950 "Incorrect CDATA serializing"=====
-
-TEST:  test case provided in bug report
-<test><![CDATA[Content ]]]]><![CDATA[></test> here!]]></test>
-
diff --git a/lib/tests/XML_Util/XML/tests/testBug_5392.phpt b/lib/tests/XML_Util/XML/tests/testBug_5392.phpt
deleted file mode 100644
index 47b2270f0796e0d1a68f92f0abe957d2840add13..0000000000000000000000000000000000000000
--- a/lib/tests/XML_Util/XML/tests/testBug_5392.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-XML_Util tests for Bug #5392 "encoding of ISO-8859-1 is the only supported encoding"
---CREDITS--
-Chuck Burgess <ashnazg@php.net>
-# created for v1.2.0a1 2008-05-04
---FILE--
-<?php
-require_once 'XML' . DIRECTORY_SEPARATOR . 'Util.php';
-echo '=====XML_Util tests for Bug #5392 "encoding of ISO-8859-1 is the only supported encoding"=====' . PHP_EOL . PHP_EOL;
-
-echo "TEST:  test case provided in bug report" . PHP_EOL;
-$data = 'This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê';
-
-$replaced = XML_Util::replaceEntities($data, XML_UTIL_ENTITIES_HTML, 'UTF-8');
-
-$reversed = XML_Util::reverseEntities($replaced, XML_UTIL_ENTITIES_HTML, 'UTF-8');
-
-echo $replaced . PHP_EOL;
-echo $reversed . PHP_EOL;
-
-?>
---EXPECT--
-=====XML_Util tests for Bug #5392 "encoding of ISO-8859-1 is the only supported encoding"=====
-
-TEST:  test case provided in bug report
-This data contains special chars like &lt;, &gt;, &amp; and &quot; as well as &auml;, &ouml;, &szlig;, &agrave; and &ecirc;
-This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê