r39295 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39294‎ | r39295 | r39296 >
Date:16:23, 13 August 2008
Author:demon
Status:old
Tags:
Comment:
Catch php installs who have proc_open() disabled.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -689,20 +689,22 @@
690690 2 => array('file', wfGetNull(), 'a')
691691 );
692692 $pipes = array();
693 - $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
694 - if (is_resource($process)) {
695 - // Theoretically, this style of communication could cause a deadlock
696 - // here. If the stdout buffer fills up, then writes to stdin could
697 - // block. This doesn't appear to happen with tidy, because tidy only
698 - // writes to stdout after it's finished reading from stdin. Search
699 - // for tidyParseStdin and tidySaveStdout in console/tidy.c
700 - fwrite($pipes[0], $text);
701 - fclose($pipes[0]);
702 - while (!feof($pipes[1])) {
703 - $cleansource .= fgets($pipes[1], 1024);
 693+ if( function_exists('proc_open') ) {
 694+ $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
 695+ if (is_resource($process)) {
 696+ // Theoretically, this style of communication could cause a deadlock
 697+ // here. If the stdout buffer fills up, then writes to stdin could
 698+ // block. This doesn't appear to happen with tidy, because tidy only
 699+ // writes to stdout after it's finished reading from stdin. Search
 700+ // for tidyParseStdin and tidySaveStdout in console/tidy.c
 701+ fwrite($pipes[0], $text);
 702+ fclose($pipes[0]);
 703+ while (!feof($pipes[1])) {
 704+ $cleansource .= fgets($pipes[1], 1024);
 705+ }
 706+ fclose($pipes[1]);
 707+ proc_close($process);
704708 }
705 - fclose($pipes[1]);
706 - proc_close($process);
707709 }
708710
709711 wfProfileOut( $fname );

Follow-up revisions

RevisionCommit summaryAuthorDate
r39662Revert Parser.php to r39295 good state....brion20:59, 19 August 2008

Status & tagging log