Well I used this subject for this thread because it was on "group permissions" (simple mode) where I detected it, but I think it may appear on other sections too. I think it may be related to the amount of data -or at least the amount of fields- that can be transferred from a form using the post method.
To check it I did the following, starting with an totally empty forum:
1) create a "category 1" category (I think this may be optional)
2) create 196 forums inside, I named them "forum 001" to "forum 196", all of them have the "default" set of permissions
3) go to "groups"/"manage groups" and enter the permissions form or any of them or create a group just for the test and enter its permissions form
4) change some of the "not moderator" to "is moderator"
5) go to the bottom of the form and click "submit"
6) you'll be redirected again to the same permissions form, instead of get the "permissions have been updated" notification, and of course the permissions haven't been changed at all
7) go to forums management and delete the "forum 196" forum
8 ) repeat the steps 3, 4 and 5; this time you'll get the notification and the permissions will be changed
Why I think it's a problem with the amount of data or the amount of fields? Because in the real forum I'm setting up, I have 184 forums at this moment, 11 of them have the "private" set of permissions, so in the "group permissions control" I have 184 "moderator" fields plus 11 "access" fields, 195 in total, and when I create another forum (not private) the problem happens (185+11=196) and it happens too if I change another of the existing forums to private (184+12=196).
Unable To Edit Group Permissions With Too Many Forums.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Nobody has something to comment about this? At least confirm the problem... I'm stuck because I cannot create more forums. Well I can create the forums, but I cannot manage any permissions after that, since I pass the limit of 195. :?
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
This is really strange... In any case it is not suitable having so many subforums, because this setup will require an high amount of memory consumption (even caching files will be big). You will experience even high generation time with all these forums.
In your case the error could be related even to "OUT OF MEMORY" error... try to raise memory limit.
If you can provide a backup of your setup I may try as well to replicate the error.
In your case the error could be related even to "OUT OF MEMORY" error... try to raise memory limit.
If you can provide a backup of your setup I may try as well to replicate the error.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Yes, I know it's a large forum. :? But I'm not sure if I can cut down the number of forums... Anyway the problem would arise too with the half of forums if all of them are private, that is 98 forums + 98 privates = 196.
I'll send you a copy of this forum's DB later.
Thanks.
I'll send you a copy of this forum's DB later.
Thanks.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
This is the backup of the test forum with 196 forums created. For me fails with this number of forums and start working again if I delete one forum, as I explain in the first post.
Thanks.
Thanks.
| too_many_forums - backup_1206477207_20080325_4d30e8e105d76bf9.sql.gz | ||
| Description: | ![]() Download |
|
| Filename: | too_many_forums - backup_1206477207_20080325_4d30e8e105d76bf9.sql.gz | |
| Filesize: | 63.2 KB | |
| Downloaded: | 151 Time(s) | |
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Oops, I forgot to say that the table prefix is "prueba_", the admin user is "admin" and the password "123456".
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Well, I think I found the cause of this problem.
I added this piece of code to the beginning of 'admin_ug_auth.php' to echo the parameters passed to the script:
For 195 forums (working) I got this output when clicking on submit:
For 196 forums (not working) I got this output when clicking on submit:
As you can see "submit" has disappeared.
For 197 forums (not working) I got this output when clicking on submit:
Here not only "submit" has disappeared, but "redirect" did it too.
I found a page about the size limit for the URL query string, saying this:
So as I suspected it seems to be related to the size of the data sent to the server, and not with a "out of memory" error. The problem now is how to fix or workaround this… without reducing the numbers of forums, I mean.
I added this piece of code to the beginning of 'admin_ug_auth.php' to echo the parameters passed to the script:
- while(list($key, $value) = each($HTTP_GET_VARS))
- {
- echo $key . '=' . $value . '&';
- }
- while(list($key, $value) = each($HTTP_POST_VARS))
- {
- if ($key=='moderator')
- {
- echo $key . '=' . $value . '(' . count($value) . ')' . '&';
- }
- else
- {
- echo $key . '=' . $value . '&';
- }
- }
For 195 forums (working) I got this output when clicking on submit:
- sid=a4f53b396ab4707180794bbb4ca15a9e&moderator=Array(195)&mode=group&adv=0&g=7&redirect=&submit=Submit&
For 196 forums (not working) I got this output when clicking on submit:
- sid=a4f53b396ab4707180794bbb4ca15a9e&moderator=Array(196)&mode=group&adv=0&g=7&redirect=&
As you can see "submit" has disappeared.
For 197 forums (not working) I got this output when clicking on submit:
- sid=a4f53b396ab4707180794bbb4ca15a9e&moderator=Array(197)&mode=group&adv=0&g=7&
Here not only "submit" has disappeared, but "redirect" did it too.
I found a page about the size limit for the URL query string, saying this:
Quote:
So as I suspected it seems to be related to the size of the data sent to the server, and not with a "out of memory" error. The problem now is how to fix or workaround this… without reducing the numbers of forums, I mean.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Ok, forgot the page said above, since it's about GET and the forum uses POST. I found this other page:
http://httpd.apache.org/docs/2.2/en...equestfieldsize
It seems that the default limit for the request header in apache is 8190 characters.
http://httpd.apache.org/docs/2.2/en...equestfieldsize
It seems that the default limit for the request header in apache is 8190 characters.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
I found a solution! :mryellow: Well, it's not a full solution, but it makes more difficult that this problem could happen.
What I would do is send to the server only the values of the "select" fields which have been changed instead of sending the whole list of fields. I'll post the code when I finish the modifications.
What I would do is send to the server only the values of the "select" fields which have been changed instead of sending the whole list of fields. I'll post the code when I finish the modifications.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Last edited by hal9000 on Tue 06 May, 2008 12:07; edited 2 times in total
Ok, I think I got it working, so here we go with the modifications.
1) First of all upload the attached "del_unchanged_selects.js" file to "/templates/common/js". This is the content of that file:
2) Apply the changes to the file "admin_ug_auth.php":
3) Apply the changes to the file "auth_ug_body.tpl":
And that’s all. Now a large amount of forums only will cause the problem if too many of values are changed at the same time, what is less probable to happen.
1) First of all upload the attached "del_unchanged_selects.js" file to "/templates/common/js". This is the content of that file:
- var select_id = new Array();
- var select_value = new Array();
- function remove_object(id)
- {
- e=document.getElementById(id);
- e.parentNode.removeChild(e);
- }
- function save_initial_values()
- {
- my_form=document.getElementById('acl_form');
- el=my_form.elements;
- for (i=0; i<el.length; i++)
- {
- if (el[i].type == 'select-one' && el[i].id != '')
- {
- select_id.push(el[i].id);
- select_value.push(el[i].value);
- }
- }
- }
- function remove_unchanged_selects()
- {
- for (i=0; i<select_id.length; i++)
- {
- s=document.getElementById(select_id[i]);
- if (s.value == select_value[i])
- {
- remove_object(select_id[i]);
- }
- }
- }
- if (window.attachEvent)
- {
- window.attachEvent("onload", save_initial_values())
- }
- else
- {
- window.onload = save_initial_values();
- }
2) Apply the changes to the file "admin_ug_auth.php":
- #
- #-----[ OPEN ]------------------------------------------
- #
- adm/admin_ug_auth.php
- #
- #-----[ FIND ]------------------------------------------
- #
- for($j = 0; $j < count($forum_auth_fields); $j++)
- {
- $auth_field = $forum_auth_fields[$j];
- while( list($forum_id, $value) = @each($_POST['private_' . $auth_field]) )
- #
- #-----[ BEFORE, ADD ]------------------------------------------
- #
- $used_forums = array();
- #
- #-----[ FIND ]------------------------------------------
- #
- for($j = 0; $j < count($forum_auth_fields); $j++)
- {
- $auth_field = $forum_auth_fields[$j];
- while( list($forum_id, $value) = @each($_POST['private_' . $auth_field]) )
- {
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- if ( !isset($used_forums[$forum_id]) )
- {
- $sql = ( $mode == 'user' ) ? "SELECT aa.*, g.group_single_user FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND aa.forum_id = $forum_id AND g.group_single_user = 1" : "SELECT * FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id AND forum_id = $forum_id";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql);
- }
- if ($row=$db->sql_fetchrow($result))
- {
- for ($k=0; $k < count($forum_auth_fields); $k++)
- {
- $change_acl_list[$forum_id][$forum_auth_fields[$k]]=$row[$forum_auth_fields[$k]];
- }
- }
- $used_forums[$forum_id]=1;
- }
- #
- #-----[ FIND ]------------------------------------------
- #
- ( isset($auth_access[$forum_id]['auth_mod']) && $change_mod_list[$forum_id] != $auth_access[$forum_id]['auth_mod'] ) ||
- #
- #-----[ BEFORE, ADD ]------------------------------------------
- #
- isset($change_mod_list[$forum_id]) && (
- #
- #-----[ FIND ]------------------------------------------
- #
- ( !isset($auth_access[$forum_id]['auth_mod']) && !empty($change_mod_list[$forum_id]) )
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- )
- #
- #-----[ FIND ]------------------------------------------
- #
- $optionlist_acl = '<select name="private[' . $forum_id . ']">';
- #
- #-----[ REPLACE WITH ]------------------------------------------
- #
- $optionlist_acl = '<select id="private_id_' . $forum_id . '" name="private[' . $forum_id . ']">';
- #
- #-----[ FIND ]------------------------------------------
- #
- $optionlist_acl_adv[$forum_id][$k] = '<select name="private_' . $field_name . '[' . $forum_id . ']">';
- #
- #-----[ REPLACE WITH ]------------------------------------------
- #
- $optionlist_acl_adv[$forum_id][$k] = '<select id="private_id_' . $field_name . '_' . $forum_id . '" name="private_' . $field_name . '[' . $forum_id . ']">';
- #
- #-----[ FIND ]------------------------------------------
- #
- $optionlist_mod = '<select name="moderator[' . $forum_id . ']">';
- #
- #-----[ REPLACE WITH ]------------------------------------------
- #
- $optionlist_mod = '<select id="moderator_id_' . $forum_id . '" name="moderator[' . $forum_id . ']">';
3) Apply the changes to the file "auth_ug_body.tpl":
- #
- #-----[ OPEN ]------------------------------------------
- #
- templates/common/ACP/auth_ug_body.tpl
- #
- #-----[ FIND ]------------------------------------------
- #
- <form method="post" action="{S_AUTH_ACTION}">
- #
- #-----[ REPLACE WITH ]------------------------------------------
- #
- <form id="acl_form" method="post" action="{S_AUTH_ACTION}" onsubmit="remove_unchanged_selects()">
- #
- #-----[ FIND ]------------------------------------------
- #
- </form>
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- <script type="text/javascript" src="{FULL_SITE_PATH}{T_COMMON_TPL_PATH}js/del_unchanged_selects.js"></script>
And that’s all. Now a large amount of forums only will cause the problem if too many of values are changed at the same time, what is less probable to happen.
Last edited by hal9000 on Tue 06 May, 2008 12:07; edited 2 times in total
| del_unchanged_selects_(fixed2).rar | ||
| Description: | Second fixed version of "del_unchanged_selects.js". | ![]() Download |
| Filename: | del_unchanged_selects_(fixed2).rar | |
| Filesize: | 414 Bytes | |
| Downloaded: | 376 Time(s) | |
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Interesting problem hal, well done for fixing it - I never really paid much attention to the way data was parsed in the forum management...
Any idea why the script even parses data through $_GET, and not just use $_POST variables? I mean when you submit this data, it goes to the same page, right? You only need to transmit data through the URL if you want it to traverse many pages... with $_POST you can't really do that, but you don't have any character length limitation...
Any idea why the script even parses data through $_GET, and not just use $_POST variables? I mean when you submit this data, it goes to the same page, right? You only need to transmit data through the URL if you want it to traverse many pages... with $_POST you can't really do that, but you don't have any character length limitation...
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Thanks, moreteavicar. Sorry, that was just an error when I was searching information on what the cause could be. Indeed the data is passed through $_POST, that's why the problem is weird. Anyway it seems that there could be limitations too for the POST method on a server basis, so may be some people can have more forums that 195 and not encounter this problem because of their servers, but I think is better to apply this way of selectively send the data, so there is less risk of have this problem.
moreteavicar wrote: [View Post]
Thanks, moreteavicar. Sorry, that was just an error when I was searching information on what the cause could be. Indeed the data is passed through $_POST, that's why the problem is weird. Anyway it seems that there could be limitations too for the POST method on a server basis, so may be some people can have more forums that 195 and not encounter this problem because of their servers, but I think is better to apply this way of selectively send the data, so there is less risk of have this problem.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Oops... I realized today that I made a mistake on "del_unchanged_selects.js".
I changed the code and the file in the previous post so it works fine with FireFox.
I changed the code and the file in the previous post so it works fine with FireFox.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
I didn't have the time to check this yet... :roll:
If you can create a premodded package with just the changed files respect to a standard package, I will add it in next patch as addon.
Thanks.
If you can create a premodded package with just the changed files respect to a standard package, I will add it in next patch as addon.
Thanks.
Subject: Re: Unable To Edit Group Permissions With Too Many Forums.
Sure, I'll do in the first chance I have. ;)
Page 1 of 2
You cannot post new topicsYou cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events
This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by Icy Phoenix based on phpBB
Generation Time: 0.281s (PHP: 14% SQL: 86%)
SQL queries: 16 - Debug Off - GZIP Enabled
