本文整理汇总了PHP中tar::extractTar方法的典型用法代码示例。如果您正苦于以下问题:PHP tar::extractTar方法的具体用法?PHP tar::extractTar怎么用?PHP tar::extractTar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tar
的用法示例。
在下文中一共展示了tar::extractTar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tar
/**
* Uncompress update TAR
*
* Extract forum files to extensions folder
* Step three (of 3) in Auto Update process.
* @todo Finish auto-update, need work on exstrating, need run auto run update script
* @uses Set_AWC_Forum_BreadCrumbs
* @since Version 2.5.8
*/
function autoupdate_unpack_and_update()
{
global $wgRequest, $IP;
Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_autoupdate') . ' - ' . get_awcsforum_word('admin_expearimental'), true);
$get_ver = $wgRequest->getVal('get_ver');
$save_tar = awc_dir . 'updates/AutoUpdate_tars/' . $get_ver . '.tar';
require awc_dir . 'includes/tar_cls.php';
$tar = new awcsforum_tar_compress_cls();
//$tar->filename = $save_tar;
$arch = new tar();
$arch->extractTar($save_tar, awc_dir . 'updates/AutoUpdate_tars/');
// die($IP);
// $tar->extract_files($IP . '/');
// working, just need to fix the TAR error problem above...
// die(header("Location: " . awc_url . 'admin/get_updates/' . $get_ver));
}
示例2: extract
function extract($src, $dest = false)
{
$path_parts = pathinfo($src);
if (!$dest) {
$dest = $path_parts['dirname'] . '/';
}
$ext = '.' . $path_parts['extension'];
$name = $path_parts['filename'];
foreach ($this->WathArchive as $key => $val) {
if (stripos($ext, $key) !== false) {
$comp = $val;
}
}
if ($comp == 'zip') {
$zip = new zip();
return $zip->extractZip($src, $dest);
} elseif (strlen($comp) > 1) {
$tar = new tar();
if ($comp == 'bz') {
$bzip2 = new bzip2();
$src = $bzip2->extractBzip2($src);
} elseif ($comp == 'gz') {
$gzip = new gzip();
$src = $gzip->extractGzip($src);
}
if ($tar->is_tar($src) || is_file($src)) {
return $tar->extractTar($src, $dest);
} else {
file_put_contents($dest . $name, $src);
}
return $dest;
}
return false;
}
示例3: fopen
// ----- db anlegen
$file_temp = "include/install/community0.5_redaxo2.7.sql";
$h = fopen($file_temp, "r");
$conts = fread($h, filesize($file_temp));
$all = explode("\n", $conts);
$add = new sql();
// $add->debugsql = 1;
foreach ($all as $hier) {
$add->setquery(Trim(str_replace("||||||+N+||||||", "\n", $hier), ";"));
$add->flush();
}
// ----- dateien anlegen
$file_temp = $REX[INCLUDE_PATH] . "/install/community0.5_redaxo2.7.tar.gz";
$tar = new tar();
$tar->openTAR($file_temp);
if (!$tar->extractTar()) {
$err_msg = $I18N->msg("problem_when_extracting") . "<br>";
if (count($tar->message) > 0) {
$err_msg .= $I18N->msg("create_dirs_manually") . "<br>";
reset($tar->message);
for ($fol = 0; $fol < count($tar->message); $fol++) {
$err_msg .= key($tar->message) . "<br>";
next($tar->message);
}
}
}
} elseif ($dbanlegen == 3) {
// ----- update
$fname = "include/install/update2_6-2_7.sql";
$h = fopen($fname, "r");
$create = fread($h, filesize($fname));
示例4: rex_a1_import_files
/**
* Importiert das Tar-Archiv $filename in den Ordner /files
*
* @param string Pfad + Dateinamen zum Tar-Archiv
*
* @return array Gibt ein Assoc. Array zurück.
* 'state' => boolean (Status ob fehler aufgetreten sind)
* 'message' => Evtl. Status/Fehlermeldung
*/
function rex_a1_import_files($filename)
{
global $REX, $I18N_IM_EXPORT;
$return = array();
$return['state'] = false;
if ($filename == '') {
$return['message'] = $I18N_IM_EXPORT->msg("no_import_file_chosen") . "<br>";
return $return;
}
// Ordner /files komplett leeren
rex_deleteDir($REX['INCLUDE_PATH'] . "/../../files");
$tar = new tar();
$tar->openTAR($filename);
if (!$tar->extractTar()) {
$msg = $I18N_IM_EXPORT->msg("problem_when_extracting") . "<br>";
if (count($tar->message) > 0) {
$msg .= $I18N_IM_EXPORT->msg("create_dirs_manually") . "<br>";
reset($tar->message);
for ($fol = 0; $fol < count($tar->message); $fol++) {
$msg .= rex_absPath(str_replace("'", "", key($tar->message))) . "<br>";
next($tar->message);
}
}
} else {
$msg = $I18N_IM_EXPORT->msg("file_imported") . "<br>";
}
$return['state'] = true;
$return['message'] = $msg;
return $return;
}