mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
99 lines
6.4 KiB
Markdown
99 lines
6.4 KiB
Markdown
# 4.9.0 (Unreleased)
|
|
|
|
## Overview
|
|
|
|
- [Features and enhancements](#features-and-enhancements)
|
|
- [Image lazy loading](#image-lazy-loading)
|
|
- [Manage your CMS sessions across devices](#session-manager)
|
|
- [Default mail transport upgraded to sendmail](#sendmail)
|
|
- [Other new features](#other-features)
|
|
- [Bugfixes](#bugfixes)
|
|
|
|
|
|
## Features and enhancements {#features-and-enhancements}
|
|
|
|
### Image lazy loading {#image-lazy-loading}
|
|
|
|
Most modern browsers support the ability to "lazy load" images. When an image is configured to be
|
|
lazy loaded, browsers only request the image once it's about to be visible to the users. This
|
|
reduces the initial rendering time for pages.
|
|
|
|
From v4.9, Silverstripe CMS lazy loads most images by default. You have the options to opt-out of this
|
|
behaviour globally or on specific image instances.
|
|
|
|
This feature was implemented in partnership with Google.
|
|
|
|
Read [Browser-level image lazy-loading for the web](https://web.dev/browser-level-image-lazy-loading/)
|
|
on _web.dev_ more information.
|
|
|
|
#### How developers can interact with image lazy loading
|
|
|
|
Most images get the `loading="lazy"` attribute added to them. This includes:
|
|
- images added via the HTML Editor's ***insert media*** button
|
|
- image DataObjects added to templates.
|
|
|
|
To disable lazy loading for an individual image in a template, use `$MyImage.LazyLoad(false)`.
|
|
|
|
Image HTML tags (`<img>`) added in templates are not lazy loaded by default. Developers
|
|
can manually lazy load these images by adding a `loading="lazy"` attribute.
|
|
|
|
Read the [Image Lazy Loading](/Developer_Guides/Files/Images#lazy-loading) Silverstripe CMS developer
|
|
documentation for more details and code examples.
|
|
|
|
#### Opting out of image lazy loading globally
|
|
There's some scenarios where you might not want to use the native Silverstripe CMS lazy loading.
|
|
For example, you might already have a custom lazy loading implementation.
|
|
|
|
To opt out of lazy loading globally, use the following yml config:
|
|
|
|
```yml
|
|
SilverStripe\Assets\Image:
|
|
lazy_loading_enabled: false
|
|
```
|
|
|
|
#### How content authors can interact with image lazy loading
|
|
|
|
Content authors can disable lazy loading on images added via the HTML editor field in the
|
|
***Insert media*** dialog by setting the ***Loading*** field to ***Eager***.
|
|
|
|
Consult the [Insert images](https://userhelp.silverstripe.org/en/4/creating_pages_and_content/creating_and_editing_content/inserting_images/#lazy-loading)
|
|
article in the Silverstripe CMS user help for detailed instructions.
|
|
|
|
### Manage your CMS sessions across devices {#session-manager}
|
|
|
|
The [session manager module](https://github.com/silverstripe/silverstripe-session-manager) is a new security focused feature which allows a CMS user to view and manage their active sessions in the CMS within the "My profile" section of the CMS (/admin/myprofile). They can see the device details behind each session and have the ability to revoke these sessions. This new module has been added to `silverstripe/recipe-cms` which is the recommended method of managing Silverstripe CMS dependencies in a project.
|
|
|
|
Projects that have `silverstripe/recipe-cms` as a requirement in their `composer.json` will automatically get `silverstripe/session-manager` when you run `composer update`. If your project does not use `silverstripe/recipe-cms`, it's recommended that you require `silverstripe/session-manager` in your composer file as a security enhancement. The session manager module requires no configuration and works out-of-the-box.
|
|
|
|
If your site has the [symbiote/silverstripe-queuedjobs](https://github.com/symbiote/silverstripe-queuedjobs) module installed, then a job will automatically be created that will periodically remove old database records created by the session manager module.
|
|
|
|
CMS users can review the [Session Manager user help](https://userhelp.silverstripe.org/en/4/managing_your_website/session_manager/) for more information on managing their sessions.
|
|
|
|
#### FuntionalTest's should not use `Security::setCurrentUser($member)` when mocking an HTTP request
|
|
|
|
When writing an automated test using `FuntionalTest` the methods `$this->get()` and `$this->post()` are available to mock HTTP requests. Previously, developers could use the method `Security::setCurrentUser($member)` to define which member those mocked requests would run against.
|
|
|
|
Because `Security::setCurrentUser()` is *stateless*, its effect only last for the current request. When mocking an HTTP request, session-manager logs out the mocked user if it was defined with `Security::setCurrentUser()`.
|
|
|
|
Functional tests should use `$this->logInAs($member)` and `$this->logOut()` when mocking HTTP requests. It is still appropriate to use `Security::setCurrentUser()` when testing stateless logic. e.g.: Testing that a `DataObject`'s `canView()` method returns the correct value for the current user.
|
|
|
|
Review the [Functional Testing developer documentation](/developer_guides/testing/functional_testing/#loginas) for more details on `logInAs()` and `logOut()`.
|
|
|
|
### Default mail transport upgraded to sendmail {#sendmail}
|
|
|
|
Silverstripe CMS provides an API over the top of the [SwiftMailer](http://swiftmailer.org/) PHP library which comes with an extensive list of "transports" for sending mail via different services.
|
|
|
|
Prior to 4.9.0, Silverstripe CMS 4 defaulted to using the built-in PHP `mail()` command via a deprecated class `Swift_MailTransport`. However, using this layer is less secure and is strongly discouraged.
|
|
|
|
Installations of Silverstripe CMS setup using silverstripe/installer 4.9.0 or greater default to using the more secure class `Swift_SendmailTransport` which uses a `sendmail` binary.
|
|
|
|
It's highly recommended that existing Silverstripe CMS installation still using `Swift_MailTransport` upgrade to using `Swift_SendmailTransport` or another available transport, such as `Swift_SmtpTransport`. Details on how to use these classes are available in the [email section](https://docs.silverstripe.org/en/4/developer_guides/email/) of the developer docs.
|
|
|
|
### Other new features
|
|
|
|
* [Dot notation support in form fields](https://github.com/silverstripe/silverstripe-framework/pull/9192): Save directly into nested has_one relationships (see [docs](/developer_guides/forms/how_tos/handle_nested_data)).
|
|
|
|
## Bugfixes {#bugfixes}
|
|
|
|
This release includes a number of bug fixes to improve a broad range of areas. Check the change logs for full details of these fixes split by module. Thank you to the community members that helped contribute these fixes as part of the release!
|