Exemple #1
0
         case 'gzip':
             if (!gzipVersion()) {
                 die('ERROR: gzip does not appear to be installed');
             }
             $commandline .= ' | gzip -cf' . OUTPUT_COMPRESSION_LEVEL . ' > ' . $newfullfilename;
             break;
         case 'none':
             $commandline .= ' > ' . $newfullfilename;
             break;
         default:
             die('ERROR: OUTPUT_COMPRESSION_TYPE (' . htmlentities(OUTPUT_COMPRESSION_TYPE) . ') must be one of "bzip2", "gzip", "none"');
             break;
     }
     set_time_limit(300);
     // shouldn't take nearly this long for anything, but just in case...
     echo SafeExec($commandline);
     echo '<hr>';
 } else {
     switch (OUTPUT_COMPRESSION_TYPE) {
         case 'gzip':
         case 'none':
             // great
             break;
         case 'bzip2':
             if (!function_exists('bzopen')) {
                 die('ERROR: PHP-bzip2 support does not appear to be installed, please change OUTPUT_COMPRESSION_TYPE to one of "gzip" or "none"');
             }
             break;
         default:
             die('ERROR: OUTPUT_COMPRESSION_TYPE (' . htmlentities(OUTPUT_COMPRESSION_TYPE) . ') must be one of "bzip2", "gzip", "none"');
             break;
function bzip2Version()
{
    static $version = null;
    if (is_null($version)) {
        $version = false;
        $execdversion = SafeExec('bzip2 --version 2>&1');
        if (eregi('^bzip2(.*) Version ([0-9\\.]+)', $execdversion, $matches)) {
            $version = $matches[2];
        } elseif (eregi('^bzip2:', $execdversion, $matches)) {
            $version = 'installed_unknown_version';
        }
    }
    return $version;
}
Exemple #3
0
function bzip2Version()
{
    static $version = null;
    if ($version === null) {
        $version = false;
        $execdversion = SafeExec('bzip2 --version 2>&1');
        if (preg_match('#^bzip2(.*) Version ([0-9\\.]+)#i', $execdversion, $matches)) {
            $version = $matches[2];
        } elseif (preg_match('#^bzip2:#i', $execdversion, $matches)) {
            $version = 'installed_unknown_version';
        }
    }
    return $version;
}