[ 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_install.php (sommaire)

Class to setup values in localconf.php and verify the TYPO3 DB tables/fields $Id: class.t3lib_install.php 2463 2007-08-29 09:44:49Z mundaun $

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 815 lignes (31 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_install:: (17 méthodes):
  t3lib_install()
  setValueInLocalconfFile()
  writeToLocalconf_control()
  checkForBadString()
  slashValueForSingleDashes()
  getFieldDefinitions_sqlContent()
  getFieldDefinitions_sqlContent_parseTypes()
  getFieldDefinitions_database()
  getDatabaseExtra()
  getUpdateSuggestions()
  assembleFieldDefinition()
  getStatementArray()
  getCreateTables()
  getTableInsertStatements()
  performUpdateQueries()
  getListOfTables()
  generateUpdateDatabaseForm_checkboxes()


Classe: t3lib_install  - X-Ref

Class to setup values in localconf.php and verify the TYPO3 DB tables/fields

t3lib_install()   X-Ref
Constructor function

return: void

setValueInLocalconfFile(&$line_array, $variable, $value)   X-Ref
This functions takes an array with lines from localconf.php, finds a variable and inserts the new value.

param: array        $line_array    the localconf.php file exploded into an array by linebreaks. (see writeToLocalconf_control())
param: string        $variable    The variable name to find and substitute. This string must match the first part of a trimmed line in the line-array. Matching is done backwards so the last appearing line will be substituted.
param: string        $value        Is the value to be insert for the variable
return: void

writeToLocalconf_control($inlines='',$absFullPath='')   X-Ref
Writes or returns lines from localconf.php

param: array        Array of lines to write back to localconf.php. Possibly
param: string        Absolute path of alternative file to use (Notice: this path is not validated in terms of being inside 'TYPO3 space')
return: mixed        If $inlines is not an array it will return an array with the lines from localconf.php. Otherwise it will return a status string, either "continue" (updated) or "nochange" (not updated)

checkForBadString($string)   X-Ref
Checking for linebreaks in the string

param: string        String to test
return: boolean        Returns TRUE if string is OK

slashValueForSingleDashes($value)   X-Ref
Replaces ' with \' and \ with \\

param: string        Input value
return: string        Output value

getFieldDefinitions_sqlContent($sqlContent)   X-Ref
Reads the field definitions for the input sql-file string

param: string        $sqlContent: Should be a string read from an sql-file made with 'mysqldump [database_name] -d'
return: array        Array with information about table.

getFieldDefinitions_sqlContent_parseTypes(&$total)   X-Ref
Multiplies varchars/tinytext fields in size according to $this->multiplySize
Useful if you want to use UTF-8 in the database and needs to extend the field sizes in the database so UTF-8 chars are not discarded. For most charsets available as single byte sets, multiplication with 2 should be enough. For chinese, use 3.

param: array        Total array (from getFieldDefinitions_sqlContent())
return: void

getFieldDefinitions_database()   X-Ref
Reads the field definitions for the current database

return: array        Array with information about table.

getDatabaseExtra($FDsrc, $FDcomp, $onlyTableList='',$ignoreNotNullWhenComparing=true)   X-Ref
Compares two arrays with field information and returns information about fields that are MISSING and fields that have CHANGED.
FDsrc and FDcomp can be switched if you want the list of stuff to remove rather than update.

param: array        Field definitions, source (from getFieldDefinitions_sqlContent())
param: array        Field definitions, comparison. (from getFieldDefinitions_database())
param: string        Table names (in list) which is the ONLY one observed.
param: boolean        If set, this function ignores NOT NULL statements of the sql file field definition when comparing current field definition from database with field definition from sql file. This way, NOT NULL statements will be executed when the field is initially created, but the sql parser will never complain about missing NOT NULL statements afterwards.
return: array        Returns an array with 1) all elements from $FSsrc that is not in $FDcomp (in key 'extra') and 2) all elements from $FSsrc that is difference from the ones in $FDcomp

getUpdateSuggestions($diffArr,$keyList='extra,diff')   X-Ref
Returns an array with SQL-statements that is needed to update according to the diff-array

param: array        Array with differences of current and needed DB settings. (from getDatabaseExtra())
param: string        List of fields in diff array to take notice of.
return: array        Array of SQL statements (organized in keys depending on type)

assembleFieldDefinition($row)   X-Ref
Converts a result row with field information into the SQL field definition string

param: array        MySQL result row.
return: string        Field definition

getStatementArray($sqlcode,$removeNonSQL=0,$query_regex='')   X-Ref
Returns an array where every entry is a single sql-statement. Input must be formatted like an ordinary MySQL-dump files

param: string        $sqlcode    The sql-file content. Provided that 1) every query in the input is ended with ';' and that a line in the file contains only one query or a part of a query.
param: boolean        If set, non-sql (like comments and blank lines) are not included in the final product)
param: string        Regex to filter SQL lines to include.
return: array        Array of SQL statements.

getCreateTables($statements, $insertCountFlag=0)   X-Ref
Returns tables to create and how many records in each

param: array        Array of SQL statements to analyse.
param: boolean        If set, will count number of INSERT INTO statements following that table definition
return: array        Array with table definitions in index 0 and count in index 1

getTableInsertStatements($statements, $table)   X-Ref
Extracts all insert statements from $statement array where content is inserted into $table

param: array        Array of SQL statements
param: string        Table name
return: array        Array of INSERT INTO statements where table match $table

performUpdateQueries($arr,$keyArr)   X-Ref
Performs the queries passed from the input array.

param: array        Array of SQL queries to execute.
param: array        Array with keys that must match keys in $arr. Only where a key in this array is set and true will the query be executed (meant to be passed from a form checkbox)
return: void

getListOfTables()   X-Ref
Returns list of tables in the database

return: array        List of tables.

generateUpdateDatabaseForm_checkboxes($arr,$label,$checked=1,$iconDis=0,$currentValue=array()   X-Ref
Creates a table which checkboxes for updating database.

param: array        Array of statements (key / value pairs where key is used for the checkboxes)
param: string        Label for the table.
param: boolean        If set, then checkboxes are set by default.
param: boolean        If set, then icons are shown.
param: array        Array of "current values" for each key/value pair in $arr. Shown if given.
param: boolean        If set, will show the prefix "Current value" if $currentValue is given.
return: string        HTML table with checkboxes for update. Must be wrapped in a form.



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