Commit Graph
11798 Commits
Author SHA1 Message Date
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
habeascodice 31376de066 Merge remote branch 'upstream/master' 2014-11-01 03:04:11 -07:00
friendica 50c16c394f check that we have valid data 2014-11-01 01:52:27 -07:00
friendica 1eacea4037 Merge https://github.com/friendica/red into pending_merge 2014-11-01 00:36:58 -07:00
friendica a659ac8952 disable request message response until we work through this 2014-11-01 00:36:21 -07:00
friendica e32a339a3d doc updates 2014-11-01 00:36:01 -07:00
marijus 5d151b9886 do not reload page for photo upload 2014-10-31 20:25:43 +01:00
Thomas Willingham 5d1bb1b685 Smarty3 now lives in store 2014-10-31 16:09:46 +00:00
jeroenpraat f294962290 Merge pull request #671 from pafcu/master
Fix problem with default birth date
2014-10-31 16:49:48 +01:00
Stefan Parviainen d9f2944565 Fix problem with default birth date 2014-10-31 16:09:48 +01:00
marijus 6e9552df4a Merge branch 'master' of https://github.com/friendica/red 2014-10-31 14:35:40 +01:00
marijus 2982212797 more work on photo upload 2014-10-31 14:33:41 +01:00
friendica 1cb45c30e9 document request packets a bit more 2014-10-31 06:24:14 -07:00
friendica 7f0bd5a6e5 doc updates 2014-10-31 05:05:31 -07:00
friendica 5637d07138 flag notify packets that are sent in response to a message_id request and prevent them from recursing 2014-10-31 04:59:30 -07:00
friendica 11ccf253e2 Heads up: "custom/module.php" is deprecated. Please read this commit if you are affected. 2014-10-30 20:27:41 -07:00
friendica 4e454656fe Merge https://github.com/friendica/red into pending_merge 2014-10-30 19:29:28 -07:00
friendica 28a35261db What this checkin does is catch the case where a comment arrived and there's a missing top-level post to match it with. So we'll send a request back to the sender that you've never seen this thread and please send a fresh copy of the entire conversation to date. We could soon have posts in the matrix from different platforms from days gone by, which have been migrated into the modern world. We'll be polite and not deliver these to everybody. However, if someone comments on one of these antique threads we wouldn't be able to see it in our own matrix because we won't have a copy of the parent post. So this rectifies that situation. Be aware that item deletion may need to change to keep "hard deleted" items indefinitely so that they don't keep coming back. We'll have to null out the important data of the former item to accomplish the deletion aspect. 2014-10-30 19:15:03 -07:00
Thomas Willingham fbd027709a Debian doco - no longer uses dropbear. 2014-10-31 01:13:56 +00:00
marijus 4495a30b88 removing this was not a good idea... 2014-10-30 18:55:24 +01:00
marijus 6103494630 update bootstrap library to version 3.3 2014-10-30 14:28:49 +01:00
marijus 0ff4d9015b some work on photo upload 2014-10-30 14:10:55 +01:00
friendica e219268a6e Merge https://github.com/friendica/red into pending_merge 2014-10-29 17:55:38 -07:00
friendica cfbfdca610 allow feed paging 2014-10-29 17:55:15 -07:00
marijus fc704d1f2f if someone does not have permission to chat do not show the chatrooms tab 2014-10-29 14:29:38 +01:00
friendica 7d9f785758 if any privacy tags are created on a top level post, restrict the post; since it could have been quite sensitive. If there were errors processing the actual tag restrict the post to the profile owner. Also make the "privacy tag over-rides ACL" behaviour configurable. Default is that privacy tags over-ride the ACL. 2014-10-28 20:01:44 -07:00
friendica d9c5823593 the default permissions for new connections when using a custom role is inadequate. Until we can make it configurable start off with something like a public social role. We're typically taking the person straight to the connection editor so they can change it before any privacy damage is done 2014-10-28 19:29:37 -07:00
friendica 653305889c Merge https://github.com/friendica/red into pending_merge 2014-10-28 04:18:35 -07:00
friendica 36110831cb change photo tag bubble tip 2014-10-28 04:18:08 -07:00
RedMatrix 4891eb5b01 Merge pull request #668 from git-marijus/master
change the way tagrm works to allow tag removal on the fly
2014-10-28 22:13:33 +11:00
marijus ec8bab7784 change the way tagrm works to allow tag removal on the fly 2014-10-28 11:56:00 +01:00
friendica 9cc76cb33d several unrelated things - auto_follow wasn't working for new accounts, error returned in private mention to a collection, and added auto-completion to photo tags; though it only matches people so the hover text is now wrong. Also made the photo edit form XHTML (XML) compliant. 2014-10-27 19:23:40 -07:00
friendica 1b53d1c1d3 Merge https://github.com/friendica/red into pending_merge 2014-10-27 16:20:59 -07:00
friendica 583b445bc0 add "repository" permissions role and make sure we have a sane "accept" default for the custom role. 2014-10-27 16:19:30 -07:00
marijus d192bcad65 do not reload page for edit album and some minor cleanup 2014-10-27 21:31:54 +01:00
Jeroen 6ff795a9f2 Merge branch 'master' of https://github.com/friendica/red 2014-10-27 15:06:34 +00:00
Jeroen eec0a67dde update nl + Terms of Service more prominent in the help files. 2014-10-27 15:05:59 +00:00
friendica bc3e7c4cad some documentation of permission roles and what the differences are. 2014-10-27 02:17:30 -07:00
friendica be8a01618e turn down the preview logging. Haven't needed that level of detail recently. 2014-10-26 21:56:56 -07:00
friendica 95de759766 a couple of photo tag issues 2014-10-26 21:37:59 -07:00
friendica d4d44b7a87 couple of other places where we need to reset stuff completely if the role changes 2014-10-26 19:47:55 -07:00
friendica 812135bfab reset ACL just in case it was custom already. 2014-10-26 19:41:53 -07:00
friendica 655c3e1b47 put privacy role selector in settings page. Change visibility of various permissions items accordingly. 2014-10-26 19:32:12 -07:00
friendica d2af45d206 use intval rather than dbesc since these are ints. Should work regardless, but this makes it consistent with the way we do most other queries. 2014-10-26 15:49:00 -07:00
friendica 864fcd1da6 Merge https://github.com/friendica/red into pending_merge
Conflicts:
	mod/like.php
2014-10-26 15:36:16 -07:00
friendica 5abd01f072 allow photos without comments to be liked 2014-10-26 15:34:18 -07:00
marijus f2ccd37c8b wrong vars in template 2014-10-26 21:50:20 +01:00
marijus 6497e78956 some work on photos like/dislike 2014-10-25 15:23:20 +02:00
friendica 59e19a1f45 moved post_to_red to its own project ( https://github.com/friendica/wptored ), which I was planning to do anyway since it's kind of lost in the util folder, but also because having it there may present licensing issues, as it's GPL. 2014-10-25 01:03:36 -07:00
friendica 98bce0e719 the to-do list is getting longer again. 2014-10-24 14:31:21 -07:00