Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

Re: [MediaWiki-CVS] SVN: [37787] trunk/phase3/includes

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


Simetrical+wikilist at gmail

Jul 17, 2008, 10:20 AM

Post #1 of 2 (384 views)
Permalink
Re: [MediaWiki-CVS] SVN: [37787] trunk/phase3/includes

On Thu, Jul 17, 2008 at 8:19 AM, <werdna[at]svn.wikimedia.org> wrote:
> + $h = popen( $cmd, 'r' );
> +
> + $diff = '';
> +
> + do {
> + $data = fread( $h, 8192 );
> + if ( strlen( $data ) == 0 ) {
> + break;
> + }
> + $diff .= $data;
> + } while ( true );
> +
> + // Clean up
> + pclose( $h );
> . . .
> + $diff_lines = explode( "\n", $diff );

Couldn't all this be replaced with the following?

$diff_lines = array();
exec( $cmd, $diff_lines );

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


tstarling at wikimedia

Jul 18, 2008, 12:57 AM

Post #2 of 2 (358 views)
Permalink
Re: [MediaWiki-CVS] SVN: [37787] trunk/phase3/includes [In reply to]

Simetrical wrote:
> On Thu, Jul 17, 2008 at 8:19 AM, <werdna[at]svn.wikimedia.org> wrote:
>> + $h = popen( $cmd, 'r' );
>> +
>> + $diff = '';
>> +
>> + do {
>> + $data = fread( $h, 8192 );
>> + if ( strlen( $data ) == 0 ) {
>> + break;
>> + }
>> + $diff .= $data;
>> + } while ( true );
>> +
>> + // Clean up
>> + pclose( $h );
>> . . .
>> + $diff_lines = explode( "\n", $diff );
>
> Couldn't all this be replaced with the following?
>
> $diff_lines = array();
> exec( $cmd, $diff_lines );

No, use wfShellExec(). All of PHP's exec functions are broken on Windows
and need some hacky workarounds. Also note that exec() will strip trailing
whitespace from each line and thus corrupt the diff.

-- Tim Starling


_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.