Commit graph

43 commits

Author SHA1 Message Date
friendica
2fcbb9c4b3 fix some directory anomolies 2014-12-16 18:33:16 -08:00
Stefan Parviainen
647311db3e Directory sorting as a dropdown, forum filter as checkbox, option to sort oldest first 2014-12-07 12:31:12 +01:00
friendica
79e5c2456b add link to search forums in the directory 2014-11-23 18:54:33 -08:00
friendica
50244f943d minor photo flag issue - and some more whitespace edits 2014-11-19 16:29:35 -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
c6d07feff5 This is long overdue - use a symblic constant NULL_DATE instead of the easily mis-typed sequence '0000-00-00 00:00:00' 2014-09-08 20:35:15 -07:00
Thomas Willingham
473e582d1f Add check_upstream_directory() to check that your directory is still
a directory, and if it isn't, let find_upstream_directory() find you
a new one.
2014-08-31 16:58:17 +01:00
friendica
4a76925787 some more work on realms 2014-08-17 19:06:56 -07:00
friendica
5a5190f2ff add an encoding type to formatted zot communication structures so that we can later add alternate encodings. 2014-07-24 15:55:01 -07:00
friendica
b2abc51929 much better fix to problem yesterday of updates with the wrong ud_addr getting updated. Now we'll
pass in the update table row to import_xchan so we know exactly which ud_addr applies. We still need ud_flags passed in separately.
2014-06-30 21:17:19 -07:00
friendica
436b44cb19 log the offending dir server 2014-06-29 18:24:34 -07:00
friendica
33034bc9b6 limit updates from new dir servers to avoid exhausting memory. 2014-06-29 18:18:29 -07:00
friendica
ddcf905d03 regression: (-1) update_flag still exists in one function. This should be UPDATE_FLAGS_FORCED or 2. 2014-06-01 16:36:11 -07:00
friendica
3e8e67df2c Set a default directory server from a hard-wired list if one was not previously chosen. 2014-04-25 18:10:23 -07:00
friendica
3d49bf0320 directory sync issues 2014-03-03 21:00:42 -08:00
friendica
d02529fde1 implement a forced directory update mode where we unconditionally create a directory sync packet. This is needed to ensure that monthly directory pings are propagated to other directory servers so they can each prove for themselves whether or not an account is alive or dead. We do not trust other directories to provide us information beyond "look at this entry and decide for yourself" as doing otherwise would invite rogue directory manipulations. As this scheduled update occurs on all channels across all servers, we should also pick up refresh messages from all existing channel clones and these should also propagate out to all directory servers using the same mechanism (though perhaps not at the same time). 2014-02-11 14:19:20 -08:00
friendica
59094cda51 reversed args in update_modtime, incorrect ud_guid and ud_hash 2014-02-10 20:38:26 -08:00
friendica
fe00e9b261 extend the directory profiles a bit more 2013-12-25 01:57:04 -08:00
friendica
8194ade886 improve the directory popup a bit 2013-12-23 19:44:23 -08:00
friendica
d32bbaf599 split private messages into two modules - "message" is just for message lists, "mail" is for reading and writing conversations. This is so we can Comanchify it cleanly. 2013-12-21 23:47:44 -08:00
Thomas Willingham
d93ba783f5 Don't let nobody set an xconfig in safe search. 2013-12-11 15:35:19 +00:00
Olaf Conradi
e31dae76ce Fix missing argument warning 2013-11-12 22:26:47 +01:00
friendica
b5bc04799c turn safemode into a proper widget 2013-11-11 01:18:09 -08:00
Thomas Willingham
888d7e05bf More safe search - since the default is one, toggle only works after
an initial xconfig is set - the first one will turn safe search on
(ie, do nothing from a users point of view).  Fix that.
2013-11-11 06:13:17 +00:00
Thomas Willingham
bbe16eba34 Stray line 2013-11-09 18:49:50 +00:00
Thomas Willingham
8569fda732 Clean up 2013-11-09 18:45:52 +00:00
Thomas Willingham
7b29400c6c Bring safe search to the UI 2013-11-09 18:43:40 +00:00
friendica
0b0bd3c207 create update record for accounts on directory server itself during profile changes, re-queue failed directory sync packets, fix account_id index in queue creation, be more selective about updating hubloc_connected (only when we're talking to the associated site). But we still need a way to flag dead accounts and these mechanisms won't cut it, because it isn't a requirement that channels communicate with anybody, except for contacting the directory when the account is created. I think we need to make every channel ping the directory once a month. Then we can find those that have not done so (after syncing with other directories). We can't have the directory just flag dead accounts as this would create a way for an anti-social attacker to become a directory server and mark all the accounts dead. 2013-10-24 19:38:50 -07:00
friendica
83daf51460 extra logging 2013-10-14 21:56:56 -07:00
friendica
96ba0dccf9 sql typo in directory sync 2013-10-14 20:51:26 -07:00
friendica
bae7f4e078 directory sort links on sidebar 2013-10-13 19:49:40 -07:00
friendica
0e0e0d018b provide config for preferred directory server 2013-10-13 19:29:54 -07:00
friendica
e992cfeca9 directory sync - this will either work, or it won't work, or it will possibly recurse and blow up the matrix. Hard to say. Do you feel lucky? Well do ya' ... punk? Rule #1 - don't mess with anything unless it's blowing up the matrix. If it doesn't blow up the matrix, but doesn't work, just let it go and let's figure out what it is doing and what it isn't doing.
The flow is as follows:
Once a day go out to all the directory servers besides yourself and grab a list of updates. This happens in the poller. If we've never seen them before add them to the updates table. The poller also looks to see if we're a directory server and have updates that haven't yet been processed. It calls onedirsync.php to process each one. If we contact the channel to update and don't find anything (we're just doing a basic zot_finger), set a ud_last timestamp. If this is set we will only try once a day for seven days. Then we stop trying to update.

This will probably cause a spike the first time through because you haven't seen any updates before, but we spread out the load over your delivery interval.
2013-09-30 18:33:27 -07:00
friendica
fd74c5b2ce really, truly fix the age missing in directory bug 2013-07-02 22:41:17 -07:00
friendica
0fbb3b6a97 for directory sync, ensure we have a fallback master; even if we have nothing else 2013-04-18 20:47:35 -07:00
friendica
ea3940c4b0 start formatting for Doxygen 2013-02-25 17:09:40 -08:00
friendica
0e9cf839d6 fix localdir privacy (again) 2013-02-19 23:41:42 -08:00
friendica
7038ad2e59 set xchan hidden flag correctly when local directory update 2013-02-19 23:31:26 -08:00
friendica
a192171365 directory debugging 2013-02-19 23:21:23 -08:00
friendica
dda4d689bb This was bloody hard to sort out.... but now it's sorted and we can move forward again. Put back xtag for efficient keyword searching, use it in conjunction with xprof['keywords'] to avoid a SQL triple join and group_concat (which simply won't scale on a directory server), figured out how best to work timezone corrected birthdays into the protocol. The directory can even provide an age if one was provided to it. Both of these things need some more work, but we have the mechanisms and a plan how to do it right instead of "how the !@#$ are we going to do pull this off?" 2012-12-27 23:33:37 -08:00
friendica
55e77a57d0 get rid of xtag 2012-12-27 14:36:06 -08:00
friendica
a2c6f8c965 master/standalone directory profile update 2012-12-26 19:39:37 -08:00
friendica
ad20e1f617 directory page still needs a lot of work, look up locally if local master or standalone, need to put some basic profile info in discovery page and direct to local directory master 2012-12-19 19:51:52 -08:00