Skip to content

Commit

Permalink
DOC Split apart Versioned and Staged
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 29, 2024
1 parent 436c4c9 commit dac3c6b
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 102 deletions.
88 changes: 44 additions & 44 deletions en/02_Developer_Guides/00_Model/10_Versioning.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Here is how it works in detail:
won't have any effect until template recompilation (e.g. on cache flush).

By default it equals to `'$CurrentReadingMode, $CurrentUser.ID'`.
This ensures the current [Versioned](api:SilverStripe\Versioned\Versioned) state and user ID are used.
This ensures the current [Versioned](api:SilverStripe\Versioned\Mode\Versioned) state and user ID are used.
At runtime that will become something like `'LIVE, 0'` (for unauthenticated users in live mode).

As usual, you may override its value via YAML configs. For example:
Expand Down
2 changes: 1 addition & 1 deletion en/02_Developer_Guides/06_Testing/00_Unit_Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace App\Test;

use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Versioned\Mode\Versioned;

class PageTest extends SapphireTest
{
Expand Down
2 changes: 1 addition & 1 deletion en/02_Developer_Guides/14_Files/03_File_Security.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ the `Versioned` extension.
namespace App\Model;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Versioned\Mode\Versioned;
class MyVersionedObject extends DataObject
{
Expand Down
4 changes: 2 additions & 2 deletions en/02_Developer_Guides/14_Files/05_File_Manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ if ($file) {
}
```

Note that you can cause the file to be moved immediately by [setting the Versioned reading mode](api:SilverStripe\Versioned\Versioned::set_reading_mode()) to draft temporarily.
Note that you can cause the file to be moved immediately by [setting the Versioned reading mode](api:SilverStripe\Versioned\Mode\Versioned::set_reading_mode()) to draft temporarily.

```php
use SilverStripe\Assets\File;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Versioned\Mode\Versioned;
$file = File::get()->filter('Name', 'oldname.jpg')->first();
if ($file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ an inline PDF document in the preview panel.
### Preview states {#preview-states-php}
The preview state(s) you apply to your `DataObject` will depend primarily on whether it uses
the [Versioned](api:SilverStripe\Versioned\Versioned) extension or not.
the [Versioned](api:SilverStripe\Versioned\Mode\Versioned) extension or not.
#### Versioned `DataObject` models
Expand Down Expand Up @@ -491,7 +491,7 @@ namespace App\Model;
use App\PageType\ProductPage;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Versioned\Mode\Versioned;

class Product extends DataObject implements CMSPreviewable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ code like this:
By applying the proper style sheet, the snippet html above could produce the look of:
![Page Node Screenshot](../../../_images/tree_node.png "Page Node")

SiteTree is a [DataObject](api:SilverStripe\ORM\DataObject) which is versioned by [Versioned](api:SilverStripe\Versioned\Versioned) extension.
SiteTree is a [DataObject](api:SilverStripe\ORM\DataObject) which is versioned by [Versioned](api:SilverStripe\Versioned\Mode\Versioned) extension.
Each node can optionally have publication status flags, e.g. "Removed from draft".
Each flag has a unique identifier, which is also used as a CSS class for easier styling.

Expand Down
26 changes: 13 additions & 13 deletions en/08_Changelogs/5.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ Note that as part of this change, the namespaces of several classes changed. Ref
[Extension](api:SilverStripe\Core\Extension) classes don't expose `protected` methods, but they *can* be used for extension hooks. This reduces the surface of methods exposed from your extensions into `Extensible` classes. For example, you might have a `protected function updateCMSFields()` method which is called after writing some `DataObject` - but because this method is `protected`, it *cannot* be accessed directly from the `DataObject` instances. You can still expose some method from the `Extension` by making it `public` - and that method *can* be accessed directly from the `DataObject` instances.

When invoking an extension hook (e.g. via `extend()`), methods prefixed with "extend" take precedence. i.e. if an `Extension` class has a `onAfterWrite()` method and an `extendOnAfterWrite()` method and you call `$this->extend('onAfterWrite')` - the `extendOnAfterWrite()` method on that `Extension` will be called, and `onAfterWrite()` will not.
This empowers advanced `Extension` functionality such as [Versioned::canPublish()](api:SilverStripe\Versioned\Versioned::canPublish()) which invokes `$owner->extendedCan('canPublish')` but doesn't result in a cycle, because the same class also implements [extendCanPublish()](api:SilverStripe\Versioned\Versioned::extendCanPublish()).
This empowers advanced `Extension` functionality such as [Versioned::canPublish()](api:SilverStripe\Versioned\Mode\Versioned::canPublish()) which invokes `$owner->extendedCan('canPublish')` but doesn't result in a cycle, because the same class also implements [extendCanPublish()](api:SilverStripe\Versioned\Mode\Versioned::extendCanPublish()).

### Other new features {#other-features}

Expand Down Expand Up @@ -1072,7 +1072,7 @@ This sections contains the full list of APIs that have been changed or removed b
- Removed deprecated class `SilverStripe\Dev\SapphireInfo` without equivalent functionality to replace it
- Removed deprecated class `SilverStripe\Dev\Tasks\MigrateFileTask` without equivalent functionality to replace it
- Removed deprecated class `SilverStripe\Dev\TestSession_STResponseWrapper` without equivalent functionality to replace it
- Removed deprecated class `SilverStripe\Forms\GridField\GridFieldVersionedState` - use [`SilverStripe\Versioned\VersionedGridFieldState\VersionedGridFieldState`](api:SilverStripe\Versioned\VersionedGridFieldState\VersionedGridFieldState) instead
- Removed deprecated class `SilverStripe\Forms\GridField\GridFieldVersionedState` - use [`SilverStripe\Versioned\Mode\VersionedGridFieldState\VersionedGridFieldState`](api:SilverStripe\Versioned\Mode\VersionedGridFieldState\VersionedGridFieldState) instead
- Removed deprecated class `SilverStripe\Forms\HTMLEditor\TinyMCEGZIPGenerator` without equivalent functionality to replace it
- Removed deprecated class `SilverStripe\ORM\Connect\PDOConnector` without equivalent functionality to replace it
- Removed deprecated class `SilverStripe\ORM\Connect\PDOQuery` without equivalent functionality to replace it
Expand Down Expand Up @@ -1773,16 +1773,16 @@ This sections contains the full list of APIs that have been changed or removed b

### `silverstripe/versioned`

- Removed deprecated method `SilverStripe\Versioned\Versioned::allVersions()` - use [`SilverStripe\Versioned\Versioned::Versions()`](api:SilverStripe\Versioned\Versioned::Versions()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::doPublish()` - use [`SilverStripe\Versioned\Versioned::publishRecursive()`](api:SilverStripe\Versioned\Versioned::publishRecursive()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::doRollbackTo()` - use [`SilverStripe\Versioned\Versioned::rollbackRecursive()`](api:SilverStripe\Versioned\Versioned::rollbackRecursive()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::getLastEditedForVersion()` - use [`SilverStripe\Versioned\Versioned::getLastEditedAndStageForVersion()`](api:SilverStripe\Versioned\Versioned::getLastEditedAndStageForVersion()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::migrateVersion()` - use [`SilverStripe\Versioned\Versioned::setMigratingVersion()`](api:SilverStripe\Versioned\Versioned::setMigratingVersion()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::onAfterRevertToLive()` without equivalent functionality to replace it
- Removed deprecated method `SilverStripe\Versioned\Versioned::onAfterRollback()` without equivalent functionality to replace it
- Removed deprecated method `SilverStripe\Versioned\Versioned::publish()` - use [`SilverStripe\Versioned\Versioned::copyVersionToStage()`](api:SilverStripe\Versioned\Versioned::copyVersionToStage()) instead
- Removed deprecated method `SilverStripe\Versioned\Versioned::VersionsList()` - use [`SilverStripe\Versioned\Versioned::allVersions()`](api:SilverStripe\Versioned\Versioned::allVersions()) instead
- Removed deprecated parameter in [`SilverStripe\Versioned\Versioned::copyVersionToStage()`](api:SilverStripe\Versioned\Versioned::copyVersionToStage()) named `$createNewVersion`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::allVersions()` - use [`SilverStripe\Versioned\Mode\Versioned::Versions()`](api:SilverStripe\Versioned\Mode\Versioned::Versions()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::doPublish()` - use [`SilverStripe\Versioned\Mode\Versioned::publishRecursive()`](api:SilverStripe\Versioned\Mode\Versioned::publishRecursive()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::doRollbackTo()` - use [`SilverStripe\Versioned\Mode\Versioned::rollbackRecursive()`](api:SilverStripe\Versioned\Mode\Versioned::rollbackRecursive()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::getLastEditedForVersion()` - use [`SilverStripe\Versioned\Mode\Versioned::getLastEditedAndStageForVersion()`](api:SilverStripe\Versioned\Mode\Versioned::getLastEditedAndStageForVersion()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::migrateVersion()` - use [`SilverStripe\Versioned\Mode\Versioned::setMigratingVersion()`](api:SilverStripe\Versioned\Mode\Versioned::setMigratingVersion()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::onAfterRevertToLive()` without equivalent functionality to replace it
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::onAfterRollback()` without equivalent functionality to replace it
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::publish()` - use [`SilverStripe\Versioned\Mode\Versioned::copyVersionToStage()`](api:SilverStripe\Versioned\Mode\Versioned::copyVersionToStage()) instead
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::VersionsList()` - use [`SilverStripe\Versioned\Mode\Versioned::allVersions()`](api:SilverStripe\Versioned\Mode\Versioned::allVersions()) instead
- Removed deprecated parameter in [`SilverStripe\Versioned\Mode\Versioned::copyVersionToStage()`](api:SilverStripe\Versioned\Mode\Versioned::copyVersionToStage()) named `$createNewVersion`
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::clear()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::clear()) from dynamic to `bool`
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::delete()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::delete()) from dynamic to `bool`
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::deleteMultiple()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::deleteMultiple()) from dynamic to `bool`
Expand All @@ -1792,7 +1792,7 @@ This sections contains the full list of APIs that have been changed or removed b
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::prune()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::prune()) from dynamic to `bool`
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::set()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::set()) from dynamic to `bool`
- Changed return type for [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::setMultiple()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::setMultiple()) from dynamic to `bool`
- [`SilverStripe\Versioned\Versioned::__construct()`](api:SilverStripe\Versioned\Versioned::__construct()) now explicitly only accepts `$mode` as a single argument.
- [`SilverStripe\Versioned\Mode\Versioned::__construct()`](api:SilverStripe\Versioned\Mode\Versioned::__construct()) now explicitly only accepts `$mode` as a single argument.
- Changed parameter type in [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::delete()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::delete()) for `$key` from dynamic to `string`
- Changed parameter type in [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::deleteMultiple()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::deleteMultiple()) for `$keys` from dynamic to `iterable`
- Changed parameter type in [`SilverStripe\Versioned\Caching\ProxyCacheAdapter::get()`](api:SilverStripe\Versioned\Caching\ProxyCacheAdapter::get()) for `$key` from dynamic to `string`
Expand Down
4 changes: 2 additions & 2 deletions en/08_Changelogs/5.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ Alongside this change, we've also added some more HTTP status codes to the list

### Versioned status badges for elemental {#elemental-badges}

Elemental content blocks now feature versioned status badges which adds a textual indicator of whether the block is in draft or a modified state. This textual label is in addition to the dot icon indicator that was already there. The new label is only provided if the [`Versioned`](api:SilverStripe\Versioned\Versioned) extension is used for elemental blocks, which it is by default.
Elemental content blocks now feature versioned status badges which adds a textual indicator of whether the block is in draft or a modified state. This textual label is in addition to the dot icon indicator that was already there. The new label is only provided if the [`Versioned`](api:SilverStripe\Versioned\Mode\Versioned) extension is used for elemental blocks, which it is by default.

![examples of the versioned labels](../_images/changelogs/5.2.0/elemental-badge.png)

Expand Down Expand Up @@ -566,7 +566,7 @@ The [`SiteTree.hide_ancestor`](api:SilverStripe\CMS\Model\SiteTree->hide_ancesto

### `silverstripe/versioned` {#api-silverstripe-versioned}

The `$having` parameter in the [`Versioned::Versions()`](api:SilverStripe\Versioned\Versioned::Versions()) method has been deprecated. This parameter was never used, and has been removed from the method signature.
The `$having` parameter in the [`Versioned::Versions()`](api:SilverStripe\Versioned\Mode\Versioned::Versions()) method has been deprecated. This parameter was never used, and has been removed from the method signature.

## Bug fixes

Expand Down
16 changes: 8 additions & 8 deletions en/08_Changelogs/alpha/5.0.0-alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ This is an alpha of a major release and as a result there are a number of breaki

#### `silverstripe/versioned`

- Removed deprecated method `SilverStripe\Versioned\Versioned::doPublish()`
- Removed deprecated method `SilverStripe\Versioned\Versioned::doRollbackTo()`
- Removed deprecated method `SilverStripe\Versioned\Versioned::migrateVersion()`
- Removed deprecated method `SilverStripe\Versioned\Versioned::onAfterRevertToLive()`
- Removed deprecated method `SilverStripe\Versioned\Versioned::onAfterRollback()`
- Removed deprecated method `SilverStripe\Versioned\Versioned::publish()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::doPublish()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::doRollbackTo()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::migrateVersion()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::onAfterRevertToLive()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::onAfterRollback()`
- Removed deprecated method `SilverStripe\Versioned\Mode\Versioned::publish()`

#### `silverstripe/versioned-admin`

Expand All @@ -133,7 +133,7 @@ This is an alpha of a major release and as a result there are a number of breaki
- `SilverStripe\Dev\MigrationTask` is now abstract.
- `SilverStripe\Dev\SapphireTest` is now abstract.
- `SilverStripe\Core\Extensible::invokeWithExtensions()` and `SilverStripe\Core\Extensible::extend()` now use the splat operator instead of having a concrete number of possible arguments.
- The constructor for `SilverStripe\Versioned\Versioned` now explicitly only accepts mode as a single argument.
- The constructor for `SilverStripe\Versioned\Mode\Versioned` now explicitly only accepts mode as a single argument.

### ORM {#api-orm}

Expand All @@ -155,7 +155,7 @@ their aliases (applied by setting a string key for the array) were being ignored
[Extension](api:SilverStripe\Core\Extension) classes don't expose `protected` methods, but they *can* be used for extension hooks. This reduces the surface of methods exposed from your extensions into `Extensible` classes. For example, you might have a `protected function updateCMSFields()` method which will be called after writing some `DataObject` - but because this method is `protected`, it *cannot* be accessed directly from the `DataObject` instances. You can however still expose some method from the `Extension` by making it `public` - and that method *can* be accessed directly from the `DataObject` instances.

When invoking an extension hook (e.g. via `extend()`), methods prefixed with "extend" will take precendence. i.e. if an `Extension` class has a `onAfterWrite()` method and an `extendOnAfterWrite()` method and I call `$this->extend('onAfterWrite')` - the `extendOnAfterWrite()` method on that `Extension` will be called, and `onAfterWrite()` will not.
This empowers advanced `Extension` functionality such as [Versioned::canPublish()](api:SilverStripe\Versioned\Versioned::canPublish()) which invokes `$owner->extendedCan('canPublish')` but doesn't result in a cycle, because the same class also implements [extendCanPublish()](api:SilverStripe\Versioned\Versioned::extendCanPublish()).
This empowers advanced `Extension` functionality such as [Versioned::canPublish()](api:SilverStripe\Versioned\Mode\Versioned::canPublish()) which invokes `$owner->extendedCan('canPublish')` but doesn't result in a cycle, because the same class also implements [extendCanPublish()](api:SilverStripe\Versioned\Mode\Versioned::extendCanPublish()).

### Other new features {#other-features}

Expand Down
Loading

0 comments on commit dac3c6b

Please sign in to comment.