last-modified: 2019-04-28 (日) 18:36:58 (1834d)[変更箇所]
1.8.xはpython2.5,2.4用。1.9.xは2.7-2.4用だが、古い2.4についてはあまりチェックされてないよ的なことが書かれているので1.8.9をダウンロード。展開した後、
python setup.py install --prefix='/home/xxx/moin'
でインストール。これで
というところにインストールされる。
次にデータ(instanceと呼ばれる)用のディレクトリをsetup。以下のスクリプトを実行
#!/bin/bash INSTANCE=/home/smdayone/moin/ SHARE=/home/smdayone/moin/share USER=smdayone GROUP=smdayone mkdir -p $INSTANCE cp -R $SHARE/moin/data $INSTANCE cp -R $SHARE/moin/underlay $INSTANCE cp -R $SHARE/moin/config/wikiconfig.py $INSTANCE cp -R $SHARE/moin/server/moin.wsgi $INSTANCE chown -R $USER.$GROUP $INSTANCE chmod -R ug+rwX $INSTANCE chmod -R o-rwx $INSTANCE
上のディレクトリに全部放り込んでしまう。
moin-1.8.9/wiki/server/moin.cgiを編集してpublic_htmlに置く。
sys.path.insert(0, '/home/smdayone/moin/lib/python2.6/site-packages') sys.path.insert(0, '/home/smdayone/moin')
.htaccessの設定も忘れずに。
moin/wikiconfig.pyを編集。以下を設定
これでURLをたたいてみると。FrontPageが表示されたが、テキスト表示でテーマが反映されていない感じ。うーむ。
moin/share/moin/htdocsを丸ごとpublic_html/moin_static189にコピー。このディレクトリの中にcss等が詰まっている。 さらにwikiconfiig.pyの以下を変更。
url_prefix_static = '/~xxx/moin_static189'
ただしこれだけではだめで、moin_satic189のpermissionを変更してあげる必要がある。ディレクトリには実効権限を与えないとだめです。(ハマった。。。)
30MBのファイルは難なくuploadできてしまった。バカでかいファイルもuploadできてしまうんではないのかい?
ググってもファイルのuploadのサイズの制限については出てこない。MoinMoin?ではできないの?多数の人が編集できるようになっているのだからそファイルサイズの制限くらい設定できるようになっているべきなのだけれど...
結局moin/lib/python2.4/site-packages/MoinMoin?/actions/AttachFile?.pyを改造。 以下の行を追加。
filesize = os.path.getsize(fpath) # kondo --> if filesize/1000 > 50000: #Exceeds Max file size (50MB) os.unlink(fpath) return target, -1 #<-- _addLogEntry(request, 'ATTNEW', pagename, target) event = FileAttachedEvent(request, pagename, target, filesize) send_event(event)
# add the attachment try: target, bytes = add_attachment(request, pagename, target, filecontent, overwrite=overwrite) # kondo if bytes < 0: # file size exceeded the limit (50MB) return _("File size is too large, should be less than 50MB") #<-- msg = _("Attachment '%(target)s' (remote name '%(filename)s')" " with %(bytes)d bytes saved.") % { 'target': target, 'filename': filename, 'bytes': bytes}
とりあえずこれでできたっぽい。一旦サーバーにファイルが置かれてしまうが、まあよしとする。add_attachmentはzipファイルのところでも使用されているが、とりあえず無視で。