Skip to content

Commit fc1ffd6

Browse files
committed
Document trophy migration to builders, l10n storage, file uploads and object filters
1 parent 6fccae9 commit fc1ffd6

3 files changed

Lines changed: 96 additions & 2 deletions

File tree

‎docs/migration/wsc62/deprecations_removals.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ With version 6.3, we have deprecated certain components and removed several othe
126126
- `wcf\data\notice\NoticeEditor`
127127
- `wcf\data\ad\AdAction`
128128
- `wcf\data\ad\AdEditor`
129+
- `wcf\data\trophy\TrophyEditor`
129130
- `wcf\acp\form\UserMergeForm`
130131
- `wcf\system\event\listener\AbstractUserMergeListener`
131132
- `wcf\system\event\listener\AbstractUserActionRenameListener`
@@ -239,6 +240,9 @@ With version 6.3, we have deprecated certain components and removed several othe
239240
- `wcf\data\style\StyleAction::validateToggle()`
240241
- `wcf\data\trophy\TrophyAction::toggle()`
241242
- `wcf\data\trophy\TrophyAction::validateToggle()`
243+
- `wcf\data\trophy\TrophyAction::create()`
244+
- `wcf\data\trophy\TrophyAction::update()`
245+
- `wcf\data\trophy\TrophyAction::delete()`
242246
- `wcf\data\user\group\assignment\UserGroupAssignmentAction::toggle()`
243247
- `wcf\data\user\group\assignment\UserGroupAssignmentAction::validateToggle()`
244248
- `wcf\data\moderation\queue\ModerationQueueAction::validateGetModerationQueueData()`
@@ -376,6 +380,8 @@ With version 6.3, we have deprecated certain components and removed several othe
376380
- `calendar\data\event\date\EventDateEditor::rebuildParticipants()`
377381
- `wcf\data\notice\Notice::getConditions()`
378382
- `wcf\data\user\group\assignment\UserGroupAssignment::getConditions()`
383+
- `wcf\data\trophy\Trophy::getConditions()`
384+
- `wcf\system\trophy\condition\TrophyConditionHandler::getGroupedObjectTypes()`
379385
- `wcf\data\user\profile\menu\item\UserProfileMenuItemAction::validateGetContent()`
380386
- `wcf\data\user\profile\menu\item\UserProfileMenuItemAction::getContent()`
381387
- `wcf\data\user\UserProfile::setFileAvatar()`
@@ -385,15 +391,18 @@ With version 6.3, we have deprecated certain components and removed several othe
385391
#### Properties
386392

387393
- `wcf\data\like\ViewableLike::$objectTypeDescription`
394+
- `wcf\system\trophy\condition\TrophyConditionHandler::$groupedObjectTypes`
388395

389396
#### Constants
390397

391398
- `wcf\system\worker\SitemapRebuildWorker::REGISTRY_PREFIX`, use `wcf\system\sitemap\SitemapHandler::REGISTRY_PREFIX` instead
399+
- `wcf\system\trophy\condition\TrophyConditionHandler::CONDITION_DEFINITION_NAME`
392400

393401
#### Object Type Definitions
394402

395403
- `com.woltlab.wcf.sitemap.object`, use the event `wcf\event\sitemap\SitemapObjectCollecting` instead
396404
- `com.woltlab.wcf.condition.userSearch`, use the event `wcf\event\gridView\admin\UserGridViewInitialized` to add filters to the user list instead
405+
- `com.woltlab.wcf.condition.trophy`, use the event `wcf\event\trophy\TrophyObjectFilterCollecting` to add filters to the conditions of trophies instead
397406

398407
### JavaScript
399408

@@ -487,6 +496,8 @@ With version 6.3, we have deprecated certain components and removed several othe
487496
- `wcf\system\clipboard\action\UserClipboardAction`
488497
- `wcf\system\clipboard\action\UserContentClipboardAction`
489498
- `wcf\system\condition\UserOptionsCondition`
499+
- `wcf\data\trophy\I18nTrophyList`, use `wcf\data\trophy\L10nTrophyList` instead
500+
- `wcf\system\upload\TrophyImageUploadFileValidationStrategy`
490501
- `wcf\system\listView\user\UserSearchResultsListView`
491502
- `wcf\system\option\user\BirthdayUserOptionOutput`
492503
- `wcf\system\option\user\DateUserOptionOutput`
@@ -621,6 +632,9 @@ With version 6.3, we have deprecated certain components and removed several othe
621632
- `wcf\data\user\option\UserOption::modifyVisibleOption()`
622633
- `wcf\data\user\option\UserOption::setRequired()`
623634
- `wcf\data\user\option\ViewableUserOption::getOutputObject()`
635+
- `wcf\data\trophy\TrophyAction::validateUpload()`
636+
- `wcf\data\trophy\TrophyAction::upload()`
637+
- `wcf\data\trophy\TrophyAction::updateTrophyImage()`
624638

625639
#### Properties
626640

@@ -714,3 +728,6 @@ With version 6.3, we have deprecated certain components and removed several othe
714728
- `WCF.User.Registration.Validation`
715729
- `WCF.User.Registration.Validation.EmailAddress`
716730
- `WCF.User.Registration.Validation.Username`
731+
- `WoltLabSuite/Core/Acp/Ui/Trophy/Badge`
732+
- `WoltLabSuite/Core/Acp/Ui/Trophy/Editor`
733+
- `WoltLabSuite/Core/Acp/Ui/Trophy/Upload`

‎docs/migration/wsc62/php.md‎

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,88 @@ User options of the `profile` category tree are automatically available as filte
875875

876876
- the filters of the user list in the ACP, which also provides a hidden column for each option,
877877
- the filters of the members list for options that are `searchable` and visible to other users than the owner,
878-
- the object filters of ads, notices and automatic user group assignments (`wcf\system\object\filter\user\UserOptionObjectFilter`).
878+
- the object filters of ads, notices, automatic user group assignments and trophies (`wcf\system\object\filter\user\UserOptionObjectFilter`).
879879

880880
No additional code is required, the filter is provided by the form option of the user option.
881881

882882
## Grid View Column Visibility
883883

884884
Grid views can allow users to select the visible columns, see [Column Visibility](../../php/api/grid_views.md#column-visibility).
885885
`AbstractGridViewPage` reads the selected columns from the `columns` parameter into the new property `$columns`, which may conflict with an existing property of the same name in a subclass.
886+
887+
## Trophies
888+
889+
### Builders and Commands
890+
891+
`wcf\data\trophy\TrophyEditor` and the `create`, `update` and `delete` actions of `wcf\data\trophy\TrophyAction` are deprecated, trophies are created and modified through the [database object builder](../../php/database-object-builder.md) `wcf\data\trophy\TrophyBuilder` and the commands `CreateTrophy`, `UpdateTrophy` and `DeleteTrophy` in the `wcf\command\trophy` namespace.
892+
The commands fire the PSR-14 events `TrophyCreated`, `TrophyUpdated` and `TrophyDeleted` in the `wcf\event\trophy` namespace.
893+
`UpdateTrophy` updates the trophy points and the special trophies of the users if the disabled state of the trophy changes, `DeleteTrophy` also deletes the awarded trophies and the image of the trophy.
894+
895+
```php
896+
// Previously
897+
$action = new TrophyAction([], 'create', [
898+
'data' => [
899+
'title' => 'Foo',
900+
'categoryID' => $categoryID,
901+
'type' => Trophy::TYPE_BADGE,
902+
'iconName' => 'trophy;false',
903+
'iconColor' => 'rgba(255, 255, 255, 1)',
904+
'badgeColor' => 'rgba(50, 92, 132, 1)',
905+
],
906+
]);
907+
$trophy = $action->executeAction()['returnValues'];
908+
909+
// Since 6.3
910+
$trophy = (new CreateTrophy(
911+
TrophyBuilder::forCreate()
912+
->setTitle([L10nStorage::MONOLINGUAL => 'Foo'])
913+
->setCategoryID($categoryID)
914+
->setType(Trophy::TYPE_BADGE)
915+
->setBadge('trophy;false', 'rgba(255, 255, 255, 1)', 'rgba(50, 92, 132, 1)')
916+
))();
917+
```
918+
919+
### Title and Description
920+
921+
The title and the description of trophies are stored in the localized storage (`wcf1_trophy_l10n`) instead of language items.
922+
The columns `title` and `description` of `wcf1_trophy` and the language items `wcf.user.trophy.title{trophyID}` and `wcf.user.trophy.description{trophyID}` have been removed.
923+
Use `Trophy::getTitle()` and `Trophy::getDescription()` to output the values and `Trophy::getL10nValues()` to read the values of all languages.
924+
`wcf\data\trophy\I18nTrophyList` has been replaced by `wcf\data\trophy\L10nTrophyList`, which provides the localized title and description as the columns `title` and `description` for sorting.
925+
926+
### Images
927+
928+
The images of image trophies are stored through the file upload system using the object type `com.woltlab.wcf.trophy.image`.
929+
The column `iconFile` of `wcf1_trophy` has been replaced by `iconFileID`, use `Trophy::getIconPath()` to output the image or `Trophy::getIconFile()` to access the file.
930+
The images are no longer stored in `images/trophy/` and the image upload of `TrophyAction` (`IUploadAction`) has been removed.
931+
932+
### Conditions
933+
934+
The conditions of trophies that are awarded automatically have been migrated to object filters, the same system that is used for the conditions of ads, notices and automatic user group assignments.
935+
The configured filters are stored as JSON in the `conditions` column of `wcf1_trophy` and are provided by `wcf\system\object\filter\builder\TrophyObjectFilterBuilder`.
936+
The object type definition `com.woltlab.wcf.condition.trophy` is deprecated, object types of this definition are no longer evaluated.
937+
938+
Additional filters are registered through the PSR-14 event `wcf\event\trophy\TrophyObjectFilterCollecting`.
939+
The trophies are awarded and revoked by applying the filters to a `UserList`, therefore only filters implementing `wcf\system\object\filter\IObjectListFilter` are supported.
940+
941+
```php
942+
EventHandler::getInstance()->register(
943+
\wcf\event\trophy\TrophyObjectFilterCollecting::class,
944+
static function (\wcf\event\trophy\TrophyObjectFilterCollecting $event) {
945+
$event->register(new \wcf\system\object\filter\user\UserIntegerPropertyObjectFilter('fooPoints', 'wcf.user.condition.fooPoints'));
946+
}
947+
);
948+
```
949+
950+
Packages that provided trophy conditions must migrate the existing conditions during the update using `wcf\system\object\filter\migration\LegacyConditionMigration`.
951+
The update of WoltLab Suite Core disables all trophies with conditions that it cannot convert, the trophies are enabled again once the remaining conditions have been converted by the updates of the other packages.
952+
The migration must run before the `objectType` package installation plugin removes the legacy object types, because deleting the object types also deletes their conditions.
953+
954+
```php
955+
(new LegacyConditionMigration('com.woltlab.wcf.condition.trophy', 'wcf1_trophy', 'trophyID'))->migrate([
956+
UserIntegerPropertyCondition::class => LegacyConditionMigration::getUserIntegerPropertyConverter([
957+
'fooPoints',
958+
]),
959+
]);
960+
```
961+
962+
`ObjectListFilterHandler::applyFilters()` now returns whether any of the stored filters has been applied.

‎docs/package/pip/user-option.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Registers new user options (profile fields / user settings).
44

55
The input field and the output of a user option are provided by [form options](../../php/api/form_builder/form_options.md), the same infrastructure that is used for contact form options and other custom fields.
6-
User options of the `profile` category tree are also automatically available as filters in the user list of the ACP, in the members list (if they are `searchable`) and in object filters, e.g. for ads, notices and automatic user group assignments.
6+
User options of the `profile` category tree are also automatically available as filters in the user list of the ACP, in the members list (if they are `searchable`) and in object filters, e.g. for ads, notices, automatic user group assignments and trophies.
77

88
## Category Components
99

0 commit comments

Comments
 (0)