mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
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:
parent
c9b67367e6
commit
5b993b9990
@ -23,15 +23,18 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach($urls as $i => $url) {
|
foreach($urls as $i => $url) {
|
||||||
$url = Director::makeRelative($url);
|
$url = Director::makeRelative($url);
|
||||||
|
Loading…
Reference in New Issue
Block a user