Role memory limit is a small module that allow you to set php_memory_limit per role.

Sandbox: http://drupal.org/sandbox/kevinn/1810870

git clone --branch 7.x-1.x username@git.drupal.org:sandbox/kevinn/1810870.git

Comments

klausi’s picture

Status: Needs review » Needs work

Welcome,

please get a review bonus first. Then try to fix issues raised by automated review tools: http://ventral.org/pareview/httpgitdrupalorgsandboxkevinn1810870git

kevinn’s picture

Status: Needs work » Needs review

Fixed all the issues.

riho’s picture

In the admin page I noticed that entering the value 0 allowed and it basically results in using whatever the system default is, maybe you should point that functionality out somewhere on your readme or project page.
Also the correct abbreviation of megabyte is MB not mb.

Module itself seems to work as intended from what I can tell.

kevinn’s picture

Fixed.

No 0 MB should not be allowed.

mpdonadio’s picture

Status: Needs review » Needs work

role_memory_limit_uninstall() gets all of the roles with user_roles(). This means that if you install module, configure module, delete a role, and then uninstall the module, you will have an orphaned variable in {variable}. The safest way to handle this situation is to implement a hook_user_role_delete(), and variable_del() from there. Doing a wildcard DELETE FROM {variable} may cause long term problems if you (or someone else) ever make a sub-module in the same namespace.

When I uninstalled the module, the variables for administrator, anonymous, and authenticated were left behind.

According to the docs for memory_limit, you can set the value to -1 to not have a memory limit, which is useful in some occasions. Your role_memory_limit_settings_form_validate() will not allow this.

You should also investigate a method to see if you can implement a hook_requirements() to test if this module will work on a user's system.

kevinn’s picture

Status: Needs work » Needs review

Implemented hook_user_role_delete() to delete variable.
Fixed issue where variables administrator, anonymous, and authenticated were left behind.
Set memory limit to -1 works now.

mpdonadio’s picture

Status: Needs review » Reviewed & tested by the community

This issues I found all look resolved.

kevinn’s picture

Status: Reviewed & tested by the community » Needs review

Added hook_requirements to check if it is allowed to change the memory limit.
Changed role_memory_limit_settings_form_validate to not allowed more then 2048 MB.

varunmishra2006’s picture

Hi kevinn

I had checked you module . Everything seem to be fine like coding conventions etc.
But suppose 100 users are online then the system will again and again set the php memory_limit. It does not seems to be right there.
Can you please elaborate why we need such module?

kevinn’s picture

The idea started when i was managing a very big site with over 200 blocks.
So when i tried to go to the blocks page drupal crashed becuse the memory wasn't enough.
With this module you can give an admin more memory and still keep the original memory limit for all other users.

varunmishra2006’s picture

@kevinn

Thanks for explaining. Seems like a good idea under such conditions.

kevinn’s picture

Status: Needs review » Reviewed & tested by the community
mpdonadio’s picture

Status: Reviewed & tested by the community » Needs review

kevinn, two quick things.

The process isn't terribly clear, but the submitter should only set the status to Needs Review. Reviewers then set it to Needs Work or RTBC, as appropriate. As you set it to Needs Review, someone else should take a look at your last round of changes and then set the status. I will try to do this in the next day or two.

You will not get final approval for a very long time unless you get a Review Bonus: http://drupal.org/node/1410826 Your module appeared to be in good shape, but you should double check the tips for ensuring a smooth review: http://drupal.org/node/1187664 Also search the applications for "fixed" to see projects that got approved, and issues that popped up.

mpdonadio’s picture

Status: Needs review » Reviewed & tested by the community

Visually, the last round of changes look OK, but I don't have a server where I can test out the hook_requirements() logic.

cubeinspire’s picture

The error message on line 71 of the admin.inc file is not correct.
It sais: "Maximum allowed is 64 MB."
Where it should say: "Minimum allowed is 64 MB."

All the rest looks good, but please correct that text.
I guess this sandbox should be promoted to full project.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Thanks logicdesign for the additional review.

Thanks for your contribution, kevinn!

I updated your account to let you 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 get 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.

kevinn’s picture

Fixed issue #15.

Thanks everybody.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.