-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwikidb.cgi
executable file
·538 lines (483 loc) · 20.3 KB
/
wikidb.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
#!/usr/bin/perl
###############################################################################
#
# ::FreeStyleWiki
#
# Wiki::DatabaseStorage 移行スクリプト
#
###############################################################################
BEGIN {
if(exists $ENV{MOD_PERL}){
# カレントディレクトリの変更
chdir($ENV{FSWIKI_HOME});
}
}
# ModPerl::Registry(Prefork)では実行時に変更されている可能性がある
if(exists $ENV{MOD_PERL}){
chdir($ENV{FSWIKI_HOME});
}
#==============================================================================
# モジュールのインクルード
#==============================================================================
use Cwd;
use lib ('./lib', './local/lib/perl5');
# ModPerl::Registry(Prefork)では@INCが初期化されている場合がある
unshift @INC, './lib' if(exists $ENV{MOD_PERL});
unshift @INC, './local/lib/perl5' if(exists $ENV{MOD_PERL});
use strict;
use Wiki;
use Util;
use Jcode;
use HTML::Template;
# これをやらないとApache::Registoryで動かない
if(exists $ENV{MOD_PERL}){
eval("use Digest::MD5;");
eval("use plugin::core::Diff;");
eval("use plugin::pdf::PDFMaker;");
}
#==============================================================================
# CGIとWikiのインスタンス化
#==============================================================================
my $wiki = Wiki->new('setup.dat');
my $cgi = $wiki->get_CGI();
# ストレージをデフォルトに変更する
$wiki->{"storage"}->finalize();
$wiki->{"storage"} = Wiki::DefaultStorage->new($wiki);
# スクリプト名の上書き
$wiki->config("script_name","wikidb.cgi");
# データベース作成用のインスタンス生成
my $wikidb = Wiki::DB->new();
eval {
# Session用ディレクトリはFarmでも共通に使用する
$wiki->config('session_dir',$wiki->config('log_dir'));
#==============================================================================
# Farmとして動作する場合
#==============================================================================
my $path_info = $cgi->path_info();
my $path_count = 0;
if(length($path_info) > 0){
# PATH_INFOの最後が/だったら/なしのURLに転送する
if($path_info =~ m|/$|) {
$path_info =~ s|/$||;
$wiki->redirectURL($cgi->url().$path_info);
}
$path_info =~ m</([^/]+)$>;
$wiki->config('script_name', $1);
$wiki->config('data_dir' , $wiki->config('data_dir' ).$path_info);
$wiki->config('config_dir' , $wiki->config('config_dir').$path_info);
$wiki->config('backup_dir' , $wiki->config('backup_dir').$path_info);
$wiki->config('log_dir' , $wiki->config('log_dir' ).$path_info);
}
#==============================================================================
# 設定を反映(もうちょっとスマートにやりたいね)
#==============================================================================
my $config = &Util::load_config_hash($wiki,$wiki->config('config_file'));
foreach my $key (keys(%$config)){
$wiki->config($key,$config->{$key});
}
# キャッシュの設定を反映
my $cache_config = &Util::load_config_hash($wiki,'cache.dat');
$wiki->config('use_cache' ,$cache_config->{use_cache});
$wiki->config('no_cache' ,$cache_config->{no_cache});
$wiki->config('remove_cache',$cache_config->{remove_cache});
#==============================================================================
# タイムアウトしているセッションを破棄
#==============================================================================
$cgi->remove_session($wiki);
#==============================================================================
# ユーザ情報の読み込み
#==============================================================================
my $users = &Util::load_config_hash($wiki,$wiki->config('userdat_file'));
foreach my $id (keys(%$users)){
my ($pass,$type) = split(/\t/,$users->{$id});
$wiki->add_user($id,$pass,$type);
}
#==============================================================================
# プラグインのインストールと初期化
#==============================================================================
# 最低限のプラグインのみインストールする
my @plugins = split(/,/,"admin,core,info");
my $plugin_error = '';
foreach(sort(@plugins)){
$plugin_error .= $wiki->install_plugin($_);
}
# プラグインごとの初期化処理を起動
$wiki->do_hook("initialize");
#==============================================================================
# アクションハンドラの呼び出し
#==============================================================================
my ($action, $content);
$action = $cgi->param("action");
$action = (!defined($action))?"LOGIN":$action;
my $login = $wiki->get_login_info();
# 未ログインの場合はログイン処理を行う。
if ( !defined($login) ) {
$action = "LOGIN";
$content = $wiki->call_handler($action);
}
# ログアウト時はログイン画面に戻す
elsif( $action eq "LOGIN" && defined($cgi->param('logout')) ) {
$content = $wiki->call_handler($action);
$wiki->redirectURL($wiki->config('script_name')."?action=LOGIN");
}
# 管理者でない場合はログアウト処理を行う。
elsif( $login->{type} != 0 ) {
$action = "LOGIN";
$cgi->param('logout','1');
$wiki->call_handler($action);
$cgi->param('logout',"");
$wiki->{'login_info'} = undef;
$content = "<div style='color:#ff0000;'>管理者でログインしてください。</div>";
$content .= $wiki->call_handler($action);
}
# 管理者ログイン時は移行画面を表示する
else {
if ( $action eq "MAKEDB" ){
$content .= $wikidb->make_db($wiki);
}
else {
$content .= "<div align='right'>".$wikidb->get_logout_form($wiki)."\n</div>\n";
$content .= $wikidb->get_db_config_form($wiki)."\n";
$content .= $wikidb->get_db_cmd_form($wiki);
}
}
# プラグインのインストールに失敗した場合
$content .= $plugin_error . $content if $plugin_error ne '';
#==============================================================================
# レスポンス
#==============================================================================
# ページのタイトルを決定
my $title = "Wiki Database Storage 作成ツール";
my $output = "";
my $tmpl = $wikidb->get_template($wiki);
my $template = HTML::Template->new(
scalarref => \$tmpl,
die_on_bad_params => 0,
loop_context_vars => 1,
case_sensitive => 1,
global_vars => 1,
utf8 => 1);
$template->param(TITLE => $title, CONTENTS => $content);
$output = $template->output;
#------------------------------------------------------------------------------
# 出力処理
#------------------------------------------------------------------------------
# ヘッダの出力
print "Content-Type: text/html;charset=UTF-8\n";
print "Pragma: no-cache\n";
print "Cache-Control: no-cache\n\n";
# HTMLの出力
print $output;
};
my $msg = $@;
$ENV{'PATH_INFO'} = undef;
$wiki->_process_before_exit();
if($msg && index($msg, 'safe_die')<0){
$msg = Util::escapeHTML($msg);
print "Content-Type: text/html\n\n";
print "<html><head><title>Software Error</title></head>";
print "<body><h1>Software Error:</h1><p>$msg</p></body></html>";
}
1;
package Wiki::DB;
use File::Path;
use DBI;
use strict;
#==============================================================================
# コンストラクタ
#==============================================================================
sub new {
my $class = shift;
my $self = {};
return bless $self,$class;
}
sub get_template {
my $self = shift;
my $wiki = shift;
return <<__EOD__;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="$wiki->{config}->{theme_uri}/default/default.css">
<title><!--TMPL_VAR 'TITLE'--></title>
</head>
<body>
<div style="">
<!--TMPL_VAR 'MESSAGE'-->
</div>
<!--TMPL_VAR 'CONTENTS'-->
</body>
</html>
__EOD__
}
sub get_logout_form {
my $self = shift;
my $wiki = shift;
my $script = $wiki->config('script_name');
return <<__EOD__;
<form method='POST' action="$script">
<input type="hidden" name="action" value="LOGIN">
<input type="submit" name="logout" value="ログアウト">
</form>
__EOD__
}
sub get_db_config_form {
my $self = shift;
my $wiki = shift;
my $script = $wiki->config('script_name');
my $driver = $wiki->{config}->{db_driver};
my $drh = DBI->installed_versions($driver);
return <<__EOD__;
<h2>データベースの操作</h2>
<p>
データベース接続への設定は以下のようになっています。
<table border="1">
<tr><th>設定項目</th><th width="250">設定値</th></tr>
<tr><td>DBI</td><td>$drh->{'DBI'} </td></tr>
<tr><td>DBドライバ</td><td>$wiki->{config}->{db_driver} - $drh->{'DBD::'.$driver} </td></tr>
<tr><td>DBホスト</td><td>$wiki->{config}->{db_host} </td></tr>
<tr><td>DB名</td><td>$wiki->{config}->{db_name} </td></tr>
<tr><td>DBユーザー</td><td>$wiki->{config}->{db_user} </td></tr>
<tr><td>DBパスワード</td><td>$wiki->{config}->{db_pass} </td></tr>
</table>
</p>
__EOD__
}
sub get_db_cmd_form {
my $self = shift;
my $wiki = shift;
my $script = $wiki->config('script_name');
return <<__EOD__;
<p>
<form method='POST' action="$script">
DBを作成(再作成)する WikiFarm を指定し、「データベースの作成」ボタンをクリックしてください。<br>
ルートWikiを指定する場合は "/" を指定してください。<br>
また、Farm名は "/" で始まるフルパスで指定します。
<br><br>
WikiFarm: <input type="text" name="farm" value="/" size=50>
<input type="hidden" name="action" value="MAKEDB">
<input type="submit" value="データベースの作成">
</form>
</p>
__EOD__
}
sub make_db {
Util::debug("exec make_db");
my $self = shift;
my $wiki = shift;
my $html = "";
eval {
my $wikifarm = $self->get_wikifarm_instance($wiki, $wiki->get_CGI()->param('farm'));
if (defined($wikifarm)){
$html .= $self->db_transition($wikifarm);
} else {
return "Wikiインスタンスの作成に失敗しました。"
}
$wikifarm->_process_before_exit();
};
if($@){
return $html."<br>$@";
}
return $html."<br>"."正常に終了しました。";
}
sub db_transition {
Util::debug("exec db_transition");
my $self = shift;
my $wiki = shift;
my $hDB = shift;
my ($sql,$hst,$hst1,$hst2) = undef;
my $html = "";
$html .= "<ul>\n";
my $dbdriver = $wiki->config('db_driver');
my $dbname = $wiki->config('db_name');
my $dbhost = $wiki->config('db_host');
my $user = $wiki->config('db_user');
my $pass = $wiki->config('db_pass');
my $dsn = "dbi:$dbdriver:database=$dbname;host=$dbhost";
$html .= "<li>データベース接続[$dsn]";
$hDB = DBI->connect($dsn, $user, $pass, {PrintError=>0});
if (!$hDB) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; }; $html .= "<br>OK</li>\n";
eval {
$sql = {
# Drop
data_drp => "DROP TABLE IF EXISTS `data_tbl`",
backup_drp => "DROP TABLE IF EXISTS `backup_tbl`",
attr_drp => "DROP TABLE IF EXISTS `attr_tbl`",
access_drp => "DROP TABLE IF EXISTS `access_tbl`",
data_drp_idx_1 => "DROP INDEX `data_idx_1`",
backup_drp_idx_1 => "DROP INDEX `backup_idx_1`",
attr_drp_idx_1 => "DROP INDEX `attr_idx_1`",
attr_drp_idx_2 => "DROP INDEX `attr_idx_2`",
access_drp_idx_1 => "DROP INDEX `access_idx_1`",
access_drp_idx_2 => "DROP INDEX `access_idx_2`",
# Table
data_tbl => "CREATE TABLE `data_tbl` (`page` text, `source` text, `lastmodified` bigint)",
backup_tbl => "CREATE TABLE `backup_tbl` (`page` text, `source` text, `lastmodified` bigint)",
attr_tbl => "CREATE TABLE `attr_tbl` (`page` text, `key` text, `value` text, `lastmodified` bigint)",
access_tbl => "CREATE TABLE `access_tbl` (`page` text, `datetime` text, `remote_addr` text, `referer` text, `user_agent` text, `lastmodified` bigint)",
# Index
data_idx_1 => "CREATE UNIQUE INDEX `data_idx_1` ON `data_tbl` (`page`(255))",
backup_idx_1 => "CREATE UNIQUE INDEX `backup_idx_1` ON `backup_tbl` (`page`(255), `lastmodified` DESC)",
attr_idx_1 => "CREATE UNIQUE INDEX `attr_idx_1` ON `attr_tbl` (`page`(255), `key`(255))",
attr_idx_2 => "CREATE UNIQUE INDEX `attr_idx_2` ON `attr_tbl` (`key`(255), `page`(255))",
access_idx_1 => "CREATE INDEX `access_idx_1` ON `access_tbl` (`lastmodified` DESC)",
access_idx_2 => "CREATE INDEX `access_idx_2` ON `access_tbl` (`page`(255), `datetime`(255) DESC)",
# Insert
data_ins => "INSERT INTO `data_tbl` VALUES(?, ?, ?)",
backup_ins => "INSERT INTO `backup_tbl` VALUES(?, ?, ?)",
attr_ins => "INSERT INTO `attr_tbl` VALUES(?, ?, ?, ?)",
};
# インデックス/テーブルの削除
$hst = $hDB->do($sql->{data_drp_idx1});
$hst = $hDB->do($sql->{backup_drp_idx1});
$hst = $hDB->do($sql->{attr_drp_idx1});
$hst = $hDB->do($sql->{attr_drp_idx2});
$hst = $hDB->do($sql->{access_drp_idx1});
$hst = $hDB->do($sql->{access_drp_idx2});
$hst = $hDB->do($sql->{data_drp});
$hst = $hDB->do($sql->{backup_drp});
$hst = $hDB->do($sql->{attr_drp});
$hst = $hDB->do($sql->{access_drp});
# ページ情報テーブル/インデックス
$html .= "<li>".$sql->{data_tbl}; $hst = $hDB->do($sql->{data_tbl}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{data_idx_1}; $hst = $hDB->do($sql->{data_idx_1}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
# バックアップ用テーブル/インデックス
$html .= "<li>".$sql->{backup_tbl}; $hst = $hDB->do($sql->{backup_tbl}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{backup_idx_1}; $hst = $hDB->do($sql->{backup_idx_1}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
# ページ属性テーブル/インデックス
$html .= "<li>".$sql->{attr_tbl}; $hst = $hDB->do($sql->{attr_tbl}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{attr_idx_1}; $hst = $hDB->do($sql->{attr_idx_1}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{attr_idx_2}; $hst = $hDB->do($sql->{attr_idx_2}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
# アクセスログ・テーブル/インデックス
$html .= "<li>".$sql->{access_tbl}; $hst = $hDB->do($sql->{access_tbl}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{access_idx_1}; $hst = $hDB->do($sql->{access_idx_1}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
$html .= "<li>".$sql->{access_idx_2}; $hst = $hDB->do($sql->{access_idx_2}); if (!$hst) { $html .= "<br>NG - ".$DBI::errstr."</li>\n"; die; }; $html .= "<br>OK</li>\n";
my @list = $wiki->get_page_list({-sort => 'name'});
$html .= "<li>ページ数:".$#list;
$hst1 = $hDB->prepare($sql->{data_ins});
die "$DBI::errstr " if (!$hst1);
$hst2 = $hDB->prepare($sql->{attr_ins});
die "$DBI::errstr " if (!$hst2);
foreach my $page (@list) {
# ページの登録
$hst1->execute($page, $wiki->get_page($page), $wiki->get_last_modified2($page) );
# ページ・レベルの登録
my $level = $wiki->get_page_level($page);
$hst2->execute($page, "page_level", $level, time() ) if ( $level > 0 );
# 凍結情報の登録
my $freeze = $wiki->is_freeze($page);
$hst2->execute($page, "freeze", $freeze, time() ) if ( $freeze > 0 );
# # タイトル情報の登録
# my @title = grep(/^{{title .+}}$/, split(/\n/,$wiki->get_page($page)));
# if ( $#title >= 0 ) {
# $title[0] =~ s/{{title (.+)}}$/$1/;
# $hst2->execute($page, "title", $title[0], time());
# }
}
$html .= "<br>OK</li>";
}; # eval
if ($@) {
$html .= "<br>エラーが発生しました。 - $@";
}
$hst1->finish() if ($hst1);
$hst2->finish() if ($hst2);
if ($hDB) {
$hDB->disconnect();
}
$html .= "</ul>\n";
return $html;
}
#===========================================================
# 指定された WikiFarm 環境のインスタンスを生成します。
# ここで指定する $farm は絶対パスである必要があります。
# この関数は farmlink から流用しています。
#===========================================================
sub get_wikifarm_instance {
my $self = shift;
my $rwiki = shift;
my $farm = shift;
# WikiFarm キャッシュから取得する
my $wiki = undef;
# InterWikiとKeyword情報のバックアップ
my $interwiki = $Wiki::Parser::interwiki;
my $keyword = $Wiki::Parser::keyword;
#-----------------------------------------------------------
# WikiFarm用のwikiインスタンス作成
#-----------------------------------------------------------
eval {
$wiki = Wiki->new('setup.dat');
$cgi = $wiki->get_CGI();
# ルートWikiへの相対パスの取得
my $relative_path = $cgi->path_info();
$relative_path =~ s/[^\/]*//g;
$relative_path =~ s/\//..\//g;
# PATH_INFOの上書き
$cgi->path_info($farm);
# pageの上書き
$cgi->param('page',"#farmlink");
# ストレージをデフォルトに変更する
$wiki->{"storage"}->finalize();
$wiki->{"storage"} = Wiki::DefaultStorage->new($wiki);
# 子Wiki呼出情報の引継ぎ
$wiki->{farmlink} = $rwiki->{farmlink};
# Session用ディレクトリはFarmでも共通に使用する
$wiki->config('session_dir',$wiki->config('log_dir'));
# Farmとして動作する設定
my $path_count = 0;
$wiki->config('script_name', $relative_path.$wiki->config('script_name').$farm);
$wiki->config('data_dir' , $wiki->config('data_dir' ).$farm);
$wiki->config('config_dir' , $wiki->config('config_dir').$farm);
$wiki->config('backup_dir' , $wiki->config('backup_dir').$farm);
$wiki->config('log_dir' , $wiki->config('log_dir' ).$farm);
if(!($wiki->config('theme_uri') =~ /^(\/|http:|https:|ftp:)/)){
my @paths = split(/\//,$farm);
$path_count = $#paths;
for(my $i=0;$i<$path_count;$i++){
$wiki->config('theme_uri','../'.$wiki->config('theme_uri'));
}
}
# 設定を反映
my $config = &Util::load_config_hash($wiki,$wiki->config('config_file'));
foreach my $key (keys(%$config)){
$wiki->config($key,$config->{$key});
}
# 個別に設定が必要なものだけ上書き
$wiki->config('css' ,$wiki->config('theme_uri')."/".$config->{theme}."/".$config->{theme}.".css");
$wiki->config('site_tmpl' ,$wiki->config('tmpl_dir')."/site/".$config->{site_tmpl_theme}."/".$config->{site_tmpl_theme}.".tmpl");
$wiki->config('site_handyphone_tmpl' ,$wiki->config('tmpl_dir')."/site/".$config->{site_tmpl_theme}."/".$config->{site_tmpl_theme}."_handyphone.tmpl");
# キャッシュの設定を反映
my $cache_config = &Util::load_config_hash($wiki,'cache.dat');
$wiki->config('use_cache' ,$cache_config->{use_cache});
$wiki->config('no_cache' ,$cache_config->{no_cache});
$wiki->config('remove_cache',$cache_config->{remove_cache});
# InterWikiとKeyword情報の再作成
$Wiki::Parser::interwiki = Wiki::InterWiki->new($wiki);
$Wiki::Parser::keyword = Wiki::Keyword->new($wiki,$Wiki::Parser::interwiki);
# InterWikiとKeyword情報の保管
$wiki->{interwiki} = $Wiki::Parser::interwiki;
$wiki->{keyword} = $Wiki::Parser::keyword;
# プラグインのインストールと初期化
### my @plugins = split(/\n/,&Util::load_config_text($wiki,$wiki->config('plugin_file')));
# 最低限のプラグインのみインストールする
my @plugins = split(/,/,"admin,core,info");
my $plugin_error = '';
foreach(sort(@plugins)){
$plugin_error .= $wiki->install_plugin($_);
}
# プラグインごとの初期化処理を起動
$wiki->do_hook("initialize");
};
# InterWikiとKeyword情報のレストア
$Wiki::Parser::interwiki = $interwiki;
$Wiki::Parser::keyword = $keyword;
if ( defined($wiki) ) {
# Wiki インスタンスのキャッシュ登録
$rwiki->{wikifarm}->{$farm} = $wiki;
# Wiki インスタンスのキャッシュ情報の引継ぎ
$wiki->{wikifarm} = $rwiki->{wikifarm};
}
return $wiki;
}
1;