Home > Tags > patch
patch Tag Archive
DMSGuestbook の日本語対応
- 2008-01-09 (水)
- WordPress
WordPress で簡単にゲストブックを設置できるプラグイン、DMSGuestbook を導入してみました。
設置の手順は簡単で、Exec-PHP や runPHP が導入されているなら、プラグインを有効化して、指示された手順に従えばすぐに使えるようになります。
具体的には、
- ゲストブック用のページを作成し、PHP を実行できる状態で、
<?php DMSGuestbook(); ?>と記述 - ゲストブック用のページIDを管理画面の DMSGuestbook Option → Basic settings 内 のPage ID に記入
- お好みで設定を変更(表示部分のテキストを日本語にする / スパム対策のために CAPTCHA や 計算問題を使う など)
といった感じですね。
日付部分の文字化け
が、なぜか Date / Time format / Time offset: の項目で、ロケールを ja_JP.UTF8 にしても、日本語が混じると化け化けになってしまいます。ロケールの指定自体は合っていて、メッセージの管理画面では正常に表示されるのに、設定画面とゲストブック本体では化けるというのは奇妙な感じ。
ということで、ソースを読んでみると、化けている場所の表示部分は、
echo htmlentities(strftime(get_option('DMSGuestbook_dateformat'), $offset), ENT_QUOTES);
となっていて、htmlentities 文字化けでググると、htmlentities()による文字化け という情報がヒット。
ひとまず、admin.php および dmsguestbook.php 内にある、htmlentities を htmlspecialchars に置換してみると、良い感じなのでこれで様子見。
- Comments: 5
- Trackbacks: 2
MyCategoryOrder の 子カテゴリの並び替えが反映されない現象に対処
- 2008-01-08 (火)
- WordPress
WordPress を 2.3.2 にアップデートした後に、My Category Order の子カテゴリの並び順が範囲されていないので、対応してみました。
とりあえず、プラグイン配布ページにて、mycategoryorder2-3-2.zip というファイルが、 2.3.2 対応で配布されていたので、それに入れ替えてみましたが改善せず。というか、これよりも 2.3対応版っぽう mycategoryorder2-3.zip の方がタイプスタンプが新しいというのはいったい?
対応策がないのかなとコメント欄を眺めていたら、コメント に修正の投稿がありました。こちらのパッチを、mycategoryorder2-3-2.zip 内の mycategoryorder.php に当ててやれば直りました。ということで、パッチは以下。
パッチ
$ diff -u mycategoryorder.php.org mycategoryorder.php
--- mycategoryorder.php.org 2007-09-30 17:24:48.000000000 +0900
+++ mycategoryorder.php 2008-01-08 14:48:35.000000000 +0900
@@ -55,14 +55,11 @@
{
$subCatStr = "";
- $results=$wpdb->get_results("SELECT DISTINCT t.term_id, name FROM $wpdb->term_taxonomy tt inner join $wpdb->term_relationships tr on tt.term_taxonomy_id = tr.term_taxonomy_id inner join $wpdb->terms t on t.term_id = tt.term_id where taxonomy = 'link_category' and tt.parent = $parentID ORDER BY term_order ASC");
- foreach($results as $row)
- {
- $catCount=$wpdb->get_row("SELECT count(*) as catCount FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' and parent = $row->term_id ", ARRAY_N);
-
- if($catCount[0] > 0)
- $subCatStr = $subCatStr."<option value='$row->term_id'>$row->name</option>";
- }
+$results=$wpdb->get_results("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = $parentID AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 1 ORDER BY t.term_order ASC");
+foreach($results as $row)
+{
+$subCatStr = $subCatStr."<option value='$row->term_id'>$row->name</option>";
+}
?>
<div class='wrap'>
<h2>My Category Order</h2>- Comments: 0
- Trackbacks: 0
WordPress 2.2.3 のコメント通知メールの文字コードを変更する
- 2007-09-20 (木)
- コンピュータ
WordPress 2.2.3 のコメント通知メールは、本体で使用している文字コードと同じもので送られてきます。ウチの場合は UTF-8 なので、通常のメーラ*1 での内容確認は問題ないのですが、携帯電話に転送すると UTF-8 が利用できず、化け化けになってしまうのを何とかしたいと思っていました。
ということで、検索。 WordPress 2.2.3のコメント通知メールをISO-2022-JPに | 老眼palm というエントリを発見し、そのパッチを適用してみたところ、件名および本文の文字化けは解消。
件名の方は、時折一部が化ける現象が発生していたのですが、メールの件名の文字化け防止パッチの実証プラグイン « iDeasilo を導入することで、それも解消。数件テストしてみた感じでは、件名の化けも起きていないようです。
で、気づいたのが差出人 From: フィールドは化けたままだということ。なので、さらにちょちょいと1行書き換えてテストしたら化けなかったのでこれでいいか、と。
パッチ
./wp-includes/pluggable.php に対するパッチは、以下。老眼palm のものとほぼ同じですが、$phpmailer->FromName についても、mb_encode_mimeheader を通してみました。
$ diff -u pluggable.php.bak pluggable.php
--- pluggable.php.bak 2007-09-08 14:06:51.000000000 +0900
+++ pluggable.php 2007-09-20 00:19:33.000000000 +0900
@@ -160,6 +160,8 @@
function wp_mail($to, $subject, $message, $headers = '') {
global $phpmailer;
+ mb_internal_encoding("UTF-8");
+
if ( !is_object( $phpmailer ) ) {
require_once(ABSPATH . WPINC . '/class-phpmailer.php');
require_once(ABSPATH . WPINC . '/class-smtp.php');
@@ -185,8 +187,12 @@
$phpmailer->FromName = "WordPress";
$phpmailer->AddAddress("$to", "");
- $phpmailer->Subject = $subject;
- $phpmailer->Body = $message;
+// $phpmailer->Subject = $subject;
+// $phpmailer->Body = $message;
+ $phpmailer->CharSet = "ISO-2022-JP";
+ $phpmailer->Encoding = "7bit";
+ $phpmailer->Subject = mb_encode_mimeheader($subject, "ISO-2022-JP", "B", "\n");
+ $phpmailer->Body = mb_convert_encoding($message, "ISO-2022-JP", "UTF-8");
$phpmailer->IsHTML(false);
$phpmailer->IsMail(); // set mailer to use php mail()
@@ -197,14 +203,16 @@
$header = explode( ":", $line );
switch ( trim( $header[0] ) ) {
case "From":
+
$from = trim( str_replace( '"', '', $header[1] ) );
if ( strpos( $from, '<' ) ) {
- $phpmailer->FromName = str_replace( '"', '', substr( $header[1], 0, strpos( $header[1], '<' ) - 1 ) );
+ $phpmailer->FromName = mb_encode_mimeheader(str_replace( '"', '', substr( $header[1], 0, strpos( $header[1], '<' ) - 1 ) ), "ISO-2022-JP", "B", "\n");
$from = trim( substr( $from, strpos( $from, '<' ) + 1 ) );
$from = str_replace( '>', '', $from );
} else {
$phpmailer->FromName = $from;
}
+
$phpmailer->From = trim( $from );
break;
default:- Gmail とか Becky!2 とか。今は Google Apss にメールはお任せしてるので、Gmail 一本です。 [↩]
- Comments: 0
- Trackbacks: 4
mod_dosdetector を Apache 2.0 系で利用したい
- 2007-09-19 (水)
- コンピュータ
はてなの中の人が作った mod_dosdetector を Vine 3.2 上の Apache 2.0.55 で利用しようと思ったら、
$ make
/usr/bin/apxs -c mod_dosdetector.c
/usr/bin/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include -c -o mod_dosdetector.lo mod_dosdetector.c && touch mod_dosdetector.slo
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:26:1: warning: "REG_ICASE" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:277:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:27:1: warning: "REG_NEWLINE" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:282:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:28:1: warning: "REG_NOTBOL" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:296:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:29:1: warning: "REG_NOTEOL" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:299:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:34:1: warning: "REG_EXTENDED" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:273:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:35:1: warning: "REG_NOSUB" redefined
In file included from mod_dosdetector.c:31:
/usr/include/regex.h:286:1: warning: this is the location of the previous definition
In file included from /usr/include/apache2/httpd.h:44,
from mod_dosdetector.c:32:
/usr/include/apache2/pcreposix.h:41: error: redefinition of `REG_BADBR'
/usr/include/regex.h:323: error: `REG_BADBR' previously defined here
/usr/include/apache2/pcreposix.h:42: error: redefinition of `REG_BADPAT'
/usr/include/regex.h:315: error: `REG_BADPAT' previously defined here
/usr/include/apache2/pcreposix.h:43: error: redefinition of `REG_BADRPT'
/usr/include/regex.h:326: error: `REG_BADRPT' previously defined here
/usr/include/apache2/pcreposix.h:44: error: redefinition of `REG_EBRACE'
/usr/include/regex.h:322: error: `REG_EBRACE' previously defined here
/usr/include/apache2/pcreposix.h:45: error: redefinition of `REG_EBRACK'
/usr/include/regex.h:320: error: `REG_EBRACK' previously defined here
/usr/include/apache2/pcreposix.h:46: error: redefinition of `REG_ECOLLATE'
/usr/include/regex.h:316: error: `REG_ECOLLATE' previously defined here
/usr/include/apache2/pcreposix.h:47: error: redefinition of `REG_ECTYPE'
/usr/include/regex.h:317: error: `REG_ECTYPE' previously defined here
/usr/include/apache2/pcreposix.h:48: error: redefinition of `REG_EESCAPE'
/usr/include/regex.h:318: error: `REG_EESCAPE' previously defined here
/usr/include/apache2/pcreposix.h:50: error: redefinition of `REG_EPAREN'
/usr/include/regex.h:321: error: `REG_EPAREN' previously defined here
/usr/include/apache2/pcreposix.h:51: error: redefinition of `REG_ERANGE'
/usr/include/regex.h:324: error: `REG_ERANGE' previously defined here
/usr/include/apache2/pcreposix.h:52: error: redefinition of `REG_ESIZE'
/usr/include/regex.h:330: error: `REG_ESIZE' previously defined here
/usr/include/apache2/pcreposix.h:53: error: redefinition of `REG_ESPACE'
/usr/include/regex.h:325: error: `REG_ESPACE' previously defined here
/usr/include/apache2/pcreposix.h:54: error: redefinition of `REG_ESUBREG'
/usr/include/regex.h:319: error: `REG_ESUBREG' previously defined here
/usr/include/apache2/pcreposix.h:57: error: redefinition of `REG_NOMATCH'
/usr/include/regex.h:311: error: `REG_NOMATCH' previously defined here
/usr/include/apache2/pcreposix.h:66: error: conflicting types for `regex_t'
/usr/include/regex.h:412: error: previous declaration of `regex_t'
/usr/include/apache2/pcreposix.h:70: warning: redefinition of `regoff_t'
/usr/include/regex.h:415: warning: `regoff_t' previously declared here
/usr/include/apache2/pcreposix.h:75: error: conflicting types for `regmatch_t'
/usr/include/regex.h:443: error: previous declaration of `regmatch_t'
/usr/include/apache2/pcreposix.h:79: error: conflicting types for `regcomp'
/usr/include/regex.h:558: error: previous declaration of `regcomp'
/usr/include/apache2/pcreposix.h:80: error: conflicting types for `regexec'
/usr/include/regex.h:562: error: previous declaration of `regexec'
/usr/include/apache2/pcreposix.h:81: error: conflicting types for `regerror'
/usr/include/regex.h:567: error: previous declaration of `regerror'
/usr/include/apache2/pcreposix.h:82: error: conflicting types for `regfree'
/usr/include/regex.h:570: error: previous declaration of `regfree'
mod_dosdetector.c: In function `dosdetector_handler':
mod_dosdetector.c:264: error: `ap_regmatch_t' undeclared (first use in this function)
mod_dosdetector.c:264: error: (Each undeclared identifier is reported only once
mod_dosdetector.c:264: error: for each function it appears in.)
mod_dosdetector.c:264: error: syntax error before "regmatch"
mod_dosdetector.c:265: error: `ap_regex_t' undeclared (first use in this function)
mod_dosdetector.c:265: error: `contenttype_regexp' undeclared (first use in this function)
mod_dosdetector.c:265: error: syntax error before ')' token
mod_dosdetector.c:267: error: `regmatch' undeclared (first use in this function)
apxs:Error: Command failed with rc=65536
.
make: *** [mod_dosdetector.so] エラー 1とステキな量のエラーが出てしまったので諦めていたのですが、今日検索したら、mizzy.org : mod_dosdetector を Apache 2.0 系で動かすパッチ というぐれぇとなパッチが提供されていたので、早速テスト。
$ patch <mod_dosdetector.patch (Stripping trailing CRs from patch.) patching file mod_dosdetector.c Hunk #1 FAILED at 28. Hunk #2 FAILED at 40. Hunk #3 succeeded at 351 with fuzz 2 (offset 249 lines). Hunk #4 FAILED at 593. patch unexpectedly ends in middle of line Hunk #5 FAILED at 722. 4 out of 5 hunks FAILED -- saving rejects to file mod_dosdetector.c.rej
orz
仕方ないので手パッチを行い、インストール。
$ make
/usr/bin/apxs -c mod_dosdetector.c
/usr/bin/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include -c -o mod_dosdetector.lo mod_dosdetector.c && touch mod_dosdetector.slo
/usr/bin/libtool --silent --mode=link gcc -o mod_dosdetector.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_dosdetector.lo
$ su
Password:
# make install
/usr/bin/apxs -c mod_dosdetector.c
/usr/bin/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include -c -o mod_dosdetector.lo mod_dosdetector.c && touch mod_dosdetector.slo
/usr/bin/libtool --silent --mode=link gcc -o mod_dosdetector.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_dosdetector.lo
/usr/bin/apxs -c -i -a -n 'dosdetector' mod_dosdetector.c
/usr/bin/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include/apache2 -I/usr/include -c -o mod_dosdetector.lo mod_dosdetector.c && touch mod_dosdetector.slo
/usr/bin/libtool --silent --mode=link gcc -o mod_dosdetector.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_dosdetector.lo
/etc/apache2/build/instdso.sh SH_LIBTOOL='/usr/bin/libtool' mod_dosdetector.la /usr/lib/apache2/modules
/usr/bin/libtool --mode=install cp mod_dosdetector.la /usr/lib/apache2/modules/
cp .libs/mod_dosdetector.so /usr/lib/apache2/modules/mod_dosdetector.so
cp .libs/mod_dosdetector.lai /usr/lib/apache2/modules/mod_dosdetector.la
cp .libs/mod_dosdetector.a /usr/lib/apache2/modules/mod_dosdetector.a
ranlib /usr/lib/apache2/modules/mod_dosdetector.a
chmod 644 /usr/lib/apache2/modules/mod_dosdetector.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/lib/apache2/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib/apache2/modules/mod_dosdetector.so
[activating module `dosdetector' in /etc/apache2/conf/apache2.conf]とりあえずインストール完了まではこぎ着けました。あとは設定を詰めてテストしよう。
パッチ内容
手パッチしたのを diff した結果。Makefile も書き換え必要だったので一緒に。
$ diff -u Makefile.org Makefile --- Makefile.org 2007-09-19 10:53:39.000000000 +0900 +++ Makefile 2007-09-19 10:53:45.000000000 +0900 @@ -4,7 +4,7 @@ ## # the used tools -APXS=/usr/sbin/apxs +APXS=/usr/bin/apxs APACHECTL=apachectl # additional user defines, includes and libraries
$ diff -u mod_dosdetector.c.org mod_dosdetector.c
--- mod_dosdetector.c.org 2007-09-19 10:53:15.000000000 +0900
+++ mod_dosdetector.c 2007-09-19 10:53:31.000000000 +0900
@@ -28,7 +28,6 @@
#include <arpa/inet.h>
//#include <netinet/in.h>
#include <time.h>
-#include <regex.h>
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
@@ -41,6 +40,7 @@
#include "apr_strings.h"
#include "apr_shm.h"
#include "apr_thread_mutex.h"
+#include "apr_version.h"
//#define _DEBUG
@@ -102,6 +102,90 @@
static apr_global_mutex_t *lock = NULL;
static apr_shm_t *shm = NULL;
+/* apr version 0.x not support apr_shm_remove, I have to copy it from apr version 1.x */
+#if (APR_MAJOR_VERSION <1)
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#ifdef HAVE_SYS_IPC_H
+#include <sys/ipc.h>
+#endif
+#ifdef HAVE_SYS_MUTEX_H
+#include <sys/mutex.h>
+#endif
+#ifdef HAVE_SYS_SHM_H
+#include <sys/shm.h>
+#endif
+#if !defined(SHM_R)
+#define SHM_R 0400
+#endif
+#if !defined(SHM_W)
+#define SHM_W 0200
+#endif
+#ifdef HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
+static apr_status_t apr_shm_remove(const char *filename, apr_pool_t * pool)
+{
+#if APR_USE_SHMEM_SHMGET
+ apr_status_t status;
+ apr_file_t *file;
+ key_t shmkey;
+ int shmid;
+#endif
+
+#if APR_USE_SHMEM_MMAP_TMP
+ return apr_file_remove(filename, pool);
+#endif
+#if APR_USE_SHMEM_MMAP_SHM
+ if (shm_unlink(filename) == -1) {
+ return errno;
+ }
+ return APR_SUCCESS;
+#endif
+#if APR_USE_SHMEM_SHMGET
+ /* Presume that the file already exists; just open for writing */
+ status = apr_file_open(&file, filename, APR_WRITE,
+ APR_OS_DEFAULT, pool);
+ if (status) {
+ return status;
+ }
+
+ /* ftok() (on solaris at least) requires that the file actually
+ * exist before calling ftok(). */
+ shmkey = ftok(filename, 1);
+ if (shmkey == (key_t) - 1) {
+ goto shm_remove_failed;
+ }
+
+ apr_file_close(file);
+
+ if ((shmid = shmget(shmkey, 0, SHM_R | SHM_W)) <0) {
+ goto shm_remove_failed;
+ }
+
+ /* Indicate that the segment is to be destroyed as soon
+ * as all processes have detached. This also disallows any
+ * new attachments to the segment. */
+ if (shmctl(shmid, IPC_RMID, NULL) == -1) {
+ goto shm_remove_failed;
+ }
+ return apr_file_remove(filename, pool);
+
+ shm_remove_failed:
+ status = errno;
+ /* ensure the file has been removed anyway. */
+ apr_file_remove(filename, pool);
+ return status;
+#endif
+
+ /* No support for anonymous shm */
+ return APR_ENOTIMPL;
+}
+#endif /* APR_MAJOR_VERSION<1 */
+
+
static apr_status_t cleanup_shm(void *not_used)
{
@@ -261,8 +345,9 @@
address = r->connection->remote_ip;
- ap_regmatch_t regmatch[AP_MAX_REG_MATCH];
- ap_regex_t **contenttype_regexp = (ap_regex_t **) cfg->contenttype_regexp->elts;
+ regmatch_t regmatch[AP_MAX_REG_MATCH];
+ regex_t **contenttype_regexp = (regex_t **) cfg->contenttype_regexp->elts;
+
for (i = 0; i <cfg->contenttype_regexp->nelts; i++) {
if(!ap_regexec(contenttype_regexp[i], content_type, AP_MAX_REG_MATCH, regmatch, 0)){
//ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, 0, "ignoring content-type: %s", content_type);
@@ -390,14 +475,12 @@
const char *arg)
{
dosdetector_dir_config *cfg = (dosdetector_dir_config *) mconfig;
- char **ignore_contenttype = (char **) cfg->ignore_contenttype->elts;
-
- *(char **) apr_array_push(cfg->ignore_contenttype) = apr_pstrdup(parms->pool, arg);
-
- int i;
regex_t *regexp;
- for (i = 0; i <cfg->ignore_contenttype->nelts; i++) {
- regexp = (regex_t *)ap_pregcomp(parms->pool, (char *)ignore_contenttype[i], REG_EXTENDED|REG_ICASE);
+ char *type;
+
+ while (*arg) {
+ type = ap_getword_conf(parms->pool, &arg);
+ regexp = ap_pregcomp(parms->pool, type, REG_EXTENDED|REG_ICASE);
*(regex_t **)apr_array_push(cfg->contenttype_regexp) = regexp;
}あれ? でも内容一緒だな。パッチの当て方ミスってたのかなorz
設定の仕方がわからない
どうにも設定のコツがわからないので、作者手ずからの説明が書かれているという Software Design 2007年 09月号 を注文。Apache モジュールの使い方特集らしいので、役に立ちそう。
| Software Design (ソフトウエア デザイン) 2007年 09月号 [雑誌] | |
![]() |
技術評論社 2007-08-18 売り上げランキング : by G-Tools |
- Apache | DoS対策 | mod_dosdetector | patch | コンピュータ
- Comments: 0
- Trackbacks: 0
wp-kumonosu のAkismet filter が利いてない
- 2007-04-18 (水)
- WordPress
WordPress を 2.1.x 系統にアップグレードした際に、同梱のAkismet プラグインが2.x にバージョンアップしたせいか、wp-kumonosu のAkismet filter が動作しなくなっていることに頭を悩ませていました。
一念発起、ソースを追ってみたら、wp-kumonosu 0.48 内の関数kumonosu_akismet_filter にて、Akismet プラグインの中にすでに存在しない関数ksd_auto_check_comment を呼び出しているのが問題の模様。関数の存在チェックで常にfalse が返る訳なので、その後のAkismet filter は動作しようがない、のかな?
同等の動作をするっぽい関数akismet_auto_check_comment をakismet.php 内で見つけたので、これを利用すればいいのかな?
ということで、投げやりなパッチ
$ diff -c wp-kumonosu.php.org wp-kumonosu.php
*** wp-kumonosu.php.org 2007-04-18 17:35:00.000000000 +0900
--- wp-kumonosu.php 2007-04-18 17:34:41.000000000 +0900
***************
*** 904,916 ****
}
add_action('preprocess_comment', 'kumonosu_akismet_filter', 1);
! if(function_exists('ksd_auto_check_comment')) {
! remove_action('preprocess_comment', 'ksd_auto_check_comment', 1);
}
function kumonosu_akismet_filter($comment) {
! if(!function_exists('ksd_auto_check_comment'))
return $comment;
$wpKumonosu = & new WpKumonosu();
--- 904,916 ----
}
add_action('preprocess_comment', 'kumonosu_akismet_filter', 1);
! if(function_exists('akismet_auto_check_comment')) {
! remove_action('preprocess_comment', 'akismet_auto_check_comment', 1);
}
function kumonosu_akismet_filter($comment) {
! if(!function_exists('akismet_auto_check_comment'))
return $comment;
$wpKumonosu = & new WpKumonosu();
***************
*** 926,932 ****
}
if($do_akismet) {
! $comment = ksd_auto_check_comment($comment);
}
return $comment;
--- 926,932 ----
}
if($do_akismet) {
! $comment = akismet_auto_check_comment($comment);
}
return $comment;自サイト内のTrackback はしっかりとデバッグログに記録されていたから、動作するようになったのは間違いなさそうですが、しばらくはこれで様子見です。
- Akismet | patch | WordPress | wp-kumonosu
- Comments: 0
- Trackbacks: 0
Home > Tags > patch
![Software Design (ソフトウエア デザイン) 2007年 09月号 [雑誌]](http://ecx.images-amazon.com/images/I/31o4lUA7YjL.jpg)
