mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR redirector link tracking is more intelligent (from r96461)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98139 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
728e51dd8a
commit
f212585325
@ -1418,11 +1418,20 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
} else {
|
} else {
|
||||||
$virtualPages = DataObject::get('VirtualPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND CopyContentFromID = {$this->ID}");
|
$virtualPages = DataObject::get('VirtualPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND CopyContentFromID = {$this->ID}");
|
||||||
}
|
}
|
||||||
|
if(class_exists('Subsite')) {
|
||||||
|
$redirectorPages = Subsite::get_from_all_subsites('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}");
|
||||||
|
} else {
|
||||||
|
$redirectorPages = DataObject::get('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}");
|
||||||
|
}
|
||||||
|
|
||||||
if($virtualPages) foreach($virtualPages as $page) {
|
if($virtualPages) foreach($virtualPages as $page) {
|
||||||
// $page->write() calls syncLinkTracking, which does all the hard work for us.
|
// $page->write() calls syncLinkTracking, which does all the hard work for us.
|
||||||
$page->write();
|
$page->write();
|
||||||
}
|
}
|
||||||
|
if($redirectorPages) foreach($redirectorPages as $page) {
|
||||||
|
// $page->write() calls syncLinkTracking, which does all the hard work for us.
|
||||||
|
$page->write();
|
||||||
|
}
|
||||||
|
|
||||||
parent::onAfterDelete();
|
parent::onAfterDelete();
|
||||||
}
|
}
|
||||||
@ -1989,6 +1998,18 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish();
|
if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish();
|
||||||
|
|
||||||
|
$suffix = Versioned::current_stage() == 'Live' ? '_Live' : '';
|
||||||
|
if(class_exists('Subsite')) {
|
||||||
|
$redirectorPages = Subsite::get_from_all_subsites('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}");
|
||||||
|
} else {
|
||||||
|
$redirectorPages = DataObject::get('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($redirectorPages) foreach($redirectorPages as $page) {
|
||||||
|
// $page->write() calls syncLinkTracking, which does all the hard work for us.
|
||||||
|
$page->write();
|
||||||
|
}
|
||||||
|
|
||||||
$this->extend('onAfterUnpublish');
|
$this->extend('onAfterUnpublish');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user