Commit graph

23 commits

Author SHA1 Message Date
Klaus Weidenbach
80816a7195 Some documentation, fix chatroom service class lookup.
Add some Doxygen documentation and fixing a service class lookup for
chatroom_create().
2015-03-14 00:10:06 +01:00
Habeas Codice
435509f609 fix improper group by usage 2015-01-28 17:36:24 -08:00
Habeas Codice
1a5a5c7edb PostgreSQL support initial commit
There were 11 main types of changes:
- UPDATE's and DELETE's sometimes had LIMIT 1 at the end of them. This is not only non-compliant but
it would certainly not do what whoever wrote it thought it would. It is likely this mistake was just
copied from Friendica. All of these instances, the LIMIT 1 was simply removed.
- Bitwise operations (and even some non-zero int checks) erroneously rely on MySQL implicit
integer-boolean conversion in the WHERE clauses. This is non-compliant (and bad programming practice
to boot). Proper explicit boolean conversions were added. New queries should use proper conventions.
- MySQL has a different operator for bitwise XOR than postgres. Rather than add yet another dba_
func, I converted them to "& ~" ("AND NOT") when turning off, and "|" ("OR") when turning on. There
were no true toggles (XOR). New queries should refrain from using XOR when not necessary.
- There are several fields which the schema has marked as NOT NULL, but the inserts don't specify
them. The reason this works is because mysql totally ignores the constraint and adds an empty text
default automatically. Again, non-compliant, obviously. In these cases a default of empty text was
added.
- Several statements rely on a non-standard MySQL feature
(http://dev.mysql.com/doc/refman/5.5/en/group-by-handling.html). These queries can all be rewritten
to be standards compliant. Interestingly enough, the newly rewritten standards compliant queries run
a zillion times faster, even on MySQL.
- A couple of function/operator name translations were needed (RAND/RANDOM, GROUP_CONCAT/STRING_AGG,
UTC_NOW, REGEXP/~, ^/#) -- assist functions added in the dba_
- INTERVALs: postgres requires quotes around the value, mysql requires that there are not quotes
around the value -- assist functions added in the dba_
- NULL_DATE's -- Postgres does not allow the invalid date '0000-00-00 00:00:00' (there is no such
thing as year 0 or month 0 or day 0). We use '0001-01-01 00:00:00' for postgres. Conversions are
handled in Zot/item packets automagically by quoting all dates with dbescdate().
- char(##) specifications in the schema creates fields with blank spaces that aren't trimmed in the
code. MySQL apparently treats char(##) as varchar(##), again, non-compliant. Since postgres works
better with text fields anyway, this ball of bugs was simply side-stepped by using 'text' datatype
for all text fields in the postgres schema. varchar was used in a couple of places where it actually
seemed appropriate (size constraint), but without rigorously vetting that all of the PHP code
actually validates data, new bugs might come out from under the rug.
- postgres doesn't store nul bytes and a few other non-printables in text fields, even when quoted.
bytea fields were used when storing binary data (photo.data, attach.data). A new dbescbin() function
was added to handle this transparently.
- postgres does not support LIMIT #,# syntax. All databases support LIMIT # OFFSET # syntax.
Statements were updated to be standard.

These changes require corresponding changes in the coding standards. Please review those before
adding any code going forward.

Still on my TODO list:
- remove quotes from non-reserved identifiers and make reserved identifiers use dba func for quoting
- Rewrite search queries for better results (both MySQL and Postgres)
2014-11-13 12:21:58 -08:00
marijus
6c806f6f48 aalso change the way we check for number of chatrooms 2014-09-20 17:28:42 +02:00
friendica
af45b34ee0 verified that chatroom expire is working, so doing away with the second function to do the same thing.
If you have a problem with chatroom expiration, check that it was created with cr_expire set to 120 (minutes). Chatrooms created during the first couple of days of the chat feature didn't have this. You can set the DB value manually.
2014-08-20 20:49:03 -07:00
friendica
a1ffb5ee72 sql error 2014-07-29 18:34:24 -07:00
Paolo Tacconi
d6d795efc9 deleted a command with debug code 2014-07-29 09:41:43 +02:00
Paolo Tacconi
87f5544f1f Chatroom lines are deleted after MAX_CHATROOM_HOURS or the chat becomes slow to load 2014-07-29 09:06:04 +02:00
friendica
806f1f0fa1 UI for deleting chatrooms 2014-05-04 20:30:52 -07:00
friendica
e40d226252 basic chatterbot support - though these would still require additional functionality in the API to maintain presence as they'll get kicked out of the room if they don't ping it regularly. 2014-04-26 16:27:03 -07:00
marijus
e06d9e97c5 make chatrooms in /chat/channel visible to observers aswell 2014-02-12 21:31:11 +01:00
friendica
a46fa1fbae apply service class restriction to the number of channels allowed in a chatroom at a time ('chatters_inroom'). If you've got a public site you probably want to restrict this. 2014-02-06 15:23:20 -08:00
friendica
e83419b53e add links to change chat status and leave room 2014-02-02 03:43:52 -08:00
friendica
a1d40431f2 chat expiration (default 2 hours) - but can be set on a per-chatroom basis 2014-01-30 20:10:47 -08:00
friendica
6c6a9b963a a bit more ajax work on chat and chatsvc and some fiddling with layouts 2014-01-30 01:00:46 -08:00
friendica
838ebbcb62 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. 2014-01-29 18:29:03 -08:00
friendica
b8fb6a4373 more chat infrastructure 2014-01-29 17:09:20 -08:00
friendica
677f5f641e more testing of chatroom interfaces, also corrected a function call that should have been a class instantiation in reddav 2014-01-29 16:02:02 -08:00
friendica
a1e7c65d51 chatroom permissions enforcement 2014-01-29 03:40:14 -08:00
friendica
6a9d43bcbe debug chatroom_list widget 2014-01-29 03:16:07 -08:00
friendica
10b51a9471 issues uncovered whilst testing the chatroom API 2014-01-29 02:25:21 -08:00
friendica
9f54675702 chatroom list widget backend 2014-01-29 01:52:23 -08:00
friendica
9261a170eb basic chatroom management backend 2014-01-29 00:08:29 -08:00