Function __global->tar_add_file

Definitions

sources/tar.php

  • Add a file to the specified TAR file.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
&$resource array Yes No required parameter N/A N/A The TAR file handle
$target_path PATH No No required parameter N/A N/A The relative path to where we wish to add the file to the archive (including filename)
$data string No No required parameter N/A N/A The data of the file to add
$_mode integer No No 420 N/A N/A The file mode (permissions)
$_mtime ?TIME No No Null N/A N/A The modification time we wish for our file (null: now)
$data_is_path boolean No No False N/A N/A Whether the $data variable is actually a full file path
$return_on_errors boolean No No False N/A N/A Whether to return on errors
$efficient_mode boolean No No False N/A N/A Don't do duplicate checks

Returns

  • Offset of the file in the TAR
  • Type: integer
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a file to the specified TAR file.
 *
 * @param  array $resource The TAR file handle
 * @param  PATH $target_path The relative path to where we wish to add the file to the archive (including filename)
 * @param  string $data The data of the file to add
 * @param  integer $_mode The file mode (permissions)
 * @param  ?TIME $_mtime The modification time we wish for our file (null: now)
 * @param  boolean $data_is_path Whether the $data variable is actually a full file path
 * @param  boolean $return_on_errors Whether to return on errors
 * @param  boolean $efficient_mode Don't do duplicate checks
 * @return integer Offset of the file in the TAR
 */

function tar_add_file(array &$resource, string $target_path, string $data, int $_mode = 420, ?int $_mtime = null, bool $data_is_path = false, bool $return_on_errors = false, bool $efficient_mode = false) : int