Commit Graph

836 Commits

Author SHA1 Message Date
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 379fbb6e5d [ActivityPub][SCRIPTS] Add fix_subscriptions.php 2020-08-04 17:12:01 +01: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
Alexei Sorokin 341f3d0ea5 [DATABASE] Fix more incorrect uses of quotation in SQL 2020-07-26 15:28:05 +03:00
Alexei Sorokin 194976135f [DATABASE] Some query improvements
Make common_sql_weight employ standard SQL functions for the timestamp
difference in seconds.
Also replace UTC_TIMESTAMP in the MariaDB-specific part with CURRENT_TIMESTAMP
as it is the only occurence and GNU social sets UTC as a default timezone.

In a delete_orphan_files.php script simplify the main query considerably.

In clean_profiles.php stop using COUNT as if it is ANY, that is unnecessary
punishment for the database. Instead implement the anti-join with a
left outer join.

In Autocomplete and Activitypub_profile use joins instead of a WHERE OR
anti-pattern for the semi-joins.

In lib/ui/galleryaction.php replace a CROSS JOIN with an INNER JOIN.

In actions/sup.php remove a redundant subquery: WHERE is applied before
grouping either way.
2020-06-10 16:52:00 +03:00
Alexei Sorokin 09a772419a [DATABASE] Use "<>" as an SQL non-equality sign in more cases
A follow-up to commit 644b417f6c
2020-06-08 18:31:22 +03:00
Alexei Sorokin 6c035d01d4 [DATABASE] Start transactions with START TRANSACTION
"BEGIN" is non-standard and unnecessary.
2020-06-08 12:25:01 +03:00
susdiv 684675bd84 [SCRIPTS] Fix postgres incompatible query in clean_profiles.php 2020-06-05 17:57:22 +00:00
Alexei Sorokin 448404e45c [SCRIPTS] Fix resend_confirm_address.php
Fix a regression from 6ec72b2978,
check if an address is set when using --email.
2019-11-16 21:22:46 +03:00
Alexei Sorokin 5bc1b8695e [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.
2019-11-02 12:21:43 +03:00
tenma 1df9ec9f0f [SCRIPTS] Add updateuris script
To fix user URIs to their non-fancy version
2019-11-03 00:43:21 +00:00
Alexei Sorokin ee7f0a2016 [DATABASE] Re-introduce PostgreSQL support 2019-09-11 14:14:40 +03:00
Alexei Sorokin 471576d6e8 [DATABASE] Columns not in GROUP BY must not be queried 2019-09-11 13:12:41 +03:00
Alexei Sorokin 62b90c29db [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.
2019-09-11 11:25:39 +03:00
Alexei Sorokin 44f4c9374d [DATABASE] Use time intervals in a SQL standard compliant way 2019-09-11 09:58:13 +03:00
Alexei Sorokin 11dabbe44d [DATABASE] Only use single quotation marks for SQL strings
Double quotation marks are only used for identifiers in the SQL standard.
2019-09-11 09:46:30 +03:00
Miguel Dantas b41f9620fa [LIB_REFACTOR] Fix requires 2019-09-03 03:33:13 +01:00
Miguel Dantas 58bde08425 [LIB_REFACTOR] Moving files into separate semantic categories 2019-09-03 03:33:13 +01:00
Diogo Cordeiro 1e378a514d [OverwriteThemeBackground] This new plugin will let the admin set a custom background theme independent 2019-09-03 03:26:35 +01:00
Diogo Cordeiro 0c2c3ec862 [CORE] Plugin API now extends a new Module API 2019-08-24 01:59:33 +01:00
Diogo Cordeiro 2e6c7b1bb8 [SCRIPTS] Make them work in v2 by setting PUBLICDIR 2019-08-03 17:49:11 +01:00
Diogo Cordeiro 893bafa14b [INSTALL] Minor reformatting and modernization. Shouldn't change functionality significatively. 2019-08-03 17:47:28 +01:00
Diogo Cordeiro 7d262ad50b [CORE] Fixed some small issues with PEAR 2019-08-03 17:47:28 +01:00
Daniel Supernault c1c2a9f1a1 [DEVTOOL] Add a robust and modern REPL 2019-08-03 17:47:26 +01:00
Diogo Cordeiro f0f5ecb756 [SCRIPTS] Fix sessiongc by XRevan86 2019-08-01 14:38:04 +01:00
Diogo Cordeiro 30a1a460b7 Minor reformatting of upgrade.php, doesn't change functionality 2019-07-01 23:14:39 +01:00
Diogo Cordeiro 45479c90a3 Add option to send email to --all users on sendemail.php script 2018-08-23 23:48:38 +01:00
Mikael Nordfeldth ec98fd0c43 Merge remote-tracking branch 'gnuio/master' into nightly 2017-12-17 18:32:23 +01:00
nee fdd3d63098 Don't write the config file when --skip-config flag is given to the installer.
* scripts/installer_cli.php: Read the arguments list before checking
  if the config file is writeable.
2017-11-26 22:14:30 +01:00
Mikael Nordfeldth 6938d26524 List the thread config value in lib/default.php 2017-08-03 09:53:00 +02: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 c505652c15 Confirm_address::getByAddress not getAddress
Also fixed the error handling to match the function call.
2017-04-29 14:48:46 +02:00
Mikael Nordfeldth 0177c8f1cf Use join instead of exists in SQL 2016-03-29 14:36:27 +02:00
Mikael Nordfeldth 78e23bd4ec Fix issue #171 with latent htmLawed reference 2016-03-21 02:55:10 +01: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 47ae21c08e Don't resend confirm_address if profile is silenced 2016-03-06 16:45:29 +01:00
Mikael Nordfeldth feb97cfc22 Resend confirm_address stuff, please read its NOTE first 2016-03-02 15:48:18 +01:00
Mikael Nordfeldth b8643f73b7 No need to set $threads = 0 on the line before it's set ;) 2016-02-28 19:40:16 +01:00
abjectio 12ad588a9b Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2016-02-27 20:37:03 +01:00
Mikael Nordfeldth 2730510393 User friendlieness in scripts/delete_notice.php 2016-02-26 00:06:04 +01:00
abjectio 6bcfc73175 Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2016-02-23 21:13:58 +01:00
Mikael Nordfeldth c8753353ed Do not delete_orphan_files on an instance with Qvitter 2016-02-12 01:45:47 +01:00
Mikael Nordfeldth 913595780f And LEFT JOIN to actually get all results 2016-02-12 00:05:36 +01:00
Mikael Nordfeldth 1471defff3 ...and avoid duplicate results... 2016-02-11 23:38:12 +01:00
Mikael Nordfeldth 05fea4cdc6 Aurhg, and get all the properties, not just id 2016-02-11 22:54:29 +01:00
Mikael Nordfeldth 2198f39597 Haha, it essentially became a NOOP with the last commit 2016-02-11 22:49:45 +01:00
Mikael Nordfeldth 6f2fbd448d Fixed the delete orphan script to include deleted notices
The file_to_post table sometimes had post_id with values that did not
exist in the notice table.
2016-02-11 22:43:26 +01:00
Mikael Nordfeldth 38a187b93e Delete orphan files maintenance script
When deleting a profile it'll delete its notices and the coupling to
file entries, but not the file entries themselves (and thus not the
files). So if one to delete a person uploading offending images, then
the images are left behind and can be hotlinked. This will remove it.
2016-02-11 22:19:56 +01:00