Esempio n. 1
0
 private static function build_extension($name)
 {
     $name = strtolower($name);
     $extension_file = ROOT_PATH . DS . 'extensions' . DS . $name;
     $extension_build_dir = ROOT_PATH . DS . 'build' . DS . $name;
     $extension_file_tar = "{$extension_file}.tar";
     $extension_file_gz = "{$extension_file}.tar.gz";
     if (file_exists($extension_file_gz)) {
         \Phar::unlinkArchive($extension_file_gz);
     }
     $phar = new \PharData($extension_file_tar);
     $phar->buildFromDirectory($extension_build_dir);
     $phar->compress(\Phar::GZ);
     if (file_exists($extension_file_tar)) {
         unlink($extension_file_tar);
     }
 }
Esempio n. 2
0
 public function testExtractFileOverwritesExistingFileIfSpecified()
 {
     $key = uniqid();
     $pharPath = $this->getTestDir() . '/phar-extractor-overwrite-' . $key . '.phar';
     $relativeFilePath = 'path/to/file-' . $key . '.txt';
     $extractedFilePath = sys_get_temp_dir() . '/jolinotif/' . $relativeFilePath;
     $this->generatePhar($pharPath, $relativeFilePath, $key, false);
     $this->assertTrue(is_file($pharPath));
     exec('php ' . $pharPath);
     \Phar::unlinkArchive($pharPath);
     $this->generatePhar($pharPath, $relativeFilePath, 'new content', true);
     $this->assertTrue(is_file($pharPath));
     exec('php ' . $pharPath);
     \Phar::unlinkArchive($pharPath);
     $this->assertTrue(is_file($extractedFilePath));
     $this->assertSame('new content', file_get_contents($extractedFilePath));
     unlink($extractedFilePath);
 }
Esempio n. 3
0
function unpack_tar($path)
{
    $response = new Response();
    //echo "Unpack.\n";
    //echo "path:".$path;
    /*
     system("mkdir archiv/name");
     system("cp upload/FosCam9805.tar.gz archiv/name/FosCam9805.tar.gz");
     system("mkdir archiv/name/temp");
     //system("tar -xvzf archiv/name/FosCam9805.tar.gz -C archiv/name/temp/");
    */
    // This input should be from somewhere else, hard-coded in this example
    $file_name = $path;
    // Raising this value may increase performance
    $buffer_size = 4096;
    // read 4kb at a time
    $out_file_name = str_replace('.gz', '', $file_name);
    // Open our files (in binary mode)
    $file = gzopen($file_name, 'rb');
    $out_file = fopen($out_file_name, 'wb');
    // Keep repeating until the end of the input file
    while (!gzeof($file)) {
        // Read buffer-size bytes
        // Both fwrite and gzread and binary-safe
        fwrite($out_file, gzread($file, $buffer_size));
    }
    // Files are done, close files
    fclose($out_file);
    gzclose($file);
    //var_dump($out_file_name);
    //return;
    $phar_data = new PharData($out_file_name);
    $phar_data->extractTo(str_replace(".tar", "", $out_file_name));
    //unlink($out_file_name);
    unset($phar_data);
    Phar::unlinkArchive($out_file_name);
    //echo "finish unpacking archive<br>";
}
Esempio n. 4
0
    public function pack()
    {
        if (file_exists(self::NAME)) {
            \Phar::unlinkArchive(self::NAME);
        }
        $phar = new \Phar(self::NAME);
        // Stub
        $code = <<<'EOC'
#! /usr/bin/env php
<?php

Phar::mapPhar('phpmig.phar');

define('PHPMIG_PHAR', true);
require 'phar://phpmig.phar/vendor/autoload.php';
$app = new PhpMigration\App();
$app->run();

__HALT_COMPILER();
EOC;
        $phar->setStub($code);
        // File
        foreach ($this->filelist as $file) {
            $phar->addFile($file);
        }
        // Vendor
        chdir(__DIR__ . '/../../');
        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('vendor'), 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
        foreach ($iterator as $file) {
            if (!preg_match('/\\/(\\.|test\\/)/i', $file)) {
                $phar->addFile($file);
            }
        }
        // Add execute permission
        chmod(self::NAME, 0755);
    }
Esempio n. 5
0
<?php

chdir(dirname(__DIR__));
$binary = $argv[1];
$scriptFilename = "scripts/{$binary}.php";
$pharFilename = "bin/{$binary}.phar";
$binaryFilename = "bin/{$binary}";
if (file_exists($pharFilename)) {
    Phar::unlinkArchive($pharFilename);
}
if (file_exists($binaryFilename)) {
    Phar::unlinkArchive($binaryFilename);
}
$phar = new Phar($pharFilename, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO, $binary);
$phar->startBuffering();
$directories = array('src', 'vendor', 'scripts');
foreach ($directories as $dirname) {
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirname));
    while ($iterator->valid()) {
        if ($iterator->isFile()) {
            $path = $iterator->getPathName();
            if ('php' == strtolower($iterator->getExtension())) {
                $contents = php_strip_whitespace($path);
                $phar->addFromString($path, $contents);
            } else {
                $phar->addFile($path);
            }
        }
        $iterator->next();
    }
}
Esempio n. 6
0
<?php

// Cleanup
if (file_exists(__DIR__ . 'ThriftSQL.phar')) {
    Phar::unlinkArchive(__DIR__ . 'ThriftSQL.phar');
}
// Create Stub
$stub = <<<EOF
<?php
  include 'phar://' . __FILE__ . '/autoload.php';
  __HALT_COMPILER();
EOF;
// Create Phar
$phar = new Phar('ThriftSQL.phar', null, 'ThriftSQL.phar');
$phar->buildFromDirectory(__DIR__ . '/src');
$phar->setStub($stub);
Esempio n. 7
0
 /**
  * Executes the current command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return null|int     null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('');
     $output->writeln('<comment>Creating package</comment>');
     $this->validate($input, $output);
     try {
         //get all params
         $rutaPhar = $input->getOption('output');
         $alias = $input->getOption('alias') . '.phar';
         $rutaPhar = rtrim($rutaPhar, '/') . '/' . $alias;
         $src = $input->getOption('src');
         $stub = $input->getOption('stub');
         $stubweb = $input->getOption('stubweb');
         $replace = $input->getOption('replace');
         $exclude = $input->getOption('exclude');
         if (true === $replace && is_file($rutaPhar)) {
             \Phar::unlinkArchive($rutaPhar);
         }
         //create and setup Stup object
         $oStub = new Stub();
         if (null !== $stub) {
             $oStub->setStubCli($stub);
         }
         if (null !== $stubweb) {
             $oStub->setStubWeb($stubweb);
         }
         $oStub->setDirTmp($src);
         $oStub->createDefaultStub();
         //create Finder object
         $finder = new Finder();
         $finder->files()->in($src);
         foreach ($exclude as $dirToExclude) {
             $finder->exclude($dirToExclude);
         }
         //inicialize progressbar
         $progress = new ProgressBar($output, count($finder));
         //create phar object
         $phar = new \Phar($rutaPhar, 0, $alias);
         $phar->startBuffering();
         //create default stubs
         $phar->setStub($phar->createDefaultStub($oStub->getStubCli(), $oStub->getStubWeb()));
         $progress->setBarCharacter('<comment>=</comment>');
         $progress->setProgressCharacter('<comment>></comment>');
         //add all files in the phar object
         $progress->start();
         foreach ($finder as $file) {
             $alias = ltrim(str_replace($src, '', $file->getPathname()), '/');
             $phar->addFile($file, $alias);
             $progress->advance();
         }
         $progress->finish();
         $phar->stopBuffering();
         $oStub->deleteTmpStubs();
         $output->writeln('');
         $output->writeln('');
         $output->writeln("<info>Phar created in: </info>" . $rutaPhar);
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . "</error>");
         exit(1);
     }
 }
Esempio n. 8
0
 function toPhar()
 {
     if (isset($this->phar)) {
         return;
     }
     if (file_exists($this->file . '.phar')) {
         try {
             $p = new \Phar($this->file . '.phar');
         } catch (\Exception $e) {
         }
         if ($p->getSignature() === $this->phar->getSignature()) {
             $this->phar = $p;
             if ($this->outfile) {
                 copy($this->file . '.phar', $this->outfile . '.phar');
             }
             return;
         }
         unset($p);
         \Phar::unlinkArchive($this->file . '.phar');
     }
     if (isset($this->tar)) {
         if ($this->signature_algo == \Phar::OPENSSL) {
             throw new Exception('Cannot create tar archive, signature is OpenSSL, ' . 'you must directly create it using the package command');
         }
         if (file_exists($this->file . '.phar')) {
             \Phar::unlinkArchive($this->file . '.phar');
             unlink($this->file . '.phar');
         }
         $this->phar = $this->tar->convertToExecutable(\Phar::PHAR, \Phar::NONE, $this->ext . '.phar');
         if ($this->outfile) {
             copy($this->file . '.phar', $this->outfile . '.phar');
         }
         $this->tar = new \PharData($this->file . '.tar');
         return;
     }
     if (isset($this->tgz)) {
         if ($this->signature_algo == \Phar::OPENSSL) {
             throw new Exception('Cannot create tar archive, signature is OpenSSL, ' . 'you must directly create it using the package command');
         }
         if (file_exists($this->file . '.phar')) {
             \Phar::unlinkArchive($this->file . '.phar');
             unlink($this->file . '.phar');
         }
         $this->phar = $this->tar->convertToExecutable(\Phar::PHAR, \Phar::NONE, $this->ext . '.phar');
         if ($this->outfile) {
             copy($this->file . '.phar', $this->outfile . '.phar');
         }
         $this->tgz = new \PharData($this->file . '.tgz');
         return;
     }
     // by process of elimination, the phar is in zip format
     if (file_exists($this->file . '.phar')) {
         \Phar::unlinkArchive($this->file . '.phar');
         unlink($this->file . '.phar');
     }
     $this->phar = $this->tar->convertToExecutable(\Phar::PHAR, \Phar::NONE, $this->ext . '.phar');
     if ($this->outfile) {
         copy($this->file . '.phar', $this->outfile . '.phar');
     }
     $this->zip = new \PharData($this->file . '.zip');
 }
Esempio n. 9
0
    echo "ERROR: Source file location does not exist!\nCheck your source and try again.\n";
    displayhelp();
    die(1);
}
/*
* Let the user know what is going on
*/
echo "Creating PHAR\n";
echo "Source      : {$sourceLocation}\n";
echo "Destination : {$pharFile}\n";
echo "Stub File   : {$stubFile}\n\n";
/*
* Clean up from previous runs
*/
if (file_exists($pharFile)) {
    Phar::unlinkArchive($pharFile);
}
/*
* Setup the phar
*/
$p = new Phar($pharFile, 0, basename($pharFile));
$p->compressFiles(Phar::GZ);
$p->setSignatureAlgorithm(Phar::SHA1);
/*
* Now build the array of files to be in the phar.
* The first file is the stub file. The rest of the files are built from the directory.
*/
$files = array();
//$files["stub.php"] = $stubFile;
echo "Building the array of files to include.\n";
$rd = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sourceLocation));
Esempio n. 10
0
 /**
  * @covers common\classes\AutoLoader::is_extension_changed
  */
 public function test_is_extension_changed()
 {
     $method = new ReflectionMethod(AutoLoader::class, 'is_extension_changed');
     $method->setAccessible(true);
     self::assertFalse($method->invoke(null, 'tools'));
     $test_file = ROOT_PATH . DS . 'build' . DS . 'tools' . DS . 'test.php';
     if (file_exists('pfmextension://tools' . DS . 'test.php')) {
         unlink('pfmextension://tools' . DS . 'test.php');
     }
     file_put_contents($test_file, '');
     self::assertTrue($method->invoke(null, 'tools'));
     unlink($test_file);
     self::assertFalse($method->invoke(null, 'tools'));
     $tools_file = ROOT_PATH . DS . 'build' . DS . 'tools' . DS . 'tools.php';
     $old_data = file_get_contents($tools_file);
     file_put_contents($tools_file, '/*test comment*/', FILE_APPEND);
     self::assertTrue($method->invoke(null, 'tools'));
     file_put_contents($tools_file, $old_data);
     self::assertFalse($method->invoke(null, 'tools'));
     $extension_file = ROOT_PATH . DS . 'extensions' . DS . 'tools.tar.gz';
     Phar::unlinkArchive($extension_file);
     self::assertFalse($method->invoke(null, 'tools'));
     self::assertTrue(AutoLoader::load_extension('Tools'));
 }
Esempio n. 11
0
             unpack_zip($target_file);
             $target_file = str_replace('.zip', '.tar.gz', $target_file);
             $zip_file = pathinfo($_FILES["fileToUpload"]['name']);
             $tar_file = $target_dir . strtolower($zip_file['filename']);
             if (is_file($tar_file . '.tar.gz')) {
                 unlink($tar_file . '.tar.gz');
             }
             if (is_file($tar_file . '.zip')) {
                 unlink($tar_file . '.zip');
             }
             try {
                 $a = new PharData($tar_file . '.tar');
                 $a->buildFromDirectory($target_dir . strtolower($zip_file['filename']));
                 $a->compress(Phar::GZ);
                 unset($a);
                 Phar::unlinkArchive($tar_file . '.tar');
             } catch (Exception $e) {
                 $response->status = 500;
                 $response->message = $e->getMessage();
                 $response->json($response);
             }
         }
         $wrong_folder = current(explode(".", $_FILES["fileToUpload"]["name"]));
         //store data in DB
         $response = read_json($target_file, $id, 'gz', $wrong_folder);
     } else {
         $response->status = 500;
         $response->message = 'Sorry, your file was not uploaded.';
         $response->json($response);
     }
 }
Esempio n. 12
0
/**
 * Créé et télécharge une archive au format .tar.gz à partir d'un package et de ses dépendences.
 * Si erreur, renvoie JSON_FILE_SYSTEM_ERROR ou JSON_DOWNLOAD_ERROR et exit.
 *
 * @param string $filename Le nom de l'archive à créer/télécharger
 * @param Object $package Les infos du package (doit contenir les strings "name" et "version")
 * @param array[Object] $dependencies Les infos des dépendences (chaque entrée doit contenir les strings "name" et "version")
 */
function sendTar($filename, $package, $dependencies)
{
    $baseDir = createDirIfNotHere(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . DIR_ALL);
    $packDir = createDirIfNotHere($baseDir . DIR_PACKAGE);
    $libDir = createDirIfNotHere($baseDir . DIR_LIB);
    $outDir = createDirIfNotHere($baseDir . DIR_OUT);
    $tempFile = $outDir . $filename . ".tar";
    try {
        $phar = new PharData($tempFile);
    } catch (UnexpectedValueException $e) {
        sendJson(JSON_FILE_SYSTEM_ERROR);
    }
    $packageToInclude = $packDir . $package["name"] . "-" . $package["version"];
    fillArchive($phar, $packageToInclude, $baseDir);
    foreach ($dependencies as $dependency) {
        $dependencyToInclude = $libDir . $dependency["name"] . "-" . $dependency["version"];
        fillArchive($phar, $dependencyToInclude, $baseDir);
    }
    $phar->compress(Phar::GZ);
    $fileToSend = $tempFile . ".gz";
    unset($phar);
    try {
        Phar::unlinkArchive($tempFile);
        // Suppression du fichier .tar
    } catch (PharException $e) {
        sendJson(JSON_FILE_SYSTEM_ERROR);
    }
    header('Content-Description: Archive Transfer');
    header('Content-Type: application/x-compressed');
    header('Content-Disposition: attachment; filename="' . basename($fileToSend) . '"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($fileToSend));
    if (!readfile($fileToSend)) {
        sendJson(JSON_DOWNLOAD_ERROR);
    }
    if (!unlink($fileToSend)) {
        // Suppression du fichier .gz
        die(JSON_FILE_SYSTEM_ERROR);
        // "die" obligatoire car on a déjà utilisé "readFile"
    }
    exit;
}
Esempio n. 13
0
 protected function unlinkArchives()
 {
     unset($this->phar);
     $prefix = $this->runtime . DIRECTORY_SEPARATOR . 'example.phar';
     foreach (['', '.bz2', '.gz'] as $extension) {
         $path = $prefix . $extension;
         if (file_exists($path) === true) {
             \Phar::unlinkArchive($path);
         }
     }
     if (file_exists($this->runtime) === true) {
         FileHelper::removeDirectory($this->runtime);
     }
     mkdir($this->runtime, 0777, true);
 }
Esempio n. 14
0
<?php

Phar::unlinkArchive("/data/users/liranuna/fbcode/hphp/test/zend/bad/ext/phar/tests/phar_gobyebye.phar.php");
Esempio n. 15
0
 public function makePharPlugin($pluginName)
 {
     if ($pluginName === "" or !($plugin = $this->getServer()->getPluginManager()->getPlugin($pluginName)) instanceof Plugin) {
         $this->getLogger()->alert("잘못된 플러그인 이름, 이름을 다시 확인해주세요");
         return;
     }
     $description = $plugin->getDescription();
     if (!$plugin->getPluginLoader() instanceof FolderPluginLoader) {
         $this->getLogger()->alert("플러그인 " . $description->getName() . " 은 이미 PHAR 상태입니다.");
         return;
     }
     $pharPath = $this->getServer()->getDataPath() . "localhost" . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . $description->getName() . "-release" . ".phar";
     if (file_exists($pharPath)) {
         $this->getLogger()->info("Phar 파일 덮어쓰기중...");
         \Phar::unlinkArchive($pharPath);
     }
     $phar = new \Phar($pharPath);
     $phar->setMetadata(["name" => $description->getName(), "version" => $description->getVersion(), "main" => $description->getMain(), "api" => $description->getCompatibleApis(), "depend" => $description->getDepend(), "description" => $description->getDescription(), "authors" => $description->getAuthors(), "website" => $description->getWebsite(), "creationDate" => time()]);
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase");
     $file = $reflection->getProperty("file");
     $file->setAccessible(true);
     $filePath = rtrim(str_replace("\\", "/", $file->getValue($plugin)), "/") . "/";
     $phar->startBuffering();
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath)) as $file) {
         $path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
         if ($path[0] === "." or strpos($path, "/.") !== false) {
             continue;
         }
         $phar->addFile($file, $path);
     }
     $phar->compressFiles(\Phar::GZ);
     $phar->stopBuffering();
     $this->getLogger()->info("PHAR이 해당 플러그인 소스폴더 안에 생성되었습니다. ");
     $this->getLogger()->info("( " . $pharPath . " )");
 }
    //=====On ferme la boundary alternative.
    $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne;
    //==========
    $message .= $passage_ligne . "--" . $boundary . $passage_ligne;
    //=====Ajout de la pièce jointe.
    $message .= "Content-Type: application/zip; name=\"" . $archiveName . '.zip' . "\"" . $passage_ligne;
    $message .= "Content-Transfer-Encoding: base64" . $passage_ligne;
    $message .= "Content-Disposition: attachment; filename=\"" . $archiveName . '.zip' . "\"" . $passage_ligne;
    $message .= $passage_ligne . $attachement . $passage_ligne . $passage_ligne;
    $message .= $passage_ligne . "--" . $boundary . "--" . $passage_ligne;
    //==========
    //=====Envoi de l'e-mail.
    $mail_sent = mail($mail, $sujet, $message, $header);
    //==========
    unset($phar);
    Phar::unlinkArchive($archiveName . '.zip');
    unlink($filePath);
    rmdir($path);
    //copy current buffer contents into $message variable and delete current output buffer
    $message = ob_get_clean();
    //send the email
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
    if ($mail_sent) {
        echo "Transmission complete!";
        require "sendBackMail.php";
    } else {
        echo "Transmission failed, please try again later";
    }
} else {
    echo 'Type de fichier invalide. Merci de le mettre au format .odt, .doc, .docx, .rtf, .pdf ou .rtf';
}
Esempio n. 17
0
<?php

/**
 * package.php
 * Create a phar for thrift impala
 *
 * @author Robert McFrazier <*****@*****.**>
 */
/*
 * change these to match your setup.
 */
define('BASE_PATH', dirname(dirname(__FILE__)));
define('BUILD_PATH', BASE_PATH . DIRECTORY_SEPARATOR . 'build');
define('LIB_PATH', BASE_PATH . DIRECTORY_SEPARATOR . 'lib');
//define('SRC_PATH', APP_PATH.DIRECTORY_SEPARATOR.'src');
/*
 * Clean up from previous 
 */
if (file_exists('php-impala.phar')) {
    Phar::unlinkArchive('php-impala.phar');
}
/*
 * Setup the phar
*/
$archive = new Phar('php-impala.phar', 0, 'php-impala.phar');
$archive->buildFromDirectory(LIB_PATH);
//$archive->buildFromDirectory(SRC_PATH);
$archive->setStub(file_get_contents('php-impala-bootstrap.php'));
Esempio n. 18
0
 /**
  * Pack to a tar.gz archive
  * 
  * @param string $path
  * @param string $target
  * return bool
  */
 public function packTargz($source, $target)
 {
     try {
         $a = new PharData($target . '.tar');
         $a->buildFromDirectory($source);
         $a->compress(Phar::GZ);
         unset($a);
         Phar::unlinkArchive($target . '.tar');
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
file_put_contents($pname . '/hi', 'hi');
$a = fopen($pname . '/hi', 'r');
var_dump(fseek($a, 1), ftell($a));
var_dump(fseek($a, 1, SEEK_CUR), ftell($a));
fclose($a);
var_dump(stat('phar://'));
var_dump(stat('phar://foo.phar'));
var_dump(is_dir($pname));
// this tests coverage of the case where the phar exists and has no files
$phar = new Phar($fname3);
var_dump(file_exists($pname3 . '/test'));
unlink($pname2 . '/hi');
unlink('phar://');
unlink('phar://foo.phar');
unlink($pname . '/oops');
rename('phar://', 'phar://');
rename($pname . '/hi', 'phar://');
rename('phar://foo.phar/hi', 'phar://');
rename($pname . '/hi', 'phar://foo.phar/hi');
ini_set('phar.readonly', 1);
rename($pname . '/hi', $pname . '/there');
ini_set('phar.readonly', 0);
Phar::unlinkArchive($fname);
file_put_contents($pname . '/test.php', '<?php
$a = fopen("./notfound.php", "r");
?>');
include $pname . '/test.php';
?>

===DONE===
                echo "\r{$tmppath}\r";
                if (file_exists($tmppath)) {
                    unlink($tmppath);
                }
                if (file_exists("{$tmppath}.gz")) {
                    unlink("{$tmppath}.gz");
                }
                $day_tar = new PharData($tmppath);
                $day_tar->buildFromDirectory("{$base_dir}/{$year}/{$month}/{$day}", '/\\.js\\.old/');
                $day_tar->compress(Phar::GZ);
                if (file_exists("{$tmppath}.gz")) {
                    $client->putObject(array('Bucket' => "uhcan", 'Key' => "{$base_upload_dir}/{$year}/{$month}/{$filename}.gz", 'SourceFile' => "{$tmppath}.gz"));
                    $client->waitUntilObjectExists(array('Bucket' => "uhcan", 'Key' => "{$base_upload_dir}/{$year}/{$month}/{$filename}.gz"));
                    unset($day_tar);
                    unlink($tmppath);
                    unlink("{$tmppath}.gz");
                    Phar::unlinkArchive($tmppath);
                    Phar::unlinkArchive("{$tmppath}.gz");
                    //echo "\r$tmppath\r";
                } else {
                    //echo "\rNo gzip file created: $tmppath\r";
                }
                unset($day_tar);
            } catch (Exception $e) {
                echo "Exception : " . $e;
                echo "\n{$filename}";
                exit;
            }
        }
    }
}