Compare commits
65 Commits
Author | SHA1 | Date |
---|---|---|
github-actions | b12eee33ed | |
Guy Sartorelli | 0a17d0c537 | |
Steve Boyd | 66da923502 | |
github-actions | 3c922398ca | |
Guy Sartorelli | 82872780eb | |
github-actions | 900aae6a25 | |
Guy Sartorelli | d082606ded | |
Steve Boyd | 4129c23c0f | |
Guy Sartorelli | 84f1ed3914 | |
Steve Boyd | b11db96d7a | |
Guy Sartorelli | 1f015f119c | |
Guy Sartorelli | ebae2446a9 | |
Maxime Rainville | 633b85537e | |
Steve Boyd | df5845176f | |
Guy Sartorelli | 4afd8ce074 | |
Guy Sartorelli | 1e78dfc828 | |
Guy Sartorelli | b56ae94e87 | |
Guy Sartorelli | 1ec4a141e3 | |
Steve Boyd | d44e506d00 | |
Sabina Talipova | 48220dad3a | |
Steve Boyd | 6699b9074a | |
Guy Sartorelli | 8041c15dc7 | |
Steve Boyd | 9f6b6f9d8a | |
Maxime Rainville | 831c178514 | |
Guy Sartorelli | 2e1dc4a46e | |
Guy Sartorelli | c5fdbcbd72 | |
Maxime Rainville | 2ba0438277 | |
Steve Boyd | 656094763b | |
Steve Boyd | d18a07213e | |
Guy Sartorelli | e8da1e07bf | |
Steve Boyd | abb248242f | |
Steve Boyd | 75237f89db | |
Steve Boyd | befc7f07d3 | |
Guy Sartorelli | c5f4a5ccdb | |
Steve Boyd | 9433c0542a | |
Guy Sartorelli | f93f32d22b | |
Steve Boyd | 600a4b2cde | |
Maxime Rainville | 7195e2a833 | |
Steve Boyd | 8171761d39 | |
Steve Boyd | 933c58128b | |
Maxime Rainville | feb6218035 | |
Steve Boyd | 2671406a86 | |
Maxime Rainville | 52f303d497 | |
Steve Boyd | baee472c9f | |
Maxime Rainville | 25ff52c1fc | |
Maxime Rainville | b4ce6caead | |
Steve Boyd | 42ea538f0f | |
Steve Boyd | a7251dba0f | |
Serge Latyntsev | c4ba8bf3a9 | |
Steve Boyd | 5cc58a1269 | |
Robbie Averill | 747cf4d68d | |
Steve Boyd | f473126c9f | |
Garion Herman | 952c7c3592 | |
Maxime Rainville | 1f832bcdc4 | |
Serge Latyntsev | 4d499524cd | |
Steve Boyd | ece9566bcb | |
Aaron Carlino | 8de3ec1dfc | |
Garion Herman | 5aef1bace1 | |
Serge Latyntcev | a56946b68b | |
Robbie Averill | 08539df0af | |
Robbie Averill | 831f03a2b8 | |
Robbie Averill | 247039ff0e | |
Robbie Averill | 0356e1e0a2 | |
Dylan Wagstaff | 9065f82d79 | |
Robbie Averill | 3b1c682a54 |
|
@ -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
|
|
@ -0,0 +1,16 @@
|
|||
name: Deploy Userhelp Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '3'
|
||||
- '2'
|
||||
- 'master'
|
||||
paths:
|
||||
- 'docs/en/userguide/**'
|
||||
jobs:
|
||||
deploy:
|
||||
name: deploy-userhelp-docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Run build hook
|
||||
run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK }}
|
|
@ -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
|
|
@ -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/*]
|
35
.travis.yml
35
.travis.yml
|
@ -1,35 +0,0 @@
|
|||
language: php
|
||||
|
||||
env:
|
||||
global:
|
||||
- COMPOSER_ROOT_VERSION=2.0.x-dev
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: DB=MYSQL RECIPE_VERSION=1.0.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||
- php: 7.0
|
||||
env: DB=MYSQL RECIPE_VERSION=1.1.x-dev PHPUNIT_TEST=1
|
||||
- php: 7.1
|
||||
env: DB=PGSQL RECIPE_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1
|
||||
- php: 7.2
|
||||
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
|
||||
|
||||
before_script:
|
||||
# Init PHP
|
||||
- phpenv rehash
|
||||
- phpenv config-rm xdebug.ini
|
||||
|
||||
# Install composer dependencies
|
||||
- composer validate
|
||||
- composer require --no-update silverstripe/recipe-cms "$RECIPE_VERSION"
|
||||
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql 2.1.x-dev; fi
|
||||
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
|
||||
|
||||
script:
|
||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
|
||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
||||
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
|
||||
|
||||
after_success:
|
||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
|
@ -1,8 +1,9 @@
|
|||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[silverstripe-versionfeed.master]
|
||||
[o:silverstripe:p:silverstripe-versionfeed:r:master]
|
||||
file_filter = lang/<lang>.yml
|
||||
source_file = lang/en.yml
|
||||
source_lang = en
|
||||
type = YML
|
||||
type = YML
|
||||
|
||||
|
|
11
README.md
11
README.md
|
@ -1,8 +1,7 @@
|
|||
# Version Feed
|
||||
|
||||
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-versionfeed.svg?style=flat)](https://travis-ci.org/silverstripe/silverstripe-versionfeed)
|
||||
[![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)
|
||||
[![codecov](https://codecov.io/gh/silverstripe/silverstripe-versionfeed/branch/master/graph/badge.svg)](https://codecov.io/gh/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)
|
||||
[![Silverstripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
|
||||
|
||||
## Overview
|
||||
|
||||
|
@ -10,13 +9,13 @@ The module creates an RSS feed on each page with their change history, as well a
|
|||
|
||||
## 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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ SilverStripe\Core\Injector\Injector:
|
|||
ContentFilter:
|
||||
class: SilverStripe\VersionFeed\Filters\CachedContentFilter
|
||||
constructor:
|
||||
- %$RateLimitFilter
|
||||
- '%$RateLimitFilter'
|
||||
Psr\SimpleCache\CacheInterface.VersionFeedController:
|
||||
factory: SilverStripe\Core\Cache\CacheFactory
|
||||
constructor:
|
||||
|
@ -22,4 +22,4 @@ SilverStripe\CMS\Controllers\ContentController:
|
|||
- SilverStripe\VersionFeed\VersionFeedController
|
||||
SilverStripe\VersionFeed\VersionFeedController:
|
||||
dependencies:
|
||||
ContentFilter: %$ContentFilter
|
||||
ContentFilter: '%$ContentFilter'
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"silverstripe/cms": "^4",
|
||||
"silverstripe/versioned": "^1",
|
||||
"silverstripe/siteconfig": "^4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -30,7 +31,6 @@
|
|||
"SilverStripe\\VersionFeed\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": [],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
title: Content change RSS
|
||||
summary: Adds page or site wide RSS feeds that display content changes
|
||||
---
|
||||
|
||||
# Content change RSS
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ en:
|
|||
TITLECHANGED: 'Title has changed:'
|
||||
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.'
|
||||
db_PublicHistory: 'Public history'
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'All page changes'
|
||||
ALLCHANGESLABEL: 'Make global changes feed public'
|
||||
db_AllChangesEnabled: 'All changes enabled'
|
||||
|
|
|
@ -6,6 +6,8 @@ eo:
|
|||
TITLECHANGED: 'Titolo estas ŝanĝita:'
|
||||
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.'
|
||||
db_PublicHistory: 'Publika historio'
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Ĉiuj paĝaj ŝanĝoj'
|
||||
ALLCHANGESLABEL: 'Ĉieaj ŝanĝoj fluu en publikan'
|
||||
db_AllChangesEnabled: 'Ĉiuj ŝanĝoj enŝaltitaj'
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
it:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Rendere pubblica la cronologia'
|
||||
SINGLEPAGEFEEDTITLE: 'Aggiornare alla pagina {title}'
|
||||
SITEFEEDTITLE: 'Aggiornare a {title}'
|
||||
TITLECHANGED: 'Il titolo è cambiato:'
|
||||
Warning: 'Pubblicare la cronologia divulgherà anche i cambiamenti che sono stati precedentemente protetti dalla vista pubblica.'
|
||||
Warning2: 'Cambiare la modalità di accesso in modo che la pagina o le pagine sottostanti diventino pubbliche<br>può comportare la pubblicazione della cronologia dei cambiamenti di queste pagine. Si prega di rivedere<br>le impostazioni della sezione "Cronologia pubblica" per assicurarsi che siano divulgate solo le informazioni desiderate.'
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Tutti i cambiamenti pagina'
|
||||
ALLCHANGESLABEL: 'Rendere pubblico il feed dei cambiamenti globali'
|
|
@ -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é'
|
|
@ -0,0 +1,12 @@
|
|||
sl:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Javno objavi zgodovino'
|
||||
SINGLEPAGEFEEDTITLE: 'Posodobitve strani ''{title}'' '
|
||||
SITEFEEDTITLE: 'Posodobitve {title}'
|
||||
TITLECHANGED: 'Spremenjen naslov:'
|
||||
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.'
|
||||
db_PublicHistory: 'Javna zgodovina'
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Vse spremembe'
|
||||
ALLCHANGESLABEL: 'Javno objavi seznam s krovnimi spremembami'
|
|
@ -1,8 +1,8 @@
|
|||
zh:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: '将历史记录公开'
|
||||
LABEL: 将历史记录公开
|
||||
SINGLEPAGEFEEDTITLE: '更新至 {title} 页面'
|
||||
SITEFEEDTITLE: '更新至 {title}'
|
||||
TITLECHANGED: '标题已更改:'
|
||||
Warning: '发布历史记录还会在公开视图中显示受保护事件内进行的改动。'
|
||||
Warning2: '用这种方式更改访问设置会使得本页及下级页面变为公开的<br>可能还会使得这些页面的所有变动历史记录也变为公开的。请查阅<br>本节的“公开历史记录”设置,确保只将需要的信息披露出来。'
|
||||
TITLECHANGED: 标题已更改:
|
||||
Warning: 发布历史记录还会在公开视图中显示受保护事件内进行的改动。
|
||||
Warning2: 用这种方式更改访问设置会使得本页及下级页面变为公开的<br>可能还会使得这些页面的所有变动历史记录也变为公开的。请查阅<br>本节的“公开历史记录”设置,确保只将需要的信息披露出来。
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<ruleset name="SilverStripe">
|
||||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<rule ref="PSR2" >
|
||||
<!-- Current exclusions -->
|
||||
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
|
||||
<testsuite name="Default">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
<testsuites>
|
||||
<testsuite name="Default">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src/</directory>
|
||||
|
|
|
@ -68,13 +68,13 @@ class RateLimitFilter extends ContentFilter
|
|||
|
||||
// Add global identifier
|
||||
if ($this->config()->get('lock_bypage')) {
|
||||
$key .= '_' . md5($itemkey);
|
||||
$key .= '_' . md5($itemkey ?? '');
|
||||
}
|
||||
|
||||
// Add user-specific identifier
|
||||
if ($this->config()->get('lock_byuserip') && Controller::has_curr()) {
|
||||
$ip = Controller::curr()->getRequest()->getIP();
|
||||
$key .= '_' . md5($ip);
|
||||
$key .= '_' . md5($ip ?? '');
|
||||
}
|
||||
|
||||
return $key;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace SilverStripe\VersionFeed;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
|
@ -77,7 +78,7 @@ class VersionFeed extends SiteTreeExtension
|
|||
$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.
|
||||
$qLimit = (int)$limit + 1;
|
||||
$versions = $this->owner->allVersions(
|
||||
$versions = $this->owner->Versions(
|
||||
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset",
|
||||
"\"SiteTree\".\"LastEdited\" DESC, \"SiteTree\".\"ID\" DESC",
|
||||
$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.
|
||||
*
|
||||
* @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 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)
|
||||
{
|
||||
Deprecation::notice('2.0.0', 'Use VersionFeed::getDiffList() instead');
|
||||
return $this->getDiffList(
|
||||
$highestVersion,
|
||||
$fullHistory ? $limit : 1
|
||||
|
|
|
@ -119,7 +119,7 @@ class VersionFeedController extends Extension
|
|||
if ($lastChange) {
|
||||
// Cache the diffs to remove DOS possibility.
|
||||
$key = 'allchanges'
|
||||
. preg_replace('#[^a-zA-Z0-9_]#', '', $lastChange['LastEdited'])
|
||||
. preg_replace('#[^a-zA-Z0-9_]#', '', $lastChange['LastEdited'] ?? '')
|
||||
. (Security::getCurrentUser() ? Security::getCurrentUser()->ID : 'public');
|
||||
$changeList = $this->filterContent($key, function () use ($latestChanges) {
|
||||
$changeList = new ArrayList();
|
||||
|
@ -191,6 +191,7 @@ class VersionFeedController extends Extension
|
|||
{
|
||||
if (!Config::inst()->get(VersionFeed::class, 'allchanges_enabled')
|
||||
|| !SiteConfig::current_site_config()->AllChangesEnabled
|
||||
|| !method_exists($this->owner, 'getSiteRSSLink')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
*/
|
||||
protected $cache;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
Director::config()->set('alternate_base_url', $this->baseURI);
|
||||
|
||||
|
@ -64,7 +64,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
Versioned::set_reading_mode(Versioned::DEFAULT_MODE);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
Director::config()->set('alternate_base_url', null);
|
||||
|
||||
|
@ -86,7 +86,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
|
||||
$response = $this->get($page->RelativeLink('allchanges'));
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$this->assertFalse(
|
||||
(bool)$xml->channel->item,
|
||||
'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'));
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$this->assertTrue(
|
||||
(bool)$xml->channel->item,
|
||||
'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'));
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$this->assertTrue(
|
||||
(bool)$xml->channel->item,
|
||||
'With "PublicHistory" enabled, `allchanges` action should have an item in the channel'
|
||||
|
@ -141,7 +141,7 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
$page1->ID,
|
||||
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);
|
||||
$response = $this->get($page1->RelativeLink('changes'));
|
||||
$this->assertEquals(429, $response->getStatusCode());
|
||||
|
@ -171,19 +171,19 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
||||
|
||||
$response = $this->get($page1->RelativeLink('changes'));
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$titles = array_map(function ($item) {
|
||||
return (string)$item->title;
|
||||
}, $xml->xpath('//item'));
|
||||
}, $xml->xpath('//item') ?? []);
|
||||
// TODO Unclear if this should contain the original version
|
||||
$this->assertContains('Changed: Page1', $titles);
|
||||
$this->assertNotContains('Changed: Page2', $titles);
|
||||
|
||||
$response = $this->get($page2->RelativeLink('changes'));
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$titles = array_map(function ($item) {
|
||||
return (string)$item->title;
|
||||
}, $xml->xpath('//item'));
|
||||
}, $xml->xpath('//item') ?? []);
|
||||
// TODO Unclear if this should contain the original version
|
||||
$this->assertNotContains('Changed: Page1', $titles);
|
||||
$this->assertContains('Changed: Page2', $titles);
|
||||
|
@ -195,10 +195,10 @@ class VersionFeedFunctionalTest extends FunctionalTest
|
|||
$page2 = $this->createPageWithChanges(['Title' => 'Page2']);
|
||||
|
||||
$response = $this->get($page1->RelativeLink('allchanges'));
|
||||
$xml = simplexml_load_string($response->getBody());
|
||||
$xml = simplexml_load_string($response->getBody() ?? '');
|
||||
$titles = array_map(function ($item) {
|
||||
return str_replace('Changed: ', '', (string) $item->title);
|
||||
}, $xml->xpath('//item'));
|
||||
}, $xml->xpath('//item') ?? []);
|
||||
$this->assertContains('Page1', $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
|
||||
$cleanDiffOutput = function ($val) {
|
||||
return str_replace(' ', '', strip_tags($val));
|
||||
return str_replace(' ', '', strip_tags($val ?? ''));
|
||||
};
|
||||
|
||||
$this->assertContains(
|
||||
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'
|
||||
);
|
||||
|
||||
$this->assertNotContains(
|
||||
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'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue