Perforce Chronicle 2012.2/486814
API Documentation
|
Provides a mechanism for running Perforce commands. More...
Public Member Functions | |
__construct ($port=null, $user=null, $client=null, $password=null, $ticket=null) | |
Create a P4_Connection_Interface instance. | |
addDisconnectCallback ($callback, $persistent=false) | |
Add a function to run when connection is closed. | |
batchArgs (array $arguments, array $prefixArgs=null, array $suffixArgs=null, $groupSize=1) | |
Return arguments split into chunks (batches) where each batch contains as many arguments as possible to not exceed ARG_MAX or OPTION_LIMIT. | |
connect () | |
Connect to a Perforce server. | |
disconnect () | |
Disconnect from a Perforce server. | |
getAppName () | |
Get the application name being reported to the server. | |
getArgMax () | |
Get the maximum allowable length of all command arguments. | |
getCharset () | |
Retrieves the character set used by this connection. | |
getClient () | |
Return the p4 user's client. | |
getClientRoot () | |
Get the current client's root directory. | |
getConnectionIdentity () | |
Get the identity of this Connection implementation. | |
getHost () | |
Retrieves the client host set for this connection. | |
getInfo () | |
Return an array of connection information. | |
getPassword () | |
Retrieves the password set for this perforce connection. | |
getPort () | |
Return the p4 port. | |
getSecurityLevel () | |
Get the server's security level. | |
getTicket () | |
Retrieves the ticket set for this perforce connection. | |
getUser () | |
Return the name of the p4 user. | |
isCaseSensitive () | |
Check if the server we are connected to is case sensitive. | |
isConnected () | |
Check connected state. | |
isSuperUser () | |
Check if the user we are connected as has super user privileges. | |
login () | |
Authenticate the user with 'p4 login'. | |
run ($command, $params=array(), $input=null, $tagged=true) | |
Executes the specified command and returns a perforce result object. | |
setAppName ($name) | |
Set the name of the application that is using this connection. | |
setCharset ($charset) | |
Sets the character set to use for this perforce connection. | |
setClient ($client) | |
Set the p4 user's client. | |
setHost ($host) | |
Sets the client host name overriding the environment. | |
setPassword ($password) | |
Sets the password to use for this perforce connection. | |
setPort ($port) | |
Set the p4 port. | |
setTicket ($ticket) | |
Sets the ticket to use for this perforce connection. | |
setUser ($user) | |
Set the name of the p4 user. |
Provides a mechanism for running Perforce commands.
P4_Connection_Interface::__construct | ( | $ | port = null , |
$ | user = null , |
||
$ | client = null , |
||
$ | password = null , |
||
$ | ticket = null |
||
) |
Create a P4_Connection_Interface instance.
string | $port | optional - the port to connect to. |
string | $user | optional - the user to connect as. |
string | $client | optional - the client spec to use. |
string | $password | optional - the password to use. |
string | $ticket | optional - a ticket to use. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::addDisconnectCallback | ( | $ | callback, |
$ | persistent = false |
||
) |
Add a function to run when connection is closed.
Callbacks are removed after they are executed unless persistent is set to true.
callable | $callback | the function to execute on disconnect (will be passed connection). |
bool | $persistent | optional - defaults to false - set to true to run callback on repeated disconnects. |
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::batchArgs | ( | array $ | arguments, |
array $ | prefixArgs = null , |
||
array $ | suffixArgs = null , |
||
$ | groupSize = 1 |
||
) |
Return arguments split into chunks (batches) where each batch contains as many arguments as possible to not exceed ARG_MAX or OPTION_LIMIT.
ARG_MAX is a character limit that affects command line programs (p4). OPTION_LIMIT is a server-side limit on the number of flags (e.g. '-n').
array | $arguments | list of arguments to split into chunks. |
array | null | $prefixArgs | arguments to begin all batches with. |
array | null | $suffixArgs | arguments to end all batches with. |
int | $groupSize | keep arguments together in groups of this size for example, when clearing attributes you want to keep pairs of -n and attr-name together. |
P4_Exception | if a argument (or set of arguments) exceed arg-max. |
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::connect | ( | ) |
Connect to a Perforce server.
P4_Connection_ConnectException | if the connection fails. |
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::disconnect | ( | ) |
Disconnect from a Perforce server.
Implemented in P4_Connection_Abstract, P4_Connection_CommandLine, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::getAppName | ( | ) |
Get the application name being reported to the server.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getArgMax | ( | ) |
Get the maximum allowable length of all command arguments.
Implemented in P4_Connection_Abstract, P4_Connection_CommandLine, and P4_Connection_Deferred.
P4_Connection_Interface::getCharset | ( | ) |
Retrieves the character set used by this connection.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getClient | ( | ) |
Return the p4 user's client.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getClientRoot | ( | ) |
Get the current client's root directory.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getConnectionIdentity | ( | ) |
Get the identity of this Connection implementation.
Implemented in P4_Connection_CommandLine, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::getHost | ( | ) |
Retrieves the client host set for this connection.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getInfo | ( | ) |
Return an array of connection information.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getPassword | ( | ) |
Retrieves the password set for this perforce connection.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getPort | ( | ) |
Return the p4 port.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getSecurityLevel | ( | ) |
Get the server's security level.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getTicket | ( | ) |
Retrieves the ticket set for this perforce connection.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::getUser | ( | ) |
Return the name of the p4 user.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::isCaseSensitive | ( | ) |
Check if the server we are connected to is case sensitive.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::isConnected | ( | ) |
Check connected state.
Implemented in P4_Connection_CommandLine, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::isSuperUser | ( | ) |
Check if the user we are connected as has super user privileges.
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::login | ( | ) |
Authenticate the user with 'p4 login'.
P4_Connection_LoginException | if login fails. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::run | ( | $ | command, |
$ | params = array() , |
||
$ | input = null , |
||
$ | tagged = true |
||
) |
Executes the specified command and returns a perforce result object.
No need to call connect() first. Run will connect automatically.
string | $command | the command to run. |
array | string | $params | optional - one or more arguments. |
array | string | $input | optional - input for the command - should be provided in array form when writing perforce spec records. |
boolean | $tagged | optional - true/false to enable/disable tagged output. defaults to true. |
P4_Connection_CommandException | if the command fails. |
Implemented in P4_Connection_Abstract, and P4_Connection_Deferred.
P4_Connection_Interface::setAppName | ( | $ | name | ) |
Set the name of the application that is using this connection.
The application name will be reported to the server and might be necessary to satisfy certain licensing restrictions.
string | null | $name | the app name to report to the server. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setCharset | ( | $ | charset | ) |
Sets the character set to use for this perforce connection.
You should only set a character set when connecting to a 'unicode enabled' server.
string | $charset | the charset to use (e.g. 'utf8'). |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setClient | ( | $ | client | ) |
Set the p4 user's client.
string | $client | the name of the client workspace to use. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setHost | ( | $ | host | ) |
Sets the client host name overriding the environment.
string | null | $host | the host name to use. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setPassword | ( | $ | password | ) |
Sets the password to use for this perforce connection.
string | $password | the password to use as authentication. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setPort | ( | $ | port | ) |
Set the p4 port.
string | $port | the port to connect to. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setTicket | ( | $ | ticket | ) |
Sets the ticket to use for this perforce connection.
string | $ticket | the ticket to use as authentication. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.
P4_Connection_Interface::setUser | ( | $ | user | ) |
Set the name of the p4 user.
string | $user | the user to connect as. |
Implemented in P4_Connection_Abstract, P4_Connection_Deferred, and P4_Connection_Extension.