Skip to content

Commit

Permalink
Migration 3.0 -> 3.1: PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdesign committed Jan 17, 2018
1 parent ef328ed commit dd8008b
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 7 deletions.
28 changes: 21 additions & 7 deletions _data/sidebars/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ entries:
url: /php_database-access.html
- title: Exceptions
url: /php_exceptions.html

- subfolders:

- title: API
subfolderitems:

- title: Caches
url: /php_api_caches.html
- title: Comments
Expand All @@ -46,7 +46,7 @@ entries:
url: /php_api_user_notifications.html
- title: Sitemaps
url: /php_api_sitemaps.html

- title: Code Style
url: /php_code-style.html

Expand Down Expand Up @@ -76,7 +76,21 @@ entries:

- subfolders:

- title: Migrating from WCF 2.1.x
- title: Migrating from WSC 3.0
subfolderitems:

- title: PHP API
url: /migration_wsc-30_php.html
- title: JavaScript API
url: /migration_wsc-30_javascript.html
- title: Templates
url: /migration_wsc-30_templates.html
- title: CSS
url: /migration_wsc-30_css.html
- title: Package Components
url: /migration_wsc-30_package.html

- title: Migrating from WCF 2.1
subfolderitems:

- title: PHP API
Expand All @@ -87,9 +101,9 @@ entries:
url: /migration_wcf-21_css.html
- title: Package Components
url: /migration_wcf-21_package.html

- title: Tutorials
folderitems:

- title: Tutorial Series
url: /tutorial_tutorial-series.html
65 changes: 65 additions & 0 deletions pages/migration/wsc-30/migration_wsc-30_php.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: WSC 3.0 - PHP
sidebar: sidebar
permalink: migration_wsc-30_php.html
folder: migration/wsc-30
---

## Approval-System for Comments

Comments can now be set to require approval by a moderator before being published. This feature is disabled by default if you do not provide a permission in the manager class, enabling it requires a new permission that has to be provided in a special property of your manage implementation.

```php
<?php
class ExampleCommentManager extends AbstractCommentManager {
protected $permissionAddWithoutModeration = 'foo.bar.example.canAddCommentWithoutModeration';
}
```

## Raw HTML in User Activity Events

User activity events were previously encapsulated inside `<div class="htmlContent">…</div>`, with impacts on native elements such as lists. You can now disable the class usage by defining your event as raw HTML:

```php
<?php
class ExampleUserActivityEvent {
// enables raw HTML for output, defaults to `false`
protected $isRawHtml = true;
}
```

## Permission to View Likes of an Object

Being able to view the like summary of an object was restricted to users that were able to like the object itself. This creates situations where the object type in general is likable, but the particular object cannot be liked by the current users, while also denying them to view the like summary (but it gets partly exposed through the footer note/summary!).

Implement the interface `\wcf\data\like\IRestrictedLikeObjectTypeProvider` in your object provider to add support for this new permission check.

```php
<?php
class LikeableExampleProvider extends ExampleProvider implements IRestrictedLikeObjectTypeProvider, IViewableLikeProvider {
public function canViewLikes(ILikeObject $object) {
// perform your permission checks here
return true;
}
}
```

## Developer Tools: Sync Feature

The synchronization feature of the newly added developer tools works by invoking a package installation plugin (PIP) outside of a regular installation, while simulating the basic environment that is already exposed by the API.

However, not all PIPs qualify for this kind of execution, especially because it could be invoked multiple times in a row by the user. This is solved by requiring a special marking for PIPs that have no side-effects (= idempotent) when invoked any amount of times with the same arguments.

There's another feature that allows all matching PIPs to be executed in a row using a single button click. In order to solve dependencies on other PIPs, any implementing PIP must also provide the method `getSyncDependencies()` that returns the dependent PIPs in an arbitrary order.

```php
<?php
class ExamplePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin implements IIdempotentPackageInstallationPlugin {
public static function getSyncDependencies() {
// provide a list of dependent PIPs in arbitrary order
return [];
}
}
```

{% include links.html %}

0 comments on commit dd8008b

Please sign in to comment.