From b1a088cea3676bb9c7b57e72832a2f7150a30622 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Apr 2010 09:58:43 +0000 Subject: [PATCH] ENHANCEMENT: Added new onRenameLinkAsset() handler to static publishing for better link rewriting. (from r89014) (from r96792) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102482 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/staticpublisher/StaticPublisher.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/code/staticpublisher/StaticPublisher.php b/code/staticpublisher/StaticPublisher.php index b8869cd8..b8e29173 100644 --- a/code/staticpublisher/StaticPublisher.php +++ b/code/staticpublisher/StaticPublisher.php @@ -30,9 +30,26 @@ abstract class StaticPublisher extends DataObjectDecorator { self::$echo_progress = (boolean)$progress; } + /** + * Called after a page is published. + */ function onAfterPublish($original) { + $this->republish($original); + } + + /** + * Called after link assets have been renamed, and the live site has been updated, without + * an actual publish event. + * + * Only called if the published content exists and has been modified. + */ + function onRenameLinkedAsset($original) { + $this->republish($original); + } + + function republish($original) { if (self::$disable_realtime) return; - + $urls = array(); if($this->owner->hasMethod('pagesAffectedByChanges')) {