Skip to content

Commit

Permalink
MINOR when a parent page is unpublished, unpublish all related virtua…
Browse files Browse the repository at this point in the history
…l pages, includes test coverage (from r94777) (from r96771)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102399 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Apr 12, 2010
1 parent c0dfaa0 commit 31bf50d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/model/SiteTree.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1997,6 +1997,15 @@ function doUnpublish() {


$this->write(); $this->write();


// Unpublish all virtual pages that point here
// This coupling to the subsites module is frustrating, but difficult to avoid.
if(class_exists('Subsite')) {
$virtualPages = Subsite::get_from_all_subsites('VirtualPage', "CopyContentFromID = {$this->ID}");
} else {
$virtualPages = DataObject::get('VirtualPage', "CopyContentFromID = {$this->ID}");
}
if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish();

$this->extend('onAfterUnpublish'); $this->extend('onAfterUnpublish');
} }


Expand Down

0 comments on commit 31bf50d

Please sign in to comment.