[geeklog-hg] geeklog: Fixed a bug where Spam-X plugin didn't work with Postgr...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Feb 2 10:21:22 EST 2014


changeset 9466:d307b7071011
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/d307b7071011
user: Kenji ITO <mystralkk at gmail.com>
date: Mon Feb 03 00:20:09 2014 +0900
description:
Fixed a bug where Spam-X plugin didn't work with PostgreSQL

diffstat:

 plugins/spamx/DeleteComment.Action.class.php |  10 ++++++++--
 plugins/spamx/sql/pgsql_install.php          |   2 +-
 public_html/admin/block.php                  |   2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 56ca2894537b -r d307b7071011 plugins/spamx/DeleteComment.Action.class.php
--- a/plugins/spamx/DeleteComment.Action.class.php	Sun Feb 02 11:37:41 2014 +0900
+++ b/plugins/spamx/DeleteComment.Action.class.php	Mon Feb 03 00:20:09 2014 +0900
@@ -47,8 +47,14 @@
         $this->result = PLG_SPAM_ACTION_DELETE;
 
         // update count of deleted spam posts
-        DB_change($_TABLES['vars'], 'value', 'value + 1', 'name', 'spamx.counter', '', true);
-
+        $sql['mysql'] = "UPDATE {$_TABLES['vars']} "
+                      . "SET value = value + 1 "
+                      . "WHERE name = 'spamx.counter' ";
+        $sql['mssql'] = $sql['mysql'];
+        $sql['pgsql'] = "UPDATE {$_TABLES['vars']} "
+                      . "SET value = CAST(value AS int) + 1 "
+                      . "WHERE name = 'spamx.counter' ";
+        DB_query($sql);
         SPAMX_log($LANG_SX00['spamdeleted']);
 
         return PLG_SPAM_FOUND;
diff -r 56ca2894537b -r d307b7071011 plugins/spamx/sql/pgsql_install.php
--- a/plugins/spamx/sql/pgsql_install.php	Sun Feb 02 11:37:41 2014 +0900
+++ b/plugins/spamx/sql/pgsql_install.php	Mon Feb 03 00:20:09 2014 +0900
@@ -34,7 +34,7 @@
 CREATE TABLE {$_TABLES['spamx']} (
   name varchar(20) NOT NULL default '',
   value varchar(255) NOT NULL default '',
-  counter int(11) NOT NULL default 0,
+  counter int NOT NULL default 0,
   regdate timestamp NOT NULL default NULL
 );
   CREATE INDEX {$_TABLES['spamx']}_name ON {$_TABLES['spamx']}(name);
diff -r 56ca2894537b -r d307b7071011 public_html/admin/block.php
--- a/public_html/admin/block.php	Sun Feb 02 11:37:41 2014 +0900
+++ b/public_html/admin/block.php	Mon Feb 03 00:20:09 2014 +0900
@@ -686,7 +686,7 @@
             
              $sql['pgsql'] = "INSERT INTO {$_TABLES['blocks']} "
              .'(bid,name,title,help,type,blockorder,content,rdfurl,rdfupdated,rdflimit,phpblockfn,onleft,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,is_enabled,allow_autotags,cache_time) '
-             ."VALUES ((SELECT NEXTVAL('{$_TABLES['blocks']}_bid_seq')),'$name','$title','$help','$type','$blockorder','$content','$rdfurl','$rdfupdated','$rdflimit','$phpblockfn',$onleft,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_enabled,$allow_autotags,$cache_time)";
+             ."VALUES ((SELECT NEXTVAL('{$_TABLES['blocks']}_bid_seq')),'$name','$title','$help','$type','$blockorder','$content','$rdfurl',CURRENT_TIMESTAMP,'$rdflimit','$phpblockfn',$onleft,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_enabled,$allow_autotags,$cache_time)";
              
              DB_query($sql);
              $bid = DB_insertId();



More information about the geeklog-cvs mailing list