mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-10-22 11:05:31 +02:00
Compare commits
42 Commits
2.2.0-beta
...
2
Author | SHA1 | Date | |
---|---|---|---|
|
55d18d8392 | ||
|
0b94f4b8a9 | ||
|
a2b6f45abd | ||
|
b12eee33ed | ||
|
0a17d0c537 | ||
|
66da923502 | ||
|
3c922398ca | ||
|
82872780eb | ||
|
900aae6a25 | ||
|
d082606ded | ||
|
4129c23c0f | ||
|
84f1ed3914 | ||
|
b11db96d7a | ||
|
1f015f119c | ||
|
ebae2446a9 | ||
|
633b85537e | ||
|
df5845176f | ||
|
4afd8ce074 | ||
|
1e78dfc828 | ||
|
b56ae94e87 | ||
|
1ec4a141e3 | ||
|
d44e506d00 | ||
|
48220dad3a | ||
|
6699b9074a | ||
|
8041c15dc7 | ||
|
9f6b6f9d8a | ||
|
831c178514 | ||
|
2e1dc4a46e | ||
|
c5fdbcbd72 | ||
|
2ba0438277 | ||
|
656094763b | ||
|
d18a07213e | ||
|
e8da1e07bf | ||
|
abb248242f | ||
|
75237f89db | ||
|
befc7f07d3 | ||
|
c5f4a5ccdb | ||
|
9433c0542a | ||
|
f93f32d22b | ||
|
600a4b2cde | ||
|
7195e2a833 | ||
|
8171761d39 |
11
.github/workflows/ci.yml
vendored
Normal file
11
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: CI
|
||||||
|
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
|
@ -1,13 +1,15 @@
|
|||||||
name: Build Docs
|
name: Deploy Userhelp Docs
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
- '3'
|
||||||
|
- '2'
|
||||||
- 'master'
|
- 'master'
|
||||||
paths:
|
paths:
|
||||||
- 'docs/en/userguide/**'
|
- 'docs/en/userguide/**'
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
deploy:
|
||||||
name: build-docs
|
name: deploy-userhelp-docs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Run build hook
|
- name: Run build hook
|
16
.github/workflows/dispatch-ci.yml
vendored
Normal file
16
.github/workflows/dispatch-ci.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
name: Dispatch CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
# At 11:10 AM UTC, only on Sunday and Monday
|
||||||
|
schedule:
|
||||||
|
- cron: '10 11 * * 0,1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dispatch-ci:
|
||||||
|
name: Dispatch CI
|
||||||
|
# Only run cron on the silverstripe account
|
||||||
|
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Dispatch CI
|
||||||
|
uses: silverstripe/gha-dispatch-ci@v1
|
17
.github/workflows/keepalive.yml
vendored
Normal file
17
.github/workflows/keepalive.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: Keepalive
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
# The 8th of every month at 11:50am UTC
|
||||||
|
schedule:
|
||||||
|
- cron: '50 11 8 * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
keepalive:
|
||||||
|
name: Keepalive
|
||||||
|
# Only run cron on the silverstripe account
|
||||||
|
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Keepalive
|
||||||
|
uses: silverstripe/gha-keepalive@v1
|
@ -1,15 +0,0 @@
|
|||||||
inherit: true
|
|
||||||
|
|
||||||
build:
|
|
||||||
nodes:
|
|
||||||
analysis:
|
|
||||||
tests:
|
|
||||||
override: [php-scrutinizer-run]
|
|
||||||
|
|
||||||
checks:
|
|
||||||
php:
|
|
||||||
code_rating: true
|
|
||||||
duplication: true
|
|
||||||
|
|
||||||
filter:
|
|
||||||
paths: [src/*, tests/*]
|
|
@ -1,4 +0,0 @@
|
|||||||
version: ~> 1.0
|
|
||||||
|
|
||||||
import:
|
|
||||||
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range.yml
|
|
@ -1,8 +1,9 @@
|
|||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
|
|
||||||
[silverstripe-versionfeed.master]
|
[o:silverstripe:p:silverstripe-versionfeed:r:master]
|
||||||
file_filter = lang/<lang>.yml
|
file_filter = lang/<lang>.yml
|
||||||
source_file = lang/en.yml
|
source_file = lang/en.yml
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = YML
|
type = YML
|
||||||
|
|
||||||
|
12
README.md
12
README.md
@ -1,9 +1,7 @@
|
|||||||
# Version Feed
|
# Version Feed
|
||||||
|
|
||||||
[![Build Status](https://api.travis-ci.com/silverstripe/silverstripe-versionfeed.svg?branch=2)](https://travis-ci.com/silverstripe/silverstripe-versionfeed)
|
[![CI](https://github.com/silverstripe/silverstripe-versionfeed/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-versionfeed/actions/workflows/ci.yml)
|
||||||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-versionfeed/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-versionfeed/?branch=master)
|
[![Silverstripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
|
||||||
[![codecov](https://codecov.io/gh/silverstripe/silverstripe-versionfeed/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-versionfeed)
|
|
||||||
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@ -11,13 +9,13 @@ The module creates an RSS feed on each page with their change history, as well a
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* SilverStripe ^4
|
* Silverstripe ^4
|
||||||
|
|
||||||
**Note:** For a SilverStripe 3.x compatible version, please use [the 1.x release line](https://github.com/silverstripe/silverstripe-versionfeed/tree/1.2).
|
**Note:** For a Silverstripe 3.x compatible version, please use [the 1.x release line](https://github.com/silverstripe/silverstripe-versionfeed/tree/1.2).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install with composer by running `composer require silverstripe/versionfeed` in the root of your SilverStripe project.
|
Install with composer by running `composer require silverstripe/versionfeed` in the root of your Silverstripe project.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3 || ^8.0",
|
"php": "^7.4 || ^8.0",
|
||||||
"silverstripe/cms": "^4",
|
"silverstripe/cms": "^4",
|
||||||
"silverstripe/versioned": "^1",
|
"silverstripe/versioned": "^1",
|
||||||
"silverstripe/siteconfig": "^4"
|
"silverstripe/siteconfig": "^4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"silverstripe/framework": "^4.10",
|
||||||
"squizlabs/php_codesniffer": "^3.0"
|
"squizlabs/php_codesniffer": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -33,4 +34,4 @@
|
|||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
|
---
|
||||||
title: Content change RSS
|
title: Content change RSS
|
||||||
summary: Adds page or site wide RSS feeds that display content changes
|
summary: Adds page or site wide RSS feeds that display content changes
|
||||||
|
---
|
||||||
|
|
||||||
# Content change RSS
|
# Content change RSS
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ en:
|
|||||||
TITLECHANGED: 'Title has changed:'
|
TITLECHANGED: 'Title has changed:'
|
||||||
Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.'
|
Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.'
|
||||||
Warning2: 'Changing access settings in such a way that this page or pages under it become publicly<br>accessible may result in publicising all historical changes on these pages too. Please review<br> this section''s "Public history" settings to ascertain only intended information is disclosed.'
|
Warning2: 'Changing access settings in such a way that this page or pages under it become publicly<br>accessible may result in publicising all historical changes on these pages too. Please review<br> this section''s "Public history" settings to ascertain only intended information is disclosed.'
|
||||||
|
db_PublicHistory: 'Public history'
|
||||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||||
ALLCHANGES: 'All page changes'
|
ALLCHANGES: 'All page changes'
|
||||||
ALLCHANGESLABEL: 'Make global changes feed public'
|
ALLCHANGESLABEL: 'Make global changes feed public'
|
||||||
|
db_AllChangesEnabled: 'All changes enabled'
|
||||||
|
@ -6,6 +6,8 @@ eo:
|
|||||||
TITLECHANGED: 'Titolo estas ŝanĝita:'
|
TITLECHANGED: 'Titolo estas ŝanĝita:'
|
||||||
Warning: 'Publikigi la historion ankaŭ malkaŝos la ŝanĝojn ĝis tiam protektitajn kontraŭ publika vido.'
|
Warning: 'Publikigi la historion ankaŭ malkaŝos la ŝanĝojn ĝis tiam protektitajn kontraŭ publika vido.'
|
||||||
Warning2: 'Ŝanĝi la alirajn agordojn tiel ke ĉi tiu paĝo, aŭ paĝoj sub ĝi, fariĝas publike alireblaj <br>eble rezultigos ke publikiĝos ĉiuj historiaj ŝanĝoj en tiuj paĝoj. Bonvole rekonsideru <br> la sekcion "Publika historio" de ĉi tiu sekcio, por certigi ke nur intencita informo publikiĝu.'
|
Warning2: 'Ŝanĝi la alirajn agordojn tiel ke ĉi tiu paĝo, aŭ paĝoj sub ĝi, fariĝas publike alireblaj <br>eble rezultigos ke publikiĝos ĉiuj historiaj ŝanĝoj en tiuj paĝoj. Bonvole rekonsideru <br> la sekcion "Publika historio" de ĉi tiu sekcio, por certigi ke nur intencita informo publikiĝu.'
|
||||||
|
db_PublicHistory: 'Publika historio'
|
||||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||||
ALLCHANGES: 'Ĉiuj paĝaj ŝanĝoj'
|
ALLCHANGES: 'Ĉiuj paĝaj ŝanĝoj'
|
||||||
ALLCHANGESLABEL: 'Ĉieaj ŝanĝoj fluu en publikan'
|
ALLCHANGESLABEL: 'Ĉieaj ŝanĝoj fluu en publikan'
|
||||||
|
db_AllChangesEnabled: 'Ĉiuj ŝanĝoj enŝaltitaj'
|
||||||
|
13
lang/sk.yml
Normal file
13
lang/sk.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
sk:
|
||||||
|
SilverStripe\VersionFeed\VersionFeed:
|
||||||
|
LABEL: 'Zverejniť históriu'
|
||||||
|
SINGLEPAGEFEEDTITLE: 'Aktualizácie stránky {title}'
|
||||||
|
SITEFEEDTITLE: 'Aktualizácie {title}'
|
||||||
|
TITLECHANGED: 'Názov sa zmenil:'
|
||||||
|
Warning: 'Zverejnením histórie sa zverejnia aj zmeny, ktoré boli v tom čase chránené pred zrakom verejnosti.'
|
||||||
|
Warning2: 'Zmena nastavení prístupu tak, aby sa táto stránka alebo stránky pod ňou stali verejne prístupné,<br>môže viesť k zverejneniu všetkých historických zmien aj na týchto stránkach.<br> Skontrolujte nastavenia v časti "Verejná história", aby ste sa uistili, že sú zverejnené iba zamýšľané informácie.'
|
||||||
|
db_PublicHistory: 'Verejná história'
|
||||||
|
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||||
|
ALLCHANGES: 'Všetky zmeny stránky'
|
||||||
|
ALLCHANGESLABEL: 'Zverejnite informačný kanál globálnych zmien'
|
||||||
|
db_AllChangesEnabled: 'Všetky zmeny povolené'
|
@ -6,6 +6,7 @@ sl:
|
|||||||
TITLECHANGED: 'Spremenjen naslov:'
|
TITLECHANGED: 'Spremenjen naslov:'
|
||||||
Warning: 'Objava zgodovine bo razkrila tudi spremembe, ki do sedaj niso bile javno objavljene.'
|
Warning: 'Objava zgodovine bo razkrila tudi spremembe, ki do sedaj niso bile javno objavljene.'
|
||||||
Warning2: 'Sprememba nastavitev dostopa tako, da so so ta stran ali njene podstrani dostopne javnosti, <br> lahko povzroči objavo tudi vseh sprememb na omenjenih straneh. Podrobno preverite <br> seznam sprememb in se prepričajte, da boste razkrili samo tiste informacije, ki jih želite.'
|
Warning2: 'Sprememba nastavitev dostopa tako, da so so ta stran ali njene podstrani dostopne javnosti, <br> lahko povzroči objavo tudi vseh sprememb na omenjenih straneh. Podrobno preverite <br> seznam sprememb in se prepričajte, da boste razkrili samo tiste informacije, ki jih želite.'
|
||||||
|
db_PublicHistory: 'Javna zgodovina'
|
||||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||||
ALLCHANGES: 'Vse spremembe'
|
ALLCHANGES: 'Vse spremembe'
|
||||||
ALLCHANGESLABEL: 'Javno objavi seznam s krovnimi spremembami'
|
ALLCHANGESLABEL: 'Javno objavi seznam s krovnimi spremembami'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
|
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Default">
|
<testsuite name="Default">
|
||||||
|
@ -68,13 +68,13 @@ class RateLimitFilter extends ContentFilter
|
|||||||
|
|
||||||
// Add global identifier
|
// Add global identifier
|
||||||
if ($this->config()->get('lock_bypage')) {
|
if ($this->config()->get('lock_bypage')) {
|
||||||
$key .= '_' . md5($itemkey);
|
$key .= '_' . md5($itemkey ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add user-specific identifier
|
// Add user-specific identifier
|
||||||
if ($this->config()->get('lock_byuserip') && Controller::has_curr()) {
|
if ($this->config()->get('lock_byuserip') && Controller::has_curr()) {
|
||||||
$ip = Controller::curr()->getRequest()->getIP();
|
$ip = Controller::curr()->getRequest()->getIP();
|
||||||
$key .= '_' . md5($ip);
|
$key .= '_' . md5($ip ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\VersionFeed;
|
namespace SilverStripe\VersionFeed;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
@ -77,7 +78,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
$offset = $highestVersion ? "AND \"SiteTree_Versions\".\"Version\"<='".(int)$highestVersion."'" : '';
|
$offset = $highestVersion ? "AND \"SiteTree_Versions\".\"Version\"<='".(int)$highestVersion."'" : '';
|
||||||
// Get just enough elements for diffing. We need one more than desired to have something to compare to.
|
// Get just enough elements for diffing. We need one more than desired to have something to compare to.
|
||||||
$qLimit = (int)$limit + 1;
|
$qLimit = (int)$limit + 1;
|
||||||
$versions = $this->owner->allVersions(
|
$versions = $this->owner->Versions(
|
||||||
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset",
|
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset",
|
||||||
"\"SiteTree\".\"LastEdited\" DESC, \"SiteTree\".\"ID\" DESC",
|
"\"SiteTree\".\"LastEdited\" DESC, \"SiteTree\".\"ID\" DESC",
|
||||||
$qLimit
|
$qLimit
|
||||||
@ -171,7 +172,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
/**
|
/**
|
||||||
* Compile a list of changes to the current page, excluding non-published and explicitly secured versions.
|
* Compile a list of changes to the current page, excluding non-published and explicitly secured versions.
|
||||||
*
|
*
|
||||||
* @deprecated 2.0.0 Use VersionFeed::getDiffList instead
|
* @deprecated 2.0.0 Use VersionFeed::getDiffList() instead
|
||||||
*
|
*
|
||||||
* @param int $highestVersion Top version number to consider.
|
* @param int $highestVersion Top version number to consider.
|
||||||
* @param boolean $fullHistory Set to true to get the full change history, set to false for a single diff.
|
* @param boolean $fullHistory Set to true to get the full change history, set to false for a single diff.
|
||||||
@ -181,6 +182,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
*/
|
*/
|
||||||
public function getDiffedChanges($highestVersion = null, $fullHistory = true, $limit = 100)
|
public function getDiffedChanges($highestVersion = null, $fullHistory = true, $limit = 100)
|
||||||
{
|
{
|
||||||
|
Deprecation::notice('2.0.0', 'Use VersionFeed::getDiffList() instead');
|
||||||
return $this->getDiffList(
|
return $this->getDiffList(
|
||||||
$highestVersion,
|
$highestVersion,
|
||||||
$fullHistory ? $limit : 1
|
$fullHistory ? $limit : 1
|
||||||
|
@ -119,7 +119,7 @@ class VersionFeedController extends Extension
|
|||||||
if ($lastChange) {
|
if ($lastChange) {
|
||||||
// Cache the diffs to remove DOS possibility.
|
// Cache the diffs to remove DOS possibility.
|
||||||
$key = 'allchanges'
|
$key = 'allchanges'
|
||||||
. preg_replace('#[^a-zA-Z0-9_]#', '', $lastChange['LastEdited'])
|
. preg_replace('#[^a-zA-Z0-9_]#', '', $lastChange['LastEdited'] ?? '')
|
||||||
. (Security::getCurrentUser() ? Security::getCurrentUser()->ID : 'public');
|
. (Security::getCurrentUser() ? Security::getCurrentUser()->ID : 'public');
|
||||||
$changeList = $this->filterContent($key, function () use ($latestChanges) {
|
$changeList = $this->filterContent($key, function () use ($latestChanges) {
|
||||||
$changeList = new ArrayList();
|
$changeList = new ArrayList();
|
||||||
@ -191,6 +191,7 @@ class VersionFeedController extends Extension
|
|||||||
{
|
{
|
||||||
if (!Config::inst()->get(VersionFeed::class, 'allchanges_enabled')
|
if (!Config::inst()->get(VersionFeed::class, 'allchanges_enabled')
|
||||||
|| !SiteConfig::current_site_config()->AllChangesEnabled
|
|| !SiteConfig::current_site_config()->AllChangesEnabled
|
||||||
|
|| !method_exists($this->owner, 'getSiteRSSLink')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
|
|
||||||
$response = $this->get($page->RelativeLink('allchanges'));
|
$response = $this->get($page->RelativeLink('allchanges'));
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
(bool)$xml->channel->item,
|
(bool)$xml->channel->item,
|
||||||
'With Page\'s "PublicHistory" disabled, `allchanges` action should not have an item in the channel'
|
'With Page\'s "PublicHistory" disabled, `allchanges` action should not have an item in the channel'
|
||||||
@ -99,7 +99,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
|
|
||||||
$response = $this->get($page->RelativeLink('changes'));
|
$response = $this->get($page->RelativeLink('changes'));
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
(bool)$xml->channel->item,
|
(bool)$xml->channel->item,
|
||||||
'With Page\'s "PublicHistory" enabled, `changes` action should have an item in the channel'
|
'With Page\'s "PublicHistory" enabled, `changes` action should have an item in the channel'
|
||||||
@ -107,7 +107,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
|
|
||||||
$response = $this->get($page->RelativeLink('allchanges'));
|
$response = $this->get($page->RelativeLink('allchanges'));
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
(bool)$xml->channel->item,
|
(bool)$xml->channel->item,
|
||||||
'With "PublicHistory" enabled, `allchanges` action should have an item in the channel'
|
'With "PublicHistory" enabled, `allchanges` action should have an item in the channel'
|
||||||
@ -141,7 +141,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
$page1->ID,
|
$page1->ID,
|
||||||
Versioned::get_versionnumber_by_stage(SiteTree::class, 'Live', $page1->ID, false)
|
Versioned::get_versionnumber_by_stage(SiteTree::class, 'Live', $page1->ID, false)
|
||||||
]);
|
]);
|
||||||
$key = RateLimitFilter::CACHE_PREFIX . '_' . md5($key);
|
$key = RateLimitFilter::CACHE_PREFIX . '_' . md5($key ?? '');
|
||||||
$this->cache->set($key, time() + 10);
|
$this->cache->set($key, time() + 10);
|
||||||
$response = $this->get($page1->RelativeLink('changes'));
|
$response = $this->get($page1->RelativeLink('changes'));
|
||||||
$this->assertEquals(429, $response->getStatusCode());
|
$this->assertEquals(429, $response->getStatusCode());
|
||||||
@ -171,19 +171,19 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
||||||
|
|
||||||
$response = $this->get($page1->RelativeLink('changes'));
|
$response = $this->get($page1->RelativeLink('changes'));
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$titles = array_map(function ($item) {
|
$titles = array_map(function ($item) {
|
||||||
return (string)$item->title;
|
return (string)$item->title;
|
||||||
}, $xml->xpath('//item'));
|
}, $xml->xpath('//item') ?? []);
|
||||||
// TODO Unclear if this should contain the original version
|
// TODO Unclear if this should contain the original version
|
||||||
$this->assertContains('Changed: Page1', $titles);
|
$this->assertContains('Changed: Page1', $titles);
|
||||||
$this->assertNotContains('Changed: Page2', $titles);
|
$this->assertNotContains('Changed: Page2', $titles);
|
||||||
|
|
||||||
$response = $this->get($page2->RelativeLink('changes'));
|
$response = $this->get($page2->RelativeLink('changes'));
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$titles = array_map(function ($item) {
|
$titles = array_map(function ($item) {
|
||||||
return (string)$item->title;
|
return (string)$item->title;
|
||||||
}, $xml->xpath('//item'));
|
}, $xml->xpath('//item') ?? []);
|
||||||
// TODO Unclear if this should contain the original version
|
// TODO Unclear if this should contain the original version
|
||||||
$this->assertNotContains('Changed: Page1', $titles);
|
$this->assertNotContains('Changed: Page1', $titles);
|
||||||
$this->assertContains('Changed: Page2', $titles);
|
$this->assertContains('Changed: Page2', $titles);
|
||||||
@ -195,10 +195,10 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||||||
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
||||||
|
|
||||||
$response = $this->get($page1->RelativeLink('allchanges'));
|
$response = $this->get($page1->RelativeLink('allchanges'));
|
||||||
$xml = simplexml_load_string($response->getBody());
|
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||||
$titles = array_map(function ($item) {
|
$titles = array_map(function ($item) {
|
||||||
return str_replace('Changed: ', '', (string) $item->title);
|
return str_replace('Changed: ', '', (string) $item->title);
|
||||||
}, $xml->xpath('//item'));
|
}, $xml->xpath('//item') ?? []);
|
||||||
$this->assertContains('Page1', $titles);
|
$this->assertContains('Page1', $titles);
|
||||||
$this->assertContains('Page2', $titles);
|
$this->assertContains('Page2', $titles);
|
||||||
}
|
}
|
||||||
|
@ -44,18 +44,18 @@ class VersionFeedTest extends SapphireTest
|
|||||||
|
|
||||||
// Strip spaces from test output because they're not reliably maintained by the HTML Tidier
|
// Strip spaces from test output because they're not reliably maintained by the HTML Tidier
|
||||||
$cleanDiffOutput = function ($val) {
|
$cleanDiffOutput = function ($val) {
|
||||||
return str_replace(' ', '', strip_tags($val));
|
return str_replace(' ', '', strip_tags($val ?? ''));
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
str_replace(' ', '', _t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Changed Title'),
|
str_replace(' ', '', _t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Changed Title'),
|
||||||
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle')),
|
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle') ?? []),
|
||||||
'Detects published title changes'
|
'Detects published title changes'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertNotContains(
|
$this->assertNotContains(
|
||||||
str_replace(' ', '', _t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Unpublished Changed Title'),
|
str_replace(' ', '', _t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Unpublished Changed Title'),
|
||||||
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle')),
|
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle') ?? []),
|
||||||
'Ignores unpublished title changes'
|
'Ignores unpublished title changes'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user