From 7ba2a4617a4259a7658a91aa9f54dab89df2e1a7 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 3 Sep 2012 17:25:21 +1200 Subject: [PATCH] BUG Fix file size format in document links --- code/DMSDocument.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/code/DMSDocument.php b/code/DMSDocument.php index 5a02ee0..791a9ab 100644 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -661,15 +661,11 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { return filesize($this->getFullPath()); } + /** + * An alias to DMSDocument::getSize() + */ function getFileSizeFormatted(){ - if($size = $this->getSize()){ - if($size < 1024) return $size . ' bytes'; - if($size < 1024*10) return (round($size/1024*10)/10). ' KB'; - if($size < 1024*1024) return round($size/1024) . ' KB'; - if($size < 1024*1024*10) return (round(($size/1024)/1024*10)/10) . ' MB'; - if($size < 1024*1024*1024) return round(($size/1024)/1024) . ' MB'; - return round($size/(1024*1024*1024)*10)/10 . ' GB'; - } + return $this->getSize(); }