GitHub/WoltLab/WCF.git
3 years agoMerge pull request #4470 from WoltLab/oauth2-state-clear
Tim Düsterhus [Fri, 20 Aug 2021 13:52:15 +0000 (15:52 +0200)]
Merge pull request #4470 from WoltLab/oauth2-state-clear

Ensure that the OAuth 2 state parameter is cleared in all cases

3 years agoEnsure that the OAuth 2 state parameter is cleared in all cases
Tim Düsterhus [Fri, 20 Aug 2021 13:16:46 +0000 (15:16 +0200)]
Ensure that the OAuth 2 state parameter is cleared in all cases

3 years agoMissing phrases for validation errors in the app management
Alexander Ebert [Fri, 20 Aug 2021 13:09:50 +0000 (15:09 +0200)]
Missing phrases for validation errors in the app management

3 years agoMerge pull request #4467 from WoltLab/coverPhoto-worker
Tim Düsterhus [Fri, 20 Aug 2021 09:50:14 +0000 (11:50 +0200)]
Merge pull request #4467 from WoltLab/coverPhoto-worker

Fix handling of cover photos in UserRebuildDataWorker

3 years agoAdd AbstractFormFieldDecorator (#4469)
Peter Lohse [Fri, 20 Aug 2021 09:19:23 +0000 (11:19 +0200)]
Add AbstractFormFieldDecorator (#4469)

3 years agoRemove records of unreadable cover photos in UserRebuildDataWorker
Tim Düsterhus [Fri, 20 Aug 2021 07:35:35 +0000 (09:35 +0200)]
Remove records of unreadable cover photos in UserRebuildDataWorker

This is a clean fix of c3ebf8b995927b826072cfcc72d08a9ebd93f878.

3 years agoCheck `coverPhotoHasWebP` in UserRebuildDataWorker
Tim Düsterhus [Fri, 20 Aug 2021 07:31:14 +0000 (09:31 +0200)]
Check `coverPhotoHasWebP` in UserRebuildDataWorker

This is already checked in `->createWebpVariant()`, but with the `->update()`
added in the previous commit this saves some work.

3 years agoUpdate `coverPhotoHasWebP` in UserRebuilDataWorker
Tim Düsterhus [Fri, 20 Aug 2021 07:30:32 +0000 (09:30 +0200)]
Update `coverPhotoHasWebP` in UserRebuilDataWorker

3 years agoUse ->getLocation() in UserCoverPhoto::createWebpVariant()
Tim Düsterhus [Fri, 20 Aug 2021 07:20:51 +0000 (09:20 +0200)]
Use ->getLocation() in UserCoverPhoto::createWebpVariant()

This partially reapplies c3ebf8b995927b826072cfcc72d08a9ebd93f878 which was
reverted in 300312306b2858b6b9f474a30814fe16c3e1854c.

3 years agoRevert "Skip cover photos that cannot be read"
Tim Düsterhus [Fri, 20 Aug 2021 07:19:28 +0000 (09:19 +0200)]
Revert "Skip cover photos that cannot be read"

This should rather be cleanly fixed within the UserRebuildDataWorker, while
also updating the database on failure.

This reverts commit c3ebf8b995927b826072cfcc72d08a9ebd93f878.

3 years agoFix check whether a non-owned index is being dropped in DatabaseTableChangeProcessor
Tim Düsterhus [Thu, 19 Aug 2021 14:43:57 +0000 (16:43 +0200)]
Fix check whether a non-owned index is being dropped in DatabaseTableChangeProcessor

The reproducer and fix is effectively identical to the one in
d7f721d6f920d66f75102723b504d89e57a8c9ff.

Package A: Installs KEY someIndex (`UNIQUE`)
Package B: Installs UNIQUE KEY someIndex2 (`UNIQUE`)
Package B: Drops UNIQUE KEY someIndex2 (`UNIQUE`)

It was erroneously detected that Package B would drop the index owned by
Package A. The actual dropping logic was already correct, just the safety check
was incorrect.

3 years agoSkip cover photos that cannot be read
Alexander Ebert [Wed, 18 Aug 2021 16:37:11 +0000 (18:37 +0200)]
Skip cover photos that cannot be read

3 years agoMerge pull request #4464 from WoltLab/session-id-unpack
Tim Düsterhus [Wed, 18 Aug 2021 09:35:20 +0000 (11:35 +0200)]
Merge pull request #4464 from WoltLab/session-id-unpack

Fix unpacking of the sessionId

3 years agoAdd safety check for unpacked session cookie data
Tim Düsterhus [Wed, 18 Aug 2021 07:43:22 +0000 (09:43 +0200)]
Add safety check for unpacked session cookie data

3 years agoFix unpacking of the sessionId
Tim Düsterhus [Wed, 18 Aug 2021 07:44:07 +0000 (09:44 +0200)]
Fix unpacking of the sessionId

As documented by PHP's reference documentation:

> The "a" code now retains trailing NULL bytes.
> The "A" code now strips all trailing ASCII whitespace (spaces, tabs,
> newlines, carriage returns, and NULL bytes).

Previously, with the 'A' code, sessionIds ending in ASCII whitespace would be
incorrectly unpacked, missing their trailing bytes. This ultimately resulted in
the session not being found and the user being logged out.

Five of the 256 possible characters exhibited this bug, making this fail in
roughly 2% of the cases.

However this likely was not noticable by the typical user. Once they have a
non-affected sessionId, this Id is not going to change. What the user might've
noticed is a login not working, despite showing a success message, because they
sessionId change after a successful login handed out an affected sessionId. But
then the user would likely try again, succeeding this time and writing off the
incident as a fluke.

Test script to reproduce the issue:

    <?php

    for ($i = 0; $i <= 255; $i++) {
        $string = "foo".chr($i);

        $packed = \pack(
            'CA4',
            1,
            $string
        );
        $unpacked1 = \unpack('Cversion/A4string', $packed);
        $unpacked2 = \unpack('Cversion/a4string', $packed);

        if ($unpacked1['string'] !== $string) {
            echo "$i: unpacked1\n";
        }
        if ($unpacked2['string'] !== $string) {
            echo "$i: unpacked2\n";
        }
    }

3 years agoFix informal phrase in de.xml
Tim Düsterhus [Wed, 18 Aug 2021 07:04:18 +0000 (09:04 +0200)]
Fix informal phrase in de.xml

3 years agoMark as read doesn't removed the badge from submenu entries
Marcel Werk [Mon, 16 Aug 2021 13:08:54 +0000 (15:08 +0200)]
Mark as read doesn't removed the badge from submenu entries

3 years agoMissing informal variant
Marcel Werk [Mon, 16 Aug 2021 12:56:30 +0000 (14:56 +0200)]
Missing informal variant

3 years agoTypo
Marcel Werk [Mon, 16 Aug 2021 12:52:59 +0000 (14:52 +0200)]
Typo

3 years agoWhitelist `abs` in enterprise mode
Tim Düsterhus [Mon, 16 Aug 2021 10:53:46 +0000 (12:53 +0200)]
Whitelist `abs` in enterprise mode

3 years agoMerge pull request #4463 from WoltLab/smiley-unicode-title
Tim Düsterhus [Mon, 16 Aug 2021 09:02:42 +0000 (11:02 +0200)]
Merge pull request #4463 from WoltLab/smiley-unicode-title

Fix Unicode in smiley titles

3 years agoFix Unicode in smiley titles
Tim Düsterhus [Mon, 16 Aug 2021 07:09:10 +0000 (09:09 +0200)]
Fix Unicode in smiley titles

see 5d0bf3ec233f62c6a5a68629e32b7eaa8c9d1dd3
see #4156

3 years agoFix localization of PAGE_TITLE in __multifactorTotpSecretField.tpl
Tim Düsterhus [Sun, 15 Aug 2021 12:33:39 +0000 (14:33 +0200)]
Fix localization of PAGE_TITLE in __multifactorTotpSecretField.tpl

3 years agoAdd `required` attributes to acptemplates/login
Tim Düsterhus [Fri, 13 Aug 2021 10:31:32 +0000 (12:31 +0200)]
Add `required` attributes to acptemplates/login

3 years agoShow article labels in recent activities
Marcel Werk [Fri, 13 Aug 2021 09:35:44 +0000 (11:35 +0200)]
Show article labels in recent activities

3 years agoFix PHP 8.1 compatibility in DatabaseObject::getDatabaseTableIndexName()
Tim Düsterhus [Fri, 13 Aug 2021 08:45:58 +0000 (10:45 +0200)]
Fix PHP 8.1 compatibility in DatabaseObject::getDatabaseTableIndexName()

3 years agoMerge branch '5.3' into 5.4
Tim Düsterhus [Fri, 13 Aug 2021 07:20:30 +0000 (09:20 +0200)]
Merge branch '5.3' into 5.4

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Fri, 13 Aug 2021 07:19:27 +0000 (09:19 +0200)]
Merge branch '5.2' into 5.3

3 years agoMerge pull request #4459 from SoftCreatR/bugfix/custom-errors
Tim Düsterhus [Fri, 13 Aug 2021 07:18:36 +0000 (09:18 +0200)]
Merge pull request #4459 from SoftCreatR/bugfix/custom-errors

Unify error handling in several templates

3 years agoUnified error handling in several templates
Sascha Greuel [Thu, 12 Aug 2021 16:08:27 +0000 (18:08 +0200)]
Unified error handling in several templates

3 years agoSlightly improve phrasing in de.xml
Tim Düsterhus [Thu, 12 Aug 2021 15:22:34 +0000 (17:22 +0200)]
Slightly improve phrasing in de.xml

3 years agoMerge branch '5.3' into 5.4
Tim Düsterhus [Thu, 12 Aug 2021 08:09:17 +0000 (10:09 +0200)]
Merge branch '5.3' into 5.4

3 years agoAdd missing call to ->loadVariables() before downloading Google Font during style...
Tim Düsterhus [Thu, 12 Aug 2021 08:07:08 +0000 (10:07 +0200)]
Add missing call to ->loadVariables() before downloading Google Font during style import

3 years agoRename `Ui/Object/Action/Toogle` to `Toggle` (#4450)
Joshua Rüsweg [Thu, 12 Aug 2021 07:23:30 +0000 (09:23 +0200)]
Rename `Ui/Object/Action/Toogle` to `Toggle` (#4450)

3 years agoMerge pull request #4456 from WoltLab/style-edit-description
Tim Düsterhus [Wed, 11 Aug 2021 13:31:13 +0000 (15:31 +0200)]
Merge pull request #4456 from WoltLab/style-edit-description

Prevent StyleEditForm from creating phrases with empty name

3 years agoDelete the empty phrase when updating to 5.4.5
Tim Düsterhus [Wed, 11 Aug 2021 12:22:10 +0000 (14:22 +0200)]
Delete the empty phrase when updating to 5.4.5

3 years agoValidate the languageVariable in I18nHandler::save()
Tim Düsterhus [Wed, 11 Aug 2021 12:19:53 +0000 (14:19 +0200)]
Validate the languageVariable in I18nHandler::save()

3 years agoAdd LanguageEditor::validateItemName()
Tim Düsterhus [Wed, 11 Aug 2021 12:17:49 +0000 (14:17 +0200)]
Add LanguageEditor::validateItemName()

3 years agoStore deterministic language variable for style description in StyleEditForm
Tim Düsterhus [Wed, 11 Aug 2021 12:12:42 +0000 (14:12 +0200)]
Store deterministic language variable for style description in StyleEditForm

If the `styleDescription` was empty (as it might be for the default style) this
attempted to store the description in the language item with empty name.

3 years agoMissing information who reported a content, if report was made by a guest
Marcel Werk [Wed, 11 Aug 2021 11:26:02 +0000 (13:26 +0200)]
Missing information who reported a content, if report was made by a guest

3 years agoMerge branch '5.3' into 5.4
Tim Düsterhus [Wed, 11 Aug 2021 09:56:40 +0000 (11:56 +0200)]
Merge branch '5.3' into 5.4

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Wed, 11 Aug 2021 09:56:10 +0000 (11:56 +0200)]
Merge branch '5.2' into 5.3

3 years agoMerge pull request #4453 from WoltLab/iformbutton-is-available
Tim Düsterhus [Wed, 11 Aug 2021 09:37:23 +0000 (11:37 +0200)]
Merge pull request #4453 from WoltLab/iformbutton-is-available

Check whether an IFormButton is available before rendering

3 years agoCheck whether an IFormButton is available before rendering
Tim Düsterhus [Wed, 11 Aug 2021 07:54:12 +0000 (09:54 +0200)]
Check whether an IFormButton is available before rendering

3 years agoUpdating minified JavaScript files 5.4.4
WoltLab [Tue, 10 Aug 2021 13:30:36 +0000 (13:30 +0000)]
Updating minified JavaScript files

3 years agoRelease 5.4.4
Alexander Ebert [Tue, 10 Aug 2021 13:26:04 +0000 (15:26 +0200)]
Release 5.4.4

3 years agoRebuild JavaScript
Tim Düsterhus [Tue, 10 Aug 2021 12:36:32 +0000 (14:36 +0200)]
Rebuild JavaScript

see 33e803caa3e934a078a240687d452f54825379d9

3 years agoFix typo in Ui/Reaction/Handler.ts
Tim Düsterhus [Tue, 10 Aug 2021 12:34:12 +0000 (14:34 +0200)]
Fix typo in Ui/Reaction/Handler.ts

see 679d5fe8a2353c69b75fd103753831dc785f83a8

3 years agouse the sessions language id instead of the user's default in `I18nDatabaseObjectList`
mutec [Tue, 10 Aug 2021 10:06:27 +0000 (12:06 +0200)]
use the sessions language id instead of the user's default in `I18nDatabaseObjectList`

`WCF::getUser()->languageID` doesn't return a valid language id as integer in every case. Additionally we (normally) want to use a specific language or the session's language - which might be different from the user's default in some moments.

see #4407

3 years agoRelease 5.4.3 5.4.3
Alexander Ebert [Tue, 10 Aug 2021 09:05:07 +0000 (11:05 +0200)]
Release 5.4.3

3 years agoUpdating minified JavaScript files
WoltLab [Mon, 9 Aug 2021 16:39:16 +0000 (16:39 +0000)]
Updating minified JavaScript files

3 years agoWorkaround for unfreezing the screen in iOS Safari
Alexander Ebert [Mon, 9 Aug 2021 16:36:13 +0000 (18:36 +0200)]
Workaround for unfreezing the screen in iOS Safari

The change to the CSS class and the properties cause a recalculation that could sometimes interfere with the page scrolling.

Forcing the scrolling into the next iteration of the event loop solves this issue by separating both actions. Since the scrolling does depend on the actions in the lines above it, this is reasonably safe to do.

3 years agoFix sorting status column in emailLogList.tpl
joshuaruesweg [Mon, 9 Aug 2021 13:22:31 +0000 (15:22 +0200)]
Fix sorting status column in emailLogList.tpl

3 years agoSkip XML that have been unchanged for 5.3 -> 5.4
Alexander Ebert [Mon, 9 Aug 2021 12:00:00 +0000 (14:00 +0200)]
Skip XML that have been unchanged for 5.3 -> 5.4

3 years agoMerge pull request #4445 from WoltLab/template-sandbox-foreachvars
Alexander Ebert [Mon, 9 Aug 2021 10:53:43 +0000 (12:53 +0200)]
Merge pull request #4445 from WoltLab/template-sandbox-foreachvars

Sandbox `foreachVars` in templates

3 years agoMerge pull request #4446 from WoltLab/mfa-setup-allocation-failed
Marcel Werk [Mon, 9 Aug 2021 09:35:07 +0000 (11:35 +0200)]
Merge pull request #4446 from WoltLab/mfa-setup-allocation-failed

Show nicer error message if allocating the MFA setup fails

3 years agoShow nicer error message if allocating the MFA setup fails
Tim Düsterhus [Mon, 9 Aug 2021 09:27:51 +0000 (11:27 +0200)]
Show nicer error message if allocating the MFA setup fails

`Setup::allocateSetUpId` can deadlock if the form is submitted twice at the
same time. This error should not be normally seen by the user. If they do they
will be directed to "Try again" and then see that MFA is active, because one of
the requests succeeded. They will also receive the info mail letting them know
where to regenerate their backup codes if necessary.

3 years agoAdd RejectEverythingFormField if email MFA is already active
Tim Düsterhus [Mon, 9 Aug 2021 09:07:27 +0000 (11:07 +0200)]
Add RejectEverythingFormField if email MFA is already active

We must not allow submitting the form in this case, because we will trigger the
assertion otherwise.

3 years agoFix assertion in EmailMultifactorMethod::processManagementForm()
Tim Düsterhus [Mon, 9 Aug 2021 09:06:39 +0000 (11:06 +0200)]
Fix assertion in EmailMultifactorMethod::processManagementForm()

3 years agoSandbox `foreachVars` in templates
Alexander Ebert [Sun, 8 Aug 2021 09:29:26 +0000 (11:29 +0200)]
Sandbox `foreachVars` in templates

Nesting the same template inside a `foreach` loop that is also accessed inside the nested call will overwrite the values from the outer template due to identical identifiers being used.

The sandbox did not protected `$this->foreachVars` despite being stateful.

See #4431
Fixes #4444

3 years agoSearch for not filled user option fields was not possible
Marcel Werk [Sat, 7 Aug 2021 09:42:38 +0000 (11:42 +0200)]
Search for not filled user option fields was not possible

3 years agoMerge pull request #4442 from SoftCreatR/css-optimizations
Alexander Ebert [Sat, 7 Aug 2021 08:48:11 +0000 (10:48 +0200)]
Merge pull request #4442 from SoftCreatR/css-optimizations

Prefixed CSS First

3 years agoPrefixed CSS First
Sascha Greuel [Fri, 6 Aug 2021 18:42:21 +0000 (20:42 +0200)]
Prefixed CSS First

Ensured vendor-prefixed versions of a CSS property are listed before the standardized, unprefixed version.

When multiple versions of the same CSS property are specified, the last supported one will be used due to how browsers handle fallback values. This means the order matters when using both vendor-prefixed and unprefixed versions of the same property. Specifically, the unprefixed version must be listed last to ensure standardized behavior takes precedence.

3 years agoRemoving inline formatting yielded empty elements and broke the selection
Alexander Ebert [Fri, 6 Aug 2021 16:15:55 +0000 (18:15 +0200)]
Removing inline formatting yielded empty elements and broke the selection

See https://community.woltlab.com/thread/291496-fettmarkierung-bei-einem-einzelnen-wort-kann-nicht-mehr-entfernt-werden/

3 years agoUpdating minified JavaScript files
WoltLab [Fri, 6 Aug 2021 12:52:45 +0000 (12:52 +0000)]
Updating minified JavaScript files

3 years agoMerge pull request #4440 from WoltLab/sourcemap-proxy
Tim Düsterhus [Fri, 6 Aug 2021 12:44:42 +0000 (14:44 +0200)]
Merge pull request #4440 from WoltLab/sourcemap-proxy

Add proxy_sourcemap.php

3 years agoMerge branch '5.3' into 5.4
Alexander Ebert [Fri, 6 Aug 2021 12:41:10 +0000 (14:41 +0200)]
Merge branch '5.3' into 5.4

3 years agoPrevent submitting an empty message to the preview
Alexander Ebert [Fri, 6 Aug 2021 12:41:00 +0000 (14:41 +0200)]
Prevent submitting an empty message to the preview

3 years agoMerge pull request #4441 from WoltLab/acp-logout-to-reauth
Tim Düsterhus [Fri, 6 Aug 2021 12:34:52 +0000 (14:34 +0200)]
Merge pull request #4441 from WoltLab/acp-logout-to-reauth

Redirect the user to ACP reauthentication instead of frontend after logout

3 years agoAdd proxy_sourcemap.php
Tim Düsterhus [Fri, 6 Aug 2021 08:04:23 +0000 (10:04 +0200)]
Add proxy_sourcemap.php

3 years agoRedirect the user to ACP reauthentication instead of frontend after logout
Tim Düsterhus [Fri, 6 Aug 2021 11:43:36 +0000 (13:43 +0200)]
Redirect the user to ACP reauthentication instead of frontend after logout

3 years agoRevert "Update Open Sans"
Tim Düsterhus [Fri, 6 Aug 2021 11:34:59 +0000 (13:34 +0200)]
Revert "Update Open Sans"

This reverts Open Sans back to the non-variable version, as the variable one
appears to render pretty badly on Windows.

This reverts commit 33c8866a790e9e6bc46358f6e82df76d2e32f56e.

3 years agoMerge branch '5.3' into 5.4
Tim Düsterhus [Fri, 6 Aug 2021 10:31:18 +0000 (12:31 +0200)]
Merge branch '5.3' into 5.4

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Fri, 6 Aug 2021 10:26:36 +0000 (12:26 +0200)]
Merge branch '5.2' into 5.3

3 years agoMerge pull request #4439 from xopez/5.2
Joshua Rüsweg [Fri, 6 Aug 2021 09:22:18 +0000 (11:22 +0200)]
Merge pull request #4439 from xopez/5.2

Fixes Bings Sitemap Howto

3 years agoReactions were not displayed in article list when sorted by title
Marcel Werk [Thu, 5 Aug 2021 15:56:02 +0000 (17:56 +0200)]
Reactions were not displayed in article list when sorted by title

3 years agoMark as read doesn't removed the badge in the mobile menu
Marcel Werk [Thu, 5 Aug 2021 15:48:20 +0000 (17:48 +0200)]
Mark as read doesn't removed the badge in the mobile menu

3 years agoFixes Bings Sitemap Howto
xopez [Thu, 5 Aug 2021 14:55:45 +0000 (16:55 +0200)]
Fixes Bings Sitemap Howto

This includes the correct links if the Bing Webmaster Tools help & how-to for sitemaps.

3 years agoMerge pull request #4438 from WoltLab/5.4-fix-missing-salts
Tim Düsterhus [Thu, 5 Aug 2021 13:44:44 +0000 (15:44 +0200)]
Merge pull request #4438 from WoltLab/5.4-fix-missing-salts

Fix having an incorrect parameter if a hash does not contains a salt

3 years agoFix having an incorrect parameter if a hash does not contains a salt
joshuaruesweg [Thu, 5 Aug 2021 12:43:29 +0000 (14:43 +0200)]
Fix having an incorrect parameter if a hash does not contains a salt

Fixes #4416

3 years agoReset the avatar cache to force the use of the WebP variants
Alexander Ebert [Thu, 5 Aug 2021 11:39:03 +0000 (13:39 +0200)]
Reset the avatar cache to force the use of the WebP variants

Fixes #4424

3 years agoDelete reaction type icon on delete action
joshuaruesweg [Thu, 5 Aug 2021 11:04:46 +0000 (13:04 +0200)]
Delete reaction type icon on delete action

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Thu, 5 Aug 2021 09:40:52 +0000 (11:40 +0200)]
Merge branch '5.2' into 5.3

3 years agoRun SCSS prettier
Tim Düsterhus [Thu, 5 Aug 2021 09:40:15 +0000 (11:40 +0200)]
Run SCSS prettier

3 years agoFix typo in watchedArticleList.tpl
Tim Düsterhus [Thu, 5 Aug 2021 07:16:18 +0000 (09:16 +0200)]
Fix typo in watchedArticleList.tpl

3 years agoMerge branch '5.3' into 5.4
Tim Düsterhus [Wed, 4 Aug 2021 13:32:36 +0000 (15:32 +0200)]
Merge branch '5.3' into 5.4

3 years agoSome external links in the admin panel did not open in a new window
Marcel Werk [Wed, 4 Aug 2021 13:27:50 +0000 (15:27 +0200)]
Some external links in the admin panel did not open in a new window

3 years agoTrim the preview height using traditional overflow
Alexander Ebert [Wed, 4 Aug 2021 12:23:34 +0000 (14:23 +0200)]
Trim the preview height using traditional overflow

`-webkit-line-clamp` is broken in Firefox and Safari once complex HTML is used.

See https://community.woltlab.com/thread/291373-rich-embeds-mit-liste-fehlerhaft/

3 years agoSkip the user menu initialization if there are no items
Alexander Ebert [Wed, 4 Aug 2021 11:49:05 +0000 (13:49 +0200)]
Skip the user menu initialization if there are no items

3 years agoDetect `<center>` as a block element
Alexander Ebert [Wed, 4 Aug 2021 10:33:43 +0000 (12:33 +0200)]
Detect `<center>` as a block element

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Wed, 4 Aug 2021 09:26:15 +0000 (11:26 +0200)]
Merge branch '5.2' into 5.3

3 years agoMerge pull request #4435 from WoltLab/php-ddl-diff
Tim Düsterhus [Wed, 4 Aug 2021 09:25:25 +0000 (11:25 +0200)]
Merge pull request #4435 from WoltLab/php-ddl-diff

PHP DDL Fixes

3 years agoTake the array key into account when checking whether a column is up to date in Datab...
Tim Düsterhus [Wed, 4 Aug 2021 08:57:06 +0000 (10:57 +0200)]
Take the array key into account when checking whether a column is up to date in DatabaseTableChangeProcessor

Previously updating a column that looks like this:

    column VARCHAR(1) NOT NULL

to:

    column VARCHAR(1) NULL

would not do anything.

Converted into the `getData()` representation of the PHP DDL API these would
look like:

    [ 'default' => null
    , 'notNull' => 1
    , 'type' => 'VARCHAR'
    , 'length' => 1
    ]

and

    [ 'default' => null
    , 'notNull' => 0
    , 'type' => 'VARCHAR'
    , 'length' => 1
    ]

respectively.

Now taking the diff of the first array against the second array (subtracting
the second from the first) will remove *both* 1 values, resulting in an
empty difference, thus believing both columns are identical.

Fix this issue by using `array_diff_assoc` which will also take the key into
account.

3 years agoTake the array key into account when checking whether a KEY is up to date in Database...
Tim Düsterhus [Wed, 4 Aug 2021 08:36:12 +0000 (10:36 +0200)]
Take the array key into account when checking whether a KEY is up to date in DatabaseTableChangeProcessor

Previously updating a (pretty contrived) KEY that looks like this:

    […] UNIQUE KEY someIndex (`UNIQUE`)

to:

    […] KEY someIndex (`UNIQUE`)

would not do anything.

Converted into the `getData()` representation of the PHP DDL API these would
look like:

    [ 'columns' => 'UNIQUE'
    , 'type' => 'UNIQUE'
    ]

and

    [ 'columns' => 'UNIQUE'
    , 'type' => null
    ]

respectively.

Now taking the diff of the first array against the second array (subtracting
the second from the first) will remove *both* 'UNIQUE' values, resulting in an
empty difference, thus believing both KEYs are identical.

Fix this issue by using `array_diff_assoc` which will also take the key into
account.

3 years agoIncorrect handling of `null` values for metacode attributes
Alexander Ebert [Tue, 3 Aug 2021 15:17:12 +0000 (17:17 +0200)]
Incorrect handling of `null` values for metacode attributes

3 years agoMerge branch '5.2' into 5.3
Tim Düsterhus [Tue, 3 Aug 2021 15:09:29 +0000 (17:09 +0200)]
Merge branch '5.2' into 5.3

3 years agoMerge pull request #4433 from WoltLab/php-ddl-diff
Tim Düsterhus [Tue, 3 Aug 2021 15:08:35 +0000 (17:08 +0200)]
Merge pull request #4433 from WoltLab/php-ddl-diff

PHP DDL Fixes

3 years agoTake the array key into account when checking whether a FOREIGN KEY is up to date...
Tim Düsterhus [Tue, 3 Aug 2021 14:33:43 +0000 (16:33 +0200)]
Take the array key into account when checking whether a FOREIGN KEY is up to date in DatabaseTableChangeProcessor

Previously updating a FOREIGN KEY that looks like this:

    […] FOREIGN KEY (fooID) REFERENCES wcf1_foo (fooID) ON DELETE SET NULL ON UPDATE CASCADE

to:

    […] FOREIGN KEY (fooID) REFERENCES wcf1_foo (fooID) ON DELETE CASCADE ON UPDATE SET NULL

would not do anything.

Converted into the `getData()` representation of the PHP DDL API these would
look identical when looking at the values only. Both span the same column and
reference the same column on the same table. The `ON …` actions are one
`CASCADE` and one `SET NULL` for both.

For this reason the diff is empty, believing that the FOREIGN KEY already
matches the expected configuration.

Fix this issue by using `array_diff_assoc` which will also take the key into
account.

3 years agoTake the array key into account when matching up FOREIGN KEYs in DatabaseTableChangeP...
Tim Düsterhus [Tue, 3 Aug 2021 14:13:58 +0000 (16:13 +0200)]
Take the array key into account when matching up FOREIGN KEYs in DatabaseTableChangeProcessor

Previously a FOREIGN KEY within the database that looks like this:

    […] FOREIGN KEY (someOtherUserID) REFERENCES wcf1_user (userID) […]

would match up a FOREIGN KEY definition like the following:

    […] FOREIGN KEY (userID) REFERENCES wcf1_user (userID) […]

Converted into the `getDiffData()` representation of the PHP DDL API these
would like:

    [ 'columns'           => 'someOtherUserID'
    , 'referencedColumns' => 'userID'
    , 'referencedTable'   => 'wcf1_user'
    ]

and

    [ 'columns'           => 'userID'
    , 'referencedColumns' => 'userID'
    , 'referencedTable'   => 'wcf1_user'
    ]

respectively.

Now taking the diff of the second array against the first array (subtracting
the first from the second) will remove *both* 'userID' values, resulting in an
empty difference, thus believing both FOREIGN KEYs are identical

Fix this issue by using `array_diff_assoc` which will also take the key into
account.

3 years agoMerge pull request #4430 from WoltLab/js-legacy-inheritance
Alexander Ebert [Tue, 3 Aug 2021 12:36:05 +0000 (14:36 +0200)]
Merge pull request #4430 from WoltLab/js-legacy-inheritance

Resolved side effects from previous inheritance approach