mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-10-22 11:05:31 +02:00
Merge pull request #51 from creative-commoners/pulls/2.0/Content-with-Contents
FIX allow allchanges to handle removed Page types
This commit is contained in:
commit
7b3d282802
@ -39,7 +39,7 @@ abstract class ContentFilter
|
|||||||
/**
|
/**
|
||||||
* Gets the cache to use
|
* Gets the cache to use
|
||||||
*
|
*
|
||||||
* @return Zend_Cache_Frontend
|
* @return CacheInterface
|
||||||
*/
|
*/
|
||||||
protected function getCache()
|
protected function getCache()
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ use SilverStripe\ORM\DataObject;
|
|||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\View\Parsers\Diff;
|
use SilverStripe\View\Parsers\Diff;
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
|
||||||
class VersionFeed extends SiteTreeExtension
|
class VersionFeed extends SiteTreeExtension
|
||||||
{
|
{
|
||||||
@ -114,7 +115,16 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy the link so it can be cached.
|
// Copy the link so it can be cached.
|
||||||
$version->GeneratedLink = $version->AbsoluteLink();
|
$oldPage = $version->getField('object');
|
||||||
|
if (!$oldPage instanceof SiteTree) {
|
||||||
|
// We only need enough info to generate the link...
|
||||||
|
$oldPage = SiteTree::create([
|
||||||
|
'ID' => $oldPage->ID,
|
||||||
|
'URLSegment' => $oldPage->URLSegment,
|
||||||
|
'ParentID' => $oldPage->ParentID
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$version->GeneratedLink = $oldPage->AbsoluteLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Omit the versions that haven't been visibly changed (only takes the above fields into consideration).
|
// Omit the versions that haven't been visibly changed (only takes the above fields into consideration).
|
||||||
|
@ -77,7 +77,7 @@ class VersionFeedController extends Extension
|
|||||||
|
|
||||||
// Cache the diffs to remove DOS possibility.
|
// Cache the diffs to remove DOS possibility.
|
||||||
$target = $this->owner;
|
$target = $this->owner;
|
||||||
$key = implode('_', array('changes', $this->owner->ID, $this->owner->Version));
|
$key = implode('_', array('changes', $target->ID, $target->Version));
|
||||||
$entries = $this->filterContent($key, function () use ($target) {
|
$entries = $this->filterContent($key, function () use ($target) {
|
||||||
return $target->getDiffList(null, Config::inst()->get(VersionFeed::class, 'changes_limit'));
|
return $target->getDiffList(null, Config::inst()->get(VersionFeed::class, 'changes_limit'));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user