GitHub/WoltLab/WCF.git
3 years agoMerge pull request #3947 from WoltLab/ts-template-circular
Tim Düsterhus [Fri, 5 Feb 2021 15:32:12 +0000 (16:32 +0100)]
Merge pull request #3947 from WoltLab/ts-template-circular

Remove the circular dependency between Core/Language and Core/Template

3 years agoConsistently use "Attention" in English texts
Matthias Schmidt [Fri, 5 Feb 2021 15:20:35 +0000 (16:20 +0100)]
Consistently use "Attention" in English texts

See #3801

3 years agoMark Core/Template#compiled as readonly
Tim Düsterhus [Fri, 5 Feb 2021 15:06:56 +0000 (16:06 +0100)]
Mark Core/Template#compiled as readonly

3 years agoUse Object.entries() in Core/Language#addObject()
Tim Düsterhus [Fri, 5 Feb 2021 15:05:26 +0000 (16:05 +0100)]
Use Object.entries() in Core/Language#addObject()

3 years agoUpdate MysqlSearchEngine::getFulltextMinimumWordLength() for InnoDB
Tim Düsterhus [Fri, 5 Feb 2021 14:55:06 +0000 (15:55 +0100)]
Update MysqlSearchEngine::getFulltextMinimumWordLength() for InnoDB

At the same time copy over the deprecation comment from AbstractSearchEngine.

see 7d059540531e82c12b0aec2ad50e38a6788657cc
Resolves #3948

3 years agoConstistently print "Achtung" in bold in German language item
Matthias Schmidt [Fri, 5 Feb 2021 14:09:31 +0000 (15:09 +0100)]
Constistently print "Achtung" in bold in German language item

See #3801

3 years agoConsistently use "ungültig" in German language item
Matthias Schmidt [Fri, 5 Feb 2021 13:59:39 +0000 (14:59 +0100)]
Consistently use "ungültig" in German language item

See #3801

3 years agoAdd `WCFMessageQuoteManager` interface to replace temporary `any` type (#3949)
Matthias Schmidt [Fri, 5 Feb 2021 12:59:50 +0000 (13:59 +0100)]
Add `WCFMessageQuoteManager` interface to replace temporary `any` type (#3949)

3 years agoRemove the circular dependency between Core/Language and Core/Template
Tim Düsterhus [Fri, 5 Feb 2021 11:19:57 +0000 (12:19 +0100)]
Remove the circular dependency between Core/Language and Core/Template

The old work-around for this issue was no longer working well since the
migration to TypeScript. This commit untangles both modules, by each splitting
them into a low level and a high level interface.

The largest change is that language items are compiled when add()ing them to
the language store instead of when get()ting the contents.

This might slightly reduce the initialization performance on pages with a large
number of unused language items and it also might increase memory usage, due to
needing to store functions instead of strings.

It however improves the readability of the code and of course it also fixes
this breakage introduced by TypeScript. If it turns out that the change
actually *is* an issue then the logic can be optimized, e.g. by skipping the
template compiler if no `{` can be found within the phrase that is being
add()ed to the language store.

3 years agoMerge branch '5.3'
Matthias Schmidt [Fri, 5 Feb 2021 10:34:20 +0000 (11:34 +0100)]
Merge branch '5.3'

3 years agoMerge branch '5.2' into 5.3
Matthias Schmidt [Fri, 5 Feb 2021 10:33:18 +0000 (11:33 +0100)]
Merge branch '5.2' into 5.3

3 years agoFix mixed boolean operators in condition in `TI18nFormField::validate()`
Matthias Schmidt [Fri, 5 Feb 2021 10:33:03 +0000 (11:33 +0100)]
Fix mixed boolean operators in condition in `TI18nFormField::validate()`

… and improve the preceding comment.

See #3926

3 years agoImplement Language#addObject() in terms of Language#add()
Tim Düsterhus [Fri, 5 Feb 2021 10:22:14 +0000 (11:22 +0100)]
Implement Language#addObject() in terms of Language#add()

3 years agoUse monospace font for language item value fields in devtools
Matthias Schmidt [Fri, 5 Feb 2021 09:24:50 +0000 (10:24 +0100)]
Use monospace font for language item value fields in devtools

Close #3933

3 years agoUpdate `.git-blame-ignore-revs`
Matthias Schmidt [Fri, 5 Feb 2021 09:09:43 +0000 (10:09 +0100)]
Update `.git-blame-ignore-revs`

3 years agoMerge pull request #3937 from WoltLab/query_formatting
Matthias Schmidt [Fri, 5 Feb 2021 09:08:47 +0000 (10:08 +0100)]
Merge pull request #3937 from WoltLab/query_formatting

Improve formatting of SQL queries in PHP code

3 years agoSplit additional joins into multiple lines
Matthias Schmidt [Thu, 4 Feb 2021 17:08:56 +0000 (18:08 +0100)]
Split additional joins into multiple lines

3 years agoSplit subquery into multiple lines
Matthias Schmidt [Thu, 4 Feb 2021 16:41:15 +0000 (17:41 +0100)]
Split subquery into multiple lines

3 years agoRemove unnecessary parentheses around join conditions
Matthias Schmidt [Thu, 4 Feb 2021 16:15:11 +0000 (17:15 +0100)]
Remove unnecessary parentheses around join conditions

3 years agoAdd missing parentheses
joshuaruesweg [Thu, 4 Feb 2021 15:31:25 +0000 (16:31 +0100)]
Add missing parentheses

3 years agoMerge pull request #3934 from WoltLab/box_pages_restricting_viewing
Joshua Rüsweg [Thu, 4 Feb 2021 15:23:50 +0000 (16:23 +0100)]
Merge pull request #3934 from WoltLab/box_pages_restricting_viewing

Inverted Permissions for Boxes and Pages

3 years agoAdd inverted permissions feature for pages
joshuaruesweg [Thu, 4 Feb 2021 12:34:58 +0000 (13:34 +0100)]
Add inverted permissions feature for pages

3 years agoAdd inverted permissions feature for boxes
joshuaruesweg [Thu, 4 Feb 2021 12:13:06 +0000 (13:13 +0100)]
Add inverted permissions feature for boxes

3 years agoAdd support for inverted permissions with Simple ACL
joshuaruesweg [Thu, 4 Feb 2021 12:08:55 +0000 (13:08 +0100)]
Add support for inverted permissions with Simple ACL

3 years agoMerge pull request #3904 from WoltLab/tag-to-object-languageID
Tim Düsterhus [Thu, 4 Feb 2021 11:48:06 +0000 (12:48 +0100)]
Merge pull request #3904 from WoltLab/tag-to-object-languageID

Clean up wcf1_tag_to_object

3 years agoMerge pull request #3928 from WoltLab/deprecated-updateStyleFile
Tim Düsterhus [Thu, 4 Feb 2021 10:32:46 +0000 (11:32 +0100)]
Merge pull request #3928 from WoltLab/deprecated-updateStyleFile

Deprecate StyleUtil::updateStyleFile()

3 years agoExplicitely configure `printWidth: 120` for Prettier
Tim Düsterhus [Wed, 3 Feb 2021 16:40:37 +0000 (17:40 +0100)]
Explicitely configure `printWidth: 120` for Prettier

3 years agoMerge branch '5.3'
Matthias Schmidt [Wed, 3 Feb 2021 15:13:04 +0000 (16:13 +0100)]
Merge branch '5.3'

3 years agoFix name of English language item
Matthias Schmidt [Wed, 3 Feb 2021 15:12:48 +0000 (16:12 +0100)]
Fix name of English language item

See 324aa486d32e0d1e7021385657fd1388d00403ca

3 years agoMerge pull request #3929 from WoltLab/style-compiler
Tim Düsterhus [Wed, 3 Feb 2021 15:08:44 +0000 (16:08 +0100)]
Merge pull request #3929 from WoltLab/style-compiler

Clean up StyleCompiler

3 years agoRemove redundant wcfFontFamily generation for ACP style
Tim Düsterhus [Wed, 3 Feb 2021 14:46:01 +0000 (15:46 +0100)]
Remove redundant wcfFontFamily generation for ACP style

3 years agoFix the use of Google fonts in StyleCompiler
Tim Düsterhus [Wed, 3 Feb 2021 14:43:35 +0000 (15:43 +0100)]
Fix the use of Google fonts in StyleCompiler

3 years agoUse a `/*!` comment for the CSS header
Tim Düsterhus [Wed, 3 Feb 2021 13:42:32 +0000 (14:42 +0100)]
Use a `/*!` comment for the CSS header

This change stops the `Compressed` formatter from removing the comment,
allowing us to remove the `insertHeader()` logic which looked somewhat fragile.

3 years agoPass SCSS instead of files + invididualScss to StyleCompiler::compileStylesheet()
Tim Düsterhus [Wed, 3 Feb 2021 13:40:35 +0000 (14:40 +0100)]
Pass SCSS instead of files + invididualScss to StyleCompiler::compileStylesheet()

3 years agoMake StyleCompiler::compileStylesheet() only compile
Tim Düsterhus [Wed, 3 Feb 2021 13:28:39 +0000 (14:28 +0100)]
Make StyleCompiler::compileStylesheet() only compile

3 years agoAdd StyleCompiler::writeCss()
Tim Düsterhus [Wed, 3 Feb 2021 13:24:20 +0000 (14:24 +0100)]
Add StyleCompiler::writeCss()

3 years agoAdd StyleCompiler::convertToRtl()
Tim Düsterhus [Wed, 3 Feb 2021 13:17:50 +0000 (14:17 +0100)]
Add StyleCompiler::convertToRtl()

3 years agoAdd StyleCompiler::injectHeader()
Tim Düsterhus [Wed, 3 Feb 2021 13:10:43 +0000 (14:10 +0100)]
Add StyleCompiler::injectHeader()

3 years agoRemove the StyleCompiler::$compiler property
Tim Düsterhus [Wed, 3 Feb 2021 11:55:44 +0000 (12:55 +0100)]
Remove the StyleCompiler::$compiler property

State is bad. This method allows to prevent leaking compiler configuration
across multiple unrelated compilation processes.

3 years agoMake the StyleCompiler `final`
Tim Düsterhus [Wed, 3 Feb 2021 12:43:47 +0000 (13:43 +0100)]
Make the StyleCompiler `final`

3 years agoMerge branch '5.3'
Tim Düsterhus [Wed, 3 Feb 2021 15:00:12 +0000 (16:00 +0100)]
Merge branch '5.3'

3 years agoDownload Google fonts before validating the individual SCSS
Tim Düsterhus [Wed, 3 Feb 2021 14:57:05 +0000 (15:57 +0100)]
Download Google fonts before validating the individual SCSS

The individual SCSS will compile the style and this compiled CSS will later be
used for the style itself.

When first downloading a new Google font the font will not yet be available
during this test, thus the necessary CSS will not be included which in turn
will cause the font to fail to display.

3 years agoAdded missing parantheses
Alexander Ebert [Wed, 3 Feb 2021 12:39:33 +0000 (13:39 +0100)]
Added missing parantheses

Stictly speaking this was a bug, but based on how the HTML is laid out, it will never cause any unexpected side effects. Fixing this for the sake of code clarity.

3 years agoDeprecate StyleUtil::updateStyleFile()
Tim Düsterhus [Wed, 3 Feb 2021 11:23:25 +0000 (12:23 +0100)]
Deprecate StyleUtil::updateStyleFile()

Resolves #3927

3 years agoAdd explicit parentheses around mixed boolean operators in BooleanUserGroupOptionType
Tim Düsterhus [Wed, 3 Feb 2021 10:03:20 +0000 (11:03 +0100)]
Add explicit parentheses around mixed boolean operators in BooleanUserGroupOptionType

see #3926

3 years agoAdd explicit parentheses around mixed boolean operators in I18nPlural
Tim Düsterhus [Wed, 3 Feb 2021 10:02:25 +0000 (11:02 +0100)]
Add explicit parentheses around mixed boolean operators in I18nPlural

see #3926

3 years agoFix reference URL for Unicode plural rules
Tim Düsterhus [Wed, 3 Feb 2021 09:57:00 +0000 (10:57 +0100)]
Fix reference URL for Unicode plural rules

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Wed, 3 Feb 2021 09:07:47 +0000 (10:07 +0100)]
Merge branch '5.2' into 5.3

3 years agoMerge branch '3.1' into 5.2
Tim Düsterhus [Wed, 3 Feb 2021 09:06:55 +0000 (10:06 +0100)]
Merge branch '3.1' into 5.2

3 years agoMerge branch '3.0' into 3.1
Tim Düsterhus [Wed, 3 Feb 2021 09:06:19 +0000 (10:06 +0100)]
Merge branch '3.0' into 3.1

3 years agoFix typo in phrases
Tim Düsterhus [Wed, 3 Feb 2021 08:18:31 +0000 (09:18 +0100)]
Fix typo in phrases

3 years agoSupport changing moderation queue status of closed entries (#3924)
Matthias Schmidt [Tue, 2 Feb 2021 14:22:52 +0000 (15:22 +0100)]
Support changing moderation queue status of closed entries (#3924)

Close #3227

3 years agoMerge branch '5.3'
Matthias Schmidt [Tue, 2 Feb 2021 12:28:26 +0000 (13:28 +0100)]
Merge branch '5.3'

3 years agoMerge branch '5.2' into 5.3
Matthias Schmidt [Tue, 2 Feb 2021 12:26:39 +0000 (13:26 +0100)]
Merge branch '5.2' into 5.3

3 years agoIgnore name of primary keys during creation (#3921)
Matthias Schmidt [Tue, 2 Feb 2021 12:26:09 +0000 (13:26 +0100)]
Ignore name of primary keys during creation (#3921)

3 years agoMerge pull request #3918 from WoltLab/exporter-init
Tim Düsterhus [Tue, 2 Feb 2021 11:19:25 +0000 (12:19 +0100)]
Merge pull request #3918 from WoltLab/exporter-init

Initialize the exporter only once in ImportWorker

3 years agoFix bad merge / codestyle
Tim Düsterhus [Tue, 2 Feb 2021 10:39:44 +0000 (11:39 +0100)]
Fix bad merge / codestyle

When resolving the conflict in UserAvatarAction due to
621a83b075404f408dd025dfdc2cc55a43466536 it was forgotten to add the leading
backslash.

3 years agoMerge branch '5.3'
Tim Düsterhus [Tue, 2 Feb 2021 10:33:23 +0000 (11:33 +0100)]
Merge branch '5.3'

3 years agoMake 5.4_session_3_migrate_session.php idempotent
Tim Düsterhus [Tue, 2 Feb 2021 10:31:21 +0000 (11:31 +0100)]
Make 5.4_session_3_migrate_session.php idempotent

Fixes #3923

3 years agoLong file name caused SQL error
Marcel Werk [Tue, 2 Feb 2021 10:28:22 +0000 (11:28 +0100)]
Long file name caused SQL error

3 years agoRelease 5.3.4 5.3.4
Alexander Ebert [Mon, 1 Feb 2021 12:07:47 +0000 (13:07 +0100)]
Release 5.3.4

3 years agoMerge branch '5.2' into 5.3
Alexander Ebert [Mon, 1 Feb 2021 12:04:25 +0000 (13:04 +0100)]
Merge branch '5.2' into 5.3

3 years agoRelease 5.2.12 5.2.12
Alexander Ebert [Mon, 1 Feb 2021 12:00:53 +0000 (13:00 +0100)]
Release 5.2.12

3 years agoMerge branch '3.1' into 5.2
Alexander Ebert [Mon, 1 Feb 2021 11:59:33 +0000 (12:59 +0100)]
Merge branch '3.1' into 5.2

3 years agoRelease 3.1.20 3.1.20
Alexander Ebert [Mon, 1 Feb 2021 11:56:07 +0000 (12:56 +0100)]
Release 3.1.20

3 years agoMerge branch '3.0' into 3.1
Alexander Ebert [Mon, 1 Feb 2021 11:55:02 +0000 (12:55 +0100)]
Merge branch '3.0' into 3.1

3 years agoMerge branch '5.3'
Tim Düsterhus [Mon, 1 Feb 2021 11:54:02 +0000 (12:54 +0100)]
Merge branch '5.3'

3 years agoRelease 3.0.26 3.0.26
Alexander Ebert [Mon, 1 Feb 2021 11:50:17 +0000 (12:50 +0100)]
Release 3.0.26

3 years agoMerge branch '5.2' into 5.3
Alexander Ebert [Mon, 1 Feb 2021 11:48:01 +0000 (12:48 +0100)]
Merge branch '5.2' into 5.3

3 years agoMerge branch '3.1' into 5.2
Alexander Ebert [Mon, 1 Feb 2021 11:47:42 +0000 (12:47 +0100)]
Merge branch '3.1' into 5.2

3 years agoMerge branch '3.0' into 3.1
Alexander Ebert [Mon, 1 Feb 2021 11:47:24 +0000 (12:47 +0100)]
Merge branch '3.0' into 3.1

3 years agoMissing check for accessible user groups
Alexander Ebert [Mon, 1 Feb 2021 11:47:09 +0000 (12:47 +0100)]
Missing check for accessible user groups

3 years agoMerge branch '3.0' into 3.1
Alexander Ebert [Mon, 1 Feb 2021 11:38:59 +0000 (12:38 +0100)]
Merge branch '3.0' into 3.1

3 years agoNotify users of the expiring support
Alexander Ebert [Mon, 1 Feb 2021 11:38:49 +0000 (12:38 +0100)]
Notify users of the expiring support

3 years agoMerge branch '3.0' into 3.1
Alexander Ebert [Mon, 1 Feb 2021 11:38:11 +0000 (12:38 +0100)]
Merge branch '3.0' into 3.1

3 years agoIgnore top-level node_modules/
Tim Düsterhus [Fri, 16 Oct 2020 11:57:29 +0000 (13:57 +0200)]
Ignore top-level node_modules/

3 years agoMerge branch '5.3'
Tim Düsterhus [Mon, 1 Feb 2021 10:54:13 +0000 (11:54 +0100)]
Merge branch '5.3'

3 years agoMerge pull request #3920 from WoltLab/http-request-proxy
Tim Düsterhus [Mon, 1 Feb 2021 10:50:35 +0000 (11:50 +0100)]
Merge pull request #3920 from WoltLab/http-request-proxy

Fix HTTPRequest with proxies

3 years agoStream HTTPRequest responses only of a maximum length is desired
Tim Düsterhus [Mon, 1 Feb 2021 10:37:09 +0000 (11:37 +0100)]
Stream HTTPRequest responses only of a maximum length is desired

cURL is not supported for streaming responses. As we process the full response
body for requests without a maximum length there is no benefit to streaming the
response, because we lose cURL support.

3 years agoUpdate Guzzle
Tim Düsterhus [Mon, 1 Feb 2021 10:34:50 +0000 (11:34 +0100)]
Update Guzzle

see guzzle/guzzle#2848
see guzzle/guzzle#2850

3 years agoMerge pull request #3917 from WoltLab/cover-photo-webp-thumbnail
Alexander Ebert [Fri, 29 Jan 2021 19:03:38 +0000 (20:03 +0100)]
Merge pull request #3917 from WoltLab/cover-photo-webp-thumbnail

WebP support for cover photos

3 years agoMerge pull request #3919 from WoltLab/lostpassword_flood
Joshua Rüsweg [Fri, 29 Jan 2021 16:42:09 +0000 (17:42 +0100)]
Merge pull request #3919 from WoltLab/lostpassword_flood

Add LostPassword Flood Control

3 years agoAdd update instructions for index updates of `wcf1_tag_to_object`
Matthias Schmidt [Fri, 29 Jan 2021 16:31:38 +0000 (17:31 +0100)]
Add update instructions for index updates of `wcf1_tag_to_object`

3 years agoMake wcf1_tag_to_object's PRIMARY KEY a UNIQUE KEY
Tim Düsterhus [Wed, 27 Jan 2021 10:52:30 +0000 (11:52 +0100)]
Make wcf1_tag_to_object's PRIMARY KEY a UNIQUE KEY

see #3803

3 years agoRemove redundant column from wcf1_tag_to_object.tagID key
Tim Düsterhus [Wed, 27 Jan 2021 10:49:23 +0000 (11:49 +0100)]
Remove redundant column from wcf1_tag_to_object.tagID key

This key was identical to the `(objectTypeID, tagID)` key. We don't need the
objectTypeID here.

3 years agoRemove the languageID column from keys in wcf1_tag_to_object
Tim Düsterhus [Wed, 27 Jan 2021 10:47:10 +0000 (11:47 +0100)]
Remove the languageID column from keys in wcf1_tag_to_object

This column is functionally dependent on tagID. Since the previous commits this
column is no longer used and only filled for backwards compatibility.

See #3803

3 years agoStop accessing wcf1_tag_to_object.languageID in TagEngine::getObjectsTags()
Tim Düsterhus [Wed, 27 Jan 2021 10:44:09 +0000 (11:44 +0100)]
Stop accessing wcf1_tag_to_object.languageID in TagEngine::getObjectsTags()

This stops accessing the redundant `languageID` column that is functionally
dependent on the tagID (see #3803).

This change will make the query a little bit slower, but this will be
remediated by adjusting the indices on the wcf1_tag_to_object table after which
the performance will be identical:

    MariaDB [*snip*]> EXPLAIN
        -> SELECT tag.*,
        ->        tag_to_object.objectid
        -> FROM   wcf1_tag_to_object tag_to_object
        ->        LEFT JOIN wcf1_tag tag
        ->               ON ( tag.tagid = tag_to_object.tagid )
        -> WHERE  tag_to_object.objecttypeid = 92
        ->        AND tag_to_object.objectid IN ( 3553, 7990 )
        ->        AND tag_to_object.languageid IN ( 1 );
    +------+-------------+---------------+--------+----------------------------------------------------------------------+-------------------------------------+---------+-------------------------------+------+--------------------------+
    | id   | select_type | table         | type   | possible_keys                                                        | key                                 | key_len | ref                           | rows | Extra                    |
    +------+-------------+---------------+--------+----------------------------------------------------------------------+-------------------------------------+---------+-------------------------------+------+--------------------------+
    |    1 | SIMPLE      | tag_to_object | range  | objectTypeID,objectTypeID_2,cbbba36334575d806c002a8756c8a107_fk,test | cbbba36334575d806c002a8756c8a107_fk | 12      | NULL                          |    8 | Using where; Using index |
    |    1 | SIMPLE      | tag           | eq_ref | PRIMARY                                                              | PRIMARY                             | 4       | *snip*.tag_to_object.tagID    |    1 |                          |
    +------+-------------+---------------+--------+----------------------------------------------------------------------+-------------------------------------+---------+-------------------------------+------+--------------------------+
    2 rows in set (0.00 sec)

    MariaDB [*snip*]>
    MariaDB [*snip*]> EXPLAIN
        -> SELECT tag.*,
        ->        tag_to_object.objectid
        -> FROM   wcf1_tag_to_object tag_to_object
        ->        LEFT JOIN wcf1_tag tag
        ->               ON ( tag.tagid = tag_to_object.tagid )
        -> WHERE  tag_to_object.objecttypeid = 92
        ->        AND tag_to_object.objectid IN ( 3553, 7990 )
        ->        AND tag.languageid IN ( 1 );
    +------+-------------+---------------+--------+----------------------------------------+---------+---------+-------------------------------+------+--------------------------+
    | id   | select_type | table         | type   | possible_keys                          | key     | key_len | ref                           | rows | Extra                    |
    +------+-------------+---------------+--------+----------------------------------------+---------+---------+-------------------------------+------+--------------------------+
    |    1 | SIMPLE      | tag_to_object | range  | objectTypeID,objectTypeID_2,tagID,test | test    | 8       | NULL                          |    8 | Using where; Using index |
    |    1 | SIMPLE      | tag           | eq_ref | PRIMARY,languageID                     | PRIMARY | 4       | *snip*.tag_to_object.tagID    |    1 | Using where              |
    +------+-------------+---------------+--------+----------------------------------------+---------+---------+-------------------------------+------+--------------------------+
    2 rows in set (0.00 sec)

3 years agoStop accessing wcf1_tag_to_object.languageID during DELETE in TagEngine
Tim Düsterhus [Wed, 27 Jan 2021 10:35:04 +0000 (11:35 +0100)]
Stop accessing wcf1_tag_to_object.languageID during DELETE in TagEngine

This stops accessing the redundant `languageID` column that is functionally
dependent on the tagID (see #3803).

3 years agoStop accessing wcf1_tag_to_object.languageID in TagCloudCacheBuilder::getTags()
Tim Düsterhus [Wed, 27 Jan 2021 09:59:30 +0000 (10:59 +0100)]
Stop accessing wcf1_tag_to_object.languageID in TagCloudCacheBuilder::getTags()

This change comes with one primary benefit:

This stops accessing the redundant `languageID` column that is functionally
dependent on the tagID (see #3803).

On MariaDB 10.1 at a first glance this results in a *much* better query plan
(note the lower row count for the first query):

    MariaDB [*snip*]> EXPLAIN
        -> SELECT tag.tagid,
        ->        Count(object.objectid) AS counter
        -> FROM   wcf1_tag_to_object object
        ->        INNER JOIN wcf1_tag tag
        ->                ON tag.tagid = object.tagid
        -> WHERE  object.objecttypeid IN ( 92 )
        ->        AND tag.languageid IN ( 1 )
        -> GROUP  BY tag.tagid
        -> ORDER  BY counter DESC,
        ->           tag.tagid DESC
        -> LIMIT  500;
    +------+-------------+--------+------+-----------------------------------+------------+---------+---------------------------+------+-----------------------------------------------------------+
    | id   | select_type | table  | type | possible_keys                     | key        | key_len | ref                       | rows | Extra                                                     |
    +------+-------------+--------+------+-----------------------------------+------------+---------+---------------------------+------+-----------------------------------------------------------+
    |    1 | SIMPLE      | tag    | ref  | PRIMARY,languageID                | languageID | 4       | const                     | 5299 | Using where; Using index; Using temporary; Using filesort |
    |    1 | SIMPLE      | object | ref  | objectTypeID,objectTypeID_2,tagID | tagID      | 8       | *snip*.tag.tagID,const    |    3 | Using index                                               |
    +------+-------------+--------+------+-----------------------------------+------------+---------+---------------------------+------+-----------------------------------------------------------+
    2 rows in set (0.00 sec)

    MariaDB [*snip*]>
    MariaDB [*snip*]> EXPLAIN
        -> SELECT object.tagid,
        ->        Count(*) AS counter
        -> FROM   wcf1_tag_to_object object
        -> WHERE  object.objecttypeid IN ( 92 )
        ->        AND object.languageid IN ( 1 )
        -> GROUP  BY object.tagid
        -> ORDER  BY counter DESC,
        ->           object.tagid DESC
        -> LIMIT  500;
    +------+-------------+--------+------+-----------------------------------------------------------------+--------------+---------+-------------+-------+-----------------------------------------------------------+
    | id   | select_type | table  | type | possible_keys                                                   | key          | key_len | ref         | rows  | Extra                                                     |
    +------+-------------+--------+------+-----------------------------------------------------------------+--------------+---------+-------------+-------+-----------------------------------------------------------+
    |    1 | SIMPLE      | object | ref  | objectTypeID,objectTypeID_2,cbbba36334575d806c002a8756c8a107_fk | objectTypeID | 8       | const,const | 56293 | Using where; Using index; Using temporary; Using filesort |
    +------+-------------+--------+------+-----------------------------------------------------------------+--------------+---------+-------------+-------+-----------------------------------------------------------+
    1 row in set (0.00 sec)

When running the query this unfortunately is a bit slower 0.05 (new) vs 0.03
(old) seconds. This can also be confirmed with a (larger) MySQL 8 installation
and using EXPLAIN ANALYZE:

    > EXPLAIN ANALYZE
        -> SELECT tag.tagid,
        ->        Count(object.objectid) AS counter
        -> FROM   wcf1_tag_to_object object
        ->        INNER JOIN wcf1_tag tag
        ->                ON tag.tagid = object.tagid
        -> WHERE  object.objecttypeid IN ( 203, 337 )
        ->        AND tag.languageid IN ( 1 )
        -> GROUP  BY tag.tagid
        -> ORDER  BY counter DESC
        -> LIMIT  500 \G
    *************************** 1. row ***************************
    EXPLAIN: -> Limit: 500 row(s)  (actual time=166.506..166.540 rows=500 loops=1)
        -> Sort: counter DESC, limit input to 500 row(s) per chunk  (actual time=166.505..166.520 rows=500 loops=1)
            -> Table scan on <temporary>  (actual time=0.001..0.509 rows=16716 loops=1)
                -> Aggregate using temporary table  (actual time=163.863..165.054 rows=16716 loops=1)
                    -> Nested loop inner join  (cost=14797.71 rows=87401) (actual time=0.056..112.533 rows=201296 loops=1)
                        -> Index lookup on tag using languageID (languageID=1)  (cost=1132.88 rows=9229) (actual time=0.037..3.809 rows=18651 loops=1)
                        -> Filter: (object.objectTypeID in (203,337))  (cost=0.27 rows=9) (actual time=0.002..0.005 rows=11 loops=18651)
                            -> Index lookup on object using tagID (tagID=tag.tagID)  (cost=0.27 rows=12) (actual time=0.002..0.004 rows=11 loops=18651)

    1 row in set (0.16 sec)

    > EXPLAIN ANALYZE
        -> SELECT object.tagid,
        ->        Count(*) AS counter
        -> FROM   wcf1_tag_to_object object
        -> WHERE  object.objecttypeid IN ( 203, 337 )
        ->        AND object.languageid IN ( 1 )
        -> GROUP  BY object.tagid
        -> ORDER  BY counter DESC
        -> LIMIT  500 \G
    *************************** 1. row ***************************
    EXPLAIN: -> Limit: 500 row(s)  (actual time=135.420..135.461 rows=500 loops=1)
        -> Sort: counter DESC, limit input to 500 row(s) per chunk  (actual time=135.419..135.437 rows=500 loops=1)
            -> Table scan on <temporary>  (actual time=0.000..0.560 rows=16716 loops=1)
                -> Aggregate using temporary table  (actual time=132.599..133.936 rows=16716 loops=1)
                    -> Filter: ((object.languageID = 1) and (object.objectTypeID in (203,337)))  (cost=31642.06 rows=157965) (actual time=0.080..72.889 rows=201296 loops=1)
                        -> Index range scan on object using objectTypeID  (cost=31642.06 rows=157965) (actual time=0.076..53.904 rows=201296 loops=1)

    1 row in set (0.14 sec)

Nonetheless this appears to be worth it. Especially if we can remove the
`languageID` column in the future.

I also attempted to get rid of the second query, by simply putting a `tag.*`
into the column list of the first query. Unfortunately MariaDB 10.1 (which is
our minimum requirement) is too dumb to determine that all the columns in the
`tag` table are functionally dependent on `tag.tagID`. MySQL 8 is able to handle
that correctly.

I have verified that both queries result in the same results (except for the
undefined ordering when the counter is identical).

3 years agoAdd LostPassword Flood Control
joshuaruesweg [Fri, 29 Jan 2021 14:49:26 +0000 (15:49 +0100)]
Add LostPassword Flood Control

3 years agoMerge branch '5.3'
Tim Düsterhus [Fri, 29 Jan 2021 15:24:32 +0000 (16:24 +0100)]
Merge branch '5.3'

3 years agoMerge branch '5.2' into 5.3
Matthias Schmidt [Fri, 29 Jan 2021 15:23:00 +0000 (16:23 +0100)]
Merge branch '5.2' into 5.3

3 years agoFix which index object is used when dropping indices with PHP API
Matthias Schmidt [Fri, 29 Jan 2021 15:22:50 +0000 (16:22 +0100)]
Fix which index object is used when dropping indices with PHP API

Only `$matchingExistingIndex` is guaranteed to have the correct index name.

3 years agoMerge branch '5.3'
Tim Düsterhus [Fri, 29 Jan 2021 15:02:09 +0000 (16:02 +0100)]
Merge branch '5.3'

3 years agoMerge branch '5.2' into 5.3
Matthias Schmidt [Fri, 29 Jan 2021 14:55:51 +0000 (15:55 +0100)]
Merge branch '5.2' into 5.3

3 years agoFix checked property when adding indices to `DatabaseTable`
Matthias Schmidt [Fri, 29 Jan 2021 14:55:26 +0000 (15:55 +0100)]
Fix checked property when adding indices to `DatabaseTable`

3 years agoMerge branch '5.2' into 5.3 5.3.3
Alexander Ebert [Fri, 29 Jan 2021 14:25:33 +0000 (15:25 +0100)]
Merge branch '5.2' into 5.3

3 years agoRelease 5.2.11 5.2.11
Alexander Ebert [Fri, 29 Jan 2021 14:01:03 +0000 (15:01 +0100)]
Release 5.2.11

3 years agoMerge branch '3.1' into 5.2
Alexander Ebert [Fri, 29 Jan 2021 13:56:16 +0000 (14:56 +0100)]
Merge branch '3.1' into 5.2

3 years agoRelease 3.1.19 3.1.19
Alexander Ebert [Fri, 29 Jan 2021 13:44:59 +0000 (14:44 +0100)]
Release 3.1.19