Example #1
0
 /** Compress*/
 public function index11Action()
 {
     echo PUBLIC_PATH;
     $options = array('adapter' => 'zip', 'options' => array('archive' => PUBLIC_PATH . '/tmp/compress.zip'));
     $filter = new \Zend\Filter\Compress($options);
     $input = PUBLIC_PATH . '/tmp/fonts';
     $output = $filter->filter($input);
     return false;
 }
Example #2
0
 public function index11Action()
 {
     echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>";
     $option = array("adapter" => "zip", "options" => array("archive" => PUBLIC_PATH . "/zip/compress.zip"));
     $input = PUBLIC_PATH . "/zip/application.config.php";
     $filter = new \Zend\Filter\Compress($option);
     $filter->filter($input);
     return false;
 }
Example #3
0
 protected static function saveVendorPkgs($checksum = '')
 {
     $checksum !== '' || ($checksum = self::getVendorsChecksum());
     // define framework cache dir. on user home directory
     $cacheHomeDir = getenv("HOME") . DS . '.phpalchemy' . DS . 'cache' . DS . 'composer' . DS;
     // create cache dir. if it doesn't exist.
     if (!is_dir($cacheHomeDir)) {
         \Alchemy\Console\Alchemist::createDir($cacheHomeDir);
     }
     // create zip file
     // save zip file on framework cache dir
     require_once 'Archive_Tar/Archive/Tar.php';
     $filter = new \Zend\Filter\Compress(array('adapter' => 'Tar', 'options' => array('archive' => $cacheHomeDir . 'vendor.tar')));
     $compressed = $filter->filter('vendor/');
     if (!$compressed) {
         $output->writeln("<error>Couldn't save the cache tarball.</error>");
     }
     copy('composer.phar', $cacheHomeDir . 'composer.phar');
     copy('composer.lock', $cacheHomeDir . 'composer.lock');
     $vendors = self::getVendorsList();
     $meta = array('date' => date('Y-m-d H:i:s'), 'checksum' => $checksum, 'packages' => $vendors->require);
     file_put_contents($cacheHomeDir . 'meta.json', json_encode($meta));
 }