Drupal's regular menu system administration doesn't scale very well. This is due to the fact that for all node edit pages, node type edit pages and vocabulary edit pages (when Taxonomy Menu is active), Drupal loads all menu items from all menus in the system. For large amount of menu items, this slows down the system to an unusably slow speed, or even causes timouts.
This is a known problem in Drupal core. This comment is from the menu module:
// The menu_links table can be practically any size and we need a way to
// allow contrib modules to provide more scalable pattern choosers.
// hook_form_alter is too late in itself because all the possible parents are
// retrieved here, unless menu_override_parent_selector is set to TRUE.
if (variable_get('menu_override_parent_selector', FALSE)) {
return array();
}
Menuperformance takes advantage of this, and sets the variable when installed. It then proceeds to add its own AJAX based parent menu item selector widgets for the node edit, node type edit and vocabulary edit pages.
http://drupal.org/sandbox/firebird/1403852
http://git.drupal.org/sandbox/firebird/1403852.git
This is a Drupal 7 module.
Reviews of other projects:
http://drupal.org/node/1403766#comment-5805046
http://drupal.org/node/1176740#comment-5805010
http://drupal.org/node/1488834#comment-5804686
http://drupal.org/node/1336934#comment-5804640
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupalcs-result.txt | 3.01 KB | klausi |
Comments
Comment #1
firebird commentedComment #2
klausiIt appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Go and review some other project applications, so we can get back to yours sooner.
manual review:
Comment #3
firebird commentedThanks for the feedback. I probably won't have time to work on this in the next couple of months, but I will get back into it.
Comment #4
firebird commentedI think I've covered all the things mentioned in the above post by klausi.
Please review again.
Comment #4.0
firebird commentedAdded D7
Comment #5
firebird commentedAdded PAReview review bonus tag.
Comment #6
targoo commentedHi
1) menuperformance.install
Your install file is empty. If you don't need it you can remove it.
2) menuperformance.js
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers.
See http://api.jquery.com/on/
3) menuperformance.module
t() is not needed for hook_menu in title and description.
4) menuperformance.module
FAPI will NOT sanitize the '#options' attribute on other elements than select boxes. Could open up XSS exploits as the menu could be create by users.
Please check http://drupal.org/node/28984
Thanks,
Comment #7
firebird commented1. Empty install file removed
2. Since Drupal currently ships with jQuery 1.4.4, I've changed the javascript to use delegate() instead. jQuery 1.4.4 doesn't have on().
3. t() calls removed from menu hook.
4. This form alter hook is directly copied from the core menu module, so I figured it would be safe. I tried adding a script tag in the menu name, and it does get stripped out before it's printed. This in done in theme_form_element_label() with a call to filter_xss_admin(). Maybe the documentation that says the values don't get filtered is out of date?
Comment #8
sankatha commentedTested this and found the following bug. Steps to reproduce is as follows. The test was done on a clean Drupal 7.12 installation.
Also I can see why you display the menu mlid before the Parent Item select box but personally think that you should not call two form elements by a same name/title (in this case 'Parent item') because this will be confusing to the end user in a UX perspective. Also removing the PAReview: review bonus tag as you can get it back by reviewing another three issues in the application queue.
Comment #9
klausi@firebird: You are actually right about the security issue, it is not necessary to sanitize #options for checkboxes and radios in Drupal 7 anymore. Thank you for pointing that out, I have updated the documentation page to address that. http://drupal.org/node/28984
That's why I love this review process, always learning something new about Drupal :-)
Comment #10
firebird commented@sankatha: Good catch. Setting a menu item as its own parent was bound to cause trouble...
I've added checks to prevent that, and I've also removed the menu item from a list of its own possible parents. This did require some refactoring of the code, so there may be new bugs introduced.
Ventral.org's online PAReview seems to be down right now, so there may be some coding standard issues. Coder-module didn't find anything, though.
Comment #11
seyv commentedFor the record:
No coding standard issues can be found by Ventral.org's online PAReview
http://ventral.org/pareview/httpgitdrupalorgsandboxfirebird1403852gitPlease update your direct link to your git repository. Will make all of our lives easier.
Despite the code refactoring, I can't find any bugs so kudos ;)
+1
Comment #11.0
seyv commentedAdded links to reviewed projects
Comment #12
frobCouple of quick notes,
There is an error in your README.txt file. Your how to use directions say to go to /config/user-interface/menuperformance it should be admin/config/user-interface/menuperformance
I would also recommend putting this link and information into a drupal_set_message when the module is enabled. Not everyone reads the README.txt until something goes wrong. It does help to have a "how to test" section in the issue summery.
Also your README isn't formatted correctly. A couple of the lines end on the first letter. I like to give short words a little bit more of a buffer (78 chars wide) to help people who use vi and the console.
On the bright side it does pass PAReview with no errors and it works. I installed with no real issues (just not knowing why it wasn't working till I read the README.txt) and I like the concept.
Comment #13
firebird commentedFixed. Not that I think a misformatted README file should prevent a project from being assigned full project status... ;)
I also added the notification you suggested, good idea.
Comment #14
frobAutomated review issues:
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
Source: http://ventral.org/pareview - PAReview.sh online service
Fix this and I will rtbc, the issue wasn't so much the misformed README.txt file as much as it was the wrong url in the README.txt file.
Comment #15
firebird commentedAdded filter_xss() and t(), checked with PAReview again.
Thanks for reviewing!
Comment #16
lawik commentedThe filter_xss() and t() is there. Marking rtbc.
Comment #17
patrickd commentedComment #18
patrickd commenteddrupal_set_message(filter_xss(t('Menuperformance module activated. To take the module into use, <a href="@baseurl/admin/config/user-interface/menuperformance">go to the settings page</a> and check the checkbox.', array('@baseurl' => $base_url))));It makes no sense to add both, t() and filter_xss() as t() already filters all used variables (prefixed with @ or %) and the text your filtering is static => contains no user input and is therefore harmless.
Also there's no need to add the @baseurl to the path - but you have to put the path though url().
drupal_set_message(t('Menuperformance module activated. To take the module into use, <a href="!url">go to the settings page</a> and check the checkbox.', array('!url' => url('admin/config/user-interface/menuperformance'))));if possible you should rather use the "weight" field in the system table to control in which order hooks should be implemented instead of using "hook_module_implements_alter()" which is more performance intensiveAnyways, there are a lot of TODO's marked, also related with access checking, you really should resolve these issues before thinking about creating a release. Also don't show developer information to normal users (you probably planned to remove that anyway) but a debug mode is always good ^^
Beside that I think you know what your doing and I like how detailed your documenting your code inline ;)
Thanks for your contribution and welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, also, for your patience with the review process and for your help in the queue! 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.
As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.
Thanks to the dedicated reviewer(s) as well.
Comment #19
patrickd commentedComment #20
klausiOne correction to #5 in Patrick's review: it is quite the opposite: do not juggle with module weights where possible, as this is unreliable and unpredictable. Hooks are cached, so there is no performance penalty for using hook_module_implements_alter().
Comment #21
patrickd commentedOhkay, good point! (shit I've got to patch my modules...)
thanks :)
Comment #22
firebird commentedThanks to all the reviewers! I've promoted the project, and will do the first release in a few moments.
In response to patrickd's comments:
1) I've improved the project page and the readme file.
2) Changed the line generating the message as per the suggestion.
3) Added the settings page to the info file.
4) Added a newline.
5) Ignored.
6) I didn't do this, since it's not Menuperformance that defines the variable. The separate activation checkbox is there for the same reason.
I've also gone through my TODOs, added necessary access checks, and done the TODOs, apart from one, which I added as a feature request in the projects issue queue.
Comment #23.0
(not verified) commentedAdded direct git link