__construct()
addFetchOptionJoin()
addImportStateToSteps()
addPositionLimit()
archiveImportLog()
assertValidCutOffOperator()
canRunStep()
create()
fetchAllKeyed()
getAdminPermissionIds()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getImportContentMap()
getImporter()
getImporterList()
getImporterName()
getModelFromCache()
getNodePermissionsGrouped()
getOrderByClause()
getPostIdsMapFromArray()
getThreadIdsMapFromArray()
getUniqueFieldId()
getUserFieldDefinitions()
getUserIdByEmail()
getUserIdByUserName()
getUserIdsByEmails()
getUserIdsByNames()
getUserIdsMapFromArray()
getUserIdsWithKey()
hasImportedData()
importAvatar()
importBan()
importCategory()
importConversation()
importFollowing()
importForum()
importGlobalModerator()
importIgnored()
importIp()
importLike()
importLinkForum()
importNodeModerator()
importPollVote()
importPost()
importPostAttachment()
importProfilePost()
importProfilePostComment()
importThread()
importThreadPoll()
importThreadPrefix()
importThreadPrefixGroup()
importThreadWatch()
importUser()
importUserField()
importUserGroup()
insertDeferredThreadWatch()
insertGlobalPermissionEntries()
insertNodePermissionEntries()
limitQueryResults()
logImportData()
mapAttachmentId()
mapNodeId()
mapPostId()
mapThreadId()
mapUserId()
prepareLimitFetchOptions()
prepareStateLimitFromConditions()
resetImportLog()
resetLocalCacheData()
resolveTimeZoneOffset()
retainKeys()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
_convertKeysToExtraData()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_getUserModel()
_importData()
$extraImporters
$retainableKeys
$_adminPermissions
$_allowCachedRead
$_cache
$_contentMapCache
$_db
$_localCacheData
$_modelCache
$_retainKeys
$_supportedLikeTypes
$_threadWatchDeferred
$_uniqueFieldIds
$_userFieldDefinitions
EXTRA_DATA_KEY
USER_FIELD_KEY
Base class for models.
Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.
package | XenForo_Mvc |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addImportStateToSteps(array $steps, array $runSteps) : array
array
array
array
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
It no limit value is specified, nothing will be returned.
This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.
inherited_from | \XenForo_Model::addPositionLimit() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededarchiveImportLog(string $archiveTableName, mixed $error) : boolean
string
Archive table name
mixed
Error phrase reference
boolean
assertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
canRunStep(string $step, array $steps, array $runSteps) : boolean
string
array
array
boolean
create(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)
Note that the specified key must exist in the query result, or it will be ignored.
inherited_from | \XenForo_Model::fetchAllKeyed() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
getAdminPermissionIds() : array
array
getConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetImportContentMap(string $contentType, array $ids) : array
string
array
array
getImporter(string $key) : \XenForo_Importer_Abstract
string
Name of importer (key); just last part of name, not full path.
getImporterList() : array
array
getImporterName(string $key) : string
string
Importer ID
string
getModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getNodePermissionsGrouped() : array
array
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetPostIdsMapFromArray(array $source, string $key) : array
array
string
Name of the key in $source that identifies the post IDs
array
getThreadIdsMapFromArray(array $source, string $key) : array
array
string
Name of the key in $source that identifies the thread IDs
array
getUniqueFieldId(string $fieldId, array $existing, integer $maxLength) : string
string
array
integer
string
getUserFieldDefinitions() : array
array
getUserIdByEmail(string $email) : integer
string
integer
getUserIdByUserName(string $name) : integer
string
integer
getUserIdsByEmails(array $emails) : array
array
array
getUserIdsByNames(array $names) : array
array
array
getUserIdsMapFromArray(array $source, string | array $key) : array
array
string
array
Name of the key in $source that identifies the user IDs
array
getUserIdsWithKey(array $conditions, string $key, string $lowerKey) : array
array
string
string
array
hasImportedData() : boolean
boolean
importAvatar(integer $oldUserId, integer $userId, string $fileName) : mixed
integer
Source user ID
integer
Imported user ID
string
Path to the avatar file
mixed
User ID on success, false on failureimportBan(array $info) : integer
array
User info
integer
Ban IDimportCategory(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported node IDimportConversation(integer $oldId, array $conversation, array $recipients, array $messages) : integer
into a XenForo conversation
integer
Source ID
array
Data for XenForo_DataWriter_ConversationMaster
array
Recipient data
array
Data for XenForo_DataWriter_ConversationMessage
integer
Imported conversation IDimportFollowing(integer $userId, array $followUserIds)
as a XenForo 'following' list.
integer
The user doing the following
array
User IDs to follow
importForum(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported node IDimportGlobalModerator(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
ID of moderating userimportIgnored(integer $userId, array $ignoreUserIds)
integer
The user doing the ignoring
array
User IDs to ignore
importIp(integer $userId, string $contentType, string $contentId, string $action, integer $ipAddress, $date) : integer
integer
User ID
string
Content type
string
Action
string
IP address
integer
Date
integer
IP IDimportLike(string $contentType, integer $contentId, integer $contentUserId, integer $likeUserId, integer $likeDate)
string
integer
integer
integer
integer
importLinkForum(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported node IDimportNodeModerator(integer $oldNodeId, integer $oldUserId, array $info) : integer
integer
integer
array
integer
Imported moderator IDimportPollVote(integer $pollId, integer $userId, integer $responseId, integer $voteDate)
integer
integer
integer
integer
importPost(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported post IDimportPostAttachment(integer $oldAttachmentId, string $fileName, string $tempFile, integer $userId, integer $postId, integer $date, array $attach, \function $messageCallback, string $messageText) : \Imported
integer
string
string
integer
integer
integer
array
data to import
\function
string
\Imported
attachment IDimportProfilePost(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported profile post IDimportProfilePostComment(integer $oldId, array $info) : \Imported
integer
Source ID
array
Data to import
\Imported
profile post comment IDimportThread(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported thread IDimportThreadPoll(integer $oldId, integer $threadId, array $info, array $responses, array $responseIds) : integer
integer
Source poll ID
integer
Thread ID
array
Data to import
array
Responses
array
Response IDs
integer
Imported poll IDimportThreadPrefix(mixed $oldId, array $info, string $title, array $nodeIds) : integer
mixed
array
string
array
integer
Imported thread prefix idimportThreadPrefixGroup(mixed $oldId, array $info) : integer
mixed
array
integer
Imported thread prefix group idimportThreadWatch(integer $userId, integer $threadId, string $emailSubscribe, boolean $deferred) : integer
integer
User ID
integer
Thread ID
string
Subscription type
boolean
Deferred
integer
Imported post IDimportUser(integer $oldId, array $info, $failedKey) : integer
integer
Source ID
array
Data to import
integer
Imported user IDimportUserField(integer $oldId, array $info) : string
integer
Source ID
array
Data to import
string
Imported user field IDimportUserGroup(integer $oldId, array $info) : integer
integer
Source ID
array
Data to import
integer
Imported user group IDinsertDeferredThreadWatch()
insertGlobalPermissionEntries(integer $userGroupId, integer $userId, array $perms)
integer
integer
array
insertNodePermissionEntries(integer $nodeId, integer $userGroupId, integer $userId, array $perms)
integer
integer
integer
array
limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessarylogImportData(string $contentType, integer $oldId, integer $newId)
string
integer
integer
mapAttachmentId(integer $id, integer $default) : integer
integer
integer
integer
mapNodeId(integer $id, integer $default) : integer
integer
integer
integer
mapPostId(integer $id, integer $default) : integer
integer
integer
integer
mapThreadId(integer $id, integer $default) : integer
integer
integer
integer
mapUserId(integer $id, integer $default) : integer
integer
integer
integer
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit stateresetImportLog()
resetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
resolveTimeZoneOffset(float $offset, boolean $useDst) : string
float
Offset (in hours) from UTC
boolean
Apply daylight savings
string
Location string, such as Europe/LondonretainKeys(boolean $retainKeys)
boolean
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
This should only be used if you know what you're doing or for testing purposes!
Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)
inherited_from | \XenForo_Model::setLocalCacheData() |
---|
string
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.
inherited_from | \XenForo_Model::standardizeViewingUserReference() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserialized_convertKeysToExtraData(array $info, array $keys)
array
array
[DataWriterInfoConst => keyName,...]
_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
_importData(string $oldId, string $dwName, string $contentKey, string $idKey, array $info, string $errorHandler, boolean $update) : integer
string
string
Name of the XenForo_DataWriter that will write the data
string
string
array
string
boolean
Attempt to force an update rather than an insert
integer
Imported content ID$extraImporters : array
$retainableKeys : array
$_adminPermissions : array
$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_contentMapCache : array
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|
$_retainKeys : boolean
$_supportedLikeTypes : array
$_threadWatchDeferred
$_uniqueFieldIds
$_userFieldDefinitions
EXTRA_DATA_KEY
USER_FIELD_KEY