Add delete to EditHistoryManager
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 18:24:04 +0000 (20:24 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 19:59:03 +0000 (21:59 +0200)
wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php

index 7565eeeacb90f9a9836e2946688e16cdc827eaae..a52f118a31174ec2bd56ab652f8986c65df180d3 100644 (file)
@@ -63,4 +63,24 @@ class EditHistoryManager extends SingletonFactory {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($this->getObjectTypeID($objectType), $objectID, $message, $time, $userID, $username, $editReason));
        }
+       
+       /**
+       * Deletes edit history entries.
+       * 
+       * @param        string          $objectType
+       * @param        array<integer>  $objectIDs
+       */
+       public function delete($objectType, array $objectIDs) {
+               $objectTypeID = $this->getObjectTypeID($objectType);
+               
+               $sql = "DELETE FROM     wcf".WCF_N."_edit_history_entry
+                       WHERE           objectTypeID = ?
+                               AND     objectID = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               WCF::getDB()->beginTransaction();
+               foreach ($objectIDs as $objectID) {
+                       $statement->execute(array($objectTypeID, $objectID));
+               }
+               WCF::getDB()->commitTransaction();
+       }
 }