Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -ur old/Archive_Tar-1.3.11/Archive/Tar.php new/Archive_Tar-1.3.11/Archive/Tar.php
- --- old/Archive_Tar-1.3.11/Archive/Tar.php 2013-02-09 03:44:17.000000000 -0800
- +++ new/Archive_Tar-1.3.11/Archive/Tar.php 2013-11-08 13:55:22.318276898 -0800
- @@ -409,12 +409,29 @@
- * the archive.
- * @param int $p_datetime A custom date/time (unix timestamp)
- * for the file (optional).
- + * @param array $p_params An array of optional params:
- + * stamp => the datetime (replaces
- + * datetime above if it exists)
- + * mode => the permissions on the
- + * file (600 by default)
- + * type => is this a link? See the
- + * tar specification for details.
- + * (default = regular file)
- + * uid => the user ID of the file
- + * (default = 0 = root)
- + * gid => the group ID of the file
- + * (default = 0 = root)
- *
- * @return true on success, false on error.
- * @access public
- */
- - function addString($p_filename, $p_string, $p_datetime = false)
- + function addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
- {
- + $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time());
- + $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600;
- + $p_type = @$p_params["type"] ? $p_params["type"] : "";
- + $p_uid = @$p_params["uid"] ? $p_params["uid"] : "";
- + $p_gid = @$p_params["gid"] ? $p_params["gid"] : "";
- $v_result = true;
- if (!$this->_isArchive()) {
- @@ -428,7 +445,7 @@
- return false;
- // Need to check the get back to the temporary file ? ....
- - $v_result = $this->_addString($p_filename, $p_string, $p_datetime);
- + $v_result = $this->_addString($p_filename, $p_string, $p_datetime, $p_params);
- $this->_writeFooter();
- @@ -1052,8 +1069,13 @@
- // }}}
- // {{{ _addString()
- - function _addString($p_filename, $p_string, $p_datetime = false)
- + function _addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
- {
- + $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time());
- + $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600;
- + $p_type = @$p_params["type"] ? $p_params["type"] : "";
- + $p_uid = @$p_params["uid"] ? $p_params["uid"] : 0;
- + $p_gid = @$p_params["gid"] ? $p_params["gid"] : 0;
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- @@ -1073,7 +1095,7 @@
- }
- if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
- - $p_datetime, 384, "", 0, 0))
- + $p_stamp, $p_mode, $p_type, $p_uid, $p_gid))
- return false;
- $i=0;
- diff -ur old/Archive_Tar-1.3.11/docs/Archive_Tar.txt new/Archive_Tar-1.3.11/docs/Archive_Tar.txt
- --- old/Archive_Tar-1.3.11/docs/Archive_Tar.txt 2013-02-09 03:44:17.000000000 -0800
- +++ new/Archive_Tar-1.3.11/docs/Archive_Tar.txt 2013-11-08 14:02:11.058267284 -0800
- @@ -293,7 +293,7 @@
- How it works :
- Simply call the addModify() method with the right parameters.
- -Method : addString($p_filename, $p_string)
- +Method : addString($p_filename, $p_string, $p_datetime, $p_params)
- Description :
- This method add a single string as a file at the
- end of the existing archive. If the archive does not yet exists it
- @@ -302,12 +302,26 @@
- $p_filename : A string which contains the full filename path
- that will be associated with the string.
- $p_string : The content of the file added in the archive.
- + $p_datetime : (Optional) Timestamp of the file (default = now)
- + $p_params : (Optional) Various file metadata:
- + stamp - As above, timestamp of the file
- + mode - UNIX-style permissions (default 0600)
- + type - Is this a regular file or link (see TAR
- + format spec for how to create a hard/symlink)
- + uid - UNIX-style user ID (default 0 = root)
- + gid - UNIX-style group ID (default 0 = root)
- Return value :
- true on success, false on error.
- Sample 1 :
- $v_archive = & new Archive_Tar($p_filename);
- $v_archive->setErrorHandling(PEAR_ERROR_PRINT);
- $v_result = $v_archive->addString('data/test.txt', 'This is the text of the string');
- + $v_result = $v_archive->addString(
- + 'data/test.sh',
- + "#!/bin/sh\necho 'Hello'",
- + time(),
- + array( "mode" => 0755, "uid" => 34 )
- + );
- Method : extract($p_path = "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement