From 811fe89d73508671f94dd63107d520e7ad27fdcc Mon Sep 17 00:00:00 2001 From: rurban Date: Mon, 26 Sep 2005 06:28:46 +0000 Subject: [PATCH] beautify tempnam() on Windows. Move execute() from above here git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@4869 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/WikiPluginCached.php | 46 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/lib/WikiPluginCached.php b/lib/WikiPluginCached.php index e9813a6d6..00dc96dfe 100644 --- a/lib/WikiPluginCached.php +++ b/lib/WikiPluginCached.php @@ -1,4 +1,4 @@ -oldFilterThroughCmd($source, $commandLine); } + /** + * Execute system command until the outfile $until exists. + * + * @param cmd string command to be invoked + * @param until string expected output filename + * @return boolean error status; true=ok; false=error + */ + function execute($cmd, $until = false) { + // cmd must redirect stderr to stdout though! + $errstr = exec($cmd); //, $outarr, $returnval); // normally 127 + //$errstr = join('',$outarr); + $ok = empty($errstr); + if (!$ok) { + trigger_error("\n".$cmd." failed: $errstr", E_USER_WARNING); + } elseif ($GLOBALS['request']->getArg('debug')) + trigger_error("\n".$cmd.": success\n", E_USER_NOTICE); + if (!isWindows()) { + if ($until) { + $loop = 100000; + while (!file_exists($until) and $loop > 0) { + $loop -= 100; + usleep(100); + } + } else { + usleep(5000); + } + } + if ($until) + return file_exists($until); + return $ok; + } + + } // WikiPluginCached // $Log: not supported by cvs2svn $ +// Revision 1.19 2004/12/16 18:30:59 rurban +// avoid ugly img border +// // Revision 1.18 2004/11/01 10:43:57 rurban // seperate PassUser methods into seperate dir (memory usage) // fix WikiUser (old) overlarge data session @@ -1136,4 +1176,4 @@ class WikiPluginCached extends WikiPlugin // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: -?> \ No newline at end of file +?> -- 2.45.0