BUGFIX Fixed issue with StaticPublisher->onAfterWrite() failing because of incorrect arguments to Versioned::get_by_stage()

MINOR Fixed undefined variable error if $urls doesn't exist and tries to loop through the non-existant array in StaticPublisher->onAfterWrite()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@74092 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-04-06 01:11:41 +00:00 committed by Sam Minnee
parent c9b67367e6
commit 5b993b9990

View File

@ -23,13 +23,16 @@ abstract class StaticPublisher extends DataObjectDecorator {
} }
function onAfterPublish($original) { function onAfterPublish($original) {
$urls = array();
if($this->owner->hasMethod('pagesAffectedByChanges')) { if($this->owner->hasMethod('pagesAffectedByChanges')) {
$urls = $this->owner->pagesAffectedByChanges($original); $urls = $this->owner->pagesAffectedByChanges($original);
} else { } else {
// $pages = array(Versioned::get_one_by_stage('SiteTree', 'Live', "`SiteTree`.ID = {$this->owner->ID}")); $pages = Versioned::get_by_stage('SiteTree', 'Live', '', '', '', 10);
$pages = Versioned::get_by_stage('SiteTree', 'Live', '', '', 10); if($pages) {
foreach($pages as $page) { foreach($pages as $page) {
$urls[] = $page->Link(); $urls[] = $page->Link();
}
} }
} }