summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-04-30 17:26:15 +0000
committeruckelman <uckelman@nomic.net>2010-04-30 17:26:15 +0000
commit1d718ace9e7c9e65fedca5dc3f7396d41ea44005 (patch)
tree21941afcdb526931a8f40acf76203141e8b66492 /src
parent0e6c8d3fbcd4afd0fb84ee736ff0d3952c713b4e (diff)
Added removePost() for post deletion.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6790 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r--src/Bridge.php12
-rw-r--r--src/F2M.php2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/Bridge.php b/src/Bridge.php
index d9f0dec..b137b51 100644
--- a/src/Bridge.php
+++ b/src/Bridge.php
@@ -126,6 +126,18 @@ class Bridge {
}
}
+ public function removePost($postId) {
+ throw_if_null($postId);
+
+ $sql = 'DELETE FROM posts WHERE post_id = ' . $postId;
+
+ $count = $this->db->exec($sql);
+
+ if ($count < 1) {
+ throw new Exception('Failed to delete post id: ' . $postId);
+ }
+ }
+
protected function get_exactly_one_row($sql) {
$result = $this->db->query($sql);
diff --git a/src/F2M.php b/src/F2M.php
index 68d2a12..079c999 100644
--- a/src/F2M.php
+++ b/src/F2M.php
@@ -202,7 +202,7 @@ function remove_post($postId) {
require_once(__DIR__ . '/Bridge.php');
$bridge = new Bridge();
- $bridge->unregisterPost($postId);
+ $bridge->removePost($postId);
}
function build_text_part($mime, $text) {