diff options
author | friendica <info@friendica.com> | 2014-01-29 18:29:03 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-29 18:29:03 -0800 |
commit | 838ebbcb62aaaca8f19e338fe89c484f9d4ececd (patch) | |
tree | 243c4bfadd46a4ad903ec854ce39718f1cbb1ddb /include/chat.php | |
parent | c24aa824fe49d6dc803fb58c577d2238db416f2f (diff) | |
download | volse-hubzilla-838ebbcb62aaaca8f19e338fe89c484f9d4ececd.tar.gz volse-hubzilla-838ebbcb62aaaca8f19e338fe89c484f9d4ececd.tar.bz2 volse-hubzilla-838ebbcb62aaaca8f19e338fe89c484f9d4ececd.zip |
apply service class limits (at the account level) to chatroom creation as chat has the potential to adversely affect system performance. In the future we may also want to service_class restrict the number of participants in a room.
Diffstat (limited to 'include/chat.php')
-rw-r--r-- | include/chat.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/chat.php b/include/chat.php index a8c3db429..aef154fe6 100644 --- a/include/chat.php +++ b/include/chat.php @@ -20,6 +20,18 @@ function chatroom_create($channel,$arr) { return $ret; } + $r = q("select count(cr_id) as total from chatroom where cr_aid = %d", + intval($channel['channel_account_id']) + ); + if($r) + $limit = service_class_fetch($channel_id,'chatrooms'); + + if(($r) && ($limit !== false) && ($r[0]['total'] >= $limit)) { + $ret['message'] = upgrade_message(); + return $ret; + } + + $created = datetime_convert(); $x = q("insert into chatroom ( cr_aid, cr_uid, cr_name, cr_created, cr_edited, allow_cid, allow_gid, deny_cid, deny_gid ) |