From 50961798252594681ea864ab3def2c30e03641cd Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Tue, 12 Dec 2017 11:39:57 +1300 Subject: [PATCH] FIX: update docs & language references --- README.md | 18 +++++++----------- docs/en/changelogs/1.0.3.md | 7 ------- docs/en/developer.md | 31 ++++++++++++++++--------------- lang/ar.yml | 3 +-- lang/en.yml | 5 ++--- lang/eo.yml | 5 ++--- lang/fi_FI.yml | 5 ++--- lang/hr.yml | 5 ++--- lang/id.yml | 2 +- lang/mi.yml | 3 +-- lang/zh.yml | 3 +-- src/VersionFeed.php | 8 ++++---- src/VersionFeedController.php | 6 +++--- src/VersionFeedSiteConfig.php | 6 +++--- 14 files changed, 45 insertions(+), 62 deletions(-) delete mode 100644 docs/en/changelogs/1.0.3.md diff --git a/README.md b/README.md index 0c75fc6..94775fd 100644 --- a/README.md +++ b/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. diff --git a/docs/en/changelogs/1.0.3.md b/docs/en/changelogs/1.0.3.md deleted file mode 100644 index 3e12d28..0000000 --- a/docs/en/changelogs/1.0.3.md +++ /dev/null @@ -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. diff --git a/docs/en/developer.md b/docs/en/developer.md index 0203089..e0677a7 100644 --- a/docs/en/developer.md +++ b/docs/en/developer.md @@ -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. \ No newline at end of file diff --git a/lang/ar.yml b/lang/ar.yml index 4677d1a..dc01740 100644 --- a/lang/ar.yml +++ b/lang/ar.yml @@ -1,9 +1,8 @@ ar: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: LABEL: 'اجعل التاريخ متاح للمشاهدة من قبل الجميع' SINGLEPAGEFEEDTITLE: 'التحديثات و صلت ل s% من الصفحة' SITEFEEDTITLE: 'التحديثات إلى s%' TITLECHANGED: 'تم تغيير العنوان:' - VersionFeed: Warning: 'إن نشر التاريخ سوف يظهر التغييرات التى تملكها و التى كنت تمنعها من العرض على العامة.' Warning2: 'إن تغيير إعدادات الدخول بهذه الطريقة كى تكون هذه الصفحة أو الصفحات التى تحتها تصبح معلنة
قد يؤدي الوصول إليها في نشر جميع التغييرات التاريخية على هذه الصفحات أيضا. من فضلك قم بمراجعة
"التاريخ العام" لهذا القطاع لكى يتم التأكد من أن المعلومات المقصودة فقط هى التى يتم الإفصاح عنها.' diff --git a/lang/en.yml b/lang/en.yml index d68d03b..5daa6d3 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -1,12 +1,11 @@ en: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: LABEL: 'Make history public' SINGLEPAGEFEEDTITLE: 'Updates to %s page' SITEFEEDTITLE: 'Updates to %s' 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
accessible may result in publicising all historical changes on these pages too. Please review
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' diff --git a/lang/eo.yml b/lang/eo.yml index 43f0464..cb143cf 100644 --- a/lang/eo.yml +++ b/lang/eo.yml @@ -1,12 +1,11 @@ eo: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: LABEL: 'Publikigu historion' SINGLEPAGEFEEDTITLE: 'Ĝisdatigoj al paĝo %s' SITEFEEDTITLE: 'Ĝisdatigoj al %s' 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
eble rezultigos ke publikiĝos ĉiuj historiaj ŝanĝoj en tiuj paĝoj. Bonvole rekonsideru
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' diff --git a/lang/fi_FI.yml b/lang/fi_FI.yml index 32af8a6..e50203d 100644 --- a/lang/fi_FI.yml +++ b/lang/fi_FI.yml @@ -1,12 +1,11 @@ fi_FI: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: LABEL: 'Tee historiasta julkinen' SINGLEPAGEFEEDTITLE: 'Päivityksiä %s sivuun' SITEFEEDTITLE: 'Päivityksiä: %s' 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,
voi toimenpide aiheuttaa myös kaiken muutoshistorian muuttumisen julkiseksi kyseisillä sivuilla. Ole hyvä
ja tarkista "Julkinen historia"-asetuksista, että vain haluttu tieto on julkaistuna.' - VersionFeedSiteConfig: + SilverStripe\VersionFeed\VersionFeedSiteConfig: ALLCHANGES: 'Kaikki sivumuokkaukset' ALLCHANGESLABEL: 'Tee muutoksista julkisia' diff --git a/lang/hr.yml b/lang/hr.yml index 3e01905..d3a6c61 100644 --- a/lang/hr.yml +++ b/lang/hr.yml @@ -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' 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
dostupne mogu rezultirati objavomm svih povijesnih promjena na tim stranicama također. Molimo pregledajte
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' diff --git a/lang/id.yml b/lang/id.yml index 0a57563..e1f4698 100644 --- a/lang/id.yml +++ b/lang/id.yml @@ -1,3 +1,3 @@ id: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: TITLECHANGED: 'Judul telah diubah:' diff --git a/lang/mi.yml b/lang/mi.yml index 0686d5e..56500d7 100644 --- a/lang/mi.yml +++ b/lang/mi.yml @@ -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' 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
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
ngā tautuhinga "Hītori tūmatanui" o tēnei wāhanga kia mōhio ai ka whakaaturia anake ngā mōhiohio ka hiahiatia.' diff --git a/lang/zh.yml b/lang/zh.yml index 6765ec4..e11cf98 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -1,9 +1,8 @@ zh: - RSSHistory: + SilverStripe\VersionFeed\VersionFeed: LABEL: '将历史记录公开' SINGLEPAGEFEEDTITLE: '更新至 %s 页面' SITEFEEDTITLE: '更新至 %s' TITLECHANGED: '标题已更改:' - VersionFeed: Warning: '发布历史记录还会在公开视图中显示受保护事件内进行的改动。' Warning2: '用这种方式更改访问设置会使得本页及下级页面变为公开的
可能还会使得这些页面的所有变动历史记录也变为公开的。请查阅
本节的“公开历史记录”设置,确保只将需要的信息披露出来。' diff --git a/src/VersionFeed.php b/src/VersionFeed.php index 4dcd284..ae09c69 100644 --- a/src/VersionFeed.php +++ b/src/VersionFeed.php @@ -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( '
%s ' . $diffTitle . '
', - _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
" . "accessible may result in publicising all historical changes on these pages too. Please review
" . "this section's \"Public history\" settings to ascertain only intended information is disclosed." diff --git a/src/VersionFeedController.php b/src/VersionFeedController.php index 502290f..c21c282 100644 --- a/src/VersionFeedController.php +++ b/src/VersionFeedController.php @@ -84,7 +84,7 @@ class VersionFeedController extends Extension }); // Generate the output. - $title = sprintf(_t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title); + $title = sprintf(_t(VersionFeed::class . '.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title); $rss = new RSSFeed($entries, $this->owner->request->getURL(), $title, '', 'Title', '', null); $rss->setTemplate('Page_changes_rss'); return $rss->outputToBrowser(); @@ -165,7 +165,7 @@ class VersionFeedController extends Extension RSSFeed::linkToFeed( $this->owner->Link('changes'), sprintf( - _t('RSSHistory.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), + _t(VersionFeed::class . '.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title ) ); @@ -194,6 +194,6 @@ class VersionFeedController extends Extension public function linkToAllSitesRSSFeedTitle() { - return sprintf(_t('RSSHistory.SITEFEEDTITLE', 'Updates to %s'), SiteConfig::current_site_config()->Title); + return sprintf(_t(VersionFeed::class . '.SITEFEEDTITLE', 'Updates to %s'), SiteConfig::current_site_config()->Title); } } diff --git a/src/VersionFeedSiteConfig.php b/src/VersionFeedSiteConfig.php index 7eff3b3..32420e0 100644 --- a/src/VersionFeedSiteConfig.php +++ b/src/VersionFeedSiteConfig.php @@ -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(VersionFeedSiteConfig::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(VersionFeedSiteConfig::class . '.ALLCHANGES', 'All page changes')) ->setDescription(_t( - 'VersionFeed.Warning', + VersionFeed::class . '.Warning', "Publicising the history will also disclose the changes that have at the time been protected " . "from the public view." ))