Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tar.php

function Archive_Tar::addString

This method add a single string as a file at the end of the existing archive. If the archive does not yet exists it is created.

Parameters

string $p_filename A string which contains the full: filename path that will be associated with the string.

string $p_string The content of the file added in: the archive.

bool|int $p_datetime A custom date/time (unix timestamp): for the file (optional).

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 value

bool true on success, false on error.

File

vendor/pear/archive_tar/Archive/Tar.php, line 501

Class

Archive_Tar
Creates a (compressed) Tar archive

Code

public 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()) {
        if (!$this->_openWrite()) {
            return false;
        }
        $this->_close();
    }
    if (!$this->_openAppend()) {
        return false;
    }
    // Need to check the get back to the temporary file ? ....
    $v_result = $this->_addString($p_filename, $p_string, $p_datetime, $p_params);
    $this->_writeFooter();
    $this->_close();
    return $v_result;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal