Page MenuHomeClusterLabs Projects
Diviner Tech Docs PhabricatorRepository

final class PhabricatorRepository
Phorge Technical Documentation (Repositories)

This class is not documented.

Tasks

Managing Connections

  • protected function getConnectionNamespace() — Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.
  • protected function getEstablishedConnection($mode) — Get an existing, cached connection for this object.
  • protected function setEstablishedConnection($mode, $connection, $force_unique) — Store a connection in the connection cache.
  • public function setForcedConnection($connection) — Force an object to use a specific connection.

Configuring Storage

Loading Objects

  • public function load($id) — Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:
  • public function loadAll() — Loads all of the objects, unconditionally.
  • public function loadAllWhere($pattern, ...) — Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:
  • public function loadOneWhere($pattern, ...) — Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.
  • public function reload() — Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.
  • public function loadFromArray($row) — Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via @{method:queryData}) and then load from an array representation.
  • public function loadAllFromArray($rows) — Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with @{method:loadAllWhere}, but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

Examining Objects

  • public function getID() — Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.
  • public function hasProperty($property) — Test if a property exists.
  • protected function getAllLiskProperties() — Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.
  • protected function checkProperty($property) — Check if a property exists on this object.
  • public function establishConnection($mode, $force_new) — Get or build the database connection for this object.
  • protected function getAllLiskPropertyValues() — Convert this object into a property dictionary. This dictionary can be restored into an object by using @{method:loadFromArray} (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Writing Objects

  • public function setID($id) — Set unique ID identifying this object. You normally don't need to call this method unless with `IDS_MANUAL`.
  • public function save() — Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.
  • public function replace() — Save this object, forcing the query to use REPLACE regardless of object state.
  • public function insert() — Save this object, forcing the query to use INSERT regardless of object state.
  • public function update() — Save this object, forcing the query to use UPDATE regardless of object state.
  • public function delete()
  • protected function insertRecordIntoDatabase($mode) — Internal implementation of INSERT and REPLACE.

Hooks and Callbacks

  • public function getIDKey() — Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.
  • public function generatePHID()
  • protected function willWriteData(&$data)
  • protected function didWriteData() — Hook to perform actions after data has been written to the database.
  • protected function willSaveObject() — Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.
  • protected function willReadData(&$data)
  • protected function didReadData() — Hook to perform an action on data after it is read from the database.
  • protected function willDelete() — Hook to perform an action before the deletion of an object.
  • protected function didDelete() — Hook to perform an action after the deletion of an object.
  • protected function readField($field) — Reads the value from a field. Override this method for custom behavior of @{method:getField} instead of overriding getField directly.
  • protected function writeField($field, $value) — Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Utilities

  • protected function applyLiskDataSerialization(&$data, $deserialize) — Applies configured serialization to a dictionary of values.
  • public function __call($method, $args) — Black magic. Builds implied get*() and set*() for all properties.
  • public function __set($name, $value) — Warns against writing to undeclared property.
  • public static function loadNextCounterValue($conn_w, $counter_name) — Increments a named counter and returns the next value.
  • public static function loadCurrentCounterValue($conn_r, $counter_name) — Returns the current value of a named counter.
  • public static function overwriteCounterValue($conn_w, $counter_name, $counter_value) — Overwrite a named counter, forcing it to a specific value.

Managing Transactions

  • public function beginReadLocking() — Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call @{method:endReadLocking}. For example:
  • public function endReadLocking() — Ends read-locking that began at an earlier @{method:beginReadLocking} call.
  • public function beginWriteLocking() — Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call @{method:endWriteLocking}.
  • public function endWriteLocking() — Ends write-locking that began at an earlier @{method:beginWriteLocking} call.

Isolation for Unit Testing

Markup Interface

No methods for this task.

Repository URI Management

  • public function getRemoteURI() — Get the remote URI for this repository.
  • public function getRemoteURIEnvelope() — Get the remote URI for this repository, including credentials if they're used by this repository.
  • public function getPublicCloneURI() — Get the clone (or checkout) URI for this repository, without authentication information.
  • public function getRemoteProtocol() — Get the protocol for the repository's remote.
  • public function getRemoteURIObject() — Get a parsed object representation of the repository's remote URI..
  • private function shouldUseSSH() — Determine if we should connect to the remote using SSH flags and credentials.
  • private function shouldUseHTTP() — Determine if we should connect to the remote using HTTP flags and credentials.
  • private function shouldUseSVNProtocol() — Determine if we should connect to the remote using SVN flags and credentials.
  • private function isSSHProtocol($protocol) — Determine if a protocol is SSH or SSH-like.

Publishing

No methods for this task.

Cluster Synchronization

No methods for this task.

Other Methods

Methods

public function __construct()
Inherited

LiskDAO

Build an empty object.

Return
this//Implicit.//

protected function establishLiveConnection($mode)
Inherited

LiskDAO

Establish a live connection to a database service. This method should return a new connection. Lisk handles connection caching and management; do not perform caching deeper in the stack.

Parameters
string$modeMode, either 'r' (reading) or 'w' (reading and writing).
Return
AphrontDatabaseConnectionNew database connection.

protected function getConnectionNamespace()
Inherited

LiskDAO

Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.

Return
stringConnection namespace for cache

protected function getDatabaseName()
Inherited

This method is not documented.
Return
wild

protected function getEstablishedConnection($mode)
Inherited

LiskDAO

Get an existing, cached connection for this object.

Parameters
mode$modeConnection mode.
Return
AphrontDatabaseConnection|nullConnection, if it exists in cache.

protected function setEstablishedConnection($mode, $connection, $force_unique)
Inherited

LiskDAO

Store a connection in the connection cache.

Parameters
mode$modeConnection mode.
AphrontDatabaseConnection$connectionConnection to cache.
$force_unique
Return
this

public function setForcedConnection($connection)
Inherited

LiskDAO

Force an object to use a specific connection.

This overrides all connection management and forces the object to use a specific connection when interacting with the database.

Parameters
AphrontDatabaseConnection$connectionConnection to force this object to use.
Return
wild

protected function getConfiguration()

LiskDAO

Change Lisk behaviors, like ID configuration and timestamps. If you want to change these behaviors, you should override this method in your child class and change the options you're interested in. For example:

protected function getConfiguration() {
  return array(
    Lisk_DataAccessObject::CONFIG_EXAMPLE => true,
  ) + parent::getConfiguration();
}

The available options are:

CONFIG_IDS Lisk objects need to have a unique identifying ID. The three mechanisms available for generating this ID are IDS_AUTOINCREMENT (default, assumes the ID column is an autoincrement primary key), IDS_MANUAL (you are taking full responsibility for ID management), or IDS_COUNTER (see below).

InnoDB does not persist the value of auto_increment across restarts, and instead initializes it to MAX(id) + 1 during startup. This means it may reissue the same autoincrement ID more than once, if the row is deleted and then the database is restarted. To avoid this, you can set an object to use a counter table with IDS_COUNTER. This will generally behave like IDS_AUTOINCREMENT, except that the counter value will persist across restarts and inserts will be slightly slower. If a database stores any DAOs which use this mechanism, you must create a table there with this schema:

CREATE TABLE lisk_counter (
  counterName VARCHAR(64) COLLATE utf8_bin PRIMARY KEY,
  counterValue BIGINT UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CONFIG_TIMESTAMPS Lisk can automatically handle keeping track of a `dateCreated' and `dateModified' column, which it will update when it creates or modifies an object. If you don't want to do this, you may disable this option. By default, this option is ON.

CONFIG_AUX_PHID This option can be enabled by being set to some truthy value. The meaning of this value is defined by your PHID generation mechanism. If this option is enabled, a `phid' property will be populated with a unique PHID when an object is created (or if it is saved and does not currently have one). You need to override generatePHID() and hook it into your PHID generation mechanism for this to work. By default, this option is OFF.

CONFIG_SERIALIZATION You can optionally provide a column serialization map that will be applied to values when they are written to the database. For example:

self::CONFIG_SERIALIZATION => array(
  'complex' => self::SERIALIZATION_JSON,
)

This will cause Lisk to JSON-serialize the 'complex' field before it is written, and unserialize it when it is read.

CONFIG_BINARY You can optionally provide a map of columns to a flag indicating that they store binary data. These columns will not raise an error when handling binary writes.

CONFIG_COLUMN_SCHEMA Provide a map of columns to schema column types.

CONFIG_KEY_SCHEMA Provide a map of key names to key specifications.

CONFIG_NO_TABLE Allows you to specify that this object does not actually have a table in the database.

CONFIG_NO_MUTATE Provide a map of columns which should not be included in UPDATE statements. If you have some columns which are always written to explicitly and should never be overwritten by a save(), you can specify them here. This is an advanced, specialized feature and there are usually better approaches for most locking/contention problems.

PhabricatorRepository
This method is not documented.
Return
dictionaryMap of configuration options to values.

public function getConfigOption($option_name)
Inherited

LiskDAO

Determine the setting of a configuration option for this class of objects.

Parameters
const$option_nameOption name, one of the CONFIG_* constants.
Return
mixedOption value, if configured (null if unavailable).

public function load($id)
Inherited

LiskDAO

Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:

$dog = id(new Dog())->load($dog_id);
Parameters
int$idNumeric ID identifying the object to load.
Return
obj|nullIdentified object, or null if it does not exist.

public function loadAll()
Inherited

LiskDAO

Loads all of the objects, unconditionally.

Return
dictDictionary of all persisted objects of this type, keyed on object ID.

public function loadAllWhere($pattern, ...)
Inherited

LiskDAO

Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:

$old_dogs = id(new Dog())->loadAllWhere('age > %d', 7);

The pattern and arguments are as per queryfx().

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
dictDictionary of matching objects, keyed on ID.

public function loadOneWhere($pattern, ...)
Inherited

LiskDAO

Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.

Parameters
string$patternqueryfx()-style SQL WHERE clause.
...Zero or more conversions.
Return
obj|nullMatching object, or null if no object matches.

protected function loadRawDataWhere($pattern)
Inherited

This method is not documented.
Parameters
$pattern
Return
wild

public function reload()
Inherited

LiskDAO

Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.

Return
this

public function loadFromArray($row)
Inherited

LiskDAO

Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via queryData()) and then load from an array representation.

Parameters
dict$rowDictionary of properties, which should be equivalent to selecting a row from the table or calling @{method:getProperties}.
Return
this

public function loadAllFromArray($rows)
Inherited

LiskDAO

Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with loadAllWhere(), but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:

function loadAllWithOwner($owner) {
  $data = $this->queryData(
    'SELECT d.*
      FROM owner o
        JOIN owner_has_dog od ON o.id = od.ownerID
        JOIN dog d ON od.dogID = d.id
      WHERE o.id = %d',
    $owner);
  return $this->loadAllFromArray($data);
}

This is a lot messier than loadAllWhere(), but more flexible.

Parameters
list$rowsList of property dictionaries.
Return
dictList of constructed objects, keyed on ID.

public function setID($id)
Inherited

LiskDAO

Set unique ID identifying this object. You normally don't need to call this method unless with IDS_MANUAL.

Parameters
mixed$idUnique ID.
Return
this

public function getID()
Inherited

LiskDAO

Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.

Return
mixedUnique ID.

public function getPHID()
Inherited

This method is not documented.
Return
wild

public function hasProperty($property)
Inherited

LiskDAO

Test if a property exists.

Parameters
string$propertyProperty name.
Return
boolTrue if the property exists.

protected function getAllLiskProperties()
Inherited

LiskDAO

Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.

Return
dictDictionary of normalized (lowercase) to canonical (original case) property names.

protected function checkProperty($property)
Inherited

LiskDAO

Check if a property exists on this object.

Parameters
$property
Return
string|nullCanonical property name, or null if the property does not exist.

public function establishConnection($mode, $force_new)
Inherited

LiskDAO

Get or build the database connection for this object.

Parameters
string$mode'r' for read, 'w' for read/write.
bool$force_newTrue to force a new connection. The connection will not be retrieved from or saved into the connection cache.
Return
AphrontDatabaseConnectionLisk connection object.

protected function getAllLiskPropertyValues()
Inherited

LiskDAO

Convert this object into a property dictionary. This dictionary can be restored into an object by using loadFromArray() (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).

Return
dictDictionary of object properties.

public function makeEphemeral()
Inherited

LiskDAO

Make an object read-only.

Making an object ephemeral indicates that you will be changing state in such a way that you would never ever want it to be written back to the storage.

Return
wild

private function isEphemeralCheck()
Inherited

This method is not documented.
Return
wild

public function save()
Inherited

LiskDAO

Persist this object to the database. In most cases, this is the only method you need to call to do writes. If the object has not yet been inserted this will do an insert; if it has, it will do an update.

Return
this

public function replace()
Inherited

LiskDAO

Save this object, forcing the query to use REPLACE regardless of object state.

Return
this

public function insert()
Inherited

LiskDAO

Save this object, forcing the query to use INSERT regardless of object state.

Return
this

public function update()
Inherited

LiskDAO

Save this object, forcing the query to use UPDATE regardless of object state.

Return
this

public function delete()

LiskDAO

Delete this object, permanently.

PhabricatorRepository
This method is not documented.
Return
this

protected function insertRecordIntoDatabase($mode)
Inherited

LiskDAO

Internal implementation of INSERT and REPLACE.

Parameters
const$modeEither "INSERT" or "REPLACE", to force the desired mode.
Return
this

protected function shouldInsertWhenSaved()
Inherited

LiskDAO

Method used to determine whether to insert or update when saving.

Return
booltrue if the record should be inserted

public function getTableName()
Inherited

LiskDAO

Retrieve the database table name. By default, this is the class name.

Return
stringTable name for object storage.

public function getIDKey()
Inherited

LiskDAO

Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.

Return
stringName of the ID column.

public function generatePHID()

LiskDAO

Generate a new PHID, used by CONFIG_AUX_PHID.

PhabricatorRepository
This method is not documented.
Return
phidUnique, newly allocated PHID.

public function getPHIDType()
Inherited

This method is not documented.
Return
wild

protected function willWriteData(&$data)
Inherited

LiskDAO

Hook to apply serialization or validation to data before it is written to the database. See also willReadData().

Parameters
array&$data
Return
wild

protected function didWriteData()
Inherited

LiskDAO

Hook to perform actions after data has been written to the database.

Return
wild

protected function willSaveObject()
Inherited

LiskDAO

Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.

Return
wild

protected function willReadData(&$data)
Inherited

LiskDAO

Hook to apply serialization or validation to data as it is read from the database. See also willWriteData().

Parameters
array&$data
Return
wild

protected function didReadData()
Inherited

LiskDAO

Hook to perform an action on data after it is read from the database.

Return
wild

protected function willDelete()
Inherited

LiskDAO

Hook to perform an action before the deletion of an object.

Return
wild

protected function didDelete()
Inherited

LiskDAO

Hook to perform an action after the deletion of an object.

Return
wild

protected function readField($field)
Inherited

LiskDAO

Reads the value from a field. Override this method for custom behavior of getField() instead of overriding getField directly.

Parameters
string$fieldCanonical field name
Return
mixedValue of the field

protected function writeField($field, $value)
Inherited

LiskDAO

Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.

Parameters
string$fieldCanonical field name
mixed$valueValue to write
Return
wild

public function openTransaction()
Inherited

LiskDAO

Increase transaction stack depth.

Return
this

public function saveTransaction()
Inherited

LiskDAO

Decrease transaction stack depth, saving work.

Return
this

public function killTransaction()
Inherited

LiskDAO

Decrease transaction stack depth, discarding work.

Return
this

public function beginReadLocking()
Inherited

LiskDAO

Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call endReadLocking(). For example:

$beach->openTransaction();
  $beach->beginReadLocking();

    $beach->reload();
    $beach->setGrainsOfSand($beach->getGrainsOfSand() + 1);
    $beach->save();

  $beach->endReadLocking();
$beach->saveTransaction();
Return
this

public function endReadLocking()
Inherited

LiskDAO

Ends read-locking that began at an earlier beginReadLocking() call.

Return
this

public function beginWriteLocking()
Inherited

LiskDAO

Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call endWriteLocking().

Return
this

public function endWriteLocking()
Inherited

LiskDAO

Ends write-locking that began at an earlier beginWriteLocking() call.

Return
this

public static function beginIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

public static function endIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

public static function shouldIsolateAllLiskEffectsToCurrentProcess()
Inherited

This method is not documented.
Return
wild

private function establishIsolatedConnection($mode)
Inherited

This method is not documented.
Parameters
$mode
Return
wild

public static function beginIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function endIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function shouldIsolateAllLiskEffectsToTransactions()
Inherited

This method is not documented.
Return
wild

public static function closeInactiveConnections($idle_window)
Inherited

LiskDAO

Close any connections with no recent activity.

Long-running processes can use this method to clean up connections which have not been used recently.

Parameters
int$idle_windowClose connections with no activity for this many seconds.
Return
void

public static function closeAllConnections()
Inherited

This method is not documented.
Return
wild

public static function closeIdleConnections()
Inherited

This method is not documented.
Return
wild

private static function closeConnection($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

protected function applyLiskDataSerialization(&$data, $deserialize)
Inherited

LiskDAO

Applies configured serialization to a dictionary of values.

Parameters
array&$data
$deserialize
Return
wild

public function __call($method, $args)
Inherited

LiskDAO

Black magic. Builds implied get*() and set*() for all properties.

Parameters
string$methodMethod name.
list$argsArgument vector.
Return
mixedget*() methods return the property value. set*() methods return $this.

public function __set($name, $value)
Inherited

LiskDAO

Warns against writing to undeclared property.

Parameters
$name
$value
Return
wild

public static function loadNextCounterValue($conn_w, $counter_name)
Inherited

LiskDAO

Increments a named counter and returns the next value.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or increment.
Return
intNext counter value.

public static function loadCurrentCounterValue($conn_r, $counter_name)
Inherited

LiskDAO

Returns the current value of a named counter.

Parameters
AphrontDatabaseConnection$conn_rDatabase where the counter resides.
string$counter_nameCounter name to read.
Return
int|nullCurrent value, or `null` if the counter does not exist.

public static function overwriteCounterValue($conn_w, $counter_name, $counter_value)
Inherited

LiskDAO

Overwrite a named counter, forcing it to a specific value.

If the counter does not exist, it is created.

Parameters
AphrontDatabaseConnection$conn_wDatabase where the counter resides.
string$counter_nameCounter name to create or overwrite.
$counter_value
Return
void

private function getBinaryColumns()
Inherited

This method is not documented.
Return
wild

public function getSchemaColumns()
Inherited

This method is not documented.
Return
wild

public function getSchemaKeys()
Inherited

This method is not documented.
Return
wild

public function getColumnMaximumByteLength($column)
Inherited

This method is not documented.
Parameters
$column
Return
wild

public function getSchemaPersistence()
Inherited

This method is not documented.
Return
wild

public function getAphrontRefDatabaseName()
Inherited

This method is not documented.
Return
wild

public function getAphrontRefTableName()
Inherited

This method is not documented.
Return
wild

private function getLiskMetadata($key, $default)
Inherited

This method is not documented.
Parameters
$key
$default
Return
wild

private function setLiskMetadata($key, $value)
Inherited

This method is not documented.
Parameters
$key
$value
Return
wild

public static function pushStorageNamespace($namespace)
Inherited

This method is not documented.
Parameters
$namespace
Return
wild

public static function popStorageNamespace()
Inherited

This method is not documented.
Return
wild

public static function getDefaultStorageNamespace()
Inherited

This method is not documented.
Return
wild

public static function getStorageNamespace()
Inherited

This method is not documented.
Return
wild

public function setForcedStorageNamespace($namespace)
Inherited

This method is not documented.
Parameters
$namespace
Return
wild

private function newClusterConnection($application, $database, $mode)
Inherited

This method is not documented.
Parameters
$application
$database
$mode
Return
wild

private function raiseImproperWrite($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseImpossibleWrite($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseUnconfigured($database)
Inherited

This method is not documented.
Parameters
$database
Return
wild

private function raiseUnreachable($database, $proxy)
Inherited

This method is not documented.
Parameters
$database
Exception$proxy
Return
wild

public function getApplicationName()
Inherited

This method is not documented.
Return
wild

public static function chunkSQL($fragments, $limit)
Inherited

PhabricatorLiskDAO

Break a list of escaped SQL statement fragments (e.g., VALUES lists for INSERT, previously built with qsprintf()) into chunks which will fit under the MySQL 'max_allowed_packet' limit.

If a statement is too large to fit within the limit, it is broken into its own chunk (but might fail when the query executes).

Parameters
array$fragments
$limit
Return
wild

protected function assertAttached($property)
Inherited

This method is not documented.
Parameters
$property
Return
wild

protected function assertAttachedKey($value, $key)
Inherited

This method is not documented.
Parameters
$value
$key
Return
wild

protected function detectEncodingForStorage($string)
Inherited

This method is not documented.
Parameters
$string
Return
wild

protected function getUTF8StringFromStorage($string, $encoding)
Inherited

This method is not documented.
Parameters
$string
$encoding
Return
wild

public static function initializeNewRepository($actor)

This method is not documented.
Parameters
PhabricatorUser$actor
Return
wild

public static function getStatusMap()

This method is not documented.
Return
wild

public static function getStatusNameMap()

This method is not documented.
Return
wild

public function getStatus()

This method is not documented.
Return
wild

public function toDictionary()

This method is not documented.
Return
wild

public function getDefaultTextEncoding()

This method is not documented.
Return
wild

public function getMonogram()

This method is not documented.
Return
wild

public function getDisplayName()

This method is not documented.
Return
wild

public function getAllMonograms()

This method is not documented.
Return
wild

public function setLocalPath($path)

This method is not documented.
Parameters
$path
Return
wild

public function getDetail($key, $default)

This method is not documented.
Parameters
$key
$default
Return
wild

public function setDetail($key, $value)

This method is not documented.
Parameters
$key
$value
Return
wild

public function attachCommitCount($count)

This method is not documented.
Parameters
$count
Return
wild

public function getCommitCount()

This method is not documented.
Return
wild

public function attachMostRecentCommit($commit)

This method is not documented.
Parameters
PhabricatorRepositoryCommit$commit
Return
wild

public function getMostRecentCommit()

This method is not documented.
Return
wild

public function getDiffusionBrowseURIForPath($user, $path, $line, $branch)

This method is not documented.
Parameters
PhabricatorUser$user
$path
$line
$branch
Return
wild

public function getSubversionBaseURI($commit)

This method is not documented.
Parameters
$commit
Return
wild

public function getSubversionPathURI($path, $commit)

This method is not documented.
Parameters
$path
$commit
Return
wild

public function attachProjectPHIDs($project_phids)

This method is not documented.
Parameters
array$project_phids
Return
wild

public function getProjectPHIDs()

This method is not documented.
Return
wild

public function getCloneName()

Get the name of the directory this repository should clone or checkout into. For example, if the repository name is "Example Repository", a reasonable name might be "example-repository". This is used to help users get reasonable results when cloning repositories, since they generally do not want to clone into directories called "X/" or "Example Repository/".

Return
string

public static function isValidRepositorySlug($slug)

This method is not documented.
Parameters
$slug
Return
wild

public static function assertValidRepositorySlug($slug)

This method is not documented.
Parameters
$slug
Return
wild

public static function assertValidCallsign($callsign)

This method is not documented.
Parameters
$callsign
Return
wild

public function getProfileImageURI()

This method is not documented.
Return
wild

public function attachProfileImageFile($file)

This method is not documented.
Parameters
PhabricatorFile$file
Return
wild

public function getProfileImageFile()

This method is not documented.
Return
wild

public function execRemoteCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function execxRemoteCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function getRemoteCommandFuture($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function passthruRemoteCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

private function newRemoteCommandFuture($argv)

This method is not documented.
Parameters
array$argv
Return
wild

private function newRemoteCommandPassthru($argv)

This method is not documented.
Parameters
array$argv
Return
wild

private function newRemoteCommandEngine($argv)

This method is not documented.
Parameters
array$argv
Return
wild

public function execLocalCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function execxLocalCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function getLocalCommandFuture($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function passthruLocalCommand($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

private function newLocalCommandFuture($argv)

This method is not documented.
Parameters
array$argv
Return
wild

private function newLocalCommandPassthru($argv)

This method is not documented.
Parameters
array$argv
Return
wild

public function getURI()

This method is not documented.
Return
wild

public function getPathURI($path)

This method is not documented.
Parameters
$path
Return
wild

public function getCommitURI($identifier)

This method is not documented.
Parameters
$identifier
Return
wild

public static function parseRepositoryServicePath($request_path, $vcs)

This method is not documented.
Parameters
$request_path
$vcs
Return
wild

public function getCanonicalPath($request_path)

This method is not documented.
Parameters
$request_path
Return
wild

public function generateURI($params)

This method is not documented.
Parameters
array$params
Return
wild

public function updateURIIndex()

This method is not documented.
Return
wild

public function isTracked()

This method is not documented.
Return
wild

public function getDefaultBranch()

This method is not documented.
Return
wild

public function getDefaultArcanistBranch()

This method is not documented.
Return
wild

private function isBranchInFilter($branch, $filter_key)

This method is not documented.
Parameters
$branch
$filter_key
Return
wild

public static function extractBranchRegexp($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function shouldTrackRef($ref)

This method is not documented.
Parameters
DiffusionRepositoryRef$ref
Return
wild

public function shouldTrackBranch($branch)

This method is not documented.
Parameters
$branch
Return
wild

public function isBranchPermanentRef($branch)

This method is not documented.
Parameters
$branch
Return
wild

public function formatCommitName($commit_identifier, $local)

This method is not documented.
Parameters
$commit_identifier
$local
Return
wild

public function isImporting()

This method is not documented.
Return
wild

public function isNewlyInitialized()

This method is not documented.
Return
wild

public function loadImportProgress()

This method is not documented.
Return
wild

public function newPublisher()

This method is not documented.
Return
wild

public function isPublishingDisabled()

This method is not documented.
Return
wild

public function getPermanentRefRules()

This method is not documented.
Return
wild

public function setPermanentRefRules($rules)

This method is not documented.
Parameters
array$rules
Return
wild

public function getTrackOnlyRules()

This method is not documented.
Return
wild

public function setTrackOnlyRules($rules)

This method is not documented.
Parameters
array$rules
Return
wild

public function supportsFetchRules()

This method is not documented.
Return
wild

public function getFetchRules()

This method is not documented.
Return
wild

public function setFetchRules($rules)

This method is not documented.
Parameters
array$rules
Return
wild

public function getRemoteURI()

Get the remote URI for this repository.

Return
string

public function getRemoteURIEnvelope()

Get the remote URI for this repository, including credentials if they're used by this repository.

Return
PhutilOpaqueEnvelopeURI, possibly including credentials.

public function getPublicCloneURI()

Get the clone (or checkout) URI for this repository, without authentication information.

Return
stringRepository URI.

public function getRemoteProtocol()

Get the protocol for the repository's remote.

Return
stringProtocol, like "ssh" or "git".

public function getRemoteURIObject()

Get a parsed object representation of the repository's remote URI..

Return
wildA @{class@arcanist:PhutilURI}.

public function getCloneURIObject()

Get the "best" clone/checkout URI for this repository, on any protocol.

Return
wild

private function getRawHTTPCloneURIObject()

This method is not documented.
Return
wild

private function shouldUseSSH()

Determine if we should connect to the remote using SSH flags and credentials.

Return
boolTrue to use the SSH protocol.

private function shouldUseHTTP()

Determine if we should connect to the remote using HTTP flags and credentials.

Return
boolTrue to use the HTTP protocol.

private function shouldUseSVNProtocol()

Determine if we should connect to the remote using SVN flags and credentials.

Return
boolTrue to use the SVN protocol.

private function isSSHProtocol($protocol)

Determine if a protocol is SSH or SSH-like.

Parameters
string$protocolA protocol string, like "http" or "ssh".
Return
boolTrue if the protocol is SSH-like.

public function isGit()

This method is not documented.
Return
wild

public function isSVN()

This method is not documented.
Return
wild

public function isHg()

This method is not documented.
Return
wild

public function isHosted()

This method is not documented.
Return
wild

public function setHosted($enabled)

This method is not documented.
Parameters
$enabled
Return
wild

public function canServeProtocol($protocol, $write, $is_intracluster)

This method is not documented.
Parameters
$protocol
$write
$is_intracluster
Return
wild

public function hasLocalWorkingCopy()

This method is not documented.
Return
wild

private function assertLocalExists()

Raise more useful errors when there are basic filesystem problems.

Return
wild

public function isWorkingCopyBare()

Determine if the working copy is bare or not. In Git, this corresponds to --bare. In Mercurial, --noupdate.

Return
wild

public function usesLocalWorkingCopy()

This method is not documented.
Return
wild

public function getHookDirectories()

This method is not documented.
Return
wild

public function canDestroyWorkingCopy()

This method is not documented.
Return
wild

public function canUsePathTree()

This method is not documented.
Return
wild

public function canUseGitLFS()

This method is not documented.
Return
wild

public function getGitLFSURI($path)

This method is not documented.
Parameters
$path
Return
wild

public function canMirror()

This method is not documented.
Return
wild

public function canAllowDangerousChanges()

This method is not documented.
Return
wild

public function shouldAllowDangerousChanges()

This method is not documented.
Return
wild

public function canAllowEnormousChanges()

This method is not documented.
Return
wild

public function shouldAllowEnormousChanges()

This method is not documented.
Return
wild

public function writeStatusMessage($status_type, $status_code, $parameters)

This method is not documented.
Parameters
$status_type
$status_code
array$parameters
Return
wild

public static function assertValidRemoteURI($uri)

This method is not documented.
Parameters
$uri
Return
wild

public function loadUpdateInterval($minimum)

Load the pull frequency for this repository, based on the time since the last activity.

We pull rarely used repositories less frequently. This finds the most recent commit which is older than the current time (which prevents us from spinning on repositories with a silly commit post-dated to some time in 2037). We adjust the pull frequency based on when the most recent commit occurred.

Parameters
int$minimumThe minimum update interval to use, in seconds.
Return
intRepository update interval, in seconds.

public function getCopyTimeLimit()

Time limit for cloning or copying this repository.

This limit is used to timeout operations like git clone or git fetch when doing intracluster synchronization, building working copies, etc.

Return
intMaximum number of seconds to spend copying this repository.

public function setCopyTimeLimit($limit)

This method is not documented.
Parameters
$limit
Return
wild

public function getDefaultCopyTimeLimit()

This method is not documented.
Return
wild

public function getEffectiveCopyTimeLimit()

This method is not documented.
Return
wild

public function getFilesizeLimit()

This method is not documented.
Return
wild

public function setFilesizeLimit($limit)

This method is not documented.
Parameters
$limit
Return
wild

public function getTouchLimit()

This method is not documented.
Return
wild

public function setTouchLimit($limit)

This method is not documented.
Parameters
$limit
Return
wild

public function getAlmanacServiceURI($viewer, $options)

Retrieve the service URI for the device hosting this repository.

See newConduitClient() for a general discussion of interacting with repository services. This method provides lower-level resolution of services, returning raw URIs.

Parameters
PhabricatorUser$viewerViewing user.
map<string,$optionswild> Constraints on selectable services.
Return
string|nullURI, or `null` for local repositories.

public function getAlmanacServiceRefs($viewer, $options)

This method is not documented.
Parameters
PhabricatorUser$viewer
array$options
Return
wild

private function sortReadableAlmanacServiceRefs($refs)

This method is not documented.
Parameters
array$refs
Return
wild

private function sortWritableAlmanacServiceRefs($refs)

This method is not documented.
Parameters
array$refs
Return
wild

public function supportsSynchronization()

This method is not documented.
Return
wild

public function supportsRefs()

This method is not documented.
Return
wild

public function getAlmanacServiceCacheKey()

This method is not documented.
Return
wild

private function buildAlmanacServiceURIs()

This method is not documented.
Return
wild

public function newConduitClient($viewer, $never_proxy)

Build a new Conduit client in order to make a service call to this repository.

If the repository is hosted locally, this method may return null. The caller should use ConduitCall or other local logic to complete the request.

By default, we will return a ConduitClient for any repository with a service, even if that service is on the current device.

We do this because this configuration does not make very much sense in a production context, but is very common in a test/development context (where the developer's machine is both the web host and the repository service). By proxying in development, we get more consistent behavior between development and production, and don't have a major untested codepath.

The $never_proxy parameter can be used to prevent this local proxying. If the flag is passed:

  • The method will return null (implying a local service call) if the repository service is hosted on the current device.
  • The method will throw if it would need to return a client.

This is used to prevent loops in Conduit: the first request will proxy, even in development, but the second request will be identified as a cluster request and forced not to proxy.

For lower-level service resolution, see getAlmanacServiceURI().

Parameters
PhabricatorUser$viewerViewing user.
bool$never_proxy`true` to throw if a client would be returned.
Return
ConduitClient|nullClient, or `null` for local repositories.

public function newConduitClientForRequest($request)

This method is not documented.
Parameters
ConduitAPIRequest$request
Return
wild

public function newConduitFuture($viewer, $method, $params, $never_proxy)

This method is not documented.
Parameters
PhabricatorUser$viewer
$method
array$params
$never_proxy
Return
wild
This method is not documented.
Return
wild

public function supportsBranchComparison()

This method is not documented.
Return
wild

public function isReadOnly()

This method is not documented.
Return
wild

public function setReadOnly($read_only)

This method is not documented.
Parameters
$read_only
Return
wild

public function getReadOnlyMessage()

This method is not documented.
Return
wild

public function setReadOnlyMessage($message)

This method is not documented.
Parameters
$message
Return
wild
This method is not documented.
Return
wild

public function attachURIs($uris)

This method is not documented.
Parameters
array$uris
Return
wild

public function getURIs()

This method is not documented.
Return
wild

public function getCloneURIs()

This method is not documented.
Return
wild

public function newBuiltinURIs()

This method is not documented.
Return
wild

public function getClusterRepositoryURIFromBinding($binding)

This method is not documented.
Parameters
AlmanacBinding$binding
Return
wild

public function loadAlmanacService()

This method is not documented.
Return
wild

public function markImporting()

This method is not documented.
Return
wild

public function getSymbolSources()

This method is not documented.
Return
wild

public function getSymbolLanguages()

This method is not documented.
Return
wild

public function supportsStaging()

This method is not documented.
Return
wild

public function getStagingURI()

This method is not documented.
Return
wild

public function supportsAutomation()

This method is not documented.
Return
wild

public function canPerformAutomation()

This method is not documented.
Return
wild

public function getAutomationBlueprintPHIDs()

This method is not documented.
Return
wild
This method is not documented.
Return
wild
This method is not documented.
Return
wild

public function getCapabilities()

This method is not documented.
Return
wild

public function getPolicy($capability)

This method is not documented.
Parameters
$capability
Return
wild

public function hasAutomaticCapability($capability, $user)

This method is not documented.
Parameters
$capability
PhabricatorUser$user
Return
wild

public function getMarkupFieldKey($field)

This method is not documented.
Parameters
$field
Return
wild

public function newMarkupEngine($field)

This method is not documented.
Parameters
$field
Return
wild

public function getMarkupText($field)

This method is not documented.
Parameters
$field
Return
wild

public function didMarkupText($field, $output, $engine)

This method is not documented.
Parameters
$field
$output
PhutilMarkupEngine$engine
Return
wild

public function shouldUseMarkupCache($field)

This method is not documented.
Parameters
$field
Return
wild

public function destroyObjectPermanently($engine)

This method is not documented.
Parameters
PhabricatorDestructionEngine$engine
Return
wild

public function newDestructibleCodex()

This method is not documented.
Return
wild

public function getSpacePHID()

This method is not documented.
Return
wild
This method is not documented.
Return
wild

public function getFieldValuesForConduit()

This method is not documented.
Return
wild

private function getStringListForConduit($list)

This method is not documented.
Parameters
$list
Return
wild

public function getConduitSearchAttachments()

This method is not documented.
Return
wild

public function newFulltextEngine()

This method is not documented.
Return
wild

public function newFerretEngine()

This method is not documented.
Return
wild