Merge branch '3.7' into 3

This commit is contained in:
Daniel Hensby 2018-07-17 20:53:41 +01:00
commit 01f29bfa5e
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
10 changed files with 41 additions and 9 deletions

View File

@ -16,7 +16,7 @@ HTTP:
no-cache: "true" no-cache: "true"
no-store: "true" no-store: "true"
must-revalidate: "true" must-revalidate: "true"
vary: "X-Requested-With, X-Forwarded-Protocol" vary: "X-Forwarded-Protocol"
LeftAndMain: LeftAndMain:
dependencies: dependencies:
versionProvider: %$SilverStripeVersionProvider versionProvider: %$SilverStripeVersionProvider

View File

@ -918,6 +918,9 @@ class Director implements TemplateGlobalProvider {
* by checking for a custom header set by jQuery or * by checking for a custom header set by jQuery or
* wether a manually set request-parameter 'ajax' is present. * wether a manually set request-parameter 'ajax' is present.
* *
* Note that if you plan to use this to alter your HTTP response on a cached page,
* you should add X-Requested-With to the Vary header.
*
* @return boolean * @return boolean
*/ */
public static function is_ajax() { public static function is_ajax() {

View File

@ -1232,11 +1232,11 @@ class InstallRequirements {
} }
public function hasErrors() { public function hasErrors() {
return sizeof($this->errors); return empty($this->errors) ? 0 : sizeof($this->errors);
} }
public function hasWarnings() { public function hasWarnings() {
return sizeof($this->warnings); return empty($this->warnings) ? 0 : sizeof($this->warnings);
} }
} }

View File

@ -209,7 +209,7 @@ when calculating a cache key, usually in addition to the full URL path.
By default, SilverStripe will output a `Vary` header with the following content: By default, SilverStripe will output a `Vary` header with the following content:
``` ```
Vary: X-Requested-With, X-Forwarded-Protocol Vary: X-Forwarded-Protocol
``` ```
To change the value of the `Vary` header, you can change this value by specifying the header in configuration. To change the value of the `Vary` header, you can change this value by specifying the header in configuration.
@ -218,3 +218,6 @@ To change the value of the `Vary` header, you can change this value by specifyin
HTTP: HTTP:
vary: "" vary: ""
``` ```
Note that if you use `Director::is_ajax()` on cached pages then you should add `X-Requested-With` to the vary
header.

View File

@ -0,0 +1,13 @@
# 3.7.1
<!--- Changes below this line will be automatically regenerated -->
## Change Log
### Bugfixes
* 2018-07-17 [e38c30f](https://github.com/silverstripe/silverstripe-framework/commit/e38c30ff0d9e4ae8ae31a59836fb8e9891f559a5) sizeof doesnt work with null types (Daniel Hensby)
* 2018-06-19 [58bd6c2](https://github.com/silverstripe/silverstripe-framework/commit/58bd6c2248282b9ef6fb940cc6792a7b8c436fbf) Switch to Trusty in Travis (Robbie Averill)
* 2018-06-11 [07112db](https://github.com/silverstripe/silverstripe-cms/commit/07112dbb0bbc4bd624e44586ef3faccdcff1acd1) Remove blind reliance on current versioning stage being valid (Guy)
* 2018-06-11 [02cd32a](https://github.com/silverstripe/silverstripe-framework/commit/02cd32acb3db7b8e3ec5b3617ce6fb5c84fca9d8) Error if invalid stage specified for get_by_stage (Damian Mooyman)
* 2018-06-09 [42e799b](https://github.com/silverstripe/silverstripe-framework/commit/42e799bc43eb83660bc4d35c9c6c5bf7f23989a8) Versioned::choose_site_stage() if no request given (Florian Thoma)

View File

@ -0,0 +1,12 @@
# 3.7.1-rc1
<!--- Changes below this line will be automatically regenerated -->
## Change Log
### Bugfixes
* 2018-06-19 [58bd6c224](https://github.com/silverstripe/silverstripe-framework/commit/58bd6c2248282b9ef6fb940cc6792a7b8c436fbf) Switch to Trusty in Travis (Robbie Averill)
* 2018-06-11 [07112dbb](https://github.com/silverstripe/silverstripe-cms/commit/07112dbb0bbc4bd624e44586ef3faccdcff1acd1) Remove blind reliance on current versioning stage being valid (Guy)
* 2018-06-11 [02cd32acb](https://github.com/silverstripe/silverstripe-framework/commit/02cd32acb3db7b8e3ec5b3617ce6fb5c84fca9d8) Error if invalid stage specified for get_by_stage (Damian Mooyman)
* 2018-06-09 [42e799bc4](https://github.com/silverstripe/silverstripe-framework/commit/42e799bc43eb83660bc4d35c9c6c5bf7f23989a8) Versioned::choose_site_stage() if no request given (Florian Thoma)

View File

@ -1640,6 +1640,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
if($this->model) $result->setDataModel($this->model); if($this->model) $result->setDataModel($this->model);
$this->extend('updateComponents', $result);
return $result return $result
->forForeignID($this->ID) ->forForeignID($this->ID)
->where($filter) ->where($filter)

View File

@ -4,8 +4,8 @@
<% end_if %> <% end_if %>
<% loop $FieldList %> <% loop $FieldList %>
<% if $ColumnCount %> <% if $Top.ColumnCount %>
<div class="column-{$ColumnCount} $FirstLast"> <div class="column-{$Top.ColumnCount} $FirstLast">
$FieldHolder $FieldHolder
</div> </div>
<% else %> <% else %>

View File

@ -4,8 +4,8 @@
<% end_if %> <% end_if %>
<% loop FieldList %> <% loop FieldList %>
<% if ColumnCount %> <% if $Top.ColumnCount %>
<div class="column-{$ColumnCount} $FirstLast"> <div class="column-{$Top.ColumnCount} $FirstLast">
$SmallFieldHolder $SmallFieldHolder
</div> </div>
<% else %> <% else %>

View File

@ -77,7 +77,6 @@ class HTTPTest extends FunctionalTest {
$this->assertNotEmpty($v); $this->assertNotEmpty($v);
$this->assertContains("X-Forwarded-Protocol", $v); $this->assertContains("X-Forwarded-Protocol", $v);
$this->assertContains("X-Requested-With", $v);
$this->assertNotContains("Cookie", $v); $this->assertNotContains("Cookie", $v);
$this->assertNotContains("User-Agent", $v); $this->assertNotContains("User-Agent", $v);
$this->assertNotContains("Accept", $v); $this->assertNotContains("Accept", $v);