Fix Page::setAsLandingPage()
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 10 Apr 2016 13:15:19 +0000 (15:15 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 10 Apr 2016 13:15:19 +0000 (15:15 +0200)
see a80873d5fe45732dd39a51a89f6f58a91656fc50

wcfsetup/install/files/lib/data/page/Page.class.php

index c56bbb671655437b7a1185db20c8a7a008d95e79..739f3f0f4d3b0e3d01d6bc2773d1a7daaa848d50 100644 (file)
@@ -213,14 +213,13 @@ class Page extends DatabaseObject {
                        throw new SystemException('Pages requiring an object id cannot be set as landing page.');
                }
                
+               WCF::getDB()->beginTransaction();
                // unmark existing landing page
                $sql = "UPDATE  wcf".WCF_N."_page
-                       SET     isLandingPage = ?
-                               AND isLandingPage = ?";
+                       SET     isLandingPage = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute([
-                       0,
-                       1
+                       0
                ]);
                
                // set current page as landing page
@@ -232,6 +231,7 @@ class Page extends DatabaseObject {
                        1,
                        $this->pageID
                ]);
+               WCF::getDB()->commitTransaction();
        }
        
        /**