Document the event-based rebuild worker registration
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Dec 2022 10:06:20 +0000 (11:06 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Dec 2022 10:06:20 +0000 (11:06 +0100)
Resolves #334

docs/migration/wsc55/php.md
snippets/package/pip/objectType.xml

index 5ff9a78a21ae43e346446e2bf0230faed5550b3d..dc01ebf4f84fae4545e772e4c62f2ff21195cc8c 100644 (file)
@@ -240,3 +240,23 @@ This is to ensure that all conditions specify a unique identifier, instead of ac
 The `$identifier` property will no longer be used and may be removed.
 
 See [WoltLab/WCF#5077](https://github.com/WoltLab/WCF/pull/5077) for details.
+
+## Rebuild Workers
+
+Rebuild workers should no longer be registered using the `com.woltlab.wcf.rebuildData` object type definition.
+Instead an event listener for the `wcf\system\worker\event\RebuildWorkerCollecting` event should be registered in a [bootstrap script](#bootstrap-scripts) the worker classname be registered using the event’s `register()` method:
+
+```php title="files/lib/bootstrap/com.example.bar.php"
+<?php
+
+use wcf\system\event\EventHandler;
+use wcf\system\worker\event\RebuildWorkerCollecting;
+
+return static function (): void {
+    $eventHandler = EventHandler::getInstance();
+
+    $eventHandler->register(RebuildWorkerCollecting::class, static function (RebuildWorkerCollecting $event) {
+        $event->register(\bar\system\worker\BazWorker::class, 0);
+    });
+};
+```
index 6df16abce3fc930477a37528b91ba399f19986ea..37ee78f2d80ecf043eba39ab2128e9209099f8d4 100644 (file)
@@ -3,9 +3,11 @@
        <import>
                <type>
                        <name>com.woltlab.wcf.example</name>
-                       <definitionname>com.woltlab.wcf.rebuildData</definitionname>
-                       <classname>wcf\system\worker\ExampleRebuildWorker</classname>
-                       <nicevalue>130</nicevalue>
+                       <definitionname>com.woltlab.wcf.bulkProcessing.user.condition</definitionname>
+                       <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
+                       <conditiongroup>contents</conditiongroup>
+                       <propertyname>example</propertyname>
+                       <minvalue>0</minvalue>
                </type>
        </import>
-</data>
\ No newline at end of file
+</data>