Verifier Library - 0.3 |
[eluser]Pygon[/eluser]
In response to this thread: http://ellislab.com/forums/viewthread/74377/ I've created the following Verifier class. Current version is 0.3 Changelog: Version 0.3 -Fixed dependancies -Added more accurate verification for Image_lib (actually checks that the library’s extension option (gd,gd2,imagemagik,netpbm is loaded) Version 0.2 -Added extension checks ( check_has_extension() ) -Added extension dependancy ( check_dependancy(), check_all_dependancies() ) -Added get array of extensions=>versions ( get_extensions() ) -Fixed check_writeable() Comments and suggestions are appreciated. http://pastebin.com/f5f216e40
[eluser]Pygon[/eluser]
TODO: CI Library Dependancy Checker (library to check) >> true | Missing Dependancies Image Support Checker (gd,gd2,imagemagik) >> specific type to check ? true | false -or- >> Array( extensions => array(name => version), types => array( image_types ) ) | false Problem: Image types not available for imagemagik
[eluser]Derek Allard[/eluser]
rock ON Pygon. Nice, thanks. When this gets finished up, I promise you we'll look at how we can best use this in CI.
[eluser]wiredesignz[/eluser]
Just a note Pygon, you should remove your email address from your code or obfuscate it somehow, Google loves this forum and spammers love to use Google to find addy's. Oops too late, its already been indexed. :lol:
[eluser]Pygon[/eluser]
Derek: Thanks, hopefully I'll get it built up relatively quickly. wired: I'm not terribly worried since it's mostly a junk box for CI forum replies, but thanks -- removed.
[eluser]Seppo[/eluser]
Pygon: I like this project. One bug, in the check_writeable method you forgot the $this-> =) I'm gonna check for some CI required versions requirements and I'll post it.
[eluser]Seppo[/eluser]
This is as much as I could do... I have to use many native PHP functions instead of the library, because some loaded extensions, after phpversion() return FALSE... for example phpversion('xml') returns false (at least on my enviroment) so I had to use extension_loaded when I just needed to know that the extension is loaded, and didn't care about the version. Code: $this->load->library('verifier');
[eluser]MadZad[/eluser]
Glad this had gotten some attention. I also started thinking about this a bit and believe there are two separate concerns requiring two different approaches. First, find issues that will cause an outright failure when you try to fire up CodeIgniter (system/codeigniter/CodeIgniter.php). The write permissions on the logs directory fall in this category, and is what got me started on this journey. Any controller trying to use the Verifier class to check existence/permission can't work, because you'll never get to the controller - CodeIgniter.php will fail while loading classes. The check has to be after you've defined where the system directory is, and before getting to the class loading. So, I think this will be a system directory hack until it is deemed worthy (if ever) to be placed in a future CI release. Here's a not-too-dirty approach: Require a new file before the last line of index.php: Code: require_once BASEPATH . 'codeigniter/Diagnostic' . EXT; Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Now, this does place directory checking overhead into every single page load, which is obviously inefficient - but that should be minuscule compared to the rest of a page request's processing. I also thought was that it's good to have this in a separate file for readability/expansion ease, the location deserves to be "core", and you can always comment out the ''require_once'' in index.php when you're confident with the app. Exiting on failure is pretty draconian, but justified (imho) for fatal situations like this. So I see this approach as "OK", but would welcome better ideas. The second kind of verification would be any Verifier checks that should/could be performed assuming CI itself is functional. That would be the code wonderfully supplied by Pygon and Seppo. I'm going to take on some expansion/packaging of that, and will hopefully be able to add some value. Testing help will be greatly appreciated, as I may accidentally tailor my code to our app setup instead of a normal CI install.
[eluser]Tom Glover[/eluser]
Very Good idea, this would save dev's time in location faults in why there logs or cache is not being written. it would also reduce the number of cache and session related bugs reported.
[eluser]Pygon[/eluser]
Finally had a little time again to play around on this: -Added extension checks ( check_has_extension() ) -Added extension dependancy ( check_dependancy(), check_all_dependancies() ) -Added get array of extensions=>versions ( get_extensions() ) -Fixed check_writeable() http://pastebin.com/f424243bc please post comments/suggestions Time test: Code: get_extensions(); above including: Code: $this->load->library('verifier'); |
Welcome Guest, Not a member yet? Register Sign In |