Re: new IM driver for Image_Transform
| From: | Dan Allen | Date: | Sun, 26 May 2002 07:17:10 +0000 |
| Subject: | Re: new IM driver for Image_Transform | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6419@lists.php.net to get a copy of this message | ||
Okay, we are getting somewhere and this is good...let me make some
final comments here...
CMD.php is now System/Command.php and there should be a new release
on the pear.php.net site soon...so I am able to make changes and I
am going to try to get which() to be more useful on windows.
Let's go with if it is windows then we use the constant path (please
document this constant) and if it is unix we can autodetect. But
either way, we can pass a full path into the class as an override,
regardless of the system.
As far as using exec(), please view the source code in
System_Command/Command.php in the CVS tree. I have a full interface
for capturing both stdout and stderr, with appropriate PEAR error
objects being created. We should really use this class if we are
going to run stuff from the commandline. I will help you with it if
you are willing to look it over a bit first.
The way to capture errors is as follows. You run
yourcommand --option value 2>/tmp/errorfile
Then you read the errorfile if the exit status was negative to find
out if any errors were captured. stdout is passed to the variable
you pass by reference to exec() and the exit status is set on yet
another variable passed by reference. But the System_Command class
will do all this dirty work, as well as escaping shell args and
everything...so please try to use it. If you find any bugs or
problems with them, I can adjust the class to work appropriately.
> Imagine anyone putting some code into production without testing it.
I know, it would be bad, but the point of PEAR is to be able to
centrally control the traceback (well, traceback is more of a future
thing, but we are planning for it) of errors so that they can be
handled in a consistent manner.
> That was the problem I had as I couldn't capture or display any error
> message without using passthru()
I can do this in System_Command, please check out the docs for it.
> Q: Can we autodetect if the curl module is loaded into PHP? I'm sure
> there's a simple way but I've never looked...
extension_loaded('curl');
> But given that these errors should never occur in production isn't this
> overkill? Error checking for the sake of it?
Error checking is never overkill, it is proper...ask anyone here,
PEAR error checking is sacred.
> Talking of driver files, what is the preferred way to make these changes in
> CVS? Delete everything and start again? I've started reorganizing the
> files locally but am unsure how to make the changes in the Repository.
CVS cannot "move" a file, so you have to do
cvs delete
cvs add
but then you loose the revisions ;(, just a shortcoming of CVS. You
can move the revisions, but it must be done manually and we don't
have the ability to do that as PEAR users.
Hope that helps!
Dan
--
________________________________________________________________
Daniel Allen, <dan@mojavelinux.com>
http://www.mojavelinux.com/
________________________________________________________________
"I'm old enough to know better, but still too young to care."
________________________________________________________________