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

Parameters

string $p_filename:

string $p_string:

bool $p_datetime:

array $p_params:

Return value

bool

1 call to Archive_Tar::_addString()
Archive_Tar::addString in vendor/pear/archive_tar/Archive/Tar.php
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.

File

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

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"] : 0;
    $p_gid = @$p_params["gid"] ? $p_params["gid"] : 0;
    if (!$this->_file) {
        $this->_error('Invalid file descriptor');
        return false;
    }
    if ($p_filename == '') {
        $this->_error('Invalid file name');
        return false;
    }
    // ----- Calculate the stored filename
    $p_filename = $this->_translateWinPath($p_filename, false);
    // ----- If datetime is not specified, set current time
    if ($p_datetime === false) {
        $p_datetime = time();
    }
    if (!$this->_writeHeaderBlock($p_filename, strlen($p_string), $p_stamp, $p_mode, $p_type, $p_uid, $p_gid)) {
        return false;
    }
    $i = 0;
    while (($v_buffer = substr($p_string, $i++ * 512, 512)) != '') {
        $v_binary_data = pack("a512", $v_buffer);
        $this->_writeBlock($v_binary_data);
    }
    return true;
}

API Navigation

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