[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_refindex.php (sommaire)

[CLASS/FUNCTION INDEX of SCRIPT] 89: class t3lib_refindex 107:     function updateRefIndexTable($table,$uid,$testOnly=FALSE) 178:     function generateRefIndexData($table,$uid) 255:     function createEntryData($table,$uid,$field,$flexpointer,$deleted,$ref_table,$ref_uid,$ref_string='',$sort=-1,$softref_key='',$softref_id='') 282:     function createEntryData_dbRels($table,$uid,$fieldname,$flexpointer,$deleted,$items) 299:     function createEntryData_fileRels($table,$uid,$fieldname,$flexpointer,$deleted,$items) 320:     function createEntryData_softreferences($table,$uid,$fieldname,$flexpointer,$deleted,$keys)

Poids: 1061 lignes (42 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_refindex:: (21 méthodes):
  updateRefIndexTable()
  generateRefIndexData()
  createEntryData()
  createEntryData_dbRels()
  createEntryData_fileRels()
  createEntryData_softreferences()
  getRelations()
  getRelations_flexFormCallBack()
  getRelations_procFiles()
  getRelations_procDB()
  setReferenceValue()
  setReferenceValue_dbRels()
  setReferenceValue_fileRels()
  setReferenceValue_softreferences()
  wordIndexing()
  updateWordIndex()
  submitWords()
  isReferenceField()
  destPathFromUploadFolder()
  error()
  updateIndex()


Classe: t3lib_refindex  - X-Ref

Reference index processing and relation extraction

NOTICE: When the reference index is updated for an offline version the results may not be correct.
First, lets assumed that the reference update happens in LIVE workspace (ALWAYS update from Live workspace if you analyse whole database!)
Secondly, lets assume that in a Draft workspace you have changed the data structure of a parent page record - this is (in TemplaVoila) inherited by subpages.
When in the LIVE workspace the data structure for the records/pages in the offline workspace will not be evaluated to the right one simply because the data structure is taken from a rootline traversal and in the Live workspace that will NOT include the changed DataSTructure! Thus the evaluation will be based on the Data Structure set in the Live workspace!
Somehow this scenario is rarely going to happen. Yet, it is an inconsistency and I see now practical way to handle it - other than simply ignoring maintaining the index for workspace records. Or we can say that the index is precise for all Live elements while glitches might happen in an offline workspace?
Anyway, I just wanted to document this finding - I don't think we can find a solution for it. And its very TemplaVoila specific.

updateRefIndexTable($table,$uid,$testOnly=FALSE)   X-Ref
Call this function to update the sys_refindex table for a record (even one just deleted)
NOTICE: Currently, references updated for a deleted-flagged record will not include those from within flexform fields in some cases where the data structure is defined by another record since the resolving process ignores deleted records! This will also result in bad cleaning up in tcemain I think... Anyway, thats the story of flexforms; as long as the DS can change, lots of references can get lost in no time.

param: string        Table name
param: integer        UID of record
param: boolean        If set, nothing will be written to the index but the result value will still report statistics on what is added, deleted and kept. Can be used for mere analysis.
return: array        Array with statistics about how many index records were added, deleted and not altered plus the complete reference set for the record.

generateRefIndexData($table,$uid)   X-Ref
Returns array of arrays with an index of all references found in record from table/uid
If the result is used to update the sys_refindex table then ->WSOL must NOT be true (no workspace overlay anywhere!)

param: string        Table name from $TCA
param: integer        Record UID
return: array        Index Rows

createEntryData($table,$uid,$field,$flexpointer,$deleted,$ref_table,$ref_uid,$ref_string='',$sort=-1,$softref_key='',$softref_id='')   X-Ref
Create array with field/value pairs ready to insert in database.
The "hash" field is a fingerprint value across this table.

param: string        Tablename of source record (where reference is located)
param: integer        UID of source record (where reference is located)
param: string        Fieldname of source record (where reference is located)
param: string        Pointer to location inside flexform structure where reference is located in [field]
param: integer        Whether record is deleted-flagged or not
param: string        For database references; the tablename the reference points to. Special keyword "_FILE" indicates that "ref_string" is a file reference either absolute or relative to PATH_site. Special keyword "_STRING" indicates some special usage (typ. softreference) where "ref_string" is used for the value.
param: integer        For database references; The UID of the record (zero "ref_table" is "_FILE" or "_STRING")
param: string        For "_FILE" or "_STRING" references: The filepath (relative to PATH_site or absolute) or other string.
param: integer        The sorting order of references if many (the "group" or "select" TCA types). -1 if no sorting order is specified.
param: string        If the reference is a soft reference, this is the soft reference parser key. Otherwise empty.
param: string        Soft reference ID for key. Might be useful for replace operations.
return: array        Array record to insert into table.

createEntryData_dbRels($table,$uid,$fieldname,$flexpointer,$deleted,$items)   X-Ref
Enter database references to ->relations array

param: string        [See createEntryData, arg 1]
param: integer        [See createEntryData, arg 2]
param: string        [See createEntryData, arg 3]
param: string        [See createEntryData, arg 4]
param: string        [See createEntryData, arg 5]
param: array        Data array with databaes relations (table/id)
return: void

createEntryData_fileRels($table,$uid,$fieldname,$flexpointer,$deleted,$items)   X-Ref
Enter file references to ->relations array

param: string        [See createEntryData, arg 1]
param: integer        [See createEntryData, arg 2]
param: string        [See createEntryData, arg 3]
param: string        [See createEntryData, arg 4]
param: string        [See createEntryData, arg 5]
param: array        Data array with file relations
return: void

createEntryData_softreferences($table,$uid,$fieldname,$flexpointer,$deleted,$keys)   X-Ref
Enter softref references to ->relations array

param: string        [See createEntryData, arg 1]
param: integer        [See createEntryData, arg 2]
param: string        [See createEntryData, arg 3]
param: string        [See createEntryData, arg 4]
param: string        [See createEntryData, arg 5]
param: array        Data array with soft reference keys
return: void

getRelations($table,$row,$onlyField='')   X-Ref
Returns relation information for a $table/$row-array
Traverses all fields in input row which are configured in TCA/columns
It looks for hard relations to files and records in the TCA types "select" and "group"

param: string        Table name
param: array        Row from table
param: string        Specific field to fetch for.
return: array        Array with information about relations

getRelations_flexFormCallBack($dsArr, $dataValue, $PA, $structurePath, &$pObj)   X-Ref
Callback function for traversing the FlexForm structure in relation to finding file and DB references!

param: array        Data structure for the current value
param: mixed        Current value
param: array        Additional configuration used in calling function
param: string        Path of value in DS structure
param: object        Object reference to caller
return: void

getRelations_procFiles($value, $conf, $uid)   X-Ref
Check field configuration if it is a file relation field and extract file relations if any

param: string        Field value
param: array        Field configuration array of type "TCA/columns"
param: integer        Field uid
return: array        If field type is OK it will return an array with the files inside. Else false

getRelations_procDB($value, $conf, $uid, $table = '')   X-Ref
Check field configuration if it is a DB relation field and extract DB relations if any

param: string        Field value
param: array        Field configuration array of type "TCA/columns"
param: integer        Field uid
param: string        Table name
return: array        If field type is OK it will return an array with the database relations. Else false

setReferenceValue($hash,$newValue,$returnDataArray=FALSE)   X-Ref
Setting the value of a reference or removing it completely.
Usage: For lowlevel clean up operations!
WARNING: With this you can set values that are not allowed in the database since it will bypass all checks for validity! Hence it is targetted at clean-up operations. Please use TCEmain in the usual ways if you wish to manipulate references.
Since this interface allows updates to soft reference values (which TCEmain does not directly) you may like to use it for that as an exception to the warning above.
Notice; If you want to remove multiple references from the same field, you MUST start with the one having the highest sorting number. If you don't the removal of a reference with a lower number will recreate an index in which the remaining references in that field has new hash-keys due to new sorting numbers - and you will get errors for the remaining operations which cannot find the hash you feed it!
To ensure proper working only admin-BE_USERS in live workspace should use this function

param: string        32-byte hash string identifying the record from sys_refindex which you wish to change the value for
param: mixed        Value you wish to set for reference. If NULL, the reference is removed (unless a soft-reference in which case it can only be set to a blank string). If you wish to set a database reference, use the format "[table]:[uid]". Any other case, the input value is set as-is
param: boolean        Return $dataArray only, do not submit it to database.
return: string        If a return string, that carries an error message, otherwise false (=OK) (except if $returnDataArray is set!)

setReferenceValue_dbRels($refRec,$itemArray,$newValue,&$dataArray,$flexpointer='')   X-Ref
Setting a value for a reference for a DB field:

param: array        sys_refindex record
param: array        Array of references from that field
param: string        Value to substitute current value with (or NULL to unset it)
param: array        data array in which the new value is set (passed by reference)
param: string        Flexform pointer, if in a flex form field.
return: string        Error message if any, otherwise false = OK

setReferenceValue_fileRels($refRec,$itemArray,$newValue,&$dataArray,$flexpointer='')   X-Ref
Setting a value for a reference for a FILE field:

param: array        sys_refindex record
param: array        Array of references from that field
param: string        Value to substitute current value with (or NULL to unset it)
param: array        data array in which the new value is set (passed by reference)
param: string        Flexform pointer, if in a flex form field.
return: string        Error message if any, otherwise false = OK

setReferenceValue_softreferences($refRec,$softref,$newValue,&$dataArray,$flexpointer='')   X-Ref
Setting a value for a soft reference token

param: array        sys_refindex record
param: array        Array of soft reference occurencies
param: string        Value to substitute current value with
param: array        data array in which the new value is set (passed by reference)
param: string        Flexform pointer, if in a flex form field.
return: string        Error message if any, otherwise false = OK

wordIndexing($table,$uid)   X-Ref
Pas de description

updateWordIndex($words,$table,$uid)   X-Ref
Update/Create word index for record

param: array        Word list array (words are values in array)
param: string        Table
param: integer        Rec uid
return: void

submitWords($wl)   X-Ref
Adds new words to db

param: array        Word List array (where each word has information about position etc).
return: void

isReferenceField($conf)   X-Ref
Returns true if the TCA/columns field type is a DB reference field

param: array        config array for TCA/columns field
return: boolean        True if DB reference field (group/db or select with foreign-table)

destPathFromUploadFolder($folder)   X-Ref
Returns destination path to an upload folder given by $folder

param: string        Folder relative to PATH_site
return: string        Input folder prefixed with PATH_site. No checking for existence is done. Output must be a folder without trailing slash.

error($msg)   X-Ref
Sets error message in the internal error log

param: string        Error message
return: void

updateIndex($testOnly,$cli_echo=FALSE)   X-Ref
Updating Index (External API)

param: boolean        If set, only a test
param: boolean        If set, output CLI status
return: array        Header and body status content



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics