Merge pull request #7884 from JorisDebonnet/patch-1

Update 4.0.0.md
This commit is contained in:
Daniel Hensby 2018-02-22 11:55:45 +00:00 committed by GitHub
commit 606f26d068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -610,7 +610,7 @@ implements the `Monolog\Formatter\FormatterInterface` interface.
### Upgrade `mysite/_config.php` {#config-php}
The globals `$database` and `$databaseConfig` are deprecated. You should upgrade your
site `_config.php` files to use the [.env configuration](#env)
site `_config.php` files to use the [.env configuration](#env).
`conf/ConfigureFromEnv.php` is no longer used, and references to this file should be deleted.
@ -946,9 +946,9 @@ if the asset is an image or not, rather than checking the subclass, as the asset
an image filter applied, rather than an instance of the `Image` dataobject.
In addition, a new file category `image/supported` has been added, which is a subset of the `image` category.
This is the subset of all image types which may be assigned to the `[Image](api:SilverStripe\Assets\Image)` dataobject, and may have
manipulations applied to it. This should be used as the file type restriction on any `[UploadField](api:SilverStripe\AssetAdmin\Forms\UploadField)` which
is intended to upload images for manipulation.
This is the subset of all image types which may be assigned to the [`Image`](api:SilverStripe\Assets\Image)
dataobject, and may have manipulations applied to it. This should be used as the file type restriction on any
[`UploadField`](api:SilverStripe\AssetAdmin\Forms\UploadField) which is intended to upload images for manipulation.
```diff
-if($file instanceof Image) {
@ -956,7 +956,7 @@ is intended to upload images for manipulation.
- $upload->setAllowedFileCategories('image');
-}
+if ($file->getIsImage()) {
+ $upload = new UploadField();
+ $upload = new UploadField(); // see higher about using FileHandleField instead
+ $upload->setAllowedFileCategories('image/supported');
+}
```
@ -997,9 +997,9 @@ You would need to upgrade your code as below.
-}
+public function importTempFile($tmp)
+{
+ Versioned::reading_stage('Stage');
+ $file = new File();
+ $file->setFromLocalFile($tmp, 'imported/' . basename($tmp));
+ Versioned::reading_stage('Stage');
+ $file = new File();
+ $file->setFromLocalFile($tmp, 'imported/' . basename($tmp));
+ $file->write();
+ $file->doPublish();
+}
@ -1127,7 +1127,7 @@ The below describes the minimum amount of effort required to implement a composi
```php
use SilverStripe\ORM\FieldType\DBComposite;
class MyAddressField extends
class MyAddressField extends DBComposite
{
private static $composite_db = [
'Street' => 'Varchar(200)',
@ -1166,7 +1166,7 @@ Example:
+public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
if(!preg_match('/MyField/', implode(' ', $query->getWhere()))) {
- $query->addWhere('"MyField" = 'foo');
- $query->addWhere('"MyField" = \'foo\'');
+ $query->addWhere(['"MyField"' => 'foo']);
}
}
@ -1226,7 +1226,7 @@ See our ["File Security" guide](/developer_guides/files/file_security) for more
### TinyMCE v4 {#tinymce}
Please see the [tinymce upgrading guide](http://archive.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x)
Please see the [TinyMCE upgrading guide](http://archive.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x)
to assist with upgrades to customisations to TinyMCE v3.
In Framework 4.0 the user interface for TinyMCE has been trimmed down considerably, with certain toolbar
@ -1241,8 +1241,8 @@ buttons removed from the default cms configuration:
* Select all
* Fullscreen
However, these function may be enabled on a case by case basis through modifification of the default
tinymce config, or by creating custom configurations (check [TinyMCE documentation](https://www.tinymce.com/docs/configure/)).
However, these function may be enabled on a case by case basis through modification of the default TinyMCE config,
or by creating custom configurations (check [TinyMCE documentation](https://www.tinymce.com/docs/configure/)).
The optional `ss_macron` plugin for inserting Māori diacritical marks
has been removed from core. You can configure the built-in `charmap` plugin instead:
@ -1325,7 +1325,7 @@ private static $owns = [
];
```
This is done to ensure that the published state of linked components are consistent with their "owner."
This is done to ensure that the published state of linked components are consistent with their "owner".
Without the concept of ownership, these linked components could be implicitly exposed on the frontend,
which may not align with the intent of the content author.
@ -1688,7 +1688,7 @@ until you no longer have any linting issues.
#### PSR-4 autoloading for project code {#psr4}
While not critical to an upgrade, SilverStripe 4.0 has adopted the [PS-4 autoloading](http://www.php-fig.org/psr/psr-4/)
While not critical to an upgrade, SilverStripe 4.0 has adopted the [PSR-4 autoloading](http://www.php-fig.org/psr/psr-4/)
standard for the core modules, so it's probably a good idea to be consistent.
You can implement this in your composer configuration like so:
@ -2066,7 +2066,7 @@ usercode before invocation.
### Filesystem {#overview-filesystem}
* Image manipulations have been moved into a new `[ImageManipulation](api:SilverStripe\Assets\ImageManipulation)` trait.
* Image manipulations have been moved into a new [`ImageManipulation`](api:SilverStripe\Assets\ImageManipulation) trait.
* Removed `CMSFileAddController`
* `UploadField::setAllowedFileCategories('image')` now excludes non-resizeable images. 'unresizeable_image' is
can be used to validate these types.
@ -2077,7 +2077,7 @@ usercode before invocation.
urls are no longer able to identify assets.
* Extension point `HtmlEditorField::processImage` has been removed, and moved to `Image::regenerateImageHTML()`
* `Upload::load()` now stores assets directly without saving into a `File` dataobject.
* Protected file storage is now a core Framework API. See [/developer_guides/files/file_security] for
* Protected file storage is now a core Framework API. See [File Security](/developer_guides/files/file_security) for
more information.
* `File` is now versioned, and should be published before they can be used on the frontend.
See section on [Migrating File DataObject from 3.x to 4.0](#migrating-file-dataobject-from-3x-to-40)