Documentation for class Archive_Tar
===================================
Last update : 2001-08-15
Overview :
----------
The Archive_Tar class helps in creating and managing GNU TAR format
files compressed by GNU ZIP or not.
The class offers basic functions like creating an archive, adding
files in the archive, extracting files from the archive and listing
the archive content.
It also provide advanced functions that allow the adding and
extraction of files with path manipulation.
Sample :
--------
// ----- Creating the object (uncompressed archive)
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT);
// ----- Creating the archive
$v_list[0]="file.txt";
$v_list[1]="data/";
$v_list[2]="file.log";
$tar_object->create($v_list);
// ----- Adding files
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/";
$v_list[2]="log/file.log";
$tar_object->add($v_list);
// ----- Adding more files
$tar_object->add("release/newfile.log release/readme.txt");
// ----- Listing the content
if (($v_list = $tar_object->listContent()) != 0)
for ($i=0; $i<sizeof($v_list); $i++)
{
echo "Filename :'".$v_list[$i][filename]."'<br>";
echo " .size :'".$v_list[$i][size]."'<br>";
echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
echo " .mode :'".$v_list[$i][mode]."'<br>";
echo " .uid :'".$v_list[$i][uid]."'<br>";
echo " .gid :'".$v_list[$i][gid]."'<br>";
echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
}
// ----- Extracting the archive in directory "install"
$tar_object->extract("install");
Public arguments :
------------------
None
Public Methods :
----------------
Method : Archive_Tar($p_tarname, $compress = null)
Description :
Archive_Tar Class constructor. This flavour of the constructor only
declare a new Archive_Tar object, identifying it by the name of the
tar file.
If the compress argument is set the tar will be read or created as a
gzip or bz2 compressed TAR file.
Arguments :
$p_tarname : A valid filename for the tar archive file.
$p_compress : can be null, 'gz' or 'bz2'. For
compatibility reason it can also be true. This
parameter indicates if gzip or bz2 compression
is required.
Return value :
The Archive_Tar object.
Sample :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object_compressed = new Archive_Tar("tarname.tgz", true);
How it works :
Initialize the object.
Method : create($p_filelist)
Description :
This method creates the archive file and add the files / directories
that are listed in $p_filelist.
If the file already exists and is writable, it is replaced by the
new tar. It is a create and not an add. If the file exists and is
read-only or is a directory it is not replaced. The method return
false and a PEAR error text.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
See also createModify() method for more details.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="file.txt";
$v_list[1]="data/"; (Optional '/' at the end)
$v_list[2]="file.log";
$tar_object->create($v_list);
Sample 2 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$tar_object->create("file.txt data/ file.log");
How it works :
Just calling the createModify() method with the right parameters.
Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
Description :
This method creates the archive file and add the files / directories
that are listed in $p_filelist.
If the file already exists and is writable, it is replaced by the
new tar. It is a create and not an add. If the file exists and is
read-only or is a directory it is not replaced. The method return
false and a PEAR error text.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
The path indicated in $p_remove_dir will be removed from the
memorized path of each file / directory listed when this path
exists. By default nothing is removed (empty path "")
The path indicated in $p_add_dir will be added at the beginning of
the memorized path of each file / directory listed. However it can
be set to empty "". The adding of a path is done after the removing
of path.
The path add/remove ability enables the user to prepare an archive
for extraction in a different path than the origin files are.
See also addModify() method for file adding properties.
Arguments :
$p_filelist : An array of filenames and directory names, or a single
string with names separated by a single blank space.
$p_add_dir : A string which contains a path to be added to the
memorized path of each element in the list.
$p_remove_dir : A string which contains a path to be removed from
the memorized path of each element in the list, when
relevant.
Return value :
true on success, false on error.
Sample 1 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="file.txt";
$v_list[1]="data/"; (Optional '/' at the end)
$v_list[2]="file.log";
$tar_object->createModify($v_list, "install");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/file.log
Sample 2 :
$tar_object = new Archive_Tar("tarname.tar");
$tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
$v_list[0]="dev/file.txt";
$v_list[1]="dev/data/"; (Optional '/' at the end)
$v_list[2]="log/file.log";
$tar_object->createModify($v_list, "install", "dev");
// files are stored in the archive as :
// install/file.txt
// install/data
// install/data/file1.txt
// install/data/... all the files and sub-dirs of data/
// install/log/file.log
How it works :
Open the file in write mode (erasing the existing one if one),
call the _addList() method for adding the files in an empty archive,
add the tar footer (512 bytes block), close the tar file.
Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
Description :
This method add the files / directories listed in $p_filelist at the
end of the existing archive. If the archive does not yet exists it
is created.
The $p_filelist parameter can be an array of string, each string
representing a filename or a directory name with their path if
needed. It can also be a single string with names separated by a
single blank.
The path indicated in $p_remove_dir will be removed from the
memorized path of each file / directory listed when this path
exists. By default nothing is removed (empty path "")
The path indicated in $p_add_dir will be added at the beginning of
the memorized path of each file / directory listed. However it can
be set to empty "". The adding of a path is done after the removing
of path.
The path add/remove ability enables the user to prepare an archive
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP实现的WEB图片共享系统(源代码)
共1390个文件
js:306个
php:266个
gif:245个
需积分: 1 0 下载量 176 浏览量
2024-05-25
21:32:13
上传
评论
收藏 5.49MB RAR 举报
温馨提示
本系统主要从现代社会电脑化观念出发,通过对现有资料的分析、研究和整理,确定了在基于现存的WEB2.0模式下开发图片共享系统的可行性、紧迫性和必要性。在现阶段,国内基于WEB2.0的图片共享系统才刚起步,该市场还有很大的介入空间。其中,在国外,已经有了很成熟的图片共享平台。在WEB2.0时代,信息由以前的服务器发布变成了用户发布。也就是从以前的通过服务器搜集资源并且发布变成了通过用户提供资源,服务器进行整理,分类,发布的模式。而且这种模式对于一个网站的用户吸引度也远远高于传统模式。
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP实现的WEB图片共享系统(源代码) (1390个子文件)
.#upu.js.1.1.1.1 3KB
.#upu.js.1.1.1.1 3KB
DojoExternalInterface.as 9KB
DojoExternalInterface.as 7KB
Storage.as 4KB
ExpressInstall.as 3KB
ChangeLog 264B
ChangeLog 264B
admin.css 17KB
basic.css 10KB
main.css 5KB
main1.css 4KB
HtmlTabContainer.css 4KB
HtmlEditorToolbar.css 4KB
HtmlMenu2.css 3KB
thickbox.css 3KB
HtmlDatePicker.css 2KB
HtmlFloatingPane.css 2KB
HtmlSimpleDropdownButtons.css 2KB
Wizard.css 1KB
HtmlMonthlyCalendar.css 1KB
general.css 1KB
HtmlButtonTemplate.css 1KB
HtmlSlider.css 978B
DemoItem.css 947B
Menu.css 943B
HtmlShow.css 820B
HtmlToolbar.css 816B
PopUpButton.css 741B
progress.css 730B
progress.css 730B
HtmlSplitContainer.css 687B
HtmlComboBox.css 631B
HtmlSpinner.css 622B
HtmlTimePicker.css 611B
Tree.css 508B
DemoContainer.css 500B
HtmlTaskBar.css 474B
HtmlFisheyeList.css 473B
DemoNavigator.css 467B
lightbox.css 457B
Tree.css 397B
HtmlInlineEditBox.css 342B
HtmlResizableTextarea.css 295B
HtmlDocPane.css 292B
SourcePane.css 247B
DemoPane.css 238B
HtmlResizeHandle.css 210B
HtmlShowSlide.css 180B
HtmlTooltipTemplate.css 168B
HtmlSlideShow.css 121B
setup.inc.cvs 4KB
run.cvs 944B
run.cvs 937B
qrv40_2.dat 87KB
qrv40_3.dat 87KB
qrv40_0.dat 87KB
qrv40_1.dat 87KB
qrv39_2.dat 83KB
qrv39_3.dat 83KB
qrv39_0.dat 83KB
qrv39_1.dat 83KB
qrv38_2.dat 79KB
qrv38_3.dat 79KB
qrv38_0.dat 79KB
qrv38_1.dat 79KB
qrv37_2.dat 75KB
qrv37_3.dat 75KB
qrv37_0.dat 75KB
qrv37_1.dat 75KB
qrv36_2.dat 71KB
qrv36_3.dat 71KB
qrv36_0.dat 71KB
qrv36_1.dat 71KB
qrv35_2.dat 67KB
qrv35_3.dat 67KB
qrv35_0.dat 67KB
qrv35_1.dat 67KB
qrv34_2.dat 65KB
qrv34_3.dat 65KB
qrv34_0.dat 65KB
qrv34_1.dat 65KB
qrv33_2.dat 61KB
qrv33_3.dat 61KB
qrv33_0.dat 61KB
qrv33_1.dat 61KB
qrv32_2.dat 58KB
qrv32_3.dat 58KB
qrv32_0.dat 58KB
qrv32_1.dat 58KB
qrv31_2.dat 55KB
qrv31_3.dat 55KB
qrv31_0.dat 55KB
qrv31_1.dat 55KB
qrv30_2.dat 51KB
qrv30_3.dat 51KB
qrv30_0.dat 51KB
qrv30_1.dat 51KB
qrv29_2.dat 48KB
qrv29_3.dat 48KB
共 1390 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
Java资深爱好者
- 粉丝: 1272
- 资源: 2577
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 内部讲师评选方案.doc
- 培训师职业训练教材《教学媒体应用技能训练》.doc
- 培训之网络写作指南.doc
- 培训师职业技能训练教材《良好心理素质养成与心理辅导技能训》.doc
- HR师认证复习资料-人力资源规划.ppt
- 关于如何对待工作的一些建议(ppt 45页).ppt
- 培训导师.ppt
- 管理领导力与激励.ppt
- 培训导师的职责与任务.ppt
- 培训艺术与技术(教材).ppt
- 企业内部培训师培训分享资料.ppt
- 培训与开发(ppt 157页).ppt
- 人力资源培训教材-人员招募与甄选(PPT 24页).ppt
- 巧妙处理听众的问题.ppt
- 企业培训讲师形象.ppt
- 人力资源培训教材-如何设计发展空间(PPT 26页).ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功