mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-06-14 00:39:10 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9b688adbef | ||
|
7172dde88e | ||
|
814734c51a | ||
|
3f7a840aa8 | ||
|
03be22fb48 | ||
|
8efb5908b7 | ||
|
7c637cc7dc | ||
|
0748333f00 | ||
|
c0b557f282 | ||
|
8190fe8579 | ||
|
2450e85c87 | ||
|
492de75e60 | ||
|
d24f2fa031 | ||
|
dd625a8683 | ||
|
a51c30fb0f | ||
|
27a64657e0 | ||
|
f00a204f6d | ||
|
89f030cfad | ||
|
eb3283662c | ||
|
4f773a79d1 | ||
|
002fbf766c | ||
|
a753712806 | ||
|
a1eac8de23 | ||
|
4e0d5ec409 | ||
|
9b92ba8d6c |
6
.github/workflows/keepalive.yml
vendored
6
.github/workflows/keepalive.yml
vendored
|
@ -1,10 +1,10 @@
|
|||
name: Keepalive
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# The 8th of every month at 11:50am UTC
|
||||
# At 9:45 PM UTC, on day 18 of the month
|
||||
schedule:
|
||||
- cron: '50 11 8 * *'
|
||||
- cron: '45 21 18 * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
keepalive:
|
||||
|
|
17
.github/workflows/merge-up.yml
vendored
Normal file
17
.github/workflows/merge-up.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
name: Merge-up
|
||||
|
||||
on:
|
||||
# At 11:10 AM UTC, only on Thursday
|
||||
schedule:
|
||||
- cron: '10 11 * * 4'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
merge-up:
|
||||
name: Merge-up
|
||||
# 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: Merge-up
|
||||
uses: silverstripe/gha-merge-up@v1
|
12
.upgrade.yml
12
.upgrade.yml
|
@ -1,12 +0,0 @@
|
|||
mappings:
|
||||
VersionFeed: SilverStripe\VersionFeed\VersionFeed
|
||||
VersionFeed_Controller: SilverStripe\VersionFeed\VersionFeedController
|
||||
VersionFeedSiteConfig: SilverStripe\VersionFeed\VersionFeedSiteConfig
|
||||
CachedContentFilter: SilverStripe\VersionFeed\Filters\CachedContentFilter
|
||||
ContentFilter: SilverStripe\VersionFeed\Filters\ContentFilter
|
||||
RateLimitFilter: SilverStripe\VersionFeed\Filters\RateLimitFilter
|
||||
\VersionFeed\Filters\CachedContentFilter: SilverStripe\VersionFeed\Filters\CachedContentFilter
|
||||
\VersionFeed\Filters\ContentFilter: SilverStripe\VersionFeed\Filters\ContentFilter
|
||||
\VersionFeed\Filters\RateLimitFilter: SilverStripe\VersionFeed\Filters\RateLimitFilter
|
||||
VersionFeedFunctionalTest: SilverStripe\VersionFeed\Tests\VersionFeedFunctionalTest
|
||||
VersionFeedTest: SilverStripe\VersionFeed\Tests\VersionFeedTest
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2017, SilverStripe Limited
|
||||
Copyright (c) 2017, Silverstripe Limited
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
10
README.md
10
README.md
|
@ -7,15 +7,11 @@
|
|||
|
||||
The module creates an RSS feed on each page with their change history, as well as one for the entire site.
|
||||
|
||||
## Requirements
|
||||
|
||||
* 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).
|
||||
|
||||
## Installation
|
||||
|
||||
Install with composer by running `composer require silverstripe/versionfeed` in the root of your Silverstripe project.
|
||||
```sh
|
||||
composer require silverstripe/versionfeed
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"silverstripe/cms": "^4",
|
||||
"silverstripe/versioned": "^1",
|
||||
"silverstripe/siteconfig": "^4"
|
||||
"php": "^8.1",
|
||||
"silverstripe/cms": "^5",
|
||||
"silverstripe/versioned": "^2",
|
||||
"silverstripe/siteconfig": "^5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"squizlabs/php_codesniffer": "^3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -33,4 +33,4 @@
|
|||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace SilverStripe\VersionFeed;
|
||||
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Forms\CheckboxField;
|
||||
|
@ -12,7 +11,7 @@ use SilverStripe\ORM\ArrayList;
|
|||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\View\Parsers\Diff;
|
||||
use SilverStripe\View\Parsers\HtmlDiff;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
|
||||
class VersionFeed extends SiteTreeExtension
|
||||
|
@ -80,7 +79,7 @@ class VersionFeed extends SiteTreeExtension
|
|||
$qLimit = (int)$limit + 1;
|
||||
$versions = $this->owner->Versions(
|
||||
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset",
|
||||
"\"SiteTree\".\"LastEdited\" DESC, \"SiteTree\".\"ID\" DESC",
|
||||
"\"LastEdited\" DESC, \"ID\" DESC",
|
||||
$qLimit
|
||||
);
|
||||
|
||||
|
@ -95,7 +94,7 @@ class VersionFeed extends SiteTreeExtension
|
|||
if (isset($previous)) {
|
||||
// Produce the diff fields for use in the template.
|
||||
if ($version->Title != $previous->Title) {
|
||||
$diffTitle = Diff::compareHTML($version->Title, $previous->Title);
|
||||
$diffTitle = HtmlDiff::compareHTML($version->Title, $previous->Title);
|
||||
|
||||
$version->DiffTitle = DBField::create_field('HTMLText', null);
|
||||
$version->DiffTitle->setValue(
|
||||
|
@ -108,7 +107,7 @@ class VersionFeed extends SiteTreeExtension
|
|||
}
|
||||
|
||||
if ($version->Content != $previous->Content) {
|
||||
$diffContent = Diff::compareHTML($version->Content, $previous->Content);
|
||||
$diffContent = HtmlDiff::compareHTML($version->Content, $previous->Content);
|
||||
|
||||
$version->DiffContent = DBField::create_field('HTMLText', null);
|
||||
$version->DiffContent->setValue('<div>'.$diffContent.'</div>');
|
||||
|
@ -169,26 +168,6 @@ class VersionFeed extends SiteTreeExtension
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a list of changes to the current page, excluding non-published and explicitly secured versions.
|
||||
*
|
||||
* @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.
|
||||
* @param int $limit Limit to the amount of items returned.
|
||||
*
|
||||
* @returns ArrayList List of cleaned records.
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
public function updateSettingsFields(FieldList $fields)
|
||||
{
|
||||
if (!$this->owner->config()->get('changes_enabled')) {
|
||||
|
|
|
@ -114,7 +114,6 @@ class VersionFeedController extends Extension
|
|||
AND ("PublicHistory" IS NULL OR "PublicHistory" = \'1\')
|
||||
ORDER BY "LastEdited" DESC LIMIT ' . $limit);
|
||||
$lastChange = $latestChanges->record();
|
||||
$latestChanges->rewind();
|
||||
|
||||
if ($lastChange) {
|
||||
// Cache the diffs to remove DOS possibility.
|
||||
|
|
Loading…
Reference in New Issue
Block a user