そもそも、WikiのXML-RPCの仕様で未定義?
Hikiのページは、本文を空にして保存すると、ページが削除されます。"hiki/command.rb"の"Hiki::Command#cmd_save"で、text.empty?として処理を分岐(削除処理につなげる)ているようです。
XML-RPCでも同様に空の本文でリクエストした場合に、ページ削除になると思い、"wiki.putPage"に空の"content"を与えてみましたが、空の本文でページが更新されるだけでした。"hiki/xmlrpc.rb"の"wiki.putPage"ハンドラ内を見てみると、保存処理が"plugin.save"で実行されている事がわかります。
"hiki/plugin.rb"の"Hiki::Plugin#save"を見てみると、先述の"Hiki::Command#cmd_save"と異なり、本文が何であれ保存されるようです。
過去の議論などを確認していないのでなぜこうなっているのかわかりませんが、一般にWikiをRPCなどでページ削除する事はないのでしょうか。それとも、自分が見落としていて、実はページ削除の方法は提供されているのでしょうか。
とりあえず、今やっている遊びには必要なので、無理矢理ページを削除する処理を追加してごまかします。
diff -NBaur hiki/plugin.rb hiki.1/plugin.rb
--- hiki/plugin.rb 2006-09-02 15:36:57.000000000 +0900
+++ hiki.1/plugin.rb 2008-07-06 17:40:10.000000000 +0900
@@ -295,6 +295,12 @@
result
end
+ def delete( page )
+ @db.delete( page )
+ @db.delete_cache( page )
+ delete_proc
+ end
+
def admin?
( @user == @conf.admin_name ) || @conf.password.empty?
end
diff -NBaur hiki/xmlrpc.rb hiki.1/xmlrpc.rb
--- hiki/xmlrpc.rb 2007-03-14 17:49:00.000000000 +0900
+++ hiki.1/xmlrpc.rb 2008-07-06 17:40:10.000000000 +0900
@@ -65,16 +65,20 @@
md5hex = attributes['md5hex'] || db.md5hex( page )
update_timestamp = !attributes['minoredit']
- unless plugin.save( page, content.gsub( /\r/, '' ), md5hex, update_timestamp )
- raise XMLRPC::FaultException.new(11, "save failed.")
- end
- keyword = attributes['keyword'] || db.get_attribute( page, :keyword )
- title = attributes['title']
- attr = [[:keyword, keyword.uniq], [:editor, plugin.user]]
- attr << [:title, title] if title
- db.set_attribute(page, attr)
- if plugin.admin? && attributes.has_key?( 'freeze' )
- db.freeze_page( page, attributes['freeze'] ? true : false)
+ if content.empty?
+ plugin.delete( page )
+ else
+ unless plugin.save( page, content.gsub( /\r/, '' ), md5hex, update_timestamp )
+ raise XMLRPC::FaultException.new(11, "save failed.")
+ end
+ keyword = attributes['keyword'] || db.get_attribute( page, :keyword )
+ title = attributes['title']
+ attr = [[:keyword, keyword.uniq], [:editor, plugin.user]]
+ attr << [:title, title] if title
+ db.set_attribute(page, attr)
+ if plugin.admin? && attributes.has_key?( 'freeze' )
+ db.freeze_page( page, attributes['freeze'] ? true : false)
+ end
end
true
end