当前位置: 首页>>代码示例>>PHP>>正文


PHP Archive_Tar::setIgnoreRegexp方法代码示例

本文整理汇总了PHP中Archive_Tar::setIgnoreRegexp方法的典型用法代码示例。如果您正苦于以下问题:PHP Archive_Tar::setIgnoreRegexp方法的具体用法?PHP Archive_Tar::setIgnoreRegexp怎么用?PHP Archive_Tar::setIgnoreRegexp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Archive_Tar的用法示例。


在下文中一共展示了Archive_Tar::setIgnoreRegexp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exportAction

 public function exportAction()
 {
     $themes = Engine_Api::_()->getDbtable('themes', 'core')->fetchAll();
     if (!($row = $themes->getRowMatching('name', $this->_getParam('name')))) {
         throw new Engine_Exception("Theme not found: " . $this->_getParam('name'));
     }
     //$targetFilename = APPLICATION_PATH . '/temporary/theme_export.tar';
     $target_filename = tempnam(APPLICATION_PATH . '/temporary/', 'theme_');
     $template_dir = APPLICATION_PATH . '/application/themes/' . $row->name;
     $tar = new Archive_Tar($target_filename);
     $tar->setIgnoreRegexp("#CVS|\\.svn#");
     $tar->createModify($template_dir, null, dirname($template_dir));
     chmod($target_filename, 0777);
     header('Content-Type: application/x-tar');
     header("Content-disposition: filename={$row->name}.tar");
     readfile($target_filename);
     @unlink($target_filename);
     exit;
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:19,代码来源:AdminThemesController.php

示例2: compress

 /**
  *
  * Compress theme into archive file
  * @param string $path target archive path
  * @param string $name archive filename
  * @return string arcive path
  */
 public function compress($path, $name = null)
 {
     if (!$name) {
         $name = "webasyst.{$this->app}.theme.{$this->id}.tar.gz";
     }
     $target_file = "{$path}/{$this->app}/{$name}";
     $autoload = waAutoload::getInstance();
     $autoload->add('Archive_Tar', 'wa-installer/lib/vendors/PEAR/Tar.php');
     $autoload->add('PEAR', 'wa-installer/lib/vendors/PEAR/PEAR.php');
     if (file_exists($this->path) && class_exists('Archive_Tar', true)) {
         waFiles::create($target_file);
         $tar_object = new Archive_Tar($target_file, true);
         $tar_object->setIgnoreRegexp('@(\\.(php\\d?|svn|git|fw_|files\\.md5$))@');
         $path = getcwd();
         chdir(dirname($this->path));
         if (!$tar_object->create('./' . basename($this->path))) {
             waFiles::delete($target_file);
         }
         chdir($path);
     }
     return $target_file;
 }
开发者ID:quadrodesign,项目名称:webasyst-framework,代码行数:29,代码来源:waTheme.class.php

示例3: plug_download

function plug_download($idplug, $idclient, $_zip = false, $_name = false, $_ext = false)
{
    global $rep, $cfg_cms, $sess, $cms_log;
    $plugin = $rep->plug_data($idplug, $idclient);
    // todo:zlib abfrage + popup
    if (is_array($plugin)) {
        // Event
        $zip = false;
        require_once "Archive/Tar.php";
        $xmlstring = $rep->plug_generate($plugin);
        $name = $_name == '' ? $plugin['root_name'] : trim($_name);
        $zip = $cfg_cms['gzip_enabled'] == true && $_zip == true ? true : false;
        if ($zip === true && ($_ext == 'tar' || $_ext == 'tgz')) {
            $_ext = 'tgz';
        } elseif ($zip === false && ($_ext == 'tar' || $_ext == 'tgz')) {
            $_ext = 'tar';
        } else {
            $_ext = 'cmsplugin';
        }
        $_mtype = $zip === true ? 'application/x-compressed' : 'application/x-tar';
        $file = $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'upload/' . 'out/' . $name . '.' . $_ext;
        $download = $cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'upload/' . 'out/' . $name . '.' . $_ext;
        lib_write_file($cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'plugins/' . $name . '/' . $name . '.cmsplug', $xmlstring);
        if (false == ($tar = new Archive_Tar($file, $zip))) {
            return '1615';
        } elseif ($tar == '-1' && $zip == true) {
            return plug_download($idplug, $idclient, false, $_name, $_ext);
        }
        $old_working_dir = getcwd();
        chdir($cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'plugins/');
        $tar->setIgnoreRegexp("#CVS|\\.svn#");
        $tar->create(trim($name));
        chdir($old_working_dir);
        ob_end_clean();
        header('Content-Type: ' . $_mtype);
        header('Content-Transfer-Encoding: binary');
        header('Content-Description: Download Data');
        header('Content-Length: ' . filesize($file));
        header('Content-Disposition: attachment; filename="' . basename($file) . '"');
        header('Expires: 0');
        header('Cache-Control: no-cache, must-revalidate');
        header('Pragma: no-cache');
        //old function: header('Location:' . $download);
        readfile($file);
        //Log
        $cms_log->info('user', 'plug_download', array('idplug' => $idplug, 'name' => $name));
        //Event
        fire_event('plug_download', array('idplug' => $idplug, 'name' => $name, 'idclient' => $idclient));
        lib_delete_file($file);
        exit;
    }
}
开发者ID:rbraband,项目名称:sefrengo,代码行数:52,代码来源:fnc.plug.php


注:本文中的Archive_Tar::setIgnoreRegexp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。