? .DS_Store ? .RELEASE-NOTES.marks ? ._3244.diff ? ._INSTALL ? ._LanguageMk.php.patch.txt ? ._LocalSettings.php ? ._README ? ._README-MYSQL41 ? ._RELEASE-NOTES ? ._UPGRADE ? ._dv.html ? ._fixes.diff ? ._install-utils.inc ? ._quick.html ? ._showfile.php ? ._test.php ? ._test2.php ? 3210.diff ? 3220.diff ? 3244.diff ? 3412.diff ? 3448.diff ? INSTALL.work ? LanguageMk.php.patch.txt ? LocalSettings.php.iatest ? LocalSettings.php.snork ? LocalSettings.php.work ? README-MYSQL41 ? UPGRADE.work ? amethyst-ie7.png ? arf ? arp ? big1.txt ? big2.txt ? bits.diff ? blarf.diff ? broke.diff ? date-3817.diff ? die.diff ? dv.html ? evil.diff ? evildiv.html ? fixes.diff ? g ? i.diff ? import.diff ? keep ? korp ? lcfirst.patch ? lcfirst.patch.txt ? lic-fix.diff ? live-hacks.diff ? meep ? morf ? morp ? murf ? murp ? nasty.html ? new.leuksman.com ? pages_articles.xml.7z ? pages_current.xml.7z ? phpinfo.php ? quick.html ? rc.diff ? rc2.diff ? rc3.diff ? san-test.diff ? san-test2.diff ? san.diff ? san2.diff ? showfile.php ? sigh.diff ? soo ? temp.diff ? test.php ? test2.php ? watch-1.diff ? watch-2.diff ? watch-images.diff ? wfShellExec.diff ? x.png ? z ? zwinger.wikimedia.org ? config/._index.php ? docs/._check.sh ? docs/._deferred.txt ? docs/._export-0.2.xsd ? docs/._export-0.3.xsd ? docs/._export-demo.xml ? docs/._globals.txt ? docs/._hooks.txt ? docs/._language.txt ? docs/._linkcache.txt ? docs/._skin.txt ? docs/._title.txt ? docs/._user.txt ? docs/check.sh ? extensions/demo ? includes/._Article.php ? includes/._Block.php ? includes/._ChangesList.php ? includes/._Database.php ? includes/._DateFormatter.php ? includes/._DefaultSettings.php ? includes/._Defines.php ? includes/._EditPage.php ? includes/._Export.php ? includes/._FileStore.php ? includes/._GlobalFunctions.php ? includes/._Group.php ? includes/._HTMLForm.php ? includes/._Hooks.php ? includes/._Image.php ? includes/._ImagePage.php ? includes/._Licenses.php ? includes/._LinkCache.php ? includes/._Linker.php ? includes/._LinksUpdate.php ? includes/._LoadBalancer.php ? includes/._MacBinary.php ? includes/._Math.php ? includes/._Namespace.php ? includes/._OutputPage.php ? includes/._PageHistory.php ? includes/._Parser.php ? includes/._ParserXML.php ? includes/._QueryPage.php ? includes/._Revision.php ? includes/._Sanitizer.php ? includes/._SearchEngine.php ? includes/._Setup.php ? includes/._Skin.php ? includes/._SkinTemplate.php ? includes/._SpecialBlockip.php ? includes/._SpecialBrokenRedirects.php ? includes/._SpecialDeadendpages.php ? includes/._SpecialDisambiguations.php ? includes/._SpecialDoubleRedirects.php ? includes/._SpecialExport.php ? includes/._SpecialImport.php ? includes/._SpecialIpblocklist.php ? includes/._SpecialListusers.php ? includes/._SpecialLog.php ? includes/._SpecialLonelypages.php ? includes/._SpecialMovepage.php ? includes/._SpecialNewimages.php ? includes/._SpecialPage.php ? includes/._SpecialRecentchanges.php ? includes/._SpecialRecentchangeslinked.php ? includes/._SpecialSearch.php ? includes/._SpecialStatistics.php ? includes/._SpecialUpload.php ? includes/._SpecialUserlogin.php ? includes/._SpecialUserrights.php ? includes/._SpecialValidate.php ? includes/._SpecialVersion.php ? includes/._SpecialWantedpages.php ? includes/._SpecialWatchlist.php ? includes/._SpecialWhatlinkshere.php ? includes/._SquidUpdate.php ? includes/._Title.php ? includes/._User.php ? includes/._WebRequest.php ? includes/._WikiError.php ? includes/Article.php.work ? includes/Block.php.work ? includes/ExternalStoreDB.php.work ? includes/FileStore.php ? includes/HistoryBlob.php.work ? includes/LinkCache.php.work ? includes/PageHistory.php.x ? includes/Parser.php.work ? includes/Revision.php.work ? includes/Sanitizer.php.safe ? includes/Sanitizer.php.work ? includes/SpecialExport.php.work ? includes/SpecialListusers.php.work ? includes/SpecialLog.php.work ? includes/SpecialUpload.php.work ? includes/SpecialWatchlist.php.evil ? includes/normal/UtfNormal.php.work ? includes/normal/UtfNormalUtil.php.work ? languages/._Language.php ? languages/._LanguageAf.php ? languages/._LanguageAr.php ? languages/._LanguageCs.php ? languages/._LanguageDa.php ? languages/._LanguageEo.php ? languages/._LanguageFy.php ? languages/._LanguageLa.php ? languages/._LanguagePl.php ? languages/._LanguageRu.php ? languages/._LanguageSk.php ? languages/._LanguageSq.php ? languages/._LanguageSr.php ? languages/._Names.php ? languages/._sq.php ? languages/hack-datepref ? languages/new ? maintenance/._FiveUpgrade.inc ? maintenance/._FiveUpgrade.php ? maintenance/._backup.inc ? maintenance/._backup.sh ? maintenance/._backupPrefetch.inc ? maintenance/._benchmarkPurge.php ? maintenance/._cleanupCaps.php ? maintenance/._cleanupDupes.inc ? maintenance/._cleanupTitles.php ? maintenance/._commandLine.inc ? maintenance/._convertUtf8.php ? maintenance/._demox.xml ? maintenance/._diffTest.php ? maintenance/._dumpBackup.php ? maintenance/._dumpTextPass.php ? maintenance/._eek.php ? maintenance/._eval.php ? maintenance/._importDump.php ? maintenance/._importDump.phps.txt ? maintenance/._importLogs.inc ? maintenance/._importPages.php ? maintenance/._importPhase2.php ? maintenance/._namespaceDupes.php ? maintenance/._parserTests.inc ? maintenance/._parserTests.php ? maintenance/._parserTests.txt ? maintenance/._rebuildall.php ? maintenance/._rebuildrecentchanges.inc ? maintenance/._recount.sql ? maintenance/._refreshLinks.inc ? maintenance/._sample-conversion ? maintenance/._tables.sql ? maintenance/._tehbig.php ? maintenance/._test.php ? maintenance/._updaters.inc ? maintenance/._upgrade1_5.php ? maintenance/._uploadSchemaUpdate.php ? maintenance/._userDupes.inc ? maintenance/._userDupes.php ? maintenance/._xxx ? maintenance/backup-test ? maintenance/backup-test-second ? maintenance/backup.sh ? maintenance/checkTitles.php ? maintenance/chunk1.gz ? maintenance/chunk2.gz ? maintenance/chunk3.gz ? maintenance/combined.xml ? maintenance/commandLine.inc.work ? maintenance/demo.xml ? maintenance/demo2.xml ? maintenance/demox.xml ? maintenance/diffTest.php ? maintenance/dump-en.sh ? maintenance/eek.php ? maintenance/fail1 ? maintenance/fail2 ? maintenance/filterFix.c ? maintenance/flarf ? maintenance/flarf2 ? maintenance/flarf3 ? maintenance/full.xml ? maintenance/import.log ? maintenance/importDump.phps.txt ? maintenance/importDumpFixPages.php ? maintenance/morp ? maintenance/mysql5 ? maintenance/parserTests.txt.work ? maintenance/run1 ? maintenance/run2 ? maintenance/sample-conversion ? maintenance/single.xml ? maintenance/test.php ? maintenance/testdump.sh ? maintenance/upgrading-test ? maintenance/uploadSchemaUpdate.php ? maintenance/wonky ? maintenance/wonky2 ? maintenance/wonky3 ? maintenance/wonky4 ? maintenance/work.php ? maintenance/xxx ? maintenance/archives/._patch-pagelinks.sql ? maintenance/archives/._patch-user_groups.sql ? maintenance/archives/._patch-user_nameindex.sql ? maintenance/archives/._patch-val_ip.sql ? maintenance/archives/._patch-watchlist-null.sql ? math/debug ? skins/._MonoBook.php ? skins/common/._commonPrint.css ? skins/common/._wikibits.js ? skins/monobook/._main.css ? tests/._GlobalTest.php ? tests/._RunTests.php ? tests/._SanitizerTest.php ? tests/._SearchEngineTest.php Index: includes/GlobalFunctions.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/GlobalFunctions.php,v retrieving revision 1.225 diff -u -r1.225 GlobalFunctions.php --- includes/GlobalFunctions.php 3 Nov 2005 02:21:01 -0000 1.225 +++ includes/GlobalFunctions.php 9 Nov 2005 03:22:10 -0000 @@ -56,6 +56,26 @@ } } +if( !function_exists( 'stream_get_contents' ) ) { + # Exists in PHP 5+ + function stream_get_contents( $handle, $maxlength=-1 ) { + if( $maxlength != -1 ) { + return fread( $handle, $maxlength ); + } else { + $bufsize = 65536; + $buffer = ''; + while( !feof( $handle ) ) { + $read = fread( $handle, $bufsize ); + if( $read === false ) { + return false; + } + $buffer .= $read; + } + return $buffer; + } + } +} + if( !function_exists('is_a') ) { # Exists in PHP 4.2.0+ function is_a( $object, $class_name ) { @@ -863,6 +883,40 @@ } /** + * Run an external program, and return its output as a string. + * + * shell_exec() doesn't work in safe_mode; if on, runs some wrapper code with + * popen() for the equivalent results. May require special configuration to + * ensure that required programs are in safe_mode_exec_dir. + * + * Quirks: shell_exec() returns null on no output, rather than empty string. + * + * @param string $command + * @return string + * @fixme popen() corrupts arguments in safe_mode. + * This needs to be worked around. + */ +function wfShellExec( $command ) { + if( true or ini_get( 'safe_mode' ) ) { + echo "[$command]"; + $stream = popen( $command, 'r' ); + if( $stream === false || $stream === null ) { + return null; + } else { + $output = stream_get_contents( $stream ); + fclose( $stream ); + if( $output === '' || $output === false ) { + return null; + } else { + return $output; + } + } + } else { + return shell_exec( $command ); + } +} + +/** * wfMerge attempts to merge differences between three texts. * Returns true for a clean merge and false for failure or a conflict. */ Index: includes/Math.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/Math.php,v retrieving revision 1.25 diff -u -r1.25 Math.php --- includes/Math.php 4 Nov 2005 02:33:50 -0000 1.25 +++ includes/Math.php 9 Nov 2005 03:22:10 -0000 @@ -65,7 +65,7 @@ } wfDebug( "TeX: $cmd\n" ); - $contents = `$cmd`; + $contents = wfShellExec( $cmd ); wfDebug( "TeX output:\n $contents\n---\n" ); if (strlen($contents) == 0) {