BUGFIX: columns quoted properly

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98694 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2010-02-10 21:59:57 +00:00 committed by Sam Minnee
parent 56f05c7a08
commit e0f9137afc

View File

@ -1978,17 +1978,17 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Unpublish all virtual pages that point here // Unpublish all virtual pages that point here
// This coupling to the subsites module is frustrating, but difficult to avoid. // This coupling to the subsites module is frustrating, but difficult to avoid.
if(class_exists('Subsite')) { if(class_exists('Subsite')) {
$virtualPages = Subsite::get_from_all_subsites('VirtualPage', "CopyContentFromID = {$this->ID}"); $virtualPages = Subsite::get_from_all_subsites('VirtualPage', "\"CopyContentFromID\" = {$this->ID}");
} else { } else {
$virtualPages = DataObject::get('VirtualPage', "CopyContentFromID = {$this->ID}"); $virtualPages = DataObject::get('VirtualPage', "\"CopyContentFromID\" = {$this->ID}");
} }
if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish(); if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish();
$suffix = Versioned::current_stage() == 'Live' ? '_Live' : ''; $suffix = Versioned::current_stage() == 'Live' ? '_Live' : '';
if(class_exists('Subsite')) { if(class_exists('Subsite')) {
$redirectorPages = Subsite::get_from_all_subsites('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}"); $redirectorPages = Subsite::get_from_all_subsites('RedirectorPage', "\"SiteTree$suffix\".\"ID\" = \"SiteTree$suffix\".\"ID\" AND \"LinkToID\" = {$this->ID}");
} else { } else {
$redirectorPages = DataObject::get('RedirectorPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND LinkToID = {$this->ID}"); $redirectorPages = DataObject::get('RedirectorPage', "\"SiteTree$suffix\".\"ID\" = \"SiteTree$suffix\".\"ID\" AND \"LinkToID\" = {$this->ID}");
} }
if($redirectorPages) foreach($redirectorPages as $page) { if($redirectorPages) foreach($redirectorPages as $page) {