Commit graph

22 commits

Author SHA1 Message Date
friendica
6679734135 Merge branch 'master' into tres
Conflicts:
	include/Contact.php
	include/ItemObject.php
	include/api.php
	include/attach.php
	include/diaspora.php
	include/dir_fns.php
	include/enotify.php
	include/event.php
	include/expire.php
	include/items.php
	include/notifier.php
	include/notify.php
	include/photos.php
	include/taxonomy.php
	include/text.php
	include/widgets.php
	include/zot.php
	mod/admin.php
	mod/channel.php
	mod/dirsearch.php
	mod/display.php
	mod/editwebpage.php
	mod/events.php
	mod/home.php
	mod/item.php
	mod/manage.php
	mod/mood.php
	mod/network.php
	mod/page.php
	mod/photos.php
	mod/ping.php
	mod/post.php
	mod/thing.php
	mod/viewsrc.php
	view/css/mod_events.css
2015-04-23 19:49:41 -07:00
friendica
f2127d4ba7 limit notification detail queries for items and events 2015-03-23 15:36:17 -07:00
friendica
62b2fa6ac7 operation snakebite, cont. 2015-03-22 20:30:23 -07:00
friendica
ba7bdd79b7 queue management actions. Still needs further work such as indication of last successful connection or indication that the hub was marked offline, but these are potentially expensive queries. 2015-03-01 15:55:27 -08:00
friendica
2b44c5fc72 Fix a couple of places where we weren't checking for dead hublocs. Add a function to mark a hubloc dead. 2015-02-27 13:43:12 -08:00
friendica
51848c6190 working through the xchan table to remove bitfields, mostly complete except for updating the updater 2015-01-20 19:33:19 -08:00
friendica
ee3eee425c that should take care of the bitfields in hubloc 2015-01-20 16:13:18 -08:00
friendica
6f11f20992 first cut at unpacking bitfields in hubloc, fixed hubloc_error and hubloc_deleted 2015-01-20 15:35:42 -08:00
friendica
1780ba5e7d don't remove obsolete hublocs that have no sitekey - it will remove all kinds of other hublocs it isn't supposed to (e.g. diaspora). 2014-12-14 22:54:27 -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
friendica
f524fb1f20 generalise the output format of xchan_fetch so it matches the input format 2014-10-23 19:41:42 -07:00
friendica
241bb3b940 API: xchan get/create 2014-10-23 19:33:47 -07:00
friendica
0057612a9f figuring out how to bootstrap the change_primary procedure when all you have is inconsistent data which you think you trust. 2014-10-13 21:38:36 -07:00
friendica
8a907a789f more diagnostic when changing primary 2014-10-13 17:59:03 -07:00
friendica
6503b91131 sql 2014-10-13 16:12:32 -07:00
friendica
1b0390af06 new function hubloc_change_primary() 2014-10-13 15:27:56 -07:00
friendica
f19d718631 that's why remove_obsolete_hublocs() isn't telling anybody when it does its thing, I forgot to uncomment the bit that tells everybody after I tested it. I needed extensive testing to make sure we didn't accidentally wipe out all hublocs everywhere. Testing went fine so I just assumed it was all working as planned; but went back today to find out why I wasn't told of a recent change. 2014-09-30 23:41:50 -07:00
friendica
0dc33900b6 provide a way to sync locations and get rid of bogus hublocs, now implemented 2014-09-14 22:19:19 -07:00
friendica
0350b76d85 some backend work for the remaining missing bits of mod_hubman - this is still a fair ways from being complete and is not ready for prime time. Basically we'll let a channel send out a public message saying "these are my currently approved locations" and anything that isn't in the list will be marked deleted. We'll send out this message when locations change somehow - either through direct personal involvement (hub revoke, change primary, channel import) or during a system rename or "find bad/obsolete hublocs" activity. This way we won't have clones sending back location info we just got rid of and re-importing the bad entries. 2014-09-13 16:00:09 -07:00
friendica
233e4e1363 remove some code duplication 2014-07-14 01:38:16 -07:00
friendica
fa5ac26828 doco 2014-03-19 19:56:21 -07:00
friendica
68fc2a220e prune_hub_reinstalls() and add cron weekly as a side effect 2014-03-19 19:53:14 -07:00