+ $sCMD = 'psql -p '.$aDSNInfo['port'].' -d '.$aDSNInfo['database'];
+
+ $ahGzipPipes = null;
+ if (preg_match('/\\.gz$/', $sFilename))
+ {
+ $aDescriptors = array(
+ 0 => array('pipe', 'r'),
+ 1 => array('pipe', 'w'),
+ 2 => array('file', '/dev/null', 'a')
+ );
+ $hGzipProcess = proc_open('zcat '.$sFilename, $aDescriptors, $ahGzipPipes);
+ if (!is_resource($hGzipProcess)) fail('unable to start zcat');
+ $aReadPipe = $ahGzipPipes[1];
+ fclose($ahGzipPipes[0]);
+ }
+ else
+ {
+ $sCMD .= ' -f '.$sFilename;
+ $aReadPipe = array('pipe', 'r');
+ }