Missing module provides information about modules missing from the filesystem
- in the /admin/reports/status page
- and via
drush mm
Missing modules can cause huge delays (250ms+) to all page loads due to 100's or 1000's of redundant calls to file_scan_directory()
This is different from other projects as it does not automatically disable modules, it provides reports and gives the drush command to re download any missing modules.
This module is designed for using when switching databases between dev, staging and live.
This is a Drupal 7 project
Page:
missing module sandbox
Git repo
git clone --branch 7.x-1.x p4ul@git.drupal.org:sandbox/p4ul/1947350.git missing_module
Cheers,
Paul
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxp4ul1947350git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
p4ul commentedFixed PAReview issues.
Comment #3
rrrob commentedHi Paul,
Great idea for a module. I've had a need for this in the past. PAReview looked good (http://ventral.org/pareview/httpgitdrupalorgsandboxp4ul1947350git)
A few things that jumped out (see http://drupal.org/node/1587704):
5.3 Ensure the code contains a well-balanced amount of inline-comments. - There were zero inline-comments.
Lines 34-36 of missing_module.install - These should be formatted for better readability.
hook_requirements() - If I'm reading the API documentation correctly, the return value array should have four parts. You are missing the description. I think you should dump all of your
$missing_outputinformation into description instead of value. Value can be empty if not applicable.Comment #4
p4ul commentedHi rrrob,
Thanks for reviewing it, if I remove value from array I get the following error.
Notice: Undefined index: value in theme_status_report() (line 2572 of /var/www/nzceronline/nzceronline/modules/system/system.admin.inc).So I have slightly modified it, see attached screenshot.
I have tided up lines 34-36 and added some comments.
Cheers,
Paul
Comment #5
rrrob commentedPaul,
Code fixes look better.
When on /admin/reports/status and have a missing module, your message provides a link to the module page to disable the module. This is a good idea, but if a module does not reside in code, it doesn't show up on the module page.
A couple of thoughts. Maybe you could put a disable link directly next to each module path, that when clicked, the database entries will be removed. Also, in addition to having the Drush download code, could you provide a link to the d.o project itself for those who don't use Drush?
Comment #6
p4ul commentedHi rrrob,
I have added links to the drupal.org projects (based on module name), removed the link to the modules page and added a disable link with a confirmation screen.
See attached screenshot.
Cheers,
Paul
Comment #7
rrrob commentedPaul,
Your new changes look and work great. I guess your next step is to either wait until someone with the proper privileges comes along and reviews your project, or perform the steps outlined to get the review bonus.
Good luck!
Rob
Comment #8
veeraprasadd commentedHi p4ul,
First of all i like this module. I installed your module in local system and verified for the same. It looks promising.
----
No issues found in automated review in ventral.org
----
I just noticed some minor things.
Files:
missing_module.module
missing_module.install
missing_module.module
Line 2 & Line 8: Single blank line is enough instead 2 lines.
Line 6: Unwanted '*' character.
Thanks and Regards,
D. Veera Prasad.
www.drup-all.com
Comment #9
drupik commentedWhat is the difference between this http://drupal.org/project/bootstrap_optimizer ?
Comment #10
p4ul commentedThanks veeraprasadd,
I a have implemented your feedback.
Cheers, Paul
Comment #11
p4ul commentedHi drupik,
This is different to http://drupal.org/project/bootstrap_optimizer in the following ways:
This module is targeted at people that swap databases between different developers / environments. This module is based on the assumptions that:
1. missing modules are bad for performance,
2. if you database is pointing to a module that does not exist this is unexpected and likely the cause of user error and you probably want to find and download it (even if you don't want it you should download it and uninstall it properly).
3. if you no longer need a module on the current environment and you no you don't need it you can disable it.
4. users want to go to one place (admin/reports/status) to see problems with their system.
Bootstrap optimizer seems to make the assumptions that:
1. If a module is no longer in the file system but it is referenced in the database it is fine to delete it from the system table (this ignores any cruft left in database due to not uninstalling it),
2. people will remember to go to obscure pages to check system performance.
Cheers,
Paul
Comment #12
sam hermans commentedHey,
I installed and reviewed your module manually and i think it's a pretty neat and usefull idea ... The only thing that i feel is that you should add is some hook to cron or a 'check' button in an admin page, since your only checking during install hook or when 'drush mm' is called, and i think you should try to use
system_list('module_enabled')instead of running a db_select to gather the active modules.Comment #13
p4ul commentedHi Sam,
The install_hook is actually called every time you visit admin/reports/status (the 'runtime' phase) which is the general place to go to look for problems with your installation.
I have modified the error level from warning to error as per http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_requirements/7 so the message will show up on the admin configuration page.
In terms of system_list this seems to be a more expensive way of getting the same information? It returns a lot of unneeded information in array structures.
Cheers,
Paul
Comment #14
sam hermans commentedYour absolutely right about the runtime, sorry about that.
About the system_list .. not sure what you should do there, using framework functions seems better then a db_select no ? Up to you, and keep up the good work ..
Comment #15
jeffstric commentedHello Paul:
It's a very useful module. But I find a file named:'missing_module.drush.inc', which seems unnecessary, is it a test file? :>
Comment #16
p4ul commentedHi jeffstric,
From what read in the documentation that file is required to run a drush command?
This allows you to run the command `drush mm` after you have updated the site (say from SVN) to see if all the required modules are present.
Cheers,
Paul
Comment #17
jeffstric commenteddrush mmwork fine!I suggest you optimalize the README.TXT
Like:
-- SUMMARY --
This module lists modules that are activated in your database but missing
from your file system.
These can greatly impact the performance of your drupal 7 site.
For example: 1 missing module lead to 900 file_scan_directory() calls
resulting in a wasted 250ms every page load.
-- Usage --
1 To use either view the site status report
/admin/reports/status
2 from drush run
drush mm
-- Module url --
* http://drupal.org/xxx
-- CONTACT --
Current maintainers:
*** - http://drupal.org/user/***
Comment #18
p4ul commentedThanks jeffstric.
I have updated readme.
Comment #19
pierre_cotiniere commentedHi p4ul,
First i found this module interesting, it could be used for my pre-production site.
Just two suggestions :
So you can replace :
$module_name = arg(4);by$view = $form_state['build_info']['args'][0];To avoid this action, in the missing_module_disable_confirm() function, you could check if the module is enabled and return an error message in this case.
Comment #20
jeffstric commentedHi pierre_cotiniere:
I'm not module creator.T_T.
Comment #21
pierre_cotiniere commentedHi jeffstric, fixed.
Comment #22
SamChez commentedVery straightforward module, short and sweet. Consider renaming the link to the module pages to something along the lines of "Module Home" just to make sure people understand that it links to the module home page instead of maybe Drupal itself. I'll be recommending this to my colleagues because it deserves more attention then it's getting at the moment. Nice Work!
Comment #23
SamChez commented*Doublepost
Comment #24
p4ul commentedHi pierre_cotiniere,
Thanks for your input, I have updated the code to use $form_state instead of args().
I am not sure that I needs an extra query to the database to inform the user that the module is already disabled? The end result is the same.
Cheers,
Paul
Comment #25
p4ul commentedHi SamChez,
Thanks for the feedback. I have updated that link text to "link to module on drupal.org".
Cheers,
Paul
Comment #26
pierre_cotiniere commentedp4ul,
it's not to inform, it's to block uninstallation if the module exists on the filesystem, to prevent errors.
With your module, i can disable the system module for example.
Comment #27
sreynen commentedThere are no special privileges required to review projects. Everyone can do it.
I see two blocker issues:
1) The permission for disabling modules is currently "access administration pages" and should be "administer modules". In general, it's very important to use the most specific permission available, so you're not granting any more access than necessary.
2) As #26 said, you're currently disabling modules with no check to confirm they're actually missing code. There's nothing wrong with disabling modules that have code, but that would need to happen differently, with module_disable(), to run the proper hooks in the module. Probably simpler to only allow your module to disable modules with no code rather than write two different processes for disabling modules.
Comment #28
p4ul commentedThanks pierre_cotiniere & sreynen, I can now see where you are coming from and have made those changes.
Cheers,
Paul
Comment #29
pranit84Manual Review
In .module file at line number 38 add t() function for
'title' => 'Disable Module',For line 55 to 60, do proper indentation.
Comment #30
p4ul commentedThanks pranit84, I have made those changes.
Comment #31
izus commentedHi,
This is a useful module, Thanks !
Here is the result of my review :
-
$result = db_select('system')->fields('system', array('filename'))->condition('status', '1', '=')->range(0, 150)->execute();I think it would be better to not hard code '150' without giving the user the possibility to alter it.
I would suggest to add a config form to set this value and use variable_get() instead of the hard coded value.
-
$missing_modules = missing_module_find_missing();You are doing this twice : in the form and in its submit handler, i would suggest to store the result you get from the form builder in $form_state['missing_module']['modules'] for example, so that you can access it in the submit handler and avoid an extra query/foreach/file_exists ;)
-Extra suggestion : For better performance the .module should only contain necessary code : the form builder and its submit handler are not necessary if we are not in 'admin/reports/status/disable_module/%'' page. i suggest to add a
'file' => 'missing_module.form.inc'to your$items['admin/reports/status/disable_module/%']array and move the form definition and submit handler to it.Comment #32
p4ul commentedHi pranit84,
I have removed the t() function as it is not allowed see ventral code review
Comment #33
p4ul commentedHi izus,
Thanks for the feedback, the limit of 150 was a bug and I have removed the range method.
I have cached the missing modules in the form_state variable and moved the form functions out to a different file as per your suggestions.
Tests are now passing
Comment #34
izus commentedHi,
I reviewed it again and tried it locally, it look good for me.
Thanks
Comment #35
klausiSorry for the delay, but you have not listed any reviews of other project applications in your issue summary as strongly recommended in the application documentation.
manual review:
But that are not blockers, so ...
Thanks for your contribution, p4ul!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #36
p4ul commentedThanks klausi!, and thanks for feedback from all the other reviewers.