Re: Conditional package dependencies?
| From: | Greg Beaver | Date: | Sat, 09 Jun 2007 22:12:33 +0000 |
| Subject: | Re: Conditional package dependencies? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-46999@lists.php.net to get a copy of this message | ||
Mark Wiesemann wrote:
> Hi,
>
> we like to publish a new DataSource driver for Structures_DataGrid soon.
> This new driver will combine the current DBQuery and MDB2 drivers (which
> will be marked as deprecated then), and add additional support for PDO.
>
> Because of the usage of a try/catch block around the PDO constructor, we
> need to require PHP 5 for the new driver, while Structures_DataGrid
> itself remains PHP 4 compatible.
>
> The problem now is that we want to make the new SQLQuery driver the
> default driver for PHP 5 users if a SQL query is passed to the bind()
> method. This modified auto-detection would require that our users have
> the new SQLQuery driver installed; otherwise backwards compatibility
> would be broken.
>
> To keep it short: Is there a way to define a conditional dependency that
> requires the new driver if PHP 5 is used, and that defines only an
> optional dependency if PHP 4 is used?
>
> Other suggestions on this problem are also welcome, of course.
Hi,
There is one possibility that may be a bit onerous. Basically, your
only hope is to take advantage of the new pre-download PHP dependency
resolution in PEAR 1.6.0.
What you could do is have the 1.0.x versions of SQLQuery driver simply
be a wrapper for the default php 4 driver, and 1.1.x versions of
SQLQuery driver be the php 5 driver. However, for this to work, you'd
need the API to be BC between 1.1.x and 1.0.x. If the php4/php5
machinations are all under the hood, this solution would actually work
and satisfy PEAR's API BC requirements
Greg