mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-10-22 11:05:31 +02:00
Merge pull request #48 from creative-commoners/pulls/2.0/new-version-feed-v4
FIX: update docs & language references
This commit is contained in:
commit
921b7c7fb5
18
README.md
18
README.md
@ -1,6 +1,8 @@
|
||||
# Version Feed
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-versionfeed.png)](http://travis-ci.org/silverstripe/silverstripe-versionfeed)
|
||||
[![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)
|
||||
|
||||
## Overview
|
||||
|
||||
@ -8,24 +10,18 @@ The module creates an RSS feed on each page with their change history, as well a
|
||||
|
||||
## Requirements
|
||||
|
||||
* SilverStripe 3.0+
|
||||
* 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.
|
||||
|
||||
Or just clone/download the git repository into a subfolder (usually called "versionfeed") of your SilverStripe project.
|
||||
Install with composer by running `composer require silverstripe/versionfeed` in the root of your SilverStripe project.
|
||||
|
||||
## Usage
|
||||
|
||||
For usage instructions see [user manual](docs/en/userguide/index.md).
|
||||
|
||||
## Contributing
|
||||
|
||||
### Translations
|
||||
|
||||
Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.
|
||||
|
@ -1,7 +0,0 @@
|
||||
# 1.0.3
|
||||
|
||||
## Upgrading
|
||||
|
||||
* Caching and rate limiting rules now apply in this version, and it may be necessary to adjust the values
|
||||
for `RateLimitFilter.lock_timeout`, `RateLimitFilter.lock_bypage` and `RateLimitFilter.lock_byuserip` configs.
|
||||
See the [Developer Documentation](../developer.md) for information on how these affect cache performance and behaviour.
|
@ -9,12 +9,12 @@ the extensions defined on the extension.
|
||||
|
||||
### Enabling / Disabling
|
||||
|
||||
The `allchanges` feed can be disabled by setting the `VersionFeed.allchanges_enabled` config to false.
|
||||
The `allchanges` feed can be disabled by setting the `SilverStripe\VersionFeed\VersionFeed.allchanges_enabled` config to false.
|
||||
|
||||
Likewise, the `changes` feed for each page can be globally disabled by setting the `VersionFeed.changes_enabled`
|
||||
Likewise, the `changes` feed for each page can be globally disabled by setting the `SilverStripe\VersionFeed\VersionFeed.changes_enabled`
|
||||
config to false. If this left true, then each page can still be individually disabled by unchecking the
|
||||
'Make History Public' checkbox in the CMS under page settings.
|
||||
See [user documentation on enabling / disabling](user.md#enabling--disabling).
|
||||
See [user documentation on enabling / disabling](userguide/index.md#enabling--disabling).
|
||||
|
||||
### Default RSS action
|
||||
|
||||
@ -22,12 +22,13 @@ Templates can offer a "Subscribe" link with a link to the most relevant RSS feed
|
||||
for the current page. You can override this behaviour by defining the `getDefaultRSSLink` function in your page type
|
||||
and returning the URL of your desired RSS feed:
|
||||
|
||||
:::php
|
||||
class MyPage extends Page {
|
||||
function getDefaultRSSLink() {
|
||||
return $this->Link('myrssfeed');
|
||||
}
|
||||
```php
|
||||
class MyPage extends Page {
|
||||
function getDefaultRSSLink() {
|
||||
return $this->Link('myrssfeed');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This can be used in templates as `$DefaultRSSLink`.
|
||||
|
||||
@ -36,31 +37,31 @@ This can be used in templates as `$DefaultRSSLink`.
|
||||
By default all content is filtered based on the rules specified in `versionfeed/_config/versionfeed.yml`.
|
||||
Two filters are applied on top of one another:
|
||||
|
||||
* `CachedContentFilter` provides caching of versions based on an identifier built up of the record ID and the
|
||||
* `SilverStripe\VersionFeed\Filters\CachedContentFilter` provides caching of versions based on an identifier built up of the record ID and the
|
||||
most recently saved version number. There is no configuration required for this class.
|
||||
* `RateLimitFilter` provides rate limiting to ensure that requests to uncached data does not overload the
|
||||
server. This filter will only be applied if the `CachedContentFilter` does not have any cached record
|
||||
* `SilverStripe\VersionFeed\Filters\RateLimitFilter` provides rate limiting to ensure that requests to uncached data does not overload the
|
||||
server. This filter will only be applied if the `SilverStripe\VersionFeed\Filters\CachedContentFilter` does not have any cached record
|
||||
for a request.
|
||||
|
||||
Either one of these can be replaced, added to, or removed, by adjusting the `SilverStripe\VersionFeed\VersionFeedController.dependencies`
|
||||
config to point to a replacement (or no) filter.
|
||||
|
||||
For smaller servers where it's reasonable to apply a strict approach to rate limiting the default
|
||||
settings should be sufficient. The `RateLimitFilter.lock_bypage` config defaults to false, meaning that a
|
||||
settings should be sufficient. The `SilverStripe\VersionFeed\Filters\RateLimitFilter.lock_bypage` config defaults to false, meaning that a
|
||||
single limit will be applied to all URLs. If set to true, then each URL will have its own rate limit,
|
||||
and on smaller servers with lots of concurrent requests this can still overwhelm capacity. This will
|
||||
also leave smaller servers vulnerable to DDoS attacks which target many URLs simultaneously.
|
||||
This config will have no effect on the `allchanges` method.
|
||||
|
||||
`RateLimitFilter.lock_byuserip` can be set to true in order to prevent requests from different users
|
||||
`SilverStripe\VersionFeed\Filters\RateLimitFilter.lock_byuserip` can be set to true in order to prevent requests from different users
|
||||
interfering with one another. However, this can provide an ineffective safeguard against malicious DDoS attacks
|
||||
which use multiple IP addresses.
|
||||
|
||||
Another important variable is the `RateLimitFilter.lock_timeout` config, which is set to 5 seconds by default.
|
||||
Another important variable is the `SilverStripe\VersionFeed\Filters\RateLimitFilter.lock_timeout` config, which is set to 5 seconds by default.
|
||||
This should be increased on sites which may be slow to generate page versions, whether due to lower
|
||||
server capacity or volume of content (number of page versions). Requests to this page after the timeout
|
||||
will not trigger any rate limit safeguard, so you should be sure that this is set to an appropriate level.
|
||||
|
||||
You can set the `ContentFilter.cache_lifetime` config in order to control the maximum age of the cache.
|
||||
You can set the `SilverStripe\VersionFeed\Filters\ContentFilter.cache_lifetime` config in order to control the maximum age of the cache.
|
||||
This is an integer value in seconds, and defaults to 300 (five minutes). Set it to 0 or null to make this
|
||||
cache unlimited.
|
@ -1,9 +1,8 @@
|
||||
ar:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'اجعل التاريخ متاح للمشاهدة من قبل الجميع'
|
||||
SINGLEPAGEFEEDTITLE: 'التحديثات و صلت ل s% من الصفحة'
|
||||
SITEFEEDTITLE: 'التحديثات إلى s%'
|
||||
TITLECHANGED: 'تم تغيير العنوان:'
|
||||
VersionFeed:
|
||||
Warning: 'إن نشر التاريخ سوف يظهر التغييرات التى تملكها و التى كنت تمنعها من العرض على العامة.'
|
||||
Warning2: 'إن تغيير إعدادات الدخول بهذه الطريقة كى تكون هذه الصفحة أو الصفحات التى تحتها تصبح معلنة<br>قد يؤدي الوصول إليها في نشر جميع التغييرات التاريخية على هذه الصفحات أيضا. من فضلك قم بمراجعة<br>"التاريخ العام" لهذا القطاع لكى يتم التأكد من أن المعلومات المقصودة فقط هى التى يتم الإفصاح عنها.'
|
||||
|
10
lang/en.yml
10
lang/en.yml
@ -1,12 +1,12 @@
|
||||
en:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Make history public'
|
||||
SINGLEPAGEFEEDTITLE: 'Updates to %s page'
|
||||
SITEFEEDTITLE: 'Updates to %s'
|
||||
SINGLEPAGEFEEDTITLE: 'Updates to {title} page'
|
||||
SITEFEEDTITLE: 'Updates to {title}'
|
||||
TITLECHANGED: 'Title has changed:'
|
||||
VersionFeed:
|
||||
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.'
|
||||
VersionFeedSiteConfig:
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'All page changes'
|
||||
ALLCHANGESLABEL: 'Make global changes feed public'
|
||||
Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.'
|
||||
|
@ -1,12 +1,11 @@
|
||||
eo:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Publikigu historion'
|
||||
SINGLEPAGEFEEDTITLE: 'Ĝisdatigoj al paĝo %s'
|
||||
SITEFEEDTITLE: 'Ĝisdatigoj al %s'
|
||||
SINGLEPAGEFEEDTITLE: 'Ĝisdatigoj al paĝo {title}'
|
||||
SITEFEEDTITLE: 'Ĝisdatigoj al {title}'
|
||||
TITLECHANGED: 'Titolo estas ŝanĝita:'
|
||||
VersionFeed:
|
||||
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.'
|
||||
VersionFeedSiteConfig:
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Ĉiuj paĝaj ŝanĝoj'
|
||||
ALLCHANGESLABEL: 'Ĉieaj ŝanĝoj fluu en publikan'
|
||||
|
@ -1,12 +1,11 @@
|
||||
fi_FI:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Tee historiasta julkinen'
|
||||
SINGLEPAGEFEEDTITLE: 'Päivityksiä %s sivuun'
|
||||
SITEFEEDTITLE: 'Päivityksiä: %s'
|
||||
SINGLEPAGEFEEDTITLE: 'Päivityksiä {title} sivuun'
|
||||
SITEFEEDTITLE: 'Päivityksiä: {title}'
|
||||
TITLECHANGED: 'Otsikko on muuttunut:'
|
||||
VersionFeed:
|
||||
Warning: 'Historian julkaisu paljastaa myös muutokset, jotka ovat suojattu julkiselta tarkastelulta.'
|
||||
Warning2: 'Muutettaessa tämä tai sen alasivut julkisiksi,<br>voi toimenpide aiheuttaa myös kaiken muutoshistorian muuttumisen julkiseksi kyseisillä sivuilla. Ole hyvä<br>ja tarkista "Julkinen historia"-asetuksista, että vain haluttu tieto on julkaistuna.'
|
||||
VersionFeedSiteConfig:
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Kaikki sivumuokkaukset'
|
||||
ALLCHANGESLABEL: 'Tee muutoksista julkisia'
|
||||
|
@ -1,12 +1,11 @@
|
||||
hr:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Učini povijest dostupnu svima'
|
||||
SINGLEPAGEFEEDTITLE: 'Ažuriranja za %s stranicu'
|
||||
SITEFEEDTITLE: 'Ažuriranja za %s'
|
||||
SINGLEPAGEFEEDTITLE: 'Ažuriranja za {title} stranicu'
|
||||
SITEFEEDTITLE: 'Ažuriranja za {title}'
|
||||
TITLECHANGED: 'Naziv se promijenio:'
|
||||
VersionFeed:
|
||||
Warning: 'Objavom povijesti će se također otkriti promjene koje su u to vrijeme bili zaštićeni od očiju javnosti.'
|
||||
Warning2: 'Promjenom postavki pristupi na takav način će učiniti da ova stranica ili stranice ispod nje postanu javno<br>dostupne mogu rezultirati objavomm svih povijesnih promjena na tim stranicama također. Molimo pregledajte<br>podatke sekcije "Public history" da budete sigurni samo željene informacije da su prikazane.'
|
||||
VersionFeedSiteConfig:
|
||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||
ALLCHANGES: 'Sve promjene stranice'
|
||||
ALLCHANGESLABEL: 'Učini sveobuhvatne promjene feeda'
|
||||
|
@ -1,3 +1,3 @@
|
||||
id:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
TITLECHANGED: 'Judul telah diubah:'
|
||||
|
@ -1,9 +1,8 @@
|
||||
mi:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: 'Meinga kia tūmatanui te hītori'
|
||||
SINGLEPAGEFEEDTITLE: 'Ngā whakahou ki te whārangi %s'
|
||||
SITEFEEDTITLE: 'Ngā whakahou ki te %s'
|
||||
SINGLEPAGEFEEDTITLE: 'Ngā whakahou ki te whārangi {title}'
|
||||
SITEFEEDTITLE: 'Ngā whakahou ki te {title}'
|
||||
TITLECHANGED: 'Kua hurihia te taitara:'
|
||||
VersionFeed:
|
||||
Warning: 'Mā te whakarite kia tūmatanui te hītori ka whakaaturia hoki ngā huringa o mua tērā i hunaia i te tirohanga tūmatanui.'
|
||||
Warning2: 'Mā te huri i ngā tautuhinga uru kia noho wātea <br>tūmatanui ai tēnei whārangi, ngā whārangi rānei i raro i taua whārangi, tērā pea ko te mutunga iho ko te wātea tūmatanui o ngā huringa hītori katoa i aua whārangi. Me arotake<br>ngā tautuhinga "Hītori tūmatanui" o tēnei wāhanga kia mōhio ai ka whakaaturia anake ngā mōhiohio ka hiahiatia.'
|
||||
|
@ -1,9 +1,8 @@
|
||||
zh:
|
||||
RSSHistory:
|
||||
SilverStripe\VersionFeed\VersionFeed:
|
||||
LABEL: '将历史记录公开'
|
||||
SINGLEPAGEFEEDTITLE: '更新至 %s 页面'
|
||||
SITEFEEDTITLE: '更新至 %s'
|
||||
SINGLEPAGEFEEDTITLE: '更新至 {title} 页面'
|
||||
SITEFEEDTITLE: '更新至 {title}'
|
||||
TITLECHANGED: '标题已更改:'
|
||||
VersionFeed:
|
||||
Warning: '发布历史记录还会在公开视图中显示受保护事件内进行的改动。'
|
||||
Warning2: '用这种方式更改访问设置会使得本页及下级页面变为公开的<br>可能还会使得这些页面的所有变动历史记录也变为公开的。请查阅<br>本节的“公开历史记录”设置,确保只将需要的信息披露出来。'
|
||||
|
@ -26,7 +26,7 @@ class VersionFeed extends SiteTreeExtension
|
||||
|
||||
public function updateFieldLabels(&$labels)
|
||||
{
|
||||
$labels['PublicHistory'] = _t('RSSHistory.LABEL', 'Make history public');
|
||||
$labels['PublicHistory'] = _t(__CLASS__ . '.LABEL', 'Make history public');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ class VersionFeed extends SiteTreeExtension
|
||||
$version->DiffTitle->setValue(
|
||||
sprintf(
|
||||
'<div><em>%s</em> ' . $diffTitle . '</div>',
|
||||
_t('RSSHistory.TITLECHANGED', 'Title has changed:')
|
||||
_t(__CLASS__ . '.TITLECHANGED', 'Title has changed:')
|
||||
)
|
||||
);
|
||||
$changed = true;
|
||||
@ -189,7 +189,7 @@ class VersionFeed extends SiteTreeExtension
|
||||
));
|
||||
|
||||
$warning = _t(
|
||||
'VersionFeed.Warning',
|
||||
__CLASS__ . '.Warning',
|
||||
"Publicising the history will also disclose the changes that have at the time been protected " .
|
||||
"from the public view."
|
||||
);
|
||||
@ -198,7 +198,7 @@ class VersionFeed extends SiteTreeExtension
|
||||
|
||||
if ($this->owner->CanViewType!='Anyone') {
|
||||
$warning = _t(
|
||||
'VersionFeed.Warning2',
|
||||
__CLASS__ . '.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."
|
||||
|
@ -3,14 +3,12 @@
|
||||
namespace SilverStripe\VersionFeed;
|
||||
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\VersionFeed\VersionFeed;
|
||||
use SilverStripe\Control\RSS\RSSFeed;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Versioned\Versioned_Version;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\View\Requirements;
|
||||
use SilverStripe\Core\Extension;
|
||||
@ -18,7 +16,6 @@ use SilverStripe\VersionFeed\Filters\ContentFilter;
|
||||
|
||||
class VersionFeedController extends Extension
|
||||
{
|
||||
|
||||
private static $allowed_actions = array(
|
||||
'changes',
|
||||
'allchanges'
|
||||
@ -84,7 +81,11 @@ class VersionFeedController extends Extension
|
||||
});
|
||||
|
||||
// Generate the output.
|
||||
$title = sprintf(_t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title);
|
||||
$title = _t(
|
||||
'SilverStripe\\VersionFeed\\VersionFeed.SINGLEPAGEFEEDTITLE',
|
||||
'Updates to {title} page',
|
||||
['title' => $this->owner->Title]
|
||||
);
|
||||
$rss = new RSSFeed($entries, $this->owner->request->getURL(), $title, '', 'Title', '', null);
|
||||
$rss->setTemplate('Page_changes_rss');
|
||||
return $rss->outputToBrowser();
|
||||
@ -148,7 +149,15 @@ class VersionFeedController extends Extension
|
||||
|
||||
// Produce output
|
||||
$url = $this->owner->getRequest()->getURL();
|
||||
$rss = new RSSFeed($changeList, $url, $this->linkToAllSitesRSSFeedTitle(), '', 'Title', '', null);
|
||||
$rss = new RSSFeed(
|
||||
$changeList,
|
||||
$url,
|
||||
$this->linkToAllSitesRSSFeedTitle(),
|
||||
'',
|
||||
'Title',
|
||||
'',
|
||||
null
|
||||
);
|
||||
$rss->setTemplate('Page_allchanges_rss');
|
||||
return $rss->outputToBrowser();
|
||||
}
|
||||
@ -164,9 +173,10 @@ class VersionFeedController extends Extension
|
||||
|
||||
RSSFeed::linkToFeed(
|
||||
$this->owner->Link('changes'),
|
||||
sprintf(
|
||||
_t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'),
|
||||
$this->owner->Title
|
||||
_t(
|
||||
'SilverStripe\\VersionFeed\\VersionFeed.SINGLEPAGEFEEDTITLE',
|
||||
'Updates to {title} page',
|
||||
['title' => $this->owner->Title]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -194,6 +204,10 @@ class VersionFeedController extends Extension
|
||||
|
||||
public function linkToAllSitesRSSFeedTitle()
|
||||
{
|
||||
return sprintf(_t('RSSHistory.SITEFEEDTITLE', 'Updates to %s'), SiteConfig::current_site_config()->Title);
|
||||
return _t(
|
||||
'SilverStripe\\VersionFeed\\VersionFeed.SITEFEEDTITLE',
|
||||
'Updates to {title}',
|
||||
['title' => SiteConfig::current_site_config()->Title]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class VersionFeedSiteConfig extends DataExtension
|
||||
|
||||
public function updateFieldLabels(&$labels)
|
||||
{
|
||||
$labels['AllChangesEnabled'] = _t('VersionFeedSiteConfig.ALLCHANGESLABEL', 'Make global changes feed public');
|
||||
$labels['AllChangesEnabled'] = _t(__CLASS__ . '.ALLCHANGESLABEL', 'Make global changes feed public');
|
||||
}
|
||||
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
@ -37,9 +37,9 @@ class VersionFeedSiteConfig extends DataExtension
|
||||
$fields->addFieldToTab(
|
||||
'Root.Access',
|
||||
FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))
|
||||
->setTitle(_t('VersionFeedSiteConfig.ALLCHANGES', 'All page changes'))
|
||||
->setTitle(_t(__CLASS__ . '.ALLCHANGES', 'All page changes'))
|
||||
->setDescription(_t(
|
||||
'VersionFeed.Warning',
|
||||
__CLASS__ . '.Warning',
|
||||
"Publicising the history will also disclose the changes that have at the time been protected " .
|
||||
"from the public view."
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user