Commit Graph

758 Commits

Author SHA1 Message Date
Alexei Sorokin
a0f72fe5c6 Avoid ordering just by a timestamp
Try to also employ an id when possible.
Involves reworking some of the indices.
2021-07-16 19:44:41 +01:00
Diogo Cordeiro
751b23f6fe [ActivityPub] Fix DELETE 2021-07-16 19:44:41 +01:00
Alexei Sorokin
ddc3371b43 [NOTICE] Store "url" as TEXT and not VARCHAR(191) 2021-07-16 19:44:40 +01:00
Alexei Sorokin
3075cffcd7 [DATABASE] Change collation handling
Before now table definitions could define collations only for MariaDB using the
MariaDB's collation names directly.
Now instead definitions get a slightly more abstract collation name syntax, but
only supporting the collations utf8mb4_bin and utf8mb4_unicode_(cs|ci) (wrapped
as utf8_bin, utf8_general_(cs|ci)), because those are the ones that have
practical use for GNU social.

Which also means that on MariaDB the formerly used utf8mb4_general_(cs|ci) have
been superseded by utf8mb4_unicode_(cs|ci), as they are the more modern
replacement.

Introduce collation support on PostgreSQL which results in use of the C (POSIX)
collation as utf8_bin and the und-x-icu collation as utf8_general_cs.
utf8_general_ci is also mapped to und-x-icu, which makes it case-sensitive,
unfortunately.
2021-07-16 19:44:40 +01:00
Alexei Sorokin
6d203d42e9 [DATABASE] Enable fulltext search by default
Also rename fulltext indices to more fitting names
and move the check from classes into database/schema.php
2021-07-16 19:44:40 +01:00
Alexei Sorokin
46ac40d981 Clean Notice_prefs and Fave_tally when a notice is deleted 2021-07-16 19:44:40 +01:00
Alexei Sorokin
665e4574da [DATABASE] Fix index identifiers and clean up redundant ones 2021-07-16 19:44:38 +01:00
Alexei Sorokin
b1b1d2af93 [DATABASE] Update "modified" in Managed_DataObject instead of a DBMS trigger
Instead of relying on the MariaDB's ON UPDATE CURRENT_TIMESTAMP trigger update
"modified" attributes in Managed_DataObject. Every raw query that needs
adjusting is adjusted, as they won't update "modified" automatically anymore.

The main goal behind this change is to fix "modified" updates on PostgreSQL.
2021-07-16 19:44:37 +01:00
Alexei Sorokin
5b6a64b125 [Notice] Fix clearReplies() and clearRepeats() 2021-07-16 19:44:37 +01:00
Alexei Sorokin
e3f1667b47 [NOTICE] Update index for verbs in ProfileNoticeStream
After adding a verb condition there, MariaDB now prefers the
("created", "id", "is_local") and ("profile_id", "verb", "created", "id")
indices for that query, even though they are slow for the job.
So replace them with ("is_local", "created", "id") and
("profile_id", "verb", "created", "id") respectively.
Also fix the naming of the ("profile_id", "created", "id") index.
2021-07-16 19:44:37 +01:00
Alexei Sorokin
26115482ef [SCHEMA] Improve timestamp storage
Avoid the use of deprecated MariaDB "zero dates" globally. If they're present
as attribute defaults somewhere, they will be replaced with NULL implicitly.
The existing "zero dates" in MariaDB storage will be left intact and this
should not present any issues.

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDB with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", which
should be close enough to the original behaviour for compatibility purposes.
It is now the recommended type for "modified" attributes, because of the
update trigger on MariaDB. But there is no such trigger implemented on
PostgreSQL as of this moment.
2021-07-16 19:44:37 +01:00
Alexei Sorokin
53af27a303 [NodeInfo][DATABASE] Adjust indices of the "notice" and "user" tables
On big databases these queries from the Nodeinfo plugin choked up:

SELECT profile_id FROM notice
  WHERE notice.created >= (CURRENT_DATE - INTERVAL '180' DAY)
  AND notice.is_local = 1;
SELECT id FROM "user"
  WHERE "user".created >= (CURRENT_DATE - INTERVAL '180' DAY);
2021-07-16 19:44:36 +01:00
Alexei Sorokin
d26aac77b3 [DATABASE] Always quote identifiers
The code used to operate under the assumption that MariaDB doesn't support
quoting identifiers. Not only is that not exactly true, but MariaDB has
reserved keywords that cannot be used as table or column names unquoted.
2021-07-16 19:44:35 +01:00
Miguel Dantas
ab3e8ce21d [LIB_REFACTOR] Fix requires 2021-07-16 19:44:34 +01:00
Miguel Dantas
2ab2e22a36 [LIB_REFACTOR] Moving files into separate semantic categories 2021-07-16 19:44:34 +01:00
Miguel Dantas
18d9875e59 [CORE] Fix small bug where Notice was sending a JSON representation to the queue, instead of sending itself 2021-07-16 19:44:34 +01:00
tenma
06fb856d24 [CORE] Add new Notice scope for private messaging
Notice:
- Add MESSAGE_SCOPE scope

lib/*.stream:
- Filter out notices with MESSAGE_SCOPE scope
2021-07-16 19:44:33 +01:00
Diogo Cordeiro
f67a93eddc [CORE] Bump Database requirement to MariaDB 10.3+ 2019-08-03 17:47:23 +01:00
Diogo Cordeiro
c03ed457a6 Fix broken user activitystreams feed due to deleted notices 2019-05-06 23:27:38 +01:00
mmn
924bcd93e5 Merge branch 'notice_id-xml' into 'nightly'
Use the statusnet namespace for notice_id in atom feed

See merge request !136
2017-07-11 20:01:01 +00:00
Mikael Nordfeldth
0dd68d11cb What just happened? Not sure if me or git caused duplicate code. 2017-05-06 14:48:04 +02:00
Mikael Nordfeldth
4f37c564a5 Merge branch 'master' into mmn_fixes 2017-05-06 14:40:06 +02:00
Mikael Nordfeldth
966971bd12 Revert some of 8a4bec811b
use Notice_prefs instead of adding a new field. The rationale here
is simply that the Notice table was _huge_ and I rant into issues
with /tmp filling up when altering the tables. So let's just create
a new table instead.
2017-05-06 14:38:48 +02:00
Mikael Nordfeldth
d115f9dd1b Output selfLink from notice asActivity[Object] 2017-05-06 14:38:45 +02:00
Mikael Nordfeldth
434956fc75 Notices start saving selfLink from activities/objects 2017-05-06 14:38:42 +02:00
Mikael Nordfeldth
286b1e0ab7 Revert some of 8a4bec811b
use Notice_prefs instead of adding a new field. The rationale here
is simply that the Notice table was _huge_ and I rant into issues
with /tmp filling up when altering the tables. So let's just create
a new table instead.
2017-05-06 13:24:11 +02:00
Mikael Nordfeldth
7c829852b8 Output selfLink from notice asActivity[Object] 2017-05-06 12:26:54 +02:00
Mikael Nordfeldth
8a4bec811b Notices start saving selfLink from activities/objects 2017-05-06 12:15:54 +02:00
Mikael Nordfeldth
000af6d9ee default to #addtag on !group mention 2017-05-02 21:21:53 +02:00
Mikael Nordfeldth
07458e5375 Fixed the parsing of ostatus:conversation etc.
Conversation will now start storing remote URL

The namespace features don't work the way they were written for here
so I fixed that, making the ostatus: namespace properly looked up and
then the homegrown getLink function looks for what is back-compat with
StatusNet etc. if I remember correctly.
2017-05-02 18:58:22 +02:00
Thomas Karpiniec
47cd054976 Use the statusnet namespace for notice_id 2017-02-04 21:59:30 +11:00
Mikael Nordfeldth
a7043bf7cc Split up source and source_link. Never trust HTML!
https://community.highlandarrow.com/notice/269667
or alternatively: https://social.umeahackerspace.se/conversation/495655
2016-09-02 01:00:52 +02:00
Mikael Nordfeldth
59b93b23e2 Split up source and source_link. Never trust HTML!
https://community.highlandarrow.com/notice/269667
or alternatively: https://social.umeahackerspace.se/conversation/495655
2016-09-02 00:55:46 +02:00
Mikael Nordfeldth
3b046ee49d Shorthand function to check if notice has been repeated. 2016-08-27 14:42:28 +02:00
Mikael Nordfeldth
3d6e25ee5f We have to create and populate the Notice_location table before constraint checking foreign keys. 2016-06-25 13:01:56 +02:00
Mikael Nordfeldth
f93f02f424 Managed_DataObject now has getByUri() 2016-06-25 11:59:06 +02:00
Mikael Nordfeldth
7978cd6d59 s/EmptyIdException/EmptyPkeyValueException/ 2016-06-25 11:50:59 +02:00
Stephen Paul Weber
47e541eaec Allow getting notice title without implying one
Sometimes I just want explicit titles, and not the generated "blah posted on date" text
2016-06-10 21:00:01 +00:00
Mikael Nordfeldth
0959efd7be Use constant for ATTN_PUBLIC (public collection) 2016-04-18 15:56:52 +02:00
Mikael Nordfeldth
6d33c003fc Maybe stop deleteRelated from failing on constraint checking 2016-04-04 12:04:20 +02:00
Mikael Nordfeldth
195285ac2f Fix constraint checking and only run it if not already constrained 2016-04-01 06:24:11 +02:00
Mikael Nordfeldth
8de3469957 Constraint check Notice table, need to get foreign key array! 2016-03-31 17:57:01 +02:00
Mikael Nordfeldth
72cafe03e9 Index object_type too... 2016-03-29 12:48:25 +02:00
Mikael Nordfeldth
4e2be07234 Better indexing for Notice (performance++) 2016-03-29 12:13:33 +02:00
Mikael Nordfeldth
4790db348d FetchRemoteNotice event call in Notice (not effective yet) 2016-03-27 14:00:05 +02:00
Mikael Nordfeldth
49a91885c9 Strictify Notice->isPublic() 2016-03-24 01:54:33 +01:00
Mikael Nordfeldth
6b4c331060 Attachment and file handling since we could get NULL instead of File 2016-03-23 17:53:38 +01:00
Mikael Nordfeldth
86ce93b376 Notice->deleteRelated should be called from delete() 2016-03-21 17:34:03 +01:00
Mikael Nordfeldth
a0336ce48b Unnecessary debug output 2016-03-06 18:15:36 +01:00
Mikael Nordfeldth
d9538183bd Use information about activityschema public mention for Notice scope 2016-03-06 17:47:35 +01:00