01167: only analyze cookbooks that are actually installed

Summary: only analyze cookbooks that are actually installed
Created: 2010-02-07 06:04
Status: Closed - documentation updated
Category: Documentation
Assigned:
Priority: 2
Version: 2.0 and after
OS: n/a

Description: The Site Analyzer (analyze.php) currently goes directly to the cookbook directory and checks every single script that exists there. An administrator may have tested a script and then uninstalled it via config.php or farmconfig.php without deleting it from cookbook/ but it will still be analyzed.

Site Analyzer should only report on recipes that are actually installed rather than reporting on all recipes that exist in the cookbook directory.

Showing unnecessarily (uninstalled) cookbooks has multiple negative side effects:

  1. administrators may become confused, thinking that they have the given recipe installed even though they cannot find it in config.php or other configuration scripts ("I was sure I uninstalled that recipe -- how is it still being reported?!")
  2. administrators may not pay as much attention to important and valid updates because they have become inured by SiteAnalyzer giving them inapplicable and irrelevant messages about recipes that are not even installed

Since the $RecipeInfo line is already stored as an array, why not use it as such instead of actually parsing the PHP script? In the ?action=analyze handler, simply look at the existing elements of $RecipeInfo (this should indicate which recipes are installed) and list those... Presumably farmconfig.php, config.php, and any page- or group-specific config files have already been processed and thus this array has already been populated and is completely available...

If a more thorough scan is a desirable feature, why not make it an option (a checkbox on the form in SiteAnalyzer)? I have put together the (very simple) modification to analyze.php in the attachment Attach:analyze.php.txt. SiteAnalyzer page just needs to be modified to include the checkbox and use it to construct the URL with a &cookbookdir=1 appended...

$RecipeInfo is not available if a recipe is included conditionally if($action=='edit') { include(...);} and a number of recipes are. --Petko February 07, 2010, at 06:18 AM

Good point. I hadn't thought of that. 3 solutions present themselves (in addition to the fact that I am lowering the priority from 3 to 2):

  1. The "make it optional" checkbox above, but perhaps defaulting to checked since, as you've shown, there could be important recipes missed without this step...
  2. Somehow mark the ones that were not actually included with a footnote message that it may be irrelevant or it may be conditionally included. I'd be happy to take a look at this, but I don't think the script associated with the SiteAnalyzer page is part of pmwiki. If you could drop me an email with that script I'd be happy to try implementing something to see what you think.
  3. Put some kind of message on the results page that informs administrators not to worry if they find recipes reported which are actually not installed. This would at least take care of the negative side-effect #1 from above.

Feel free to improve the page PmWiki:AnalyzeResults and add any relevant footnotes or messages. --Petko February 07, 2010, at 04:24 PM

Hmmm... I made a change. Part of it comes through to SiteAnalyzer and part of it doesn't... The part on the line below doesn't seem to appear...?

Oh, never mind, I figured it out. It is being (:include ...:)ed via section headers and so the start of my reference section ended the old section... It appears to be working now, as long as the wording is satisfactory. As far as I'm concerned this entry can be closed.


PS On a separate note, why is *.php a disallowed extension in the PITS group? It seems logical that people would be submitting suggested PHP scripts in this group to solve the problems they are reporting...?

While it was already defined as an $UploadsExtSize entry, the $UploadsExts entry was forgotten, now fixed. Attach:hello.php Petko