Commit Graph

6106 Commits

Author SHA1 Message Date
Diogo Peralta Cordeiro
ec1719e61d [StoreRemoteMedia][Embed] Bump plugins version 2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
a657a7809a [Media] Upload of previously uploaded files now works (bug fix)
This bug was introduced with the commit "[Media] Fix issues with database file storage"
due to the API change "File::getByHash now returns a yield of files".

I had updated this function on that commit but had missed this little detail.
2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
ef0f65720e [StoreRemoteMedia] Remote images are now stored exactly on the necessary size for the thumb 2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
22b5dd8567 [Media] Fix several issues
[StoreRemoteMedia] Upgrade plugin to use the new Media system

API Changes:
- Added getters to File to better formalize the ideas of the commit "[Media] Fix issues with database file storage"

UI Changes:
- Now presented thumbnails are actual thumbnails (bug fix)
- Attachment actions have a slightly more extended behaviour

Many other minor bug fixes...
2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
6028175bfc [Media] Fix issues with database file storage
Fixed file quota as well.

There can be more than one file for the same filehash IF the url are different.

Possible states:
  - A file with no url and with filename is a local file.
  - A file with an url but no filename is a remote file that wasn't fetched,
    not even the thumbnail.
  - A file with an url and filename is a fetched remote file (maybe just a
    thumbnail of it).
  - A file with no filename nor url is a redirect.

Routes:
  Given these states, updated routes so that an attachment can only be
  retrieved by id and a file by filehash.

Major API changes:
  File::getByHash now returns a yield of files

Major UI changes:
  - Now remote non stored files are presented.
  - /view became preferred
  - Redirects to remote originals are preferred.

Many other minor bug fixes...
2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
aa153f2ee7 [i18n] Re-add gettext emulation
Removed by mistake with 9cc7df51d6#L50
2021-02-21 15:38:49 +00:00
Alexei Sorokin
06dfd91a82 Various fixes
Fix OAuth and Realtime issues introduced in 9a515b9234

[DATABASE] Fix an empty default value mistake introduced in
fde929b151

[DATABASE][PostgreSQL] Avoid use of pg_constraint.consrc, which was removed in
PostgreSQL 12.

[DATABASE][MariaDB] Fix a typo introduced in aed2344bd4

[DAEMON] Wrap an assignment inside "switch":
a follow-up to adc689cb15
2020-10-11 18:29:47 +03:00
Alexei Sorokin
4d8b04cda9 Clear out potential duplicates when semi-joining a union
Using a left outer join as a semi-join is not a valid approach.
Can still be used for an anti-semi-join.
2020-09-21 22:25:33 +03:00
Alexei Sorokin
aed2344bd4 Set the character set before making a connection
Ideally the character set should be set with the connection, and so this is
exactly what's being done now.

And now the character set code is attempted to be generalised.
2020-09-16 19:34:49 +03:00
SENOO, Ken
c2508f8fa2 Change required MySQL database character set variable
Changing `character_set_server` requires root permissions and rebooting
the server.

Which is impossible on shared web hosting services.

So use `character_set_database`. This variable can be changed with
user permissions using `ALTER DATABASE`.
2020-09-16 17:14:58 +03:00
Alexei Sorokin
52d67b0f44 Avoid ordering just by a timestamp
Try to also employ an id when possible.
Involves reworking some of the indices.
2020-09-15 16:59:27 +03:00
Alexei Sorokin
8079a476b6 Remove "magic quotes" code and avoid wrong order implode
"Magic quotes" were removed in PHP 5.4, no need to mitigate it anymore.

Avoid implode() with the join()-like order of arguments which was deprecated
since PHP 7.4 and implicitly since PHP 5.3.
Also avoid implode() with an implicit separator for stylistic reasons.

mktime() with no arguments has been deprecated since PHP 5.1.
2020-09-15 14:59:27 +03:00
Alexei Sorokin
2ef944d5c4 [UTIL] Sanitise instead of validate in common_copy_args()
And remove common_validate_utf8() which is now unused.
2020-09-15 14:53:35 +03:00
Alexei Sorokin
fde929b151 [DATABASE] Switch from PEAR DB to MDB2 2020-09-14 22:46:29 +03:00
Alexei Sorokin
d2c7d70f49 Fix "Implement a class for automatic temporary file handling"
TemporaryFile::commit throws instead of returning a bool.
2020-09-14 20:37:48 +03:00
Alexei Sorokin
b04469a252 [DATABASE] Make sure the session always uses UTF-8 and UTC 2020-09-12 15:40:39 +03:00
Alexei Sorokin
54484e56e7 [API] Fix /api/statuses/update reporting a failure 2020-09-12 13:58:57 +03:00
Alexei Sorokin
adc689cb15 Avoid use of assignments bare inside statements
Either use them in a subroutine call or put parentheses around the assignment.
2020-09-08 12:42:51 +03:00
Alexei Sorokin
08145f635f Implement a class for automatic temporary file handling
And adopt it all over the code.
2020-09-04 13:15:23 +03:00
Diogo Cordeiro
11a7182594 [ActivityPub] Implement Failed Queue 2020-08-29 20:32:21 +01:00
Diogo Cordeiro
ef6a986dc6 [TheFreeNetwork] Do not allow lower priority protocols to handle remote actors already handled by the higher ones 2020-08-27 01:32:15 +01:00
Alexei Sorokin
99a9a5d850 [NOTICES] Condition pushdown in the subquery in inboxnoticestream
This improves performance on PostgreSQL.
2020-08-19 19:14:11 +03:00
Alexei Sorokin
a15d51c3d8 [DATABASE][PostgreSQL] Ignore index prefix length 2020-08-17 17:01:42 +03:00
Alexei Sorokin
be5bec9887 Rename the mysql_foreign_keys option to foreign_keys
And apply it universally.
2020-08-17 14:12:49 +03:00
Alexei Sorokin
341e34b766 [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.
2020-08-16 23:41:28 +03:00
Alexei Sorokin
5c21816b22 [SEARCH][PostgreSQL] Make LIKE search case-insensitive 2020-08-16 19:05:47 +03:00
Alexei Sorokin
6c8cd4c9f8 [SEARCH][MariaDB] Change user-facing fulltext search syntax
Now analogous to the simple and safe PostgreSQL's websearch_to_tsquery syntax.
MariaDB's full-text boolean search queries will fail on input such as "@user"
(unquoted) which is particularly noticeable to the user.
2020-08-13 23:44:59 +03:00
Alexei Sorokin
255d395f1d [SEARCH] Exclude message scope 2020-08-13 22:59:41 +03:00
tenma
1371e3efb8 [MEDIA] Add WebP support
WebP format is now the default image format for anything that
is not an animated GIF. Image Intervention doesn't support
animated WebPs so we don't convert animated GIFs.

ImageFile:
MediaFile:
default:
- Add WebP support
2020-08-14 19:48:02 +01:00
Alexei Sorokin
8bc714a2b1 [DATABASE][MariaDB] Always use LONGBLOB for "blob"
"blob" is practically used with the expectation of unlimited length, which is
true with PostgreSQL's bytea, but not with MariaDB's BLOB, which is limited to
64KiB.
So instead use LONGBLOB, which has a maximum of 4GiB, effectively unlimited.
2020-08-10 10:55:59 +03:00
Alexei Sorokin
07b0aa8f52 [DATABASE] Fix remaining misuses of SQL's GROUP BY 2020-08-10 19:29:04 +03:00
Alexei Sorokin
8c41663175 Revert "[CORE] Avoid the old "reply" relation in inboxnoticestream"
It is needed for mentions.
2020-08-10 17:23:57 +03:00
Alexei Sorokin
47cacf5f1a [NOTICES] Restore FullNoticeStream
But only allow a select number of verbs.
This is to display optional subscription notices.
2020-08-09 21:00:14 +03:00
Alexei Sorokin
f84dbb369f [DATABASE] Enable fulltext search by default
Also rename fulltext indices to more fitting names
and move the check from classes into database/schema.php
2020-08-08 18:08:06 +03:00
Alexei Sorokin
34ec165bff [DATABASE][PostgreSQL] Add fulltext search support 2020-08-08 16:56:20 +03:00
Alexei Sorokin
46f788d1eb [UTIL] Fix up common_ensure_session()
Give priority to cookies over GET.

Make sure session ids have only expected characters
(PHP file session handler's limitation).

Replace a mostly useless log warning with a debug message.
2020-08-06 21:54:49 +03:00
Alexei Sorokin
5ea5d30075 [EXCEPTIONS] Inherit the Previous Exception parameter 2020-08-06 20:03:44 +03:00
Diogo Cordeiro
7a2bb38331 [MEDIA] fromUrl now supports using original file name 2020-08-05 17:53:31 +01:00
Alexei Sorokin
e206995268 Set HTTP status codes with http_​response_​code() 2020-08-04 14:12:17 +03:00
Diogo Cordeiro
a9c365a5eb [VersionBump] 2.0.0alpha0
Ran composer update and locale updater
2020-08-04 05:31:44 +01:00
Diogo Cordeiro
34c5be5c42 [MODULES] Make default loading attributes available in global config 2020-08-04 01:36:21 +01:00
Alexei Sorokin
a38c608420 [SCHEMA] Better DBMS information fetching
On PostgreSQL:
  - Parse defaults for strings and booleans properly.
  - Parse the "serial" definition type properly.
  - Get information on the "enum" definition type.
  - Re-work getting information about keys/indices.

On MariaDB:
  - Get information about lengths in indices.
  - Get foreign key information separately from the rest as they can have
    colliding names.
2020-08-01 19:05:48 +03:00
Alexei Sorokin
1870f38099 [SCHEMA] Fix a few mistakes 2020-07-31 18:24:12 +03:00
Alexei Sorokin
92e8c40c55 [DATABASE] Add explicit indices for all foreign keys
This adds a requirement for all definitions that have foreign keys to also
require indices for all source (local) attributes mentioned in foreign keys.

MariaDB/MySQL creates indices for source attributes automatically, so this
serves as a way to get rid of those automatic indices and create clean explicit
ones instead.

In PostgreSQL, most of the time, indices on the source are necessary to
decrease performance penalty of foreign keys (like in MariaDB), but they aren't
created automatically, so this serves to remove that difference between
PostgreSQL and MariaDB.
2020-07-31 16:36:40 +03:00
Alexei Sorokin
0bfa747382 [DATABASE] Fix index identifiers and clean up redundant ones 2020-07-31 16:12:48 +03:00
Alexei Sorokin
ec86de2bc4 [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.
2020-07-27 19:10:33 +03:00
Diogo Cordeiro
0b947ce2c7 [AuthCrypt] Update README and fix formatting 2020-07-25 17:42:46 +01:00
Diogo Cordeiro
2222d6d173 [MODULES] Make settings great again
Plugin main class doesn't use this construct despite extending this class.
2020-07-25 17:47:53 +01:00
Alexei Sorokin
7e01fd9c38 [DATABASE][MariaDB] Fix index changes with foreign keys enabled 2020-07-23 19:09:41 +03:00
Alexei Sorokin
eefaf7a2b4 [DATABASE][Schema_version] Change the hashing algorithm to SHA3-512 2020-07-23 18:16:56 +03:00