[drupal-devel] question about external php module dependencies
As a Drupal newbie I ask: what's the policy on requiring other PHP/PEAR modules in order to implement my module? For example, I would like to build on the following: * PEAR/XML_Serializer * PEAR/HTTP_Request Also, if there is a good summary of developer notes on PHP4/PHP5 support, I would appreciate a pointer. I have only experience with PHP4 up til now, and have questions about how to ensure my module works on all Drupal installations. Thanks -- Brian Del Vecchio | bdv@hybernaut.com | http://hybernaut.com/
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 We try not to require any external code for Drupal, especially since many hosts might not have PEAR available. That said, you are free to build your contrib module however you need to, but you aren't allowed to include non-GPL code with your module. Have those classes perhaps been released as seperate projects? On 20 Apr 2005, at 5:22 AM, Brian Del Vecchio wrote:
As a Drupal newbie I ask: what's the policy on requiring other PHP/PEAR modules in order to implement my module? For example, I would like to build on the following:
* PEAR/XML_Serializer * PEAR/HTTP_Request
Also, if there is a good summary of developer notes on PHP4/PHP5 support, I would appreciate a pointer. I have only experience with PHP4 up til now, and have questions about how to ensure my module works on all Drupal installations.
Thanks -- Brian Del Vecchio | bdv@hybernaut.com | http://hybernaut.com/
- -- Adrian Rossouw Drupal developer and Bryght Guy http://drupal.org | http://bryght.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCZhqGgegMqdGlkasRAkt/AJ9RvG3gctKCs9rUQKiCZZIPpmlXUACeJFGb QYBFTGifBLrL0g/z7X729sA= =DmO9 -----END PGP SIGNATURE-----
How to use PEAR in a contributed module is a question I've been looking at as well.
We try not to require any external code for Drupal, especially since many hosts might not have PEAR available.
It's easy enough to use PEAR packages without a PEAR install, but it requires manual configuration (i.e., extraction of packages into correct directory structure) something that goes beyond what should be expected for module installation...
... you aren't allowed to include non-GPL code with your module.
and few packages are GPL (the ones you cite being PHP and BSD, respectively). So, perhaps, the best approach is to provide a preconfigured PEAR directory as a separate download (e.g., on your server/website, linked in the module install text). Here's a quick idea of a module to facilitate PEAR use. I've put in help text, but it's really for module authors rather than users. You'll see it does nothing but set the include path! But I suppose it could also use directory uploading to put the needed PEAR files in place. <?php // $Id: /** * @file * Facilitates the use of PEAR packages in Drupal. */ // Add the PEAR/ directory to your include path. $path = $_SERVER['PATH_TRANSLATED']; $dir = substr($path, 0, strrpos($path, '/modules/') + 1); ini_set('include_path', $dir . 'PEAR/' . PATH_SEPARATOR . ini_get('include_path')); /** * Implementation of hook_help(). */ function pear_help($section) { switch ($section) { case 'admin/help#pear': $output = t(" <h3>Using PEAR</h3> <p>The PEAR module is designed to facilitate use of PEAR packages within Drupal in cases where the package are not available on the host server. In this case (since most PEAR packages are not GPl and therefore can't be included within Drupal.org module downloads), it's necessary to post packages for separate download and install. To use the module: <ul> <li>Install your desired PEAR package(s), and all of their dependencies, in a directory called PEAR. For example, for the packages HTTP_Request and XML_Serializer, the install might include: <pre>PEAR -HTTP -Request.php -Request -... -XML -Serializer.php -Serializer -...</pre> </li> <li>Create a tar.gz file of the PEAR directory and it contents, and post it for download (e.g., on your website/server).</li> <li>Instruct your users to download and uncompress the tar.gz file into their base Drupal directory.</li> <li>Enable the PEAR module.</li> </ul> "); return $output; case 'admin/modules#description': return t('Facilitates the use of PEAR packages in Drupal.'); } } ?> ________ Nedjo Rogers Learning Technologies Developer GroundWorks Learning Centre (250) 360-0799 nedjo@gworks.ca
On Tue, Apr 19, 2005 at 11:22:12PM -0400, Brian Del Vecchio wrote:
* PEAR/HTTP_Request
I haven't looked at this, but I think you might want to look at http://drupaldocs.org/drupal_http_request. -Neil
Neil, thanks for the valuable pointer. On 4/20/05, neil@civicspacelabs.org <neil@civicspacelabs.org> wrote:
I haven't looked at this, but I think you might want to look at http://drupaldocs.org/drupal_http_request.
-- Brian Del Vecchio | bdv@hybernaut.com | http://hybernaut.com/
participants (4)
-
Adrian Rossouw -
Brian Del Vecchio -
Nedjo Rogers -
neil@civicspacelabs.org