Overview

Classes

  • Package
  • Service
  • Tlaloc_File
  • User
  • Overview
  • Class
  • Tree

Class Tlaloc_File

Tlaloc_File

Copyright: Copyright (c) 2014
Author: selt
Version: $Id$
Located at File.php
Methods summary
public
# __construct( mixed $array_Repositories = null, mixed $Agent_PrivKey = null, mixed $array_Rsync_Excludes = null )

Tlaloc_File::__construct() Instantiate a File object, make sure to supply a Repository array listing, the SSH agent's private key and optionally RSYNC Exclude clauses

Tlaloc_File::__construct() Instantiate a File object, make sure to supply a Repository array listing, the SSH agent's private key and optionally RSYNC Exclude clauses

Parameters

$array_Repositories
mixed
$Agent_PrivKey
mixed
$array_Rsync_Excludes
mixed
public boolean
# Run_Process( mixed $cmd, mixed $flag_WaitForCompletion = true, mixed $flag_TextualResult = false, mixed $array_ENV = null, mixed $flag_ShowOutput = false )

Tlaloc_File::Run_Process() Execute a shell command/process. We encapsulate these calls so we don't clobber code with pipes, buffering and such... TODO: make async vs sync calls (flag_WaitForCompletion) by forking or not.

Tlaloc_File::Run_Process() Execute a shell command/process. We encapsulate these calls so we don't clobber code with pipes, buffering and such... TODO: make async vs sync calls (flag_WaitForCompletion) by forking or not.

Parameters

$cmd
mixed
$flag_WaitForCompletion
mixed
$flag_TextualResult
mixed
$array_ENV
mixed
$flag_ShowOutput
mixed

Returns

boolean
$result
private
# Merge_RSYNC_Clauses( mixed $array_Input, string $rsync_clause = "--exclude" )

Tlaloc_File::Merge_RSYNC_Clauses() Internal function used to merge rsync command line parameters

Tlaloc_File::Merge_RSYNC_Clauses() Internal function used to merge rsync command line parameters

Parameters

$array_Input
mixed
$rsync_clause
string

Returns


private string
# Pick_A_Repos( )

Tlaloc_File::Pick_A_Repos() Obtain a random repository from the list.

Tlaloc_File::Pick_A_Repos() Obtain a random repository from the list.

Returns

string
$repository
private string
# Look_For_BestSource( mixed $Filename, $Module_Name = null, $flag_UseOsSuffix = true )

Tlaloc_File::Look_For_Source() Look for the source file in the stacked repositories, from node to defaults TODO: Make this work with other mediums than SSH, and perhaps, cache the remote listings somehow or have an agent running on the repositories (which would rule out Amazon:S3,arg)

Tlaloc_File::Look_For_Source() Look for the source file in the stacked repositories, from node to defaults TODO: Make this work with other mediums than SSH, and perhaps, cache the remote listings somehow or have an agent running on the repositories (which would rule out Amazon:S3,arg)

Parameters

$Filename
mixed
$Module_Name
$flag_UseOsSuffix

Returns

string
$repository_url
public boolean
# Exists( mixed $File_Name )

Tlaloc_File::Exists() See if a file exists on the local system

Tlaloc_File::Exists() See if a file exists on the local system

Parameters

$File_Name
mixed

Returns

boolean
$result
public
# Reset( mixed $Src_File, mixed $param_Destination_Filename = null )

Tlaloc_File::Reset() Compare a local file with the repository copy, and if they differ, reset it to the Repository's version.

Tlaloc_File::Reset() Compare a local file with the repository copy, and if they differ, reset it to the Repository's version.

Parameters

$Src_File
mixed
$param_Destination_Filename
mixed

Returns


public boolean
# Source( mixed $Src_File, mixed $Destination_Filename = null, mixed $Repository = null, mixed $Permissions = null, mixed $Owner = null, mixed $Group = null, mixed $Module_Name = null, $RSync_Options = "" )

Tlaloc_File::Source() Source or re-source a file from a repository

Tlaloc_File::Source() Source or re-source a file from a repository

Parameters

$Src_File
mixed
$Destination_Filename
mixed
$Repository
mixed
$Permissions
mixed
$Owner
mixed
$Group
mixed
$Module_Name
mixed
$RSync_Options

Returns

boolean
$result
public
# File_ChangeGroup( mixed $Filename, string $Group = "wheel", boolean $flag_Recursive = false )

Tlaloc_File::File_ChangeGroup() Change Group settings on a file, usually used internally, but available publicly

Tlaloc_File::File_ChangeGroup() Change Group settings on a file, usually used internally, but available publicly

Parameters

$Filename
mixed
$Group
string
$flag_Recursive
boolean

Returns


public boolean
# File_Chown( mixed $Filename, string $Owner = "root", boolean $flag_Recursive = false )

Tlaloc_File::File_Chown() Chown a file resource, usually used internally, but available publicly

Tlaloc_File::File_Chown() Chown a file resource, usually used internally, but available publicly

Parameters

$Filename
mixed
$Owner
string
$flag_Recursive
boolean

Returns

boolean
$result
public boolean
# File_SetPermissions( mixed $Filename, string $Permissions = "755", boolean $flag_Recursive = false )

Tlaloc_File::File_SetPermissions() Set File/Folder permissions, usually used internally, but available publicly

Tlaloc_File::File_SetPermissions() Set File/Folder permissions, usually used internally, but available publicly

Parameters

$Filename
mixed
$Permissions
string
$flag_Recursive
boolean

Returns

boolean
$result
public
# SetAttributes( mixed $Filename, mixed $Permissions = null, mixed $Owner = null, mixed $Group = null, boolean $flag_Recursive = false )

Tlaloc_File::SetAttributes() Apply a set of attribute to a File/Folder object (Permissions, Owner, Group) Usually used internally, but available publicly

Tlaloc_File::SetAttributes() Apply a set of attribute to a File/Folder object (Permissions, Owner, Group) Usually used internally, but available publicly

Parameters

$Filename
mixed
$Permissions
mixed
$Owner
mixed
$Group
mixed
$flag_Recursive
boolean
boolean, default false

Returns


public boolean
# Makedir( mixed $Dirname, string $Permissions = "0755", string $Owner = "root", string $Group = "wheel" )

File::Makedir() Create a directory on the local host with Permissions,Owner and Group to be set

File::Makedir() Create a directory on the local host with Permissions,Owner and Group to be set

Parameters

$Dirname
mixed
$Permissions
string
default "0755"
$Owner
string
default "root"
$Group
string
default "wheel"

Returns

boolean
$result
public boolean
# AddLine( mixed $Filename, mixed $LineToAdd )

Tlaloc_File::AddLine() Add a text line to a text file (in append mode at the bottom of the file)

Tlaloc_File::AddLine() Add a text line to a text file (in append mode at the bottom of the file)

Parameters

$Filename
mixed
$LineToAdd
mixed

Returns

boolean
$result
public boolean
# AddLine_IfNotFound( mixed $Filename, mixed $LineToAdd, mixed $NotFound_Pattern )

Tlaloc_File::AddLine_IfNotFound() Append a line of text to a text file, given that the submitted Grep pattern is not found in the file.

Tlaloc_File::AddLine_IfNotFound() Append a line of text to a text file, given that the submitted Grep pattern is not found in the file.

Parameters

$Filename
mixed
$LineToAdd
mixed
$NotFound_Pattern
mixed

Returns

boolean
$result
public boolean
# RemoveLine( mixed $Filename, mixed $Grep_Pattern )

Tlaloc_File::RemoveLine() Remove a line, using a grep pattern, from a file. Note that you can grep many lines ;)

Tlaloc_File::RemoveLine() Remove a line, using a grep pattern, from a file. Note that you can grep many lines ;)

Parameters

$Filename
mixed
$Grep_Pattern
mixed
$Filename

Returns

boolean
$result
public integer
# WriteFile( mixed $Filename, mixed $Content, mixed $flag_OverwriteIfExists = false )

Tlaloc_File::WriteFile() Create and write a file with the provided content. set flag_Overwrite to true to force an overwrite.

Tlaloc_File::WriteFile() Create and write a file with the provided content. set flag_Overwrite to true to force an overwrite.

Parameters

$Filename
mixed
$Content
mixed
$flag_OverwriteIfExists
mixed

Returns

integer
$bytes_written or boolean FALSE
public boolean
# Append_To_Var( mixed $Filename, mixed $Varname, mixed $Value_To_Add, mixed $Var_Style = "RC" )

Tlaloc_File::Append_To_Var() Append to a var content within a config text file.

Tlaloc_File::Append_To_Var() Append to a var content within a config text file.

Parameters

$Filename
mixed
$Varname
mixed
$Value_To_Add
mixed
$Var_Style
mixed
(SSH|RC)

Returns

boolean
$result
private boolean
# Replace_Line( mixed $Filename, mixed $Old_Line, mixed $New_Line )

Tlaloc_File::Replace_Line() Internal function used in swapping old and new text lines in config files.

Tlaloc_File::Replace_Line() Internal function used in swapping old and new text lines in config files.

Parameters

$Filename
mixed
$Old_Line
mixed
$New_Line
mixed

Returns

boolean
$result
public boolean
# Remove_From_Var( mixed $Filename, mixed $Varname, mixed $Value_To_Remove, string $Var_Style = "RC" )

Tlaloc_File::Remove_From_Var() Remove a value from a var within a specified text/config file

Tlaloc_File::Remove_From_Var() Remove a value from a var within a specified text/config file

Parameters

$Filename
mixed
$Varname
mixed
$Value_To_Remove
mixed
$Var_Style
string

Returns

boolean
$result
protected array
# ldd_check( mixed $Src_File )

Tlaloc_File::ldd_check() Execute the ldd utility on a file and return its dependency list or null if none, or false on error

Tlaloc_File::ldd_check() Execute the ldd utility on a file and return its dependency list or null if none, or false on error

Parameters

$Src_File
mixed

Returns

array
$dependency_list
public boolean
# Jail( mixed $Src_File, mixed $Destination_Root, boolean $flag_Strip_Source_Path = false, $flag_Executable = true )

Tlaloc_File::Jail() Jail a program file or a config file within a particular Destination_Root, making sure to transfer any dependencies as reported by the ldd unix utility, and creating the necessary sub-folders in the destination.

Tlaloc_File::Jail() Jail a program file or a config file within a particular Destination_Root, making sure to transfer any dependencies as reported by the ldd unix utility, and creating the necessary sub-folders in the destination.

Parameters

$Src_File
mixed
$Destination_Root
mixed
$flag_Strip_Source_Path
boolean
$flag_Executable

Returns

boolean
$result
Properties summary
public array $SUPPORTED_COMMANDS array("exists"=>"Check to see if a file exists","reset"=>"Overwrite the file if it differs","write"=>"Write a file (ignoring previous one)","delete"=>"Delete a local file","install"=>"install")
#
public array $Repos array()
#
private $Repository_Type
#
private $Agent_PrivKey
#
private array $RSync_Excludes array()
#
private $RSYNC_Excludes_Str
#
public array $Digest array()
#
API documentation generated by ApiGen 2.6.0