Skip to content

Commit

Permalink
- Fixed get PHPFiwa feed size bug
Browse files Browse the repository at this point in the history
- Fixed PHPTIMESTORE csv export bug
  • Loading branch information
TrystanLea committed Mar 27, 2014
1 parent 232f99b commit be26c22
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Modules/feed/engine/PHPFiwa.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,14 @@ public function delete($id)
public function get_feed_size($id)
{
if (!$meta = $this->get_meta($id)) return false;
return (filesize($this->dir.$meta->id.".meta") + filesize($this->dir.$meta->id.".dat"));

$size = 0;
$size += filesize($this->dir.$meta->id.".meta");
$size += filesize($this->dir.$meta->id."_0.dat");
$size += filesize($this->dir.$meta->id."_1.dat");
$size += filesize($this->dir.$meta->id."_2.dat");
$size += filesize($this->dir.$meta->id."_3.dat");
return $size;
}


Expand Down
11 changes: 11 additions & 0 deletions Modules/feed/engine/PHPTimestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,17 @@ public function csv_export($feedid,$start,$end,$outinterval)
$start = (int) $start;
$end = (int) $end;
$outinterval = (int) $outinterval;

if ($end == 0) $end = time();

$meta = $this->get_meta($feedid);

$start = round($start/$meta->interval)*$meta->interval;

if ($outinterval<1) $outinterval = 1;
$npoints = ceil(($end - $start) / $outinterval);
$end = $start + ($npoints * $outinterval);
if ($npoints<1) return false;

$meta->decimation = array(20, 6, 6, 4, 7);

Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

$emoncms_version = "8.0.4";
$emoncms_version = "8.0.6";

$ltime = microtime(true);

Expand Down

0 comments on commit be26c22

Please sign in to comment.