Skip to content

Migrating from WSC 3.1 - PHP#

Form Builder#

WoltLab Suite Core 5.2 introduces a new, simpler and quicker way of creating forms: form builder. You can find examples of how to migrate existing forms to form builder here.

In the near future, to ensure backwards compatibility within WoltLab packages, we will only use form builder for new forms or for major rewrites of existing forms that would break backwards compatibility anyway.

Like System#

WoltLab Suite Core 5.2 replaced the like system with the reaction system. You can find the migration guide here.

User Content Providers#

User content providers help the WoltLab Suite to find user generated content. They provide a class with which you can find content from a particular user and delete objects.

PHP Class#

First, we create the PHP class that provides our interface to provide the data. The class must implement interface wcf\system\user\content\provider\IUserContentProvider in any case. Mostly we process data which is based on wcf\data\DatabaseObject. In this case, the WoltLab Suite provides an abstract class wcf\system\user\content\provider\AbstractDatabaseUserContentProvider that can be used to automatically generates the standardized classes to generate the list and deletes objects via the DatabaseObjectAction. For example, if we would create a content provider for comments, the class would look like this:

files/lib/system/user/content/provider/CommentUserContentProvider.class.php
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace wcf\system\user\content\provider;
use wcf\data\comment\Comment;

/**
 * User content provider for comments.
 *
 * @author  Joshua Ruesweg
 * @copyright   2001-2018 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\User\Content\Provider
 * @since   5.2
 */
class CommentUserContentProvider extends AbstractDatabaseUserContentProvider {
    /**
     * @inheritdoc
     */
    public static function getDatabaseObjectClass() {
        return Comment::class;
    }
}

Object Type#

Now the appropriate object type must be created for the class. This object type must be from the definition com.woltlab.wcf.content.userContentProvider and include the previous created class as FQN in the parameter classname. Also the following parameters can be used in the object type:

nicevalue#

Optional

The nice value is used to determine the order in which the remove content worker are execute the provider. Content provider with lower nice values are executed first.

hidden#

Optional

Specifies whether or not this content provider can be actively selected in the Content Remove Worker. If it cannot be selected, it will not be executed automatically!

requiredobjecttype#

Optional

The specified list of comma-separated object types are automatically removed during content removal when this object type is being removed. Attention: The order of removal is undefined by default, specify a nicevalue if the order is important.

PHP Database API#

WoltLab Suite 5.2 introduces a new way to update the database scheme: database PHP API.


Last update: 2021-04-26