Commit Graph

751 Commits

Author SHA1 Message Date
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
Mikael Nordfeldth
d6598e790c Introduce a ConfigException 2016-03-02 12:33:06 +01:00
Mikael Nordfeldth
9534969c05 Don't set is_local=LOCAL_NONPUBLIC on sandboxed user notices
Let's decide whether they are nonpublic by testing them when the notice
is shown instead.
2016-03-02 12:26:23 +01:00
Mikael Nordfeldth
47f408ca7c Strict typing for mail_notify_attn 2016-03-01 23:37:11 +01:00
Mikael Nordfeldth
e41809af89 Nothing interesting was made in this commit. 2016-03-01 16:30:00 +01:00
Mikael Nordfeldth
63c087a255 Consistent behaviour for ScopingNoticeStream $scoped
We don't guess the current profile anymore if the value of the profile === -1

Also sets $this->scoped for all ScopingNoticeStream inheritors, which just
like in an Action can be null if we're not scoped in any way (logged in).
2016-03-01 14:51:47 +01:00
Mikael Nordfeldth
52a3764ae4 Resolve relative URLs (assuming URI.Base==notice URL)
The real way to do this would be to get the xml:base property from
the Atom feed but it's probably not there in any posts we see today.
2016-02-26 14:46:26 +01:00
Mikael Nordfeldth
c58228195b Make sure the saved Notice has an ID 2016-02-26 01:11:20 +01:00