Commit 0ad1d2ef9cf3496243d85c8fc3f7b3013a597e52

Authored by kevin_fourie
1 parent d654aa22

Merged in...

KTS-3768
"Document Indexer stats shows 'ago' as value for 'Period since last indexing'"
Fixed. Now returns 'never' when no time has elapsed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.4-Release-Branch@9491 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 10 additions and 2 deletions
lib/util/ktutil.inc
@@ -46,7 +46,7 @@ class KTUtil { @@ -46,7 +46,7 @@ class KTUtil {
46 const DAY_IN_SECS = 86400; 46 const DAY_IN_SECS = 86400;
47 const KB = 1024; 47 const KB = 1024;
48 const MB = 1048576; 48 const MB = 1048576;
49 - const GB = 1073741824; 49 + const GB = 1000000000;
50 const TB = 1099511627776; 50 const TB = 1099511627776;
51 const PB = 1125899906842624; 51 const PB = 1125899906842624;
52 52
@@ -182,8 +182,16 @@ class KTUtil { @@ -182,8 +182,16 @@ class KTUtil {
182 if ($days > 0) $str .= sprintf(_kt(' %d day(s)'), $days); 182 if ($days > 0) $str .= sprintf(_kt(' %d day(s)'), $days);
183 if ($hours > 0) $str .= sprintf(_kt(' %d hour(s)'), $hours); 183 if ($hours > 0) $str .= sprintf(_kt(' %d hour(s)'), $hours);
184 if ($mins > 0) $str .= sprintf(_kt(' %d minute(s)'), $mins); 184 if ($mins > 0) $str .= sprintf(_kt(' %d minute(s)'), $mins);
185 - if ($secs > 0) $str .= sprintf(_kt(' %d second(s)'), $secs);  
186 185
  186 + // lets loose some granularity. the string does get quite long...
  187 + if ($days == 0 && $hours == 0 && $mins == 0 && $secs > 0)
  188 + {
  189 + $str .= sprintf(_kt(' %d second(s)'), $secs);
  190 + }
  191 + if (empty($str))
  192 + {
  193 + return _kt('never');
  194 + }
187 $str .= " $suffix"; 195 $str .= " $suffix";
188 196
189 if ($returnArray) 197 if ($returnArray)