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


PHP Archive_Tar::setIgnoreList方法代码示例

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


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

示例1: archive

 public static function archive($name = false, $listFilesAndFolders, $export_files_dir, $export_files_dir_name, $backupName, $move = false, $identifier, $type)
 {
     if (empty($export_files_dir)) {
         return;
     }
     $dir_separator = DIRECTORY_SEPARATOR;
     $backupName = 'backup' . $dir_separator . $backupName;
     $installFilePath = 'system' . $dir_separator . 'admin-scripts' . $dir_separator . 'miscellaneous' . $dir_separator;
     $dbSQLFilePath = 'backup' . $dir_separator;
     $old_path = getcwd();
     chdir($export_files_dir);
     $tar = new Archive_Tar($backupName, 'gz');
     if (SJB_System::getIfTrialModeIsOn()) {
         $tar->setIgnoreList(array('system/plugins/mobile', 'system/plugins/facebook_app', 'templates/mobile', 'templates/Facebook'));
     }
     SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
     switch ($type) {
         case 'full':
             $tar->addModify("{$installFilePath}install.php", '', $installFilePath);
             $tar->addModify($dbSQLFilePath . $name, '', $dbSQLFilePath);
             $tar->addModify($listFilesAndFolders, '');
             SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $name);
             break;
         case 'files':
             $tar->addModify("{$installFilePath}install.php", '', $installFilePath);
             $tar->addModify($listFilesAndFolders, '');
             break;
         case 'database':
             $tar->addModify($dbSQLFilePath . $listFilesAndFolders, '', $dbSQLFilePath);
             SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $listFilesAndFolders);
             break;
     }
     chdir($old_path);
     return true;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:35,代码来源:Backup.php

示例2: nc_tgz_create

function nc_tgz_create($archive_name, $file_name, $additional_path = '', $exclude_tag = NULL)
{
    global $DOCUMENT_ROOT, $SUB_FOLDER;
    @set_time_limit(0);
    $path = $DOCUMENT_ROOT . $SUB_FOLDER . $additional_path;
    if (SYSTEM_TAR) {
        $exclude_tag_cmd = '';
        if ($exclude_tag) {
            $exclude_array_tmp = nc_exclude_tag_to_array($path, $exclude_tag);
            $exclude_array = array();
            foreach ($exclude_array_tmp as $item) {
                $exclude_array[] = '--exclude=' . preg_quote(ltrim(substr($item, strlen($path)), '/'));
            }
            $exclude_tag_cmd = implode(' ', $exclude_array);
        }
        exec("cd {$path}; tar -zcf '{$archive_name}' {$exclude_tag_cmd} {$file_name} 2>&1", $output, $err_code);
        if ($err_code) {
            trigger_error("{$output['0']}", E_USER_WARNING);
            return false;
        }
        return true;
    } else {
        $tar_object = new Archive_Tar($archive_name, "gz");
        $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
        if ($exclude_tag) {
            $exclude_array_tmp = nc_exclude_tag_to_array($path, $exclude_tag);
            $exclude_array = array();
            foreach ($exclude_array_tmp as $item) {
                $exclude_array[] = ltrim(substr($item, strlen($path)), '/');
            }
            $tar_object->setIgnoreList($exclude_array);
        }
        chdir($path);
        ob_start();
        $file_name_array = explode(' ', $file_name);
        $res = $tar_object->create($file_name_array);
        if (!$res) {
            ob_end_flush();
        } else {
            ob_end_clean();
        }
        return $res;
    }
}
开发者ID:Blu2z,项目名称:implsk,代码行数:44,代码来源:tar.inc.php

示例3: deflate

 public static function deflate(Engine_Package_Manifest $package, $outputPath)
 {
     // Sanity
     if (!file_exists($outputPath) || !is_dir($outputPath) || !is_writeable($outputPath)) {
         throw new Engine_Package_Exception('Output path does not exist, is not a directory, or is not writeable');
     }
     if (!is_dir($package->getBasePath())) {
         throw new Engine_Package_Exception('Missing package base path');
     }
     self::_loadArchiveClass();
     // Make filenames and paths
     $basePath = $package->getBasePath();
     $archiveFile = $package->getKey() . '.tar';
     $archiveFullPath = $outputPath . DIRECTORY_SEPARATOR . $archiveFile;
     if (file_exists($archiveFullPath) && !unlink($archiveFullPath)) {
         throw new Engine_Package_Exception('Target archive already exists and unable to remove');
     }
     // Start packing
     $archive = new Archive_Tar($archiveFullPath);
     $archive->setIgnoreList(array('CVS', '.svn'));
     // Add all directories, files, and subpackages
     $package->addToArchive($archive);
     return $archiveFullPath;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:24,代码来源:Archive.php

示例4: extractProjectByExtension

 /**
  * Extract via extension
  *
  * @param string $source 
  * @param string $destination 
  * @param string $project 
  * @return void
  * @author Sergey Startsev
  */
 private function extractProjectByExtension($source, $destination, $project)
 {
     $arch = new Archive_Tar("{$destination}{$project}.tar.gz", 'gz');
     $arch->setIgnoreList(array('.git', '.gitignore', '.gitmodules', '.svn', "{$project}.tar.gz"));
     $arch->create(array("../" . pathinfo($source, PATHINFO_BASENAME)));
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:15,代码来源:afsExportTask.class.php


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