Re: [Proposal] Tools and Utilities::BackPort - updated
| From: | Davey | Date: | Sun, 29 Jun 2003 08:59:26 +0000 |
| Subject: | Re: [Proposal] Tools and Utilities::BackPort - updated | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17833@lists.php.net to get a copy of this message | ||
Davey wrote:
Hey, here is my original message: http://news.php.net/article.php?group=php.pear.dev&article=17807 I would like to add to that everything that has happened since: A) Finished testing, Functions, Classes and Extensions all work now B) Removed dl() of extensions on windows till I have time to make it more fine grained (i.e. not try to dl() on threaded SAPIs) (see D) C) Added the "hide" failsafe, this was intended to be in from the beginning just didn't want to write it in till everything else was working. Basically you use this failsafe when you want to be able to "hide" parts of a program if a dependency fails. Imagine this hypothetical scenario: phpMyAdmin's Process List part of the application requires a certain function, which only appeared in PHP 4.4.8 and is impossible to write in userland (too slow, too hard, whatever). Rather than have the entire application not work on pre-PHP 4.4.8 it just hides that functionality by doing this: if (!isHidden('hypothetical_function')) {Oh, and suggestions for names if BackPort is unnaceptable would be welcomed :D - Davey//code here for process list} This allows for graceful degradation of PHP applications. D) Extensions allow for a userland failsafe too E) Tested on *nix (FreeBSD) and Win32 (WinXP using Apache 1.3.27 and PHP 4.2.2/4.3.3RC2-Dev snapshot) F) extensions will automatically fallthrough to the "hide" or "error" failsafes if the "load" failsafe fails, this works by sing the error levels, if you choose E_ERROR it errors, if you choose E_NOTICE, E_WARNING or E_PARSE it hides. Complete sourcecode can be found here: http://www.its-explosive.net/~davey/PEAR/backport.class.phps and here: http://www.its-explosive.net/~davey/PEAR/backport.class.txt Tests sourcecode can be found here: Functions Example http://its-explosive.net/~davey/PEAR/backport.test.1.phps or http://its-explosive.net/~davey/PEAR/backport.test.1.txt Classes Example http://its-explosive.net/~davey/PEAR/backport.test.2.phps or http://its-explosive.net/~davey/PEAR/backport.test.2.txt Extensions Example http://its-explosive.net/~davey/PEAR/backport.test.3.phps http://its-explosive.net/~davey/PEAR/backport.test.3.txt I hope you guys like this, I'm now going to write it up in my article :) Votes so Far: +1 (Nicos) - Davey