當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Archive_Tar::add方法代碼示例

本文整理匯總了PHP中Archive_Tar::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP Archive_Tar::add方法的具體用法?PHP Archive_Tar::add怎麽用?PHP Archive_Tar::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Archive_Tar的用法示例。


在下文中一共展示了Archive_Tar::add方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addFiles

 /**
  * Method to create an archive file
  *
  * @param  string|array $files
  * @return void
  */
 public function addFiles($files)
 {
     if (!is_array($files)) {
         $files = array($files);
     }
     foreach ($files as $file) {
         // If file is a directory, loop through and add the files.
         if (file_exists($file) && is_dir($file)) {
             $realpath = realpath($file);
             $dir = new Dir($file, true, true);
             $dirFiles = $dir->getFiles();
             foreach ($dirFiles as $fle) {
                 if (file_exists($fle) && !is_dir($fle)) {
                     $fle = $file . DIRECTORY_SEPARATOR . str_replace($realpath . DIRECTORY_SEPARATOR, '', $fle);
                     $this->archive->add($fle);
                 }
             }
             // Else, just add the file.
         } else {
             if (file_exists($file)) {
                 $this->archive->add($file);
             }
         }
     }
 }
開發者ID:akinyeleolubodun,項目名稱:PhireCMS2,代碼行數:31,代碼來源:Tar.php

示例2: add

 /**
  * Add a file to the archive
  *
  * @param string $file The file to add
  *
  * @since 1.0.0
  */
 public function add($file)
 {
     $this->tar->add($file);
 }
開發者ID:NavaINT1876,項目名稱:ccustoms,代碼行數:11,代碼來源:archive.php

示例3: die

$candidateData = $mriData->getCandidateData($scanTypes);
$mriDataDictionary = $mriData->getDataDictionary($scanTypes);
//add all dictionary names as excel column headings
foreach ($mriDataDictionary as $dicKey => $dicVal) {
    //if column not already present
    if (!array_key_exists($dicKey, $candidateData[0])) {
        $candidateData[0][$dicKey] = NULL;
    }
}
writeExcel($Test_name, $candidateData, $dataDir);
// Clean up
// tar and gzip the product
$tarFile = $dumpName . ".tgz";
// produced dump file name and extension
$tar = new Archive_Tar($tarFile, "gz");
$tar->add("./{$dumpName}/") or die("Could not add files!");
// mv (or as php calls it, 'rename') to a web-accessible pickup directory
rename("./{$tarFile}", "{$destinationDir}/{$tarFile}");
//change, if not a subdirectory
// rm left-over junk, from all that excel file generation.
delTree($dataDir);
// Announce completion
echo "{$tarFile} ready in {$destinationDir}\n";
/**
 * Takes a 2D array and saves it as a nicely formatted Excel spreadsheet.
 * Metadata columns are preserved, multiple worksheets are used, when appropriate and headers are maintained.
 *
 * @param string	$Test_name	File name to be used.
 * @param unknown_type $instrument_table 	A 2D array of the data to be presented in Excel format
 * @param unknown_type $dataDir The  output directory.
 */
開發者ID:frankbiospective,項目名稱:Loris,代碼行數:31,代碼來源:excelDump.php

示例4: dirname

 // Increase script execution time-limit to 15 min for archiving.
 if (!ini_get('safe_mode')) {
     @set_time_limit(15 * 60);
 }
 // create Archive_Tar() object
 require_once dirname(__FILE__) . '/Tar.php';
 // Compress the archive file
 if ($archive_gzip) {
     log_msg(date("H:i:s") . ": Archiving SQL files in " . $db_backup_fname . ".gz ...\n");
     $tar = new Archive_Tar(DB_BACKUP_PATH . "/" . $db_backup_fname . ".gz", "gz");
 } else {
     log_msg(date("H:i:s") . ": Archiving SQL files in " . $db_backup_fname . " ...\n");
     $tar = new Archive_Tar(DB_BACKUP_PATH . "/" . $db_backup_fname);
 }
 // Build archive
 if ($tar->add("days weeks months")) {
     log_msg(date("H:i:s") . ": Archiving succesfull.\n");
     log_msg($sep);
     // Remove the SQL files
     if ($archive_del_sql) {
         log_msg(date("H:i:s") . ": Removing SQL-files ...\n");
         del_sql_files("days");
         del_sql_files("weeks");
         del_sql_files("months");
         chdir(DB_BACKUP_PATH);
         if (rmdir($db_name)) {
             log_msg(date("H:i:s") . ": Directory \"{$db_name}\" removed.\n");
         } else {
             log_msg(date("H:i:s") . ": Error removing directory \"{$db_name}\"!\n", 20);
             $db_error_count++;
         }
開發者ID:kashifnasim,項目名稱:nexexcel,代碼行數:31,代碼來源:db_backup.php


注:本文中的Archive_Tar::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。