mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Count() call on a non-object in File::BackLinkTrackingCount()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@109079 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a699ff1a75
commit
58ce293347
@ -169,7 +169,12 @@ class File extends DataObject {
|
|||||||
* @return Integer
|
* @return Integer
|
||||||
*/
|
*/
|
||||||
function BackLinkTrackingCount() {
|
function BackLinkTrackingCount() {
|
||||||
return $this->BackLinkTracking()->Count();
|
$pages = $this->BackLinkTracking();
|
||||||
|
if($pages) {
|
||||||
|
return $pages->Count();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +199,8 @@ class File extends DataObject {
|
|||||||
protected function onAfterDelete() {
|
protected function onAfterDelete() {
|
||||||
parent::onAfterDelete();
|
parent::onAfterDelete();
|
||||||
|
|
||||||
if($brokenPages = $this->BackLinkTracking()) {
|
$brokenPages = $this->BackLinkTracking();
|
||||||
|
if($brokenPages) {
|
||||||
$origStage = Versioned::current_stage();
|
$origStage = Versioned::current_stage();
|
||||||
|
|
||||||
// This will syncLinkTracking on draft
|
// This will syncLinkTracking on draft
|
||||||
|
Loading…
Reference in New Issue
Block a user