Skip to content

Commit

Permalink
Disable HTTP caches on preview links (for 2.x)
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Jul 20, 2018
1 parent 73abb79 commit d7e3873
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ env:
matrix:
include:
- php: 5.6
env: DB=MYSQL INSTALLER_VERSION=4.0.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
env: DB=MYSQL INSTALLER_VERSION=4.2.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
- php: 7.0
env: DB=MYSQL INSTALLER_VERSION=4.1.x-dev PHPUNIT_TEST=1
env: DB=MYSQL INSTALLER_VERSION=4.2.x-dev PHPUNIT_TEST=1
- php: 7.1
env: DB=MYSQL INSTALLER_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1
- php: 7.2
Expand All @@ -38,7 +38,7 @@ before_script:

# Install composer dependencies
- composer validate
- composer require silverstripe/installer:"$INSTALLER_VERSION" silverstripe/recipe-testing:^1 --no-update
- composer require silverstripe/installer:"$INSTALLER_VERSION" silverstripe/recipe-testing:^1.2 --no-update
- if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.1.x-dev --no-update; fi
- composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
}
],
"require": {
"silverstripe/framework": "^4.0",
"silverstripe/cms": "^4.0"
"silverstripe/framework": "^4.2",
"silverstripe/cms": "^4.2"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This module adds a 'Share draft' action menu to the CMS. This enables Content Au

## Requirements

- SilverStripe ^4.0
- SilverStripe ^4.2

Note: this version is compatible with SilverStripe 4. For SilverStripe 3, please see the 1.x release line.

Expand Down
4 changes: 4 additions & 0 deletions src/Controllers/ShareDraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
use SilverStripe\Control\Session;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\FieldType\DBHTMLText;
Expand Down Expand Up @@ -50,6 +51,9 @@ class ShareDraftController extends Controller
*/
public function preview(HTTPRequest $request)
{
// Ensure this URL doesn't get picked up by HTTP caches
HTTPCacheControlMiddleware::singleton()->disableCache();

$key = $request->param('Key');
$token = $request->param('Token');
try {
Expand Down

0 comments on commit d7e3873

Please sign in to comment.