BUGFIX: Make virtual page broken link detection work across subsites. (from r91311) (from r96740)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102366 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 02:34:04 +00:00
parent 848b7805e2
commit 967e218758

View File

@ -1375,7 +1375,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Also write all VPs pointing here // Also write all VPs pointing here
$suffix = Versioned::current_stage() == 'Live' ? '_Live' : ''; $suffix = Versioned::current_stage() == 'Live' ? '_Live' : '';
// This coupling to the subsites module is frustrating, but difficult to avoid.
if(class_exists('Subsite')) {
$virtualPages = Subsite::get_from_all_subsites('VirtualPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND CopyContentFromID = {$this->ID}");
} 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($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();