Undefined index: csvdownloadlimit_mb in

I recently tried to export a feed from both the graph view and also feed view, but run into an issue (using emonCMS Version: low-write 10.1.8) where even tiny amounts of data won’t download. The error message is:

<br />
<b>Notice</b>:  Undefined index: csvdownloadlimit_mb in <b>/var/www/emoncms/Modules/feed/feed_model.php</b> on line <b>676</b><br />
{"success":false,"message":"CSV download limit exeeded downloadsize=440640"}

Checking line 676 in the file refers back to settings.php where download limit is “25,” (note the “,”). If I edit this and remove the comma, emoncms won’t load, even after a reboot. I don’t use php so not sure if the comma means anything or is ignored.
Any suggestions welcome…

The reason for the comma is that this is a PHP object declaration. The new ini settings method does away with that.

However, there is a bug. The setting I think you will find is csv_downloadlimit_mb and the system is looking for csvdownloadlimit_mb.

If you delete the first underscore in the settings file, it will probably work.

Actually you need to make the change somewhere else to try to fix this.

in /var/www/emoncms/Modules/feed/feed_model.php add in an underscore after csv.

Can you try this please?

That’s fixed the download from the feed view (good for 24 MB!), but still an error when downloading from the graph csv menu. Is that using a different script?

Can you confirm you did my edited suggestion (edit the feed model file)?

Can you paste the actual error please.

Yes, edited the feed_model.php file for:

  // Download limit
        $downloadsize = (($end - $start) / $outinterval) * 17; // 17 bytes per dp
        if ($downloadsize>($this->settings['csv_downloadlimit_mb']*1048576)) {
            $this->log->warn("csv_export() CSV download limit exeeded downloadsize=$downloadsize feedid=$feedid");
            return array('success'=>false, 'message'=>"CSV download limit exeeded downloadsize=$downloadsize");
        }

The error message from graph csv is different:

<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/var/www/emoncms/Modules/graph/graph_controller.php</b> on line <b>97</b><br />
<br />
<b>Warning</b>:  file_get_contents(http://192.168.20.24/emoncms//feed/aget.json?id=87): failed to open stream: HTTP request failed! HTTP/1.0 406 Not Acceptable
 in <b>/var/www/emoncms/Modules/graph/graph_controller.php</b> on line <b>130</b><br />
"Date-time string",": ()"

That is a different issue, @emrys can you take a look? I can’t see anything obvious.

OK I’ve raised a PR.

Many thanks.

You will need to revert your change before you will be able to do an update once the change has been agreed and pushed out.