Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 2
Goto page 1, 2  Next
 
Reply with quote Download Post 
Post Unable To Edit Group Permissions With Too Many Forums. 
 
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).
 



 
hal9000Send private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post 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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.

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: 148 Time(s)

 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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".
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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:
Code: [Download] [Hide]
  1. while(list($key, $value) = each($HTTP_GET_VARS))  
  2. {  
  3. echo $key . '=' . $value . '&';  
  4. }  
  5. while(list($key, $value) = each($HTTP_POST_VARS))  
  6. {  
  7. if ($key=='moderator')  
  8.     {  
  9.     echo $key . '=' . $value . '(' . count($value) . ')' . '&';  
  10.     }  
  11. else  
  12.     {  
  13.     echo $key . '=' . $value . '&';  
  14.     }  


For 195 forums (working) I got this output when clicking on submit:
Code: [Download] [Hide]
  1. 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:
Code: [Download] [Hide]
  1. 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:
Code: [Download] [Hide]
  1. 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:
The spec for URL length does not dictate a minimum or maximum URL length, but implementation varies by browser. On Windows: Opera supports ~4050 characters, IE 4.0+ supports exactly 2083 characters, Netscape 3 -> 4.78 support up to 8192 characters before causing errors on shut-down, and Netscape 6 supports ~2000 before causing errors on start-up.
 
Note that there is no limit on the number of parameters you can stuff into a URL, but only on the length it can aggregate to.


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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Unable To Edit Group Permissions With Too Many Forums. 
 
I found a solution!    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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Unable To Edit Group Permissions With Too Many Forums. 
 
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:
Code: [Download] [Hide]
  1. var select_id = new Array();  
  2. var select_value = new Array();  
  3.  
  4. function remove_object(id)  
  5. {  
  6.     e=document.getElementById(id);  
  7.     e.parentNode.removeChild(e);  
  8. }  
  9.       
  10. function save_initial_values()  
  11. {  
  12.     my_form=document.getElementById('acl_form');  
  13.     el=my_form.elements;  
  14.     for (i=0; i<el.length; i++)  
  15.     {  
  16.         if (el[i].type == 'select-one' && el[i].id != '')  
  17.         {  
  18.             select_id.push(el[i].id);  
  19.             select_value.push(el[i].value);  
  20.         }  
  21.     }  
  22. }  
  23.  
  24. function remove_unchanged_selects()  
  25. {  
  26.     for (i=0; i<select_id.length; i++)  
  27.     {  
  28.         s=document.getElementById(select_id[i]);  
  29.         if (s.value == select_value[i])  
  30.         {  
  31.             remove_object(select_id[i]);  
  32.         }  
  33.     }  
  34. }  
  35.  
  36. if (window.attachEvent)  
  37. {  
  38.     window.attachEvent("onload", save_initial_values())  
  39. }  
  40. else  
  41. {  
  42.     window.onload = save_initial_values();  



2) Apply the changes to the file "admin_ug_auth.php":
Code: [Download] [Hide]
  1. #  
  2. #-----[ OPEN ]------------------------------------------  
  3. #  
  4.  
  5. adm/admin_ug_auth.php  
  6.  
  7. #  
  8. #-----[ FIND ]------------------------------------------  
  9. #  
  10.  
  11.                 for($j = 0; $j < count($forum_auth_fields); $j++)  
  12.                 {  
  13.                     $auth_field = $forum_auth_fields[$j];  
  14.  
  15.                     while( list($forum_id, $value) = @each($_POST['private_' . $auth_field]) )  
  16.  
  17. #  
  18. #-----[ BEFORE, ADD ]------------------------------------------  
  19. #  
  20.  
  21.                 $used_forums = array();  
  22.  
  23. #  
  24. #-----[ FIND ]------------------------------------------  
  25. #  
  26.  
  27.                 for($j = 0; $j < count($forum_auth_fields); $j++)  
  28.                 {  
  29.                     $auth_field = $forum_auth_fields[$j];  
  30.  
  31.                     while( list($forum_id, $value) = @each($_POST['private_' . $auth_field]) )  
  32.                     {  
  33.  
  34. #  
  35. #-----[ AFTER, ADD ]------------------------------------------  
  36. #  
  37.  
  38.                         if ( !isset($used_forums[$forum_id]) )  
  39.                         {  
  40.                             $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";  
  41.                             if ( !($result = $db->sql_query($sql)) )  
  42.                             {  
  43.                                 message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql);  
  44.                             }  
  45.                             if ($row=$db->sql_fetchrow($result))  
  46.                             {  
  47.                                 for ($k=0; $k < count($forum_auth_fields); $k++)  
  48.                                 {  
  49.                                     $change_acl_list[$forum_id][$forum_auth_fields[$k]]=$row[$forum_auth_fields[$k]];  
  50.                                 }  
  51.                             }  
  52.  
  53.                             $used_forums[$forum_id]=1;  
  54.                         }  
  55.  
  56. #  
  57. #-----[ FIND ]------------------------------------------  
  58. #  
  59.  
  60.                     ( isset($auth_access[$forum_id]['auth_mod']) && $change_mod_list[$forum_id] != $auth_access[$forum_id]['auth_mod'] ) ||  
  61.  
  62. #  
  63. #-----[ BEFORE, ADD ]------------------------------------------  
  64. #  
  65.  
  66.                     isset($change_mod_list[$forum_id]) && (  
  67.  
  68. #  
  69. #-----[ FIND ]------------------------------------------  
  70. #  
  71.  
  72.                     ( !isset($auth_access[$forum_id]['auth_mod']) && !empty($change_mod_list[$forum_id]) )  
  73.  
  74. #  
  75. #-----[ AFTER, ADD ]------------------------------------------  
  76. #  
  77.  
  78.  
  79.                     )  
  80.  
  81. #  
  82. #-----[ FIND ]------------------------------------------  
  83. #  
  84.  
  85.                     $optionlist_acl = '<select name="private[' . $forum_id . ']">';  
  86.  
  87. #  
  88. #-----[ REPLACE WITH ]------------------------------------------  
  89. #  
  90.  
  91.                     $optionlist_acl = '<select id="private_id_' . $forum_id . '" name="private[' . $forum_id . ']">';  
  92.  
  93. #  
  94. #-----[ FIND ]------------------------------------------  
  95. #  
  96.  
  97.                                 $optionlist_acl_adv[$forum_id][$k] = '<select name="private_' . $field_name . '[' . $forum_id . ']">';  
  98.  
  99. #  
  100. #-----[ REPLACE WITH ]------------------------------------------  
  101. #  
  102.  
  103.                                 $optionlist_acl_adv[$forum_id][$k] = '<select id="private_id_' . $field_name . '_' . $forum_id . '" name="private_' . $field_name . '[' . $forum_id . ']">';  
  104.  
  105. #  
  106. #-----[ FIND ]------------------------------------------  
  107. #  
  108.  
  109.             $optionlist_mod = '<select name="moderator[' . $forum_id . ']">';  
  110.  
  111. #  
  112. #-----[ REPLACE WITH ]------------------------------------------  
  113. #  
  114.  
  115.             $optionlist_mod = '<select id="moderator_id_' . $forum_id . '" name="moderator[' . $forum_id . ']">';  
  116.  



3)  Apply the changes to the file "auth_ug_body.tpl":
Code: [Download] [Hide]
  1. #  
  2. #-----[ OPEN ]------------------------------------------  
  3. #  
  4.  
  5. templates/common/ACP/auth_ug_body.tpl  
  6.  
  7. #  
  8. #-----[ FIND ]------------------------------------------  
  9. #  
  10.  
  11. <form method="post" action="{S_AUTH_ACTION}">  
  12.  
  13. #  
  14. #-----[ REPLACE WITH ]------------------------------------------  
  15. #  
  16.  
  17. <form id="acl_form" method="post" action="{S_AUTH_ACTION}" onsubmit="remove_unchanged_selects()">  
  18.  
  19. #  
  20. #-----[ FIND ]------------------------------------------  
  21. #  
  22.  
  23. </form>  
  24.  
  25. #  
  26. #-----[ AFTER, ADD ]------------------------------------------  
  27. #  
  28.  
  29. <script type="text/javascript" src="{FULL_SITE_PATH}{T_COMMON_TPL_PATH}js/del_unchanged_selects.js"></script>  
  30.  



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.

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: 360 Time(s)

 



 
Last edited by hal9000 on Tue 06 May, 2008 12:07; edited 2 times in total 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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...
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Unable To Edit Group Permissions With Too Many Forums. 
 
moreteavicar wrote: [View Post]
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...

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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
hal9000Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Unable To Edit Group Permissions With Too Many Forums. 
 
I didn't have the time to check this yet...

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.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Unable To Edit Group Permissions With Too Many Forums. 
 
Sure, I'll do in the first chance I have.
 



 
hal9000Send private message  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 2
Goto page 1, 2  Next


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You 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


  

 

  cron