Commit Graph

47 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 346aec9b2a [DATABASE] Fix more incorrect uses of quotation in SQL 2021-07-16 19:44:37 +01:00
Alexei Sorokin 434f07430d [DATABASE] Use "<>" as an SQL non-equality sign in more cases
A follow-up to commit 644b417f6c
2021-07-16 19:44:36 +01:00
Alexei Sorokin 9ac632ca2d [DATABASE] Start transactions with START TRANSACTION
"BEGIN" is non-standard and unnecessary.
2021-07-16 19:44:36 +01:00
Alexei Sorokin eab5725698 [DATABASE] Disable 'NULL' strings evaluation as SQL NULLs
Use $object->sqlValue('NULL') (identical to DataObject_Cast'ing) instead and
fix related issues like (email|sms)settings considering these NULLs as a
false positive for the E-Mail address still being set when it's been removed.

There could also be security implications to the now-disabled approach of
considering 'NULL' strings as SQL NULLs.
2021-07-16 19:44:35 +01:00
Alexei Sorokin 16b5ddd230 [DATABASE] Re-introduce PostgreSQL support 2021-07-16 19:44:35 +01:00
Alexei Sorokin 3f17a0efea [DATABASE] Introduce a bool type in schema
PostgreSQL has a clear distinction between integers and booleans, so it makes
sense to draw a clear line.
2021-07-16 19:44:35 +01:00
Alexei Sorokin 6095a6de64 [DATABASE] Only use single quotation marks for SQL strings
Double quotation marks are only used for identifiers in the SQL standard.
2021-07-16 19:44:35 +01:00
Diogo Cordeiro 2e6c7b1bb8 [SCRIPTS] Make them work in v2 by setting PUBLICDIR 2019-08-03 17:49:11 +01:00
Diogo Cordeiro 30a1a460b7 Minor reformatting of upgrade.php, doesn't change functionality 2019-07-01 23:14:39 +01:00
Mikael Nordfeldth 6a2a54dcb5 Making upgrade.php somewhat more efficient by remember one-time-inits. 2017-07-10 20:27:37 +02:00
Mikael Nordfeldth 0177c8f1cf Use join instead of exists in SQL 2016-03-29 14:36:27 +02:00
Mikael Nordfeldth 15c16ac54e Make sure File_thumbnail->getPath() doesn't throw NoResultException 2016-03-09 23:49:01 +01:00
Mikael Nordfeldth 4c7436e328 Match empty on "" and not just NULL 2016-03-08 02:00:34 +01:00
Mikael Nordfeldth 893d888152 Add urlhash field to File_thumbnail for indexing 2016-02-10 04:15:41 +01:00
Mikael Nordfeldth c0851d59f5 migrateProfilePrefs added to scripts/upgrade.php
Makes it easier for plugin developers to change the topics set in Profile_prefs
2016-01-28 19:03:24 +01:00
Mikael Nordfeldth b596391fcd Avoid having to check for notices without rendered copies in upgrade.php
Always call the Notice->getRendered() function to get a rendered copy.
We could perhaps put some sanitation there too in the future
2016-01-06 15:32:27 +01:00
Mikael Nordfeldth d6ac002639 Get conversation ID from child too in scripts/upgrade.php 2016-01-06 14:57:30 +01:00
Mikael Nordfeldth e02c10a589 common_render_content doesn't require a Profile now 2016-01-01 18:40:58 +01:00
Mikael Nordfeldth cf916141d0 Group membership URI needs dataobjects not IDs 2015-12-27 13:01:24 +01:00
Mikael Nordfeldth b01484a0a3 Managed_DataObject::newUri was called improperly 2015-11-23 00:39:49 +01:00
Mikael Nordfeldth 88f7bb1ed5 Some work on ActivityModeration with notice deletion
Let's now create an event called DeleteNotice and also make sure we
handle the onNoticeDeleteRelated properly in ActivityModeration to
avoid possible endless loops etc.
2015-10-03 02:02:37 +02:00
Bhuvan Krishna 1ab4c9998a Add executable permission to script missing it 2015-07-10 14:46:08 +05:30
Mikael Nordfeldth a55d1df585 Clearer warning message on non-existing file 2015-04-16 00:22:09 +02:00
Mikael Nordfeldth 325e784ccd Don't store duplicates of files.
If a new file is uploaded, it will be matched with a previously uploaded
file so we don't have to store duplicates. SHA256 is random enough and
also unlikely enough to cause collisions.
2015-02-24 21:11:25 +01:00
Mikael Nordfeldth 45dc76de26 File and File_redirection adhoc storage methods updated for urlhash 2015-02-19 19:05:24 +01:00
Mikael Nordfeldth 27480d8e8e File_redirection also got urlhash column 2015-02-19 18:34:48 +01:00
Mikael Nordfeldth 5a8f24eb46 urlhash first steps, including scripts/upgrade.php 2015-02-17 18:55:12 +01:00
Mikael Nordfeldth d02f3c4648 Conversation URIs could be NULL on upgrade 2014-11-27 18:56:57 +01:00
Mikael Nordfeldth fcdd061b4f pluginified most of hasFave, getFaves and related calls
The code is now more event-driven when it comes to rendering notices
and their related HTML elements, since we can't have direct calls from
core to a plugin.

lib/activitymover.php has a function to move a Favorite activity which
will not happen now. The move must be pluginified and performed as an
event which plugins can catch on to.
2014-06-27 14:09:02 +02:00
Mikael Nordfeldth 214a10ddec File_thumbnail fixes (run scripts/upgrade.php)
We're now capable of doing image rotation for thumbnails based on
EXIF orientation data. Also, thumbnails are tracked by filenames and
thus we can delete them from storage when we feel like it.
2014-05-12 14:33:41 +02:00
Mikael Nordfeldth e526909bd8 File width and height is now properly set for File 2014-04-22 12:09:24 +02:00
Mikael Nordfeldth d59eb5e184 Dynamically generate thumbnails (see full text)
The File object now stores width and height of files that can
supply this kind of information. Formats which we can not read
natively in PHP do not currently benefit from this. However an
event hook will be introduced later.

The CreateFileImageThumbnail event is renamed to:
CreateFileImageThumbnailSource to clarify that the hooks should not
generate their own thumbnails but only the source image. Also it now
accepts File objects, not MediaFile objects.

The thumbnail generation is documented in the source code. For
developers, call 'getThumbnail' on a File object and hope for the best.

Default thumbnail sizes have increased to be more appealing.
2014-04-21 20:46:11 +02:00
Mikael Nordfeldth 2272cc244d Removed Inbox from core (unused since 4b2a66ed29)
Added the following FIXME:
How should a Twitter user get their Inbox filled with foreign tweets?

Every imported Twitter user has a profile in the Profile table, so we
could setup a Subscription entry for each of those, meaning they get
collected in the InboxNoticeStream... But this would mean a lot of
unnecessary entries and listings that generally just point to the
locked down Twitter service.

Let's figure out a good relation so we can connect any profile to any
imported foreign notice, so it shows up in the "all" feed.
2014-03-06 04:46:29 +01:00
Mikael Nordfeldth 352bef2374 Add support (and upgrade path) for group profiles 2013-10-15 11:12:50 +02:00
Mikael Nordfeldth 2a4dc77a63 The overloaded DB_DataObject function staticGet is now called getKV
I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV

   sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq)

If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV!

This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class)

Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
2013-08-18 13:13:56 +02:00
Evan Prodromou 841c71f37d Add profile lists for all tags on upgrade 2011-09-27 11:16:14 -04:00
Evan Prodromou 73afcad34c add hooks for upgrades 2011-09-15 17:05:32 -04:00
Evan Prodromou b2ed258e42 Avoid resetting modified for Faves in upgrade script 2011-09-12 15:24:47 -04:00
Evan Prodromou 14f03a237e initialize fave, sub, and membership URIs 2011-09-12 12:13:04 -04:00
Evan Prodromou e06202852a Make sure reshare notices get the right object_type and verb 2011-09-07 18:34:31 -04:00
Evan Prodromou f77c850b80 initialize the local_group table 2011-09-07 18:27:20 -04:00
Evan Prodromou 9ed1beb3a0 Move inbox initialization to upgrade.php
Move the inbox initialization code to upgrade.php. Might not catch
group messages, but maybe that's not a big deal.
2011-09-07 16:48:10 -04:00
Evan Prodromou dc4f2c3b10 Move conversation table initialization to upgrade script 2011-09-07 16:23:49 -04:00
Evan Prodromou 9e64ae59ba move fixup group uri code to upgrade.php 2011-09-07 16:14:21 -04:00
Evan Prodromou c265463112 fixup conversations in upgrade.php 2011-09-07 16:09:05 -04:00
Evan Prodromou 196be4e6fb move notices-rendered code into upgrade script 2011-09-07 12:10:26 -04:00