• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revisionffefa6ae60010f8e35f96fe77bca38fb57e1b195 (tree)
Time2014-11-30 09:36:00
Authorhenoheno <henoheno>
Commiterumorigu

Log Message

BugTrack2/264: Compute MD5 if needed, not everytime! (patched by ioio & ryu1)

Change Summary

Incremental Difference

--- a/plugin/attach.inc.php
+++ b/plugin/attach.inc.php
@@ -449,7 +449,11 @@ class AttachFile
449449 $this->logname = $this->basename . '.log';
450450 $this->exist = file_exists($this->filename);
451451 $this->time = $this->exist ? filemtime($this->filename) - LOCALZONE : 0;
452- $this->md5hash = $this->exist ? md5_file($this->filename) : '';
452+ }
453+
454+ function gethash()
455+ {
456+ return $this->exist ? md5_file($this->filename) : '';
453457 }
454458
455459 // ファイル情報取得
@@ -563,6 +567,7 @@ class AttachFile
563567 }
564568 }
565569 $info = $this->toString(TRUE, FALSE);
570+ $hash = $this->gethash();
566571
567572 $retval = array('msg'=>sprintf($_attach_messages['msg_info'], htmlsc($this->file)));
568573 $retval['body'] = <<< EOD
@@ -574,7 +579,7 @@ class AttachFile
574579 <dt>$info</dt>
575580 <dd>{$_attach_messages['msg_page']}:$s_page</dd>
576581 <dd>{$_attach_messages['msg_filename']}:{$this->filename}</dd>
577- <dd>{$_attach_messages['msg_md5hash']}:{$this->md5hash}</dd>
582+ <dd>{$_attach_messages['msg_md5hash']}:$hash</dd>
578583 <dd>{$_attach_messages['msg_filesize']}:{$this->size_str} ({$this->size} bytes)</dd>
579584 <dd>Content-type:{$this->type}</dd>
580585 <dd>{$_attach_messages['msg_date']}:{$this->time_str}</dd>