Skip to content

Commit 45a097c

Browse files
authored
Merge pull request #1 from nswdpc/replace-backend
Replace backend
2 parents 8322ff7 + dbcded9 commit 45a097c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2504
-1178
lines changed

.gitattributes

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
/tests export-ignore
2-
/docs export-ignore
3-
/client/src export-ignore
4-
/.gitattributes export-ignore
5-
/.gitignore export-ignore
6-
/.php_cs.dist
7-
/.phpcs.xml.dist
8-
/.phpunit.xml.dist
9-
/.waratah export-ignore
10-
/README.md export-ignore
1+
/tests export-ignore
2+
/docs export-ignore
3+
/client/src export-ignore
4+
/.editorconfig export-ignore
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.php-cs-fixer.dist.php export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.waratah export-ignore
10+
/code-of-conduct.md export-ignore
11+
/CONTRIBUTING.md export-ignore
12+
/README.md export-ignore

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/client/node_modules
22
/vendor/
33
.DS_Store
4-
/.php_cs.cahce
4+
/.php-cs-fixer.cache

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
$finder = PhpCsFixer\Finder::create()
88
->in(__DIR__);
99

10-
return PhpCsFixer\Config::create()
11-
->setRules([
10+
$config = new PhpCsFixer\Config();
11+
return $config->setRules([
1212
'@PSR2' => true,
1313
'array_indentation' => true,
1414
'array_syntax' => ['syntax' => 'short'],

CONTRIBUTING.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# Contributing
2+
3+
For simplicity, our contribution process follows the relevant Silverstripe documents.
4+
5+
## Guidelines
6+
27
- Maintenance on this module is a shared effort of those who use it
38
- To contribute improvements to the code, ensure you raise a pull request and discuss with the module maintainers
4-
- Please follow the SilverStripe [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard)
9+
- Please follow the Silverstripe [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard)
510
- Supply documentation that follows the [GitHub Flavored Markdown](https://help.github.com/articles/markdown-basics/) conventions
6-
- When having discussions about this module in issues or pull request please adhere to the [SilverStripe Community Code of Conduct](https://docs.silverstripe.org/en/contributing/code_of_conduct/)
7-
11+
- When having discussions about this module in issues or pull request please adhere to the [Silverstripe Community Code of Conduct](https://docs.silverstripe.org/en/contributing/code_of_conduct/)
812

913
## Contributor license agreement
10-
By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright
11-
of that code to MODULE_COPYRIGHT_HOLDER_HERE., on the condition that these code changes are released under the
12-
same BSD license as the original module. We ask for this so that the ownership in the license is clear
13-
and unambiguous. By releasing this code under a permissive license such as BSD, this copyright assignment
14-
won't prevent you from using the code in any way you see fit.
14+
15+
By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright of that code to New South Wales Department of Premier & Cabinet, on the condition that these code changes are released under the same BSD license as the original module.
16+
17+
We ask for this so that the ownership in the license is clear and unambiguous.
18+
19+
By releasing this code under a permissive license such as BSD, this copyright assignment won't prevent you from using the code in any way you see fit.

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Reinforced Cloudflare support for Silverstripe websites
1+
# Cloudflare purge support for Silverstripe websites
22

3-
This module provides some extra sharp additions for Silverstripe using Cloudflare as a frontend
3+
Purge cache handling
44

55
### Features
66

@@ -13,14 +13,6 @@ This module provides some extra sharp additions for Silverstripe using Cloudflar
1313

1414
See [composer.json](./composer.json) for specifics.
1515

16-
+ Versioned
17-
+ Cloudflare PHP SDK
18-
+ Oldman
19-
+ MultivalueField
20-
+ Queued Jobs
21-
22-
Site publish/unpublish URL purging is undertaken by [symbiote/silverstripe-oldman](https://github.com/symbiote/silverstripe-oldman)
23-
2416

2517
## Installation
2618

@@ -41,13 +33,21 @@ See [License](./LICENSE.md)
4133

4234
## Configuration
4335

44-
Given a a standard symbiote-oldman configuration:
36+
37+
### Authentication Token
38+
39+
Documentation: https://developers.cloudflare.com/api/get-started/create-token/
40+
41+
1. Create Custom Token, give it a name
42+
1. Zone / Cache Purge / Purge
43+
1. Include Zone / Specific Zone / < zone >
44+
1. Client IP Address filtering: restrict access to token
45+
1. TTL, if required
4546

4647
```yaml
47-
Symbiote\Cloudflare\Cloudflare:
48+
NSWDPC\Utilities\Cloudflare\CloudflarePurgeService:
4849
enabled: true
49-
email: 'cloudflare@email'
50-
auth_key: '<auth_key>'
50+
auth_token: '<auth_token>'
5151
zone_id: '<zone_id>'
5252
# Optional, specify a URL to use instead of Director::baseURL()
5353
base_url: 'https://www.example.com/'

_config/config.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
---
22
Name: nswdpc-oldmantium
3-
After:
4-
- '#cloudflare_extensions'
53
---
6-
SilverStripe\Core\Injector\Injector:
7-
Symbiote\Cloudflare\Cloudflare:
8-
class: NSWDPC\Utilities\Cloudflare\CloudflarePurgeService
94
NSWDPC\Utilities\Cloudflare\PurgeRecord:
105
extensions:
116
- 'NSWDPC\Utilities\Cloudflare\DataObjectPurgeable'
127
- 'Silverstripe\Versioned\Versioned'
8+
SilverStripe\CMS\Model\SiteTree:
9+
extensions:
10+
- 'NSWDPC\Utilities\Cloudflare\SiteTreeExtension'

composer.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
}
2020
],
2121
"require": {
22+
"guzzlehttp/guzzle": "^7",
23+
"silverstripe/framework": "^4.10.0",
24+
"silverstripe/cms": "^4",
2225
"silverstripe/versioned" : "^1",
23-
"symbiote/silverstripe-oldman" : "^3",
24-
"cloudflare/sdk" : "^1.1",
2526
"symbiote/silverstripe-queuedjobs": "^4",
2627
"symbiote/silverstripe-multivaluefield" : "^5"
2728
},
@@ -30,7 +31,21 @@
3031
"silverstripe/versioned-admin" : "for administration of versioned dataobjects"
3132
},
3233
"require-dev": {
33-
"phpunit/phpunit": "^5.7 | ^7",
34-
"squizlabs/php_codesniffer": "^3.0"
34+
"phpunit/phpunit": "^9.5",
35+
"friendsofphp/php-cs-fixer": "^3"
36+
},
37+
"autoload": {
38+
"psr-4": {
39+
"NSWDPC\\Utilities\\Cloudflare\\": [
40+
"src/Controllers/",
41+
"src/Extensions/",
42+
"src/Interfaces/",
43+
"src/Jobs/",
44+
"src/Models/",
45+
"src/Services/",
46+
"src/Tasks/"
47+
],
48+
"NSWDPC\\Utilities\\Cloudflare\\Tests\\": "tests/"
49+
}
3550
}
3651
}

docs/en/001_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Documentation
22

3+
4+
## Pages
5+
6+
Publishing/unpublising a page will send a request to purge the cache for the page's current URL.
7+
38
## PurgeRecord
49

510
### URL

lang/en.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
en:
2+
NSWDPC\Utilities\Cloudflare\PurgeRecord:
3+
TYPE_HOST: 'Purge by host'
4+
TYPE_TAG: 'Purge by cache tag'
5+
TYPE_PREFIX: 'Purge by prefix'
6+
TYPE_URL: 'Purge by URL'
7+
TYPE_ENTIRE: 'Entire cache purge (warning)'
8+
TYPE_FILEEXTENSION: 'Purge public files by file extension(s)'
9+
TYPE_IMAGE: 'Purge public files by common image extensions'
10+
TYPE_CSSJAVASCRIPT: 'Purge public css, json and js files'

phpcs.xml.dist

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)