Seeking a Moodle validation tool

Seeking a Moodle validation tool

by Clem Smith -
Number of replies: 0
First, I should confess that I'm quite lazy when it comes to doing things for which automation is available. That said, my current "I am far too lazy to do this" issue is checking customisations for deprecated functions. Very soon, it will be joined by checking version.php files in some of our home-grown plug-ins for all the required fields ($plugin->component comes to mind, since they all lack this and it will be required for M3.0).


So, I thought I would come here and ask whether there is either a page available from Moodle at which I can upload a file and have it checked for deprecated functions and, in the case of version.php, for missing bits such as listed here: https://docs.moodle.org/dev/version.php OR a plug-in available that would do something similar for me. Note: I have not found any plug-ins so far that can do this, but it is possible my search fu is low.


Now, if neither of these things exists, would there be interest in such a thing from other developers? As we've established, I'm far too lazy to have to do this manually, yet I am definitely ambitious enough to undertake automating this so that I can go back to being lazy smile In fact, I've given some thought to how this might work as a plug-in. The best idea I have so far is this:

Create a page within Moodle that lets you upload a copy of lib/deprecatedlib.php and specify the directory|ies you wish searched. That file would then be parsed for the names of the functions contained within. Next, the logic would search the specified directory for any instances of the functions found in the uploaded deprecatedlib.php file. Finally, it would print a report on the page listing the deprecated functions in use, the files in which they are still in use, and the lines on which the function was found. Essentially, the report would give you the same information as if you executed "grep -nr 'add_to_log' ./" from the command line.

Obviously, this should only be available to site administrators. The primary idea being that you would upload a copy of deprecatedlib.php for the Moodle version you wish to upgrade to and get a report helping you quickly remove deprecated functions from use in your code. I'm not sure whether a scan of the entire Moodle installation should be allowed, as I am not sure how long that would take or how hard it would hit the server's resources. I am leaning toward not allowing it because it keeps users from putting themselves in a bad situation and because I don't really think it would be terribly useful, even if it is light on the server. Mostly, I figure people will be interested in scanning particular directories because developers know where the custom code is in their Moodle installation and I don't think any of us have the patience to scan the whole Moodle installation.


Thoughts, suggestions, comments, criticisms? Thanks for any and all, in advance!

Average of ratings: -