[Tickets #3551] NEW: CLI enchanment to read in blocks from stdin

bugs@bugs.horde.org bugs at bugs.horde.org
Wed Mar 1 07:46:36 PST 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=3551
-----------------------------------------------------------------------
 Ticket             | 3551
 Created By         | air2 at dds.nl
 Summary            | CLI enchanment to read in blocks from stdin
 Queue              | Horde Framework Packages
 Version            | HEAD
 State              | New
 Priority           | 1. Low
 Type               | Enhancement
 Owners             | 
-----------------------------------------------------------------------


air2 at dds.nl (2006-03-01 07:46) wrote:

To process the mail, in the mail-filter.php of the whups package, in a
memory-frieldly way, its necessary to read the input in blocks, write them
to a file, read the next part etc. instead of reading the whole message into
 a variable at once. As now happens:

$text = $cli->readStdin();

So I suppose an extension of the CLI in the framework, an extra function:

$cli->readStdinByteRange (&$output, &$read, $bytes)

It returns true if there is more data, and false if the feof is reached. 
In this way it can be used in a loop liike this one:

while ($cli->readStdinByteRange (&$output, &$read, $bytes)) {
   fwrite($handle, $output);
}

An patch containing an little enchangement voor the CLI packages is
included.





More information about the bugs mailing list