mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: replaced proprietary update query with one that is ANSI compliant in doPublish()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97705 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fe98778fb4
commit
f2098eaac7
@ -1896,24 +1896,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
$this->write();
|
$this->write();
|
||||||
$this->publish("Stage", "Live");
|
$this->publish("Stage", "Live");
|
||||||
|
|
||||||
|
DB::query("UPDATE \"SiteTree_Live\"
|
||||||
if(DB::getConn() instanceof MySQLDatabase) {
|
SET \"Sort\" = (SELECT \"SiteTree\".\"Sort\" FROM \"SiteTree\" WHERE \"SiteTree_Live\".\"ID\" = \"SiteTree\".\"ID\")
|
||||||
// Special syntax for MySQL (grr!)
|
WHERE EXISTS (SELECT \"SiteTree\".\"Sort\" FROM \"SiteTree\" WHERE \"SiteTree_Live\".\"ID\" = \"SiteTree\".\"ID\") AND \"ParentID\" = " . sprintf('%d', $this->ParentID) );
|
||||||
// More ANSI-compliant syntax
|
|
||||||
DB::query("UPDATE \"SiteTree_Live\", \"SiteTree\"
|
|
||||||
SET \"SiteTree_Live\".\"Sort\" = \"SiteTree\".\"Sort\"
|
|
||||||
WHERE \"SiteTree_Live\".\"ID\" = \"SiteTree\".\"ID\"
|
|
||||||
AND \"SiteTree_Live\".\"ParentID\" = " . sprintf('%d', $this->ParentID) );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// More ANSI-compliant syntax
|
|
||||||
DB::query("UPDATE \"SiteTree_Live\"
|
|
||||||
SET \"Sort\" = \"SiteTree\".\"Sort\"
|
|
||||||
FROM \"SiteTree\"
|
|
||||||
WHERE \"SiteTree_Live\".\"ID\" = \"SiteTree\".\"ID\"
|
|
||||||
AND \"SiteTree_Live\".\"ParentID\" = " . sprintf('%d', $this->ParentID) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Publish any virtual pages that might need publishing
|
// Publish any virtual pages that might need publishing
|
||||||
$linkedPages = DataObject::get("VirtualPage", "\"CopyContentFromID\" = $this->ID");
|
$linkedPages = DataObject::get("VirtualPage", "\"CopyContentFromID\" = $this->ID");
|
||||||
if($linkedPages) foreach($linkedPages as $page) {
|
if($linkedPages) foreach($linkedPages as $page) {
|
||||||
|
Loading…
Reference in New Issue
Block a user