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
- protected function establishLiveConnection($mode)
- protected function getConfiguration()
- public function getConfigOption($option_name) — Determine the setting of a configuration option for this class of objects.
- public function getTableName()
- public static function pushStorageNamespace($namespace)
- public static function popStorageNamespace()
- public static function getDefaultStorageNamespace()
- public static function getStorageNamespace()
- public function getApplicationName()
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()
- 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() — Delete this object, permanently.
- 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)
- 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
- public static function beginIsolateAllLiskEffectsToCurrentProcess()
- public static function endIsolateAllLiskEffectsToCurrentProcess()
- public static function shouldIsolateAllLiskEffectsToCurrentProcess()
- private function establishIsolatedConnection($mode)
- public static function beginIsolateAllLiskEffectsToTransactions()
- public static function endIsolateAllLiskEffectsToTransactions()
- public static function shouldIsolateAllLiskEffectsToTransactions()
Availability
- public function attachAvailability($availability)
- public function getAwayUntil() — Get the timestamp the user is away until, if they are currently away.
- public function getAvailabilityCache() — Get cached availability, if present.
- public function writeAvailabilityCache($availability, $ttl) — Write to the availability cache.
Profile Image Cache
Multi-Factor Authentication
- public function updateMultiFactorEnrollment() — Update the flag storing this user's enrollment in multi-factor auth.
- public function getIsEnrolledInMultiFactor() — Check if the user is enrolled in multi-factor authentication.
Managing Handles
Settings
- public function compareUserSetting($key, $value) — Test if a given setting is set to a particular value.
- public function overrideTimezoneIdentifier($identifier) — Override the user's timezone identifier.
User Cache
- public function attachRawCacheData($data)
- protected function requireCacheData($key)
- public function clearCacheData($key)
Other Methods
- public function __construct() — Build an empty object.
- protected function getDatabaseName()
- protected function loadRawDataWhere($pattern)
- public function getPHID()
- public function makeEphemeral() — Make an object read-only.
- private function isEphemeralCheck()
- protected function shouldInsertWhenSaved() — Method used to determine whether to insert or update when saving.
- public function getPHIDType()
- public function openTransaction() — Increase transaction stack depth.
- public function saveTransaction() — Decrease transaction stack depth, saving work.
- public function killTransaction() — Decrease transaction stack depth, discarding work.
- public static function closeInactiveConnections($idle_window) — Close any connections with no recent activity.
- public static function closeAllConnections()
- public static function closeIdleConnections()
- private static function closeConnection($key)
- private function getBinaryColumns()
- public function getSchemaColumns()
- public function getSchemaKeys()
- public function getColumnMaximumByteLength($column)
- public function getSchemaPersistence()
- public function getAphrontRefDatabaseName()
- public function getAphrontRefTableName()
- private function getLiskMetadata($key, $default)
- private function setLiskMetadata($key, $value)
- public function setForcedStorageNamespace($namespace)
- private function newClusterConnection($application, $database, $mode)
- private function raiseImproperWrite($database)
- private function raiseImpossibleWrite($database)
- private function raiseUnconfigured($database)
- private function raiseUnreachable($database, $proxy)
- public static function chunkSQL($fragments, $limit) — Break a list of escaped SQL statement fragments (e.g., VALUES lists for INSERT, previously built with @{function:qsprintf}) into chunks which will fit under the MySQL 'max_allowed_packet' limit.
- protected function assertAttached($property)
- protected function assertAttachedKey($value, $key)
- protected function detectEncodingForStorage($string)
- protected function getUTF8StringFromStorage($string, $encoding)
- public function isUserActivated() — Is this a live account which has passed required approvals? Returns true if this is an enabled, verified (if required), approved (if required) account, and false otherwise.
- public function isResponsive() — Is this a user who we can reasonably expect to respond to requests?
- public function canEstablishWebSessions()
- public function canEstablishAPISessions()
- public function canEstablishSSHSessions()
- public function getIsStandardUser() — Returns `true` if this is a standard user who is logged in. Returns `false` for logged out, anonymous, or external users.
- public function getMonogram()
- public function isLoggedIn()
- public function saveWithoutIndex()
- public function attachSession($session)
- public function getSession()
- public function hasSession()
- public function hasHighSecuritySession()
- private function generateConduitCertificate()
- private function cleanUpProfile() — This function removes the blurb from a profile. This is an incredibly broad hammer to handle some spam on the upstream, which will be refined later.
- public function getUserProfile()
- public function attachUserProfile($profile)
- public function loadUserProfile()
- public function loadPrimaryEmailAddress()
- public function loadPrimaryEmail()
- public function getUserSetting($key)
- private function writeUserSettingCache($key, $value)
- public function getTranslation()
- public function getTimezoneIdentifier()
- public static function getGlobalSettingsCacheKey()
- private function loadGlobalSettings()
- public function getGender()
- public function updateNameTokens() — Populate the nametoken table, which used to fetch typeahead results. When a user types "linc", we want to match "Abraham Lincoln" from on-demand typeahead sources. To do this, we need a separate table of name fragments.
- public static function describeValidUsername()
- public static function validateUsername($username)
- public static function getDefaultProfileImageURI()
- public function getProfileImageURI()
- public function getUnreadNotificationCount()
- public function getUnreadMessageCount()
- public function getRecentBadgeAwards()
- public function getFullName()
- public function getTimeZone()
- public function getTimeZoneOffset()
- public function getTimeZoneOffsetInHours()
- public function formatShortDateTime($when, $now)
- public function __toString()
- public static function loadOneWithEmailAddress($address)
- public function getDefaultSpacePHID()
- public function hasConduitClusterToken()
- public function attachConduitClusterToken($token)
- public function getConduitClusterToken()
- public function getDisplayAvailability()
- public function getAvailabilityEventPHID()
- public function isOmnipotent() — Returns true if this user is omnipotent. Omnipotent users bypass all policy checks.
- public static function getOmnipotentUser() — Get an omnipotent user object for use in contexts where there is no acting user, notably daemons.
- public function getCacheFragment() — Get a scalar string identifying this user.
- public function attachBadgePHIDs($phids)
- public function getBadgePHIDs()
- public function getCSRFToken()
- public function validateCSRFToken($token)
- public function getAlternateCSRFString()
- public function attachAlternateCSRFString($string)
- private function newCSRFEngine()
- public function getCapabilities()
- public function getPolicy($capability)
- public function hasAutomaticCapability($capability, $viewer)
- public function describeAutomaticCapability($capability)
- public function getCustomFieldSpecificationForRole($role)
- public function getCustomFieldBaseClass()
- public function getCustomFields()
- public function attachCustomFields($fields)
- public function destroyObjectPermanently($engine)
- public function getSSHPublicKeyManagementURI($viewer)
- public function getSSHKeyDefaultName()
- public function getSSHKeyNotifyPHIDs()
- public function getApplicationTransactionEditor()
- public function getApplicationTransactionTemplate()
- public function newFulltextEngine()
- public function newFerretEngine()
- public function getFieldSpecificationsForConduit()
- public function getFieldValuesForConduit()
- public function getConduitSearchAttachments()
- public function setAllowInlineCacheGeneration($allow_cache_generation)
- public function getCSSValue($variable_key)
- public function newPasswordDigest($envelope, $password)
- public function newPasswordBlocklist($viewer, $engine)
handle
- public function loadHandles($phids) — Get a @{class:PhabricatorHandleList} which benefits from this viewer's internal handle pool.
- public function renderHandle($phid) — Get a @{class:PHUIHandleView} for a single handle.
- public function renderHandleList($phids) — Get a @{class:PHUIHandleListView} for a list of handles.