From: henoheno Date: Mon, 30 Jul 2007 14:30:14 +0000 (+0900) Subject: BugTrack2/264: Compute MD5 if needed, not everytime! (patched by ioio & ryu1) X-Git-Tag: r1_5_end-eucjp~14 X-Git-Url: http://git.osdn.net/view?p=pukiwiki%2Fpukiwiki.git;a=commitdiff_plain;h=2b92bec1fe17dc0c690cc66df6f7d5ed64f9c60b BugTrack2/264: Compute MD5 if needed, not everytime! (patched by ioio & ryu1) --- diff --git a/plugin/attach.inc.php b/plugin/attach.inc.php index 5679b21..4e04a6c 100644 --- a/plugin/attach.inc.php +++ b/plugin/attach.inc.php @@ -449,7 +449,11 @@ class AttachFile $this->logname = $this->basename . '.log'; $this->exist = file_exists($this->filename); $this->time = $this->exist ? filemtime($this->filename) - LOCALZONE : 0; - $this->md5hash = $this->exist ? md5_file($this->filename) : ''; + } + + function gethash() + { + return $this->exist ? md5_file($this->filename) : ''; } // ¥Õ¥¡¥¤¥ë¾ðÊó¼èÆÀ @@ -563,6 +567,7 @@ class AttachFile } } $info = $this->toString(TRUE, FALSE); + $hash = $this->gethash(); $retval = array('msg'=>sprintf($_attach_messages['msg_info'], htmlsc($this->file))); $retval['body'] = <<< EOD @@ -574,7 +579,7 @@ class AttachFile
$info
{$_attach_messages['msg_page']}:$s_page
{$_attach_messages['msg_filename']}:{$this->filename}
-
{$_attach_messages['msg_md5hash']}:{$this->md5hash}
+
{$_attach_messages['msg_md5hash']}:$hash
{$_attach_messages['msg_filesize']}:{$this->size_str} ({$this->size} bytes)
Content-type:{$this->type}
{$_attach_messages['msg_date']}:{$this->time_str}