本文整理汇总了PHP中Archive_Tar::_openRead方法的典型用法代码示例。如果您正苦于以下问题:PHP Archive_Tar::_openRead方法的具体用法?PHP Archive_Tar::_openRead怎么用?PHP Archive_Tar::_openRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive_Tar
的用法示例。
在下文中一共展示了Archive_Tar::_openRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: step2
function step2($file = "")
{
global $_CONFIG, $filepath;
$DBcreated = $_REQUEST[DBcreated];
if ($DBcreated == 'on') {
$DBhostname = $_REQUEST['mysql_server'];
$DBuserName = $_REQUEST['mysql_username'];
$DBpassword = $_REQUEST['mysql_pass'];
$DBname = $_REQUEST['mysql_db'];
$_CONFIG['mysqli'] = new mysqli($DBhostname, $DBuserName, $DBpassword, $DBname);
/* check connection */
if ($_CONFIG['mysqli']->connect_errno) {
printf("Connect failed: %s\n", $_CONFIG['mysqli']->connect_error);
exit;
}
$_CONFIG['mysqli']->query("SET sql_mode='';");
$_CONFIG['mysqli']->query("SET foreign_key_checks = 0;");
if ($_REQUEST['charset_of_file'] != "") {
$_CONFIG['mysqli']->query("SET NAMES " . $_REQUEST['charset_of_file'] . "");
} else {
$_CONFIG['mysqli']->query("SET NAMES utf8;");
}
}
if ($_REQUEST['do_database'] != 1) {
############ DATABASE ONLY RESTRICTION##################################################
########################### START FTP MODE #################################
if ($_REQUEST[transfer_mode] == 2) {
$_CONFIG[output_path] = $_CONFIG[output_path] . "/archive_tmp/";
@mkdir($_CONFIG[output_path]);
// set up basic connection
$conn_id = @ftp_connect($_REQUEST[ftp_server], $_REQUEST[ftp_port]) or die("<span class='error'>Could not connect to {$_REQUEST['ftp_server']} on port {$_REQUEST['ftp_port']}! Ftp connection has failed!</span>");
// login with username and password
$login_result = @ftp_login($conn_id, $_REQUEST[ftp_user], $_REQUEST[ftp_pass]) or die("<span class='error'>Could not login to ftp server for user {$_REQUEST['ftp_user']} and provided pass! Ftp connection has failed!</span>");
// check connection
if (!$conn_id || !$login_result) {
echo "<b style='color:red'>FTP connection has failed!</b>";
echo "<b style='color:red'>Attempted to connect to " . $_REQUEST[ftp_server] . ":" . $_REQUEST[ftp_port] . " for user " . $_REQUEST[ftp_user] . "</b>";
return;
} else {
echo "<br />Connected to {$_REQUEST['ftp_server']}, for user {$_REQUEST['ftp_user']}, starting transfer...<br />";
}
$ftp_dir_original = ftp_pwd($conn_id);
@ftp_mkdir($conn_id, $_REQUEST[ftp_path]);
// try to change the directory to somedir
if (@ftp_chdir($conn_id, $_REQUEST[ftp_path])) {
echo "Current directory is now: <b>" . ftp_pwd($conn_id) . "</b>\n";
} else {
echo "<b style='color:red'>Couldn't change directory to <b>{$_REQUEST['ftp_path']}</b>, please verify that the ftp location exists or use the \"Install files directly\" option!</b><br />\n";
return;
}
@ftp_chdir($conn_id, $ftp_dir_original);
}
########################## END FTP MODE ######################################
##### START extract ######
if ($_REQUEST['refresh'] < 1) {
$ext = substr($file, strlen($file) - 4, strlen($file));
if ($_REQUEST['file_utilities'] != '1') {
$tar_object = new Archive_Tar($file);
if ($_REQUEST['manual_ftp']) {
$tar_object->_openRead();
fseek($tar_object->_file, $_CONFIG['seek']);
$seek = $tar_object->_extractList($_CONFIG['output_path'], $return, "partial", "", "", $_CONFIG['filesLimit']);
$seek = $seek - 512;
//reverse 512 bytes
if ($seek > 0) {
$backupSize = filesize($file);
$rurl = rurl($seek, $backupSize);
$percent = sprintf("%.2f", $seek * 100 / $backupSize);
echo "<h3>Processing files - " . $percent . "%</h3>";
echo "<script> document.location='" . $rurl . "'</script>";
return;
}
$_REQUEST['fpos'] = 0;
$_REQUEST['chunk'] = 0;
} else {
$tar_object->extract($_CONFIG['output_path']);
#$tar_object->extractList("backups/perm.txt", $_CONFIG['output_path']);
}
} else {
if ($ext == '.tgz') {
$compress = 'z';
} else {
$compress = '';
}
shell_exec("tar -x" . $compress . "pf {$file} -C {$_CONFIG['output_path']}");
}
}
##### END extract ######
$new_arr = array();
#@chmod($_CONFIG[output_path], 0777);
$tran_file = $_CONFIG[output_path] . "/transfer.txt";
if ($_REQUEST[transfer_mode] == 2) {
# initialise list arrays, directories and files separately and array counters for them
$excludedFolders = array();
$d_arr = array();
$d = 0;
$ds_arr = array();
$f_arr = array();
$f = 0;
$s_arr = array();
//.........这里部分代码省略.........