class.t3lib_install.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Class to setup values in localconf.php and verify the TYPO3 DB tables/fields
00029  *
00030  * $Id: class.t3lib_install.php 8145 2010-07-09 07:34:38Z steffenk $
00031  *
00032  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  *
00038  *
00039  *   83: class t3lib_install
00040  *  108:     function t3lib_install()
00041  *
00042  *              SECTION: Writing to localconf.php
00043  *  132:     function setValueInLocalconfFile(&$line_array, $variable, $value)
00044  *  183:     function writeToLocalconf_control($inlines='',$absFullPath='')
00045  *  253:     function checkForBadString($string)
00046  *  266:     function slashValueForSingleDashes($value)
00047  *
00048  *              SECTION: SQL
00049  *  291:     function getFieldDefinitions_fileContent($fileContent)
00050  *  359:     function getFieldDefinitions_sqlContent_parseTypes(&$total)
00051  *  406:     function getFieldDefinitions_database()
00052  *  450:     function getDatabaseExtra($FDsrc, $FDcomp, $onlyTableList='')
00053  *  496:     function getUpdateSuggestions($diffArr,$keyList='extra,diff')
00054  *  589:     function assembleFieldDefinition($row)
00055  *  611:     function getStatementArray($sqlcode,$removeNonSQL=0,$query_regex='')
00056  *  649:     function getCreateTables($statements, $insertCountFlag=0)
00057  *  683:     function getTableInsertStatements($statements, $table)
00058  *  704:     function performUpdateQueries($arr,$keyArr)
00059  *  720:     function getListOfTables()
00060  *  736:     function generateUpdateDatabaseForm_checkboxes($arr,$label,$checked=1,$iconDis=0,$currentValue=array(),$cVfullMsg=0)
00061  *
00062  * TOTAL FUNCTIONS: 17
00063  * (This index is automatically created/updated by the extension "extdeveval")
00064  *
00065  */
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 /**
00076  * Class to setup values in localconf.php and verify the TYPO3 DB tables/fields
00077  *
00078  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00079  * @package TYPO3
00080  * @subpackage t3lib
00081  */
00082 class t3lib_install {
00083 
00084 
00085         // External, Static
00086     var $updateIdentity = '';                   // Set to string which identifies the script using this class.
00087     var $deletedPrefixKey = 'zzz_deleted_';     // Prefix used for tables/fields when deleted/renamed.
00088     var $dbUpdateCheckboxPrefix = 'TYPO3_INSTALL[database_update]'; // Prefix for checkbox fields when updating database.
00089     var $localconf_addLinesOnly = 0;            // If this is set, modifications to localconf.php is done by adding new lines to the array only. If unset, existing values are recognized and changed.
00090     var $localconf_editPointToken = 'INSTALL SCRIPT EDIT POINT TOKEN - all lines after this points may be changed by the install script!';      // If set and addLinesOnly is disabled, lines will be change only if they are after this token (on a single line!) in the file
00091     var $allowUpdateLocalConf = 0;      // If true, this class will allow the user to update the localconf.php file. Is set true in the init.php file.
00092     var $backPath = '../';              // Backpath (used for icons etc.)
00093 
00094     var $multiplySize = 1;              // Multiplier of SQL field size (for char, varchar and text fields)
00095     var $character_sets = array();          // Caching output of $GLOBALS['TYPO3_DB']->admin_get_charsets()
00096 
00097         // Internal, dynamic:
00098     var $setLocalconf = 0;              // Used to indicate that a value is change in the line-array of localconf and that it should be written.
00099     var $messages = array();            // Used to set (error)messages from the executing functions like mail-sending, writing Localconf and such
00100     var $touchedLine = 0;               // updated with line in localconf.php file that was changed.
00101 
00102 
00103     /**
00104      * Constructor function
00105      *
00106      * @return  void
00107      */
00108     function t3lib_install()    {
00109         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize']>= 1 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize']<=5)  {
00110             $this->multiplySize = (double)$GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'];
00111         }
00112     }
00113 
00114 
00115 
00116     /**************************************
00117      *
00118      * Writing to localconf.php
00119      *
00120 
00121      **************************************/
00122 
00123     /**
00124      * This functions takes an array with lines from localconf.php, finds a variable and inserts the new value.
00125      *
00126      * @param   array       $line_array the localconf.php file exploded into an array by linebreaks. (see writeToLocalconf_control())
00127      * @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.
00128      * @param   string      $value      Is the value to be insert for the variable
00129      * @param   boolean     $quoteValue Whether the given value should be quoted before being written
00130      * @return  void
00131      * @see writeToLocalconf_control()
00132      */
00133     public function setValueInLocalconfFile(&$line_array, $variable, $value, $quoteValue = TRUE) {
00134         if (!$this->checkForBadString($value))  return 0;
00135 
00136             // Initialize:
00137         $found = 0;
00138         $this->touchedLine = '';
00139         $commentKey = '## ';
00140         $inArray = in_array($commentKey.$this->localconf_editPointToken,$line_array);
00141         $tokenSet = ($this->localconf_editPointToken && !$inArray);     // Flag is set if the token should be set but is not yet...
00142         $stopAtToken = ($this->localconf_editPointToken && $inArray);
00143         $comment = ' Modified or inserted by '.$this->updateIdentity.'.';
00144         $replace = array('["', '"]');
00145         $search = array('[\'', '\']');
00146         $varDoubleQuotes = str_replace($search, $replace, $variable);
00147 
00148             // Search for variable name:
00149         if (!$this->localconf_addLinesOnly && !$tokenSet)   {
00150             $line_array = array_reverse($line_array);
00151             foreach($line_array as $k => $v)    {
00152                 $v2 = trim($v);
00153                 if ($stopAtToken && !strcmp($v2,$commentKey.$this->localconf_editPointToken))   break;      // If stopAtToken and token found, break out of the loop..
00154                 if (!strcmp(substr($v2,0,strlen($variable.' ')),$variable.' ')) {
00155                     $mainparts = explode($variable,$v,2);
00156                     if (count($mainparts)==2)   {   // should ALWAYS be....
00157                         $subparts = explode('//',$mainparts[1],2);
00158                         if ($quoteValue) {
00159                             $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
00160                         }
00161                         $line_array[$k] = $mainparts[0] . $variable . " = " . $value . ";   " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
00162                         $this->touchedLine = count($line_array)-$k-1;
00163                         $found = 1;
00164                         break;
00165                     }
00166                 } elseif (!strcmp(substr($v2, 0, strlen($varDoubleQuotes . ' ')), $varDoubleQuotes . ' ')) {
00167                         // Due to a bug in the update wizard (fixed in TYPO3 4.1.7) it is possible
00168                         // that $TYPO3_CONF_VARS['SYS']['compat_version'] was enclosed by "" (double
00169                         // quotes) instead of the expected '' (single quotes) when is was written to
00170                         // localconf.php. The following code was added to make sure that values with
00171                         // double quotes are updated, too.
00172                     $mainparts = explode($varDoubleQuotes, $v, 2);
00173                     if (count($mainparts) == 2) { // should ALWAYS be....
00174                         $subparts = explode('//', $mainparts[1], 2);
00175                         if ($quoteValue) {
00176                             $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
00177                         }
00178                         $line_array[$k] = $mainparts[0] . $variable . " = " . $value . ";   " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
00179                         $this->touchedLine = count($line_array) - $k - 1;
00180                         $found = 1;
00181                         break;
00182                     }
00183                 }
00184             }
00185             $line_array = array_reverse($line_array);
00186         }
00187         if (!$found)    {
00188             if ($tokenSet)      {
00189                 $line_array[] = $commentKey.$this->localconf_editPointToken;
00190                 $line_array[] = '';
00191             }
00192             if ($quoteValue) {
00193                 $value = '\'' . $this->slashValueForSingleDashes($value) . '\'';
00194             }
00195             $line_array[] = $variable . " = " . $value . "; // " . $comment;
00196             $this->touchedLine = -1;
00197         }
00198         if ($variable == '$typo_db_password') {
00199             $this->messages[] = 'Updated ' . $variable;
00200         } else {
00201             $this->messages[] = $variable . " = " . htmlspecialchars($value);
00202         }
00203         $this->setLocalconf = 1;
00204     }
00205 
00206     /**
00207      * Writes or returns lines from localconf.php
00208      *
00209      * @param   array       Array of lines to write back to localconf.php. Possibly
00210      * @param   string      Absolute path of alternative file to use (Notice: this path is not validated in terms of being inside 'TYPO3 space')
00211      * @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)
00212      * @see setValueInLocalconfFile()
00213      */
00214     function writeToLocalconf_control($inlines='',$absFullPath='')  {
00215         $tmpExt = '.TMP.php';
00216         $writeToLocalconf_dat = array();
00217         $writeToLocalconf_dat['file'] = $absFullPath ? $absFullPath : PATH_typo3conf.'localconf.php';
00218         $writeToLocalconf_dat['tmpfile'] = $writeToLocalconf_dat['file'].$tmpExt;
00219 
00220             // Checking write state of localconf.php:
00221         if (!$this->allowUpdateLocalConf) {
00222             throw new RuntimeException(
00223                 'TYPO3 Fatal Error: ->allowUpdateLocalConf flag in the install object is not set and therefore "localconf.php" cannot be altered.',
00224                 1270853915
00225             );
00226         }
00227         if (!@is_writable($writeToLocalconf_dat['file']))   {
00228             throw new RuntimeException(
00229                 'TYPO3 Fatal Error: ' . $writeToLocalconf_dat['file'] . ' is not writable!',
00230                 1270853916
00231             );
00232         }
00233 
00234                 // Splitting localconf.php file into lines:
00235         $lines = explode(LF,str_replace(CR,'',trim(t3lib_div::getUrl($writeToLocalconf_dat['file']))));
00236         $writeToLocalconf_dat['endLine'] = array_pop($lines);   // Getting "? >" ending.
00237 
00238             // Checking if "updated" line was set by this tool - if so remove old line.
00239         $updatedLine = array_pop($lines);
00240         $writeToLocalconf_dat['updatedText'] = '// Updated by '.$this->updateIdentity.' ';
00241 
00242         if (!strstr($updatedLine, $writeToLocalconf_dat['updatedText']))    {
00243             array_push($lines,$updatedLine);
00244         }
00245 
00246         if (is_array($inlines)) {   // Setting a line and write:
00247                 // Setting configuration
00248             $updatedLine = $writeToLocalconf_dat['updatedText'].date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' H:i:s');
00249             array_push($inlines,$updatedLine);
00250             array_push($inlines,$writeToLocalconf_dat['endLine']);
00251 
00252             if ($this->setLocalconf)    {
00253                 $success = FALSE;
00254                 if (!t3lib_div::writeFile($writeToLocalconf_dat['tmpfile'],implode(LF,$inlines)))   {
00255                     $msg = 'typo3conf/localconf.php'.$tmpExt.' could not be written - maybe a write access problem?';
00256                 }
00257                 elseif (strcmp(t3lib_div::getUrl($writeToLocalconf_dat['tmpfile']), implode(LF,$inlines)))  {
00258                     @unlink($writeToLocalconf_dat['tmpfile']);
00259                     $msg = 'typo3conf/localconf.php'.$tmpExt.' was NOT written properly (written content didn\'t match file content) - maybe a disk space problem?';
00260                 }
00261                 elseif (!@copy($writeToLocalconf_dat['tmpfile'],$writeToLocalconf_dat['file'])) {
00262                     $msg = 'typo3conf/localconf.php could not be replaced by typo3conf/localconf.php'.$tmpExt.' - maybe a write access problem?';
00263                 }
00264                 else {
00265                     @unlink($writeToLocalconf_dat['tmpfile']);
00266                     $success = TRUE;
00267                     $msg = 'Configuration written to typo3conf/localconf.php';
00268                 }
00269                 $this->messages[] = $msg;
00270 
00271                 if ($success)   {
00272                     return 'continue';
00273                 } else {
00274                     t3lib_div::sysLog($msg, 'Core', 3);
00275                     return 'nochange';
00276                 }
00277             } else {
00278                 return 'nochange';
00279             }
00280         } else {    // Return lines found in localconf.php
00281             return $lines;
00282         }
00283     }
00284 
00285     /**
00286      * Checking for linebreaks in the string
00287      *
00288      * @param   string      String to test
00289      * @return  boolean     Returns TRUE if string is OK
00290      * @see setValueInLocalconfFile()
00291      */
00292     function checkForBadString($string) {
00293         return preg_match('/['.LF.CR.']/',$string) ? FALSE : TRUE;
00294     }
00295 
00296     /**
00297      * Replaces ' with \' and \ with \\
00298      *
00299      * @param   string      Input value
00300      * @return  string      Output value
00301      * @see setValueInLocalconfFile()
00302      */
00303     function slashValueForSingleDashes($value)  {
00304         $value = str_replace("'.LF.'", '###INSTALL_TOOL_LINEBREAK###', $value);
00305         $value = str_replace("'","\'",str_replace('\\','\\\\',$value));
00306         $value = str_replace('###INSTALL_TOOL_LINEBREAK###', "'.LF.'", $value);
00307 
00308         return $value;
00309     }
00310 
00311 
00312 
00313 
00314 
00315 
00316 
00317 
00318 
00319 
00320     /*************************************
00321      *
00322      * SQL
00323      *
00324      *************************************/
00325 
00326     /**
00327      * Reads the field definitions for the input SQL-file string
00328      *
00329      * @param   string      Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
00330      * @return  array       Array with information about table.
00331      */
00332     function getFieldDefinitions_fileContent($fileContent)  {
00333         $lines = t3lib_div::trimExplode(LF, $fileContent, 1);
00334         $table = '';
00335         $total = array();
00336 
00337         foreach ($lines as $value) {
00338             if (substr($value,0,1)=='#') {
00339                 continue;   // Ignore comments
00340             }
00341 
00342             if (!strlen($table)) {
00343                 $parts = t3lib_div::trimExplode(' ', $value, TRUE);
00344                 if (strtoupper($parts[0]) === 'CREATE' && strtoupper($parts[1]) === 'TABLE') {
00345                     $table = str_replace( '`', '', $parts[2]);
00346                     if (TYPO3_OS=='WIN') {  // tablenames are always lowercase on windows!
00347                         $table = strtolower($table);
00348                     }
00349                 }
00350             } else {
00351                 if (substr($value,0,1)==')' && substr($value,-1)==';')  {
00352                     $ttype = array();
00353                     if (preg_match('/(ENGINE|TYPE)[ ]*=[ ]*([a-zA-Z]*)/',$value,$ttype)) {
00354                         $total[$table]['extra']['ENGINE'] = $ttype[2];
00355                     } // Otherwise, just do nothing: If table engine is not defined, just accept the system default.
00356 
00357                         // Set the collation, if specified
00358                     if (preg_match('/(COLLATE)[ ]*=[ ]*([a-zA-z0-9_-]+)/', $value, $tcollation)) {
00359                         $total[$table]['extra']['COLLATE'] = $tcollation[2];
00360                     } else {
00361                             // Otherwise, get the CHARACTER SET and try to find the default collation for it as returned by "SHOW CHARACTER SET" query (for details, see http://dev.mysql.com/doc/refman/5.1/en/charset-table.html)
00362                         if (preg_match('/(CHARSET|CHARACTER SET)[ ]*=[ ]*([a-zA-z0-9_-]+)/', $value, $tcharset)) {  // Note: Keywords "DEFAULT CHARSET" and "CHARSET" are the same, so "DEFAULT" can just be ignored
00363                             $charset = $tcharset[2];
00364                         } else {
00365                             $charset = $GLOBALS['TYPO3_DB']->default_charset;   // Fallback to default charset
00366                         }
00367                         $total[$table]['extra']['COLLATE'] = $this->getCollationForCharset($charset);
00368                     }
00369 
00370                     $table = '';    // Remove table marker and start looking for the next "CREATE TABLE" statement
00371                 } else {
00372                     $lineV = preg_replace('/,$/','',$value);    // Strip trailing commas
00373                     $lineV = str_replace('`', '', $lineV);
00374                     $lineV = str_replace('  ', ' ', $lineV);    // Remove double blanks
00375 
00376                     $parts = explode(' ', $lineV, 2);
00377                     if (!preg_match('/(PRIMARY|UNIQUE|FULLTEXT|INDEX|KEY)/',$parts[0])) {   // Field definition
00378 
00379                             // Make sure there is no default value when auto_increment is set
00380                         if (stristr($parts[1],'auto_increment')) {
00381                             $parts[1] = preg_replace('/ default \'0\'/i','',$parts[1]);
00382                         }
00383                             // "default" is always lower-case
00384                         if (stristr($parts[1], ' DEFAULT '))    {
00385                             $parts[1] = str_ireplace(' DEFAULT ', ' default ', $parts[1]);
00386                         }
00387 
00388                             // Change order of "default" and "null" statements
00389                         $parts[1] = preg_replace('/(.*) (default .*) (NOT NULL)/', '$1 $3 $2', $parts[1]);
00390                         $parts[1] = preg_replace('/(.*) (default .*) (NULL)/', '$1 $3 $2', $parts[1]);
00391 
00392                         $key = $parts[0];
00393                         $total[$table]['fields'][$key] = $parts[1];
00394 
00395                     } else {    // Key definition
00396                         $search = array('/UNIQUE (INDEX|KEY)/', '/FULLTEXT (INDEX|KEY)/', '/INDEX/');
00397                         $replace = array('UNIQUE', 'FULLTEXT', 'KEY');
00398                         $lineV = preg_replace($search, $replace, $lineV);
00399 
00400                         if (preg_match('/PRIMARY|UNIQUE|FULLTEXT/', $parts[0])) {
00401                             $parts[1] = preg_replace('/^(KEY|INDEX) /', '', $parts[1]);
00402                         }
00403 
00404                         $newParts = explode(' ',$parts[1],2);
00405                         $key = $parts[0]=='PRIMARY' ? $parts[0] : $newParts[0];
00406 
00407                         $total[$table]['keys'][$key] = $lineV;
00408 
00409                             // This is a protection against doing something stupid: Only allow clearing of cache_* and index_* tables.
00410                         if (preg_match('/^(cache|index)_/',$table)) {
00411                                 // Suggest to truncate (clear) this table
00412                             $total[$table]['extra']['CLEAR'] = 1;
00413                         }
00414                     }
00415                 }
00416             }
00417         }
00418 
00419         $this->getFieldDefinitions_sqlContent_parseTypes($total);
00420         return $total;
00421     }
00422 
00423     /**
00424      * Multiplies varchars/tinytext fields in size according to $this->multiplySize
00425      * 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.
00426      *
00427      * @param   array       Total array (from getFieldDefinitions_fileContent())
00428      * @return  void
00429      * @access private
00430      * @see getFieldDefinitions_fileContent()
00431      */
00432     function getFieldDefinitions_sqlContent_parseTypes(&$total) {
00433 
00434         $mSize = (double)$this->multiplySize;
00435         if ($mSize > 1) {
00436 
00437                 // Init SQL parser:
00438             $sqlParser = t3lib_div::makeInstance('t3lib_sqlparser');
00439             foreach($total as $table => $cfg)   {
00440                 if (is_array($cfg['fields'])) {
00441                     foreach($cfg['fields'] as $fN => $fType)    {
00442                         $orig_fType = $fType;
00443                         $fInfo = $sqlParser->parseFieldDef($fType);
00444 
00445                         switch($fInfo['fieldType']) {
00446                             case 'char':
00447                             case 'varchar':
00448                                 $newSize = round($fInfo['value']*$mSize);
00449 
00450                                 if ($newSize <= 255)    {
00451                                     $fInfo['value'] = $newSize;
00452                                 } else {
00453                                     $fInfo = array(
00454                                         'fieldType' => 'text',
00455                                         'featureIndex' => array(
00456                                             'NOTNULL' => array(
00457                                                 'keyword' => 'NOT NULL'
00458                                             )
00459                                         )
00460                                     );
00461                                         // Change key definition if necessary (must use "prefix" on TEXT columns)
00462                                     if (is_array($cfg['keys'])) {
00463                                         foreach ($cfg['keys'] as $kN => $kType) {
00464                                             $match = array();
00465                                             preg_match('/^([^(]*)\(([^)]+)\)(.*)/', $kType, $match);
00466                                             $keys = array();
00467                                             foreach (t3lib_div::trimExplode(',',$match[2]) as $kfN) {
00468                                                 if ($fN == $kfN)    {
00469                                                     $kfN .= '('.$newSize.')';
00470                                                 }
00471                                                 $keys[] = $kfN;
00472                                             }
00473                                             $total[$table]['keys'][$kN] = $match[1].'('.implode(',',$keys).')'.$match[3];
00474                                         }
00475                                     }
00476                                 }
00477                             break;
00478                             case 'tinytext':
00479                                 $fInfo['fieldType'] = 'text';
00480                             break;
00481                         }
00482 
00483                         $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
00484                         if ($sqlParser->parse_error) {
00485                             throw new RuntimeException(
00486                                 'TYPO3 Fatal Error: ' . $sqlParser->parse_error,
00487                                 1270853961
00488                             );
00489                         }
00490                     }
00491                 }
00492             }
00493         }
00494     }
00495 
00496     /**
00497      * Look up the default collation for specified character set based on "SHOW CHARACTER SET" output
00498      *
00499      * @param   string      Character set
00500      * @return  string      Corresponding default collation
00501      */
00502     function getCollationForCharset($charset)   {
00503             // Load character sets, if not cached already
00504         if (!count($this->character_sets)) {
00505             if (method_exists($GLOBALS['TYPO3_DB'],'admin_get_charsets')) {
00506                 $this->character_sets = $GLOBALS['TYPO3_DB']->admin_get_charsets();
00507             } else {
00508                 $this->character_sets[$charset] = array();  // Add empty element to avoid that the check will be repeated
00509             }
00510         }
00511 
00512         $collation = '';
00513         if (isset($this->character_sets[$charset]['Default collation'])) {
00514             $collation = $this->character_sets[$charset]['Default collation'];
00515         }
00516 
00517         return $collation;
00518     }
00519 
00520     /**
00521      * Reads the field definitions for the current database
00522      *
00523      * @return  array       Array with information about table.
00524      */
00525     function getFieldDefinitions_database() {
00526         $total = array();
00527         $tempKeys = array();
00528         $tempKeysPrefix = array();
00529 
00530         $GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db);
00531         echo $GLOBALS['TYPO3_DB']->sql_error();
00532 
00533         $tables = $GLOBALS['TYPO3_DB']->admin_get_tables(TYPO3_db);
00534         foreach ($tables as $tableName => $tableStatus) {
00535 
00536                 // Fields:
00537             $fieldInformation = $GLOBALS['TYPO3_DB']->admin_get_fields($tableName);
00538             foreach ($fieldInformation as $fN => $fieldRow) {
00539                 $total[$tableName]['fields'][$fN] = $this->assembleFieldDefinition($fieldRow);
00540             }
00541 
00542                 // Keys:
00543             $keyInformation = $GLOBALS['TYPO3_DB']->admin_get_keys($tableName);
00544 
00545             foreach ($keyInformation as $keyRow) {
00546                 $keyName = $keyRow['Key_name'];
00547                 $colName = $keyRow['Column_name'];
00548                 if ($keyRow['Sub_part']) {
00549                     $colName.= '('.$keyRow['Sub_part'].')';
00550                 }
00551                 $tempKeys[$tableName][$keyName][$keyRow['Seq_in_index']] = $colName;
00552                 if ($keyName=='PRIMARY') {
00553                     $prefix = 'PRIMARY KEY';
00554                 } else {
00555                     if ($keyRow['Index_type']=='FULLTEXT') {
00556                         $prefix = 'FULLTEXT';
00557                     } elseif ($keyRow['Non_unique']) {
00558                         $prefix = 'KEY';
00559                     } else {
00560                         $prefix = 'UNIQUE';
00561                     }
00562                     $prefix.= ' '.$keyName;
00563                 }
00564                 $tempKeysPrefix[$tableName][$keyName] = $prefix;
00565             }
00566 
00567                 // Table status (storage engine, collaction, etc.)
00568             if (is_array($tableStatus)) {
00569                 $tableExtraFields = array(
00570                     'Engine' => 'ENGINE',
00571                     'Collation' => 'COLLATE',
00572                 );
00573 
00574                 foreach ($tableExtraFields as $mysqlKey=>$internalKey) {
00575                     if (isset($tableStatus[$mysqlKey])) {
00576                         $total[$tableName]['extra'][$internalKey] = $tableStatus[$mysqlKey];
00577                     }
00578                 }
00579             }
00580         }
00581 
00582             // Compile key information:
00583         if (count($tempKeys)) {
00584             foreach ($tempKeys as $table => $keyInf) {
00585                 foreach ($keyInf as $kName => $index) {
00586                     ksort($index);
00587                     $total[$table]['keys'][$kName] = $tempKeysPrefix[$table][$kName].' ('.implode(',',$index).')';
00588                 }
00589             }
00590         }
00591 
00592         return $total;
00593     }
00594 
00595     /**
00596      * Compares two arrays with field information and returns information about fields that are MISSING and fields that have CHANGED.
00597      * FDsrc and FDcomp can be switched if you want the list of stuff to remove rather than update.
00598      *
00599      * @param   array       Field definitions, source (from getFieldDefinitions_fileContent())
00600      * @param   array       Field definitions, comparison. (from getFieldDefinitions_database())
00601      * @param   string      Table names (in list) which is the ONLY one observed.
00602      * @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.
00603      * @return  array       Returns an array with 1) all elements from $FDsrc that is not in $FDcomp (in key 'extra') and 2) all elements from $FDsrc that is different from the ones in $FDcomp
00604      */
00605     function getDatabaseExtra($FDsrc, $FDcomp, $onlyTableList='',$ignoreNotNullWhenComparing=true)  {
00606         $extraArr = array();
00607         $diffArr = array();
00608 
00609         if (is_array($FDsrc)) {
00610             foreach ($FDsrc as $table => $info) {
00611                 if (!strlen($onlyTableList) || t3lib_div::inList($onlyTableList, $table)) {
00612                     if (!isset($FDcomp[$table])) {
00613                         $extraArr[$table] = $info;      // If the table was not in the FDcomp-array, the result array is loaded with that table.
00614                         $extraArr[$table]['whole_table']=1;
00615                     } else {
00616                         $keyTypes = explode(',','extra,fields,keys');
00617                         foreach ($keyTypes as $theKey) {
00618                             if (is_array($info[$theKey])) {
00619                                 foreach ($info[$theKey] as $fieldN => $fieldC) {
00620                                     $fieldN = str_replace('`','',$fieldN);
00621                                     if ($fieldN=='COLLATE') {
00622                                         continue;   // TODO: collation support is currently disabled (needs more testing)
00623                                     }
00624 
00625                                     if (!isset($FDcomp[$table][$theKey][$fieldN])) {
00626                                         $extraArr[$table][$theKey][$fieldN] = $fieldC;
00627                                     } else {
00628                                         $fieldC = trim($fieldC);
00629                                         if ($ignoreNotNullWhenComparing) {
00630                                             $fieldC = str_replace(' NOT NULL', '', $fieldC);
00631                                             $FDcomp[$table][$theKey][$fieldN] = str_replace(' NOT NULL', '', $FDcomp[$table][$theKey][$fieldN]);
00632                                         }
00633                                         if ($fieldC !== $FDcomp[$table][$theKey][$fieldN]) {
00634                                             $diffArr[$table][$theKey][$fieldN] = $fieldC;
00635                                             $diffArr_cur[$table][$theKey][$fieldN] = $FDcomp[$table][$theKey][$fieldN];
00636                                         }
00637                                     }
00638                                 }
00639                             }
00640                         }
00641                     }
00642                 }
00643             }
00644         }
00645 
00646         $output = array(
00647             'extra' => $extraArr,
00648             'diff' => $diffArr,
00649             'diff_currentValues' => $diffArr_cur
00650         );
00651 
00652         return $output;
00653     }
00654 
00655     /**
00656      * Returns an array with SQL-statements that is needed to update according to the diff-array
00657      *
00658      * @param   array       Array with differences of current and needed DB settings. (from getDatabaseExtra())
00659      * @param   string      List of fields in diff array to take notice of.
00660      * @return  array       Array of SQL statements (organized in keys depending on type)
00661      */
00662     function getUpdateSuggestions($diffArr,$keyList='extra,diff')   {
00663         $statements = array();
00664         $deletedPrefixKey = $this->deletedPrefixKey;
00665         $remove = 0;
00666         if ($keyList == 'remove')   {
00667             $remove = 1;
00668             $keyList = 'extra';
00669         }
00670         $keyList = explode(',',$keyList);
00671         foreach ($keyList as $theKey) {
00672             if (is_array($diffArr[$theKey])) {
00673                 foreach ($diffArr[$theKey] as $table => $info) {
00674                     $whole_table = array();
00675                     if (is_array($info['fields'])) {
00676                         foreach ($info['fields'] as $fN => $fV) {
00677                             if ($info['whole_table']) {
00678                                 $whole_table[]=$fN.' '.$fV;
00679                             } else {
00680                                     // Special case to work around MySQL problems when adding auto_increment fields:
00681                                 if (stristr($fV, 'auto_increment')) {
00682                                         // The field can only be set "auto_increment" if there exists a PRIMARY key of that field already.
00683                                         // The check does not look up which field is primary but just assumes it must be the field with the auto_increment value...
00684                                     if (isset($diffArr['extra'][$table]['keys']['PRIMARY'])) {
00685                                             // Remove "auto_increment" from the statement - it will be suggested in a 2nd step after the primary key was created
00686                                         $fV = str_replace(' auto_increment', '', $fV);
00687                                     } else {
00688                                             // In the next step, attempt to clear the table once again (2 = force)
00689                                         $info['extra']['CLEAR'] = 2;
00690                                     }
00691                                 }
00692                                 if ($theKey=='extra') {
00693                                     if ($remove) {
00694                                         if (substr($fN,0,strlen($deletedPrefixKey))!=$deletedPrefixKey) {
00695                                             $statement = 'ALTER TABLE '.$table.' CHANGE '.$fN.' '.$deletedPrefixKey.$fN.' '.$fV.';';
00696                                             $statements['change'][md5($statement)] = $statement;
00697                                         } else {
00698                                             $statement = 'ALTER TABLE '.$table.' DROP '.$fN.';';
00699                                             $statements['drop'][md5($statement)] = $statement;
00700                                         }
00701                                     } else {
00702                                         $statement = 'ALTER TABLE '.$table.' ADD '.$fN.' '.$fV.';';
00703                                         $statements['add'][md5($statement)] = $statement;
00704                                     }
00705                                 } elseif ($theKey=='diff') {
00706                                     $statement = 'ALTER TABLE '.$table.' CHANGE '.$fN.' '.$fN.' '.$fV.';';
00707                                     $statements['change'][md5($statement)] = $statement;
00708                                     $statements['change_currentValue'][md5($statement)] = $diffArr['diff_currentValues'][$table]['fields'][$fN];
00709                                 }
00710                             }
00711                         }
00712                     }
00713                     if (is_array($info['keys'])) {
00714                         foreach ($info['keys'] as $fN => $fV) {
00715                             if ($info['whole_table']) {
00716                                 $whole_table[] = $fV;
00717                             } else {
00718                                 if ($theKey=='extra') {
00719                                     if ($remove) {
00720                                         $statement = 'ALTER TABLE '.$table.($fN=='PRIMARY' ? ' DROP PRIMARY KEY' : ' DROP KEY '.$fN).';';
00721                                         $statements['drop'][md5($statement)] = $statement;
00722                                     } else {
00723                                         $statement = 'ALTER TABLE '.$table.' ADD '.$fV.';';
00724                                         $statements['add'][md5($statement)] = $statement;
00725                                     }
00726                                 } elseif ($theKey=='diff') {
00727                                     $statement = 'ALTER TABLE '.$table.($fN=='PRIMARY' ? ' DROP PRIMARY KEY' : ' DROP KEY '.$fN).';';
00728                                     $statements['change'][md5($statement)] = $statement;
00729                                     $statement = 'ALTER TABLE '.$table.' ADD '.$fV.';';
00730                                     $statements['change'][md5($statement)] = $statement;
00731                                 }
00732                             }
00733                         }
00734                     }
00735                     if (is_array($info['extra'])) {
00736                         $extras = array();
00737                         $extras_currentValue = array();
00738                         $clear_table = false;
00739 
00740                         foreach ($info['extra'] as $fN => $fV) {
00741 
00742                                 // Only consider statements which are missing in the database but don't remove existing properties
00743                             if (!$remove) {
00744                                 if (!$info['whole_table']) {    // If the whole table is created at once, we take care of this later by imploding all elements of $info['extra']
00745                                     if ($fN=='CLEAR') {
00746                                             // Truncate table must happen later, not now
00747                                             // Valid values for CLEAR: 1=only clear if keys are missing, 2=clear anyway (force)
00748                                         if (count($info['keys']) || $fV==2) {
00749                                             $clear_table = true;
00750                                         }
00751                                         continue;
00752                                     } else {
00753                                         $extras[] = $fN.'='.$fV;
00754                                         $extras_currentValue[] = $fN.'='.$diffArr['diff_currentValues'][$table]['extra'][$fN];
00755                                     }
00756                                 }
00757                             }
00758                         }
00759                         if ($clear_table) {
00760                             $statement = 'TRUNCATE TABLE '.$table.';';
00761                             $statements['clear_table'][md5($statement)] = $statement;
00762                         }
00763                         if (count($extras)) {
00764                             $statement = 'ALTER TABLE '.$table.' '.implode(' ',$extras).';';
00765                             $statements['change'][md5($statement)] = $statement;
00766                             $statements['change_currentValue'][md5($statement)] = implode(' ',$extras_currentValue);
00767                         }
00768                     }
00769                     if ($info['whole_table']) {
00770                         if ($remove) {
00771                             if (substr($table,0,strlen($deletedPrefixKey))!=$deletedPrefixKey) {
00772                                 $statement = 'ALTER TABLE '.$table.' RENAME '.$deletedPrefixKey.$table.';';
00773                                 $statements['change_table'][md5($statement)] = $statement;
00774                             } else {
00775                                 $statement = 'DROP TABLE '.$table.';';
00776                                 $statements['drop_table'][md5($statement)] = $statement;
00777                             }
00778                                 // count:
00779                             $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table);
00780                             $statements['tables_count'][md5($statement)] = $count?'Records in table: '.$count:'';
00781                         } else {
00782                             $statement = 'CREATE TABLE '.$table." (\n".implode(",\n",$whole_table)."\n)";
00783                             if ($info['extra']) {
00784                                 foreach ($info['extra'] as $k=>$v) {
00785                                     if ($k=='COLLATE' || $k=='CLEAR') {
00786                                         continue;   // Skip these special statements. TODO: collation support is currently disabled (needs more testing)
00787                                     }
00788                                     $statement.= ' '.$k.'='.$v; // Add extra attributes like ENGINE, CHARSET, etc.
00789                                 }
00790                             }
00791                             $statement.= ';';
00792                             $statements['create_table'][md5($statement)] = $statement;
00793                         }
00794                     }
00795                 }
00796             }
00797         }
00798 
00799         return $statements;
00800     }
00801 
00802     /**
00803      * Converts a result row with field information into the SQL field definition string
00804      *
00805      * @param   array       MySQL result row
00806      * @return  string      Field definition
00807      */
00808     function assembleFieldDefinition($row)  {
00809         $field = array($row['Type']);
00810 
00811         if ($row['Null']=='NO') {
00812             $field[] = 'NOT NULL';
00813         }
00814         if (!strstr($row['Type'],'blob') && !strstr($row['Type'],'text')) {
00815                 // Add a default value if the field is not auto-incremented (these fields never have a default definition)
00816             if (!stristr($row['Extra'],'auto_increment')) {
00817                 $field[] = 'default \''.addslashes($row['Default']).'\'';
00818             }
00819         }
00820         if ($row['Extra']) {
00821             $field[] = $row['Extra'];
00822         }
00823 
00824         return implode(' ',$field);
00825     }
00826 
00827     /**
00828      * Returns an array where every entry is a single SQL-statement. Input must be formatted like an ordinary MySQL-dump files.
00829      *
00830      * @param   string      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.
00831      * @param   boolean     If set, non-SQL content (like comments and blank lines) is not included in the final output
00832      * @param   string      Regex to filter SQL lines to include
00833      * @return  array       Array of SQL statements
00834      */
00835     function getStatementArray($sqlcode,$removeNonSQL=0,$query_regex='')    {
00836         $sqlcodeArr = explode(LF, $sqlcode);
00837 
00838             // Based on the assumption that the sql-dump has
00839         $statementArray = array();
00840         $statementArrayPointer = 0;
00841 
00842         foreach ($sqlcodeArr as $line => $lineContent) {
00843             $is_set = 0;
00844 
00845                 // auto_increment fields cannot have a default value!
00846             if (stristr($lineContent,'auto_increment')) {
00847                 $lineContent = preg_replace('/ default \'0\'/i', '', $lineContent);
00848             }
00849 
00850             if (!$removeNonSQL || (strcmp(trim($lineContent),'') && substr(trim($lineContent),0,1)!='#' && substr(trim($lineContent),0,2)!='--')) {     // '--' is seen as mysqldump comments from server version 3.23.49
00851                 $statementArray[$statementArrayPointer].= $lineContent;
00852                 $is_set = 1;
00853             }
00854             if (substr(trim($lineContent),-1)==';') {
00855                 if (isset($statementArray[$statementArrayPointer])) {
00856                     if (!trim($statementArray[$statementArrayPointer]) || ($query_regex && !preg_match('/'.$query_regex.'/i',trim($statementArray[$statementArrayPointer])))) {
00857                         unset($statementArray[$statementArrayPointer]);
00858                     }
00859                 }
00860                 $statementArrayPointer++;
00861 
00862             } elseif ($is_set) {
00863                 $statementArray[$statementArrayPointer].= LF;
00864             }
00865         }
00866 
00867         return $statementArray;
00868     }
00869 
00870     /**
00871      * Returns tables to create and how many records in each
00872      *
00873      * @param   array       Array of SQL statements to analyse.
00874      * @param   boolean     If set, will count number of INSERT INTO statements following that table definition
00875      * @return  array       Array with table definitions in index 0 and count in index 1
00876      */
00877     function getCreateTables($statements, $insertCountFlag=0) {
00878         $crTables = array();
00879         $insertCount = array();
00880         foreach ($statements as $line => $lineContent) {
00881             $reg = array();
00882             if (preg_match('/^create[[:space:]]*table[[:space:]]*[`]?([[:alnum:]_]*)[`]?/i',substr($lineContent,0,100),$reg)) {
00883                 $table = trim($reg[1]);
00884                 if ($table) {
00885                         // table names are always lowercase on Windows!
00886                     if (TYPO3_OS == 'WIN') {
00887                         $table = strtolower($table);
00888                     }
00889                     $sqlLines = explode(LF, $lineContent);
00890                     foreach ($sqlLines as $k=>$v) {
00891                         if (stristr($v,'auto_increment')) {
00892                             $sqlLines[$k] = preg_replace('/ default \'0\'/i', '', $v);
00893                         }
00894                     }
00895                     $lineContent = implode(LF, $sqlLines);
00896                     $crTables[$table] = $lineContent;
00897                 }
00898             } elseif ($insertCountFlag && preg_match('/^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?/i',substr($lineContent,0,100),$reg)) {
00899                 $nTable = trim($reg[1]);
00900                 $insertCount[$nTable]++;
00901             }
00902         }
00903 
00904         return array($crTables,$insertCount);
00905     }
00906 
00907     /**
00908      * Extracts all insert statements from $statement array where content is inserted into $table
00909      *
00910      * @param   array       Array of SQL statements
00911      * @param   string      Table name
00912      * @return  array       Array of INSERT INTO statements where table match $table
00913      */
00914     function getTableInsertStatements($statements, $table)  {
00915         $outStatements=array();
00916         foreach($statements as $line => $lineContent) {
00917             $reg = array();
00918             if (preg_match('/^insert[[:space:]]*into[[:space:]]*[`]?([[:alnum:]_]*)[`]?/i',substr($lineContent,0,100),$reg)) {
00919                 $nTable = trim($reg[1]);
00920                 if ($nTable && !strcmp($table,$nTable)) {
00921                     $outStatements[] = $lineContent;
00922                 }
00923             }
00924         }
00925         return $outStatements;
00926     }
00927 
00928     /**
00929      * Performs the queries passed from the input array.
00930      *
00931      * @param   array       Array of SQL queries to execute.
00932      * @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)
00933      * @return  mixed       Array with error message from database if any occured. Otherwise true if everything was executed successfully.
00934      */
00935     function performUpdateQueries($arr,$keyArr) {
00936         $result = array();
00937         if (is_array($arr)) {
00938             foreach($arr as $key => $string)    {
00939                 if (isset($keyArr[$key]) && $keyArr[$key])  {
00940                     $res = $GLOBALS['TYPO3_DB']->admin_query($string);
00941                     if ($res === false) {
00942                         $result[$key] = $GLOBALS['TYPO3_DB']->sql_error();
00943                     } elseif (is_resource($res)) {
00944                         $GLOBALS['TYPO3_DB']->sql_free_result($res);
00945                     }
00946                 }
00947             }
00948         }
00949         if (count($result) > 0) {
00950             return $result;
00951         } else {
00952             return true;
00953         }
00954     }
00955 
00956     /**
00957      * Returns list of tables in the database
00958      *
00959      * @return  array       List of tables.
00960      * @see t3lib_db::admin_get_tables()
00961      */
00962     function getListOfTables()  {
00963         $whichTables = $GLOBALS['TYPO3_DB']->admin_get_tables(TYPO3_db);
00964         foreach ($whichTables as $key=>&$value) {
00965             $value = $key;
00966         }
00967         return $whichTables;
00968     }
00969 
00970     /**
00971      * Creates a table which checkboxes for updating database.
00972      *
00973      * @param   array       Array of statements (key / value pairs where key is used for the checkboxes)
00974      * @param   string      Label for the table.
00975      * @param   boolean     If set, then checkboxes are set by default.
00976      * @param   boolean     If set, then icons are shown.
00977      * @param   array       Array of "current values" for each key/value pair in $arr. Shown if given.
00978      * @param   boolean     If set, will show the prefix "Current value" if $currentValue is given.
00979      * @return  string      HTML table with checkboxes for update. Must be wrapped in a form.
00980      */
00981     function generateUpdateDatabaseForm_checkboxes($arr,$label,$checked=1,$iconDis=0,$currentValue=array(),$cVfullMsg=0)    {
00982         $out = array();
00983         if (is_array($arr)) {
00984             $tableId = uniqid('table');
00985             if (count($arr) > 1) {
00986                 $out[] = '
00987                     <tr class="update-db-fields-batch">
00988                         <td valign="top">
00989                             <input type="checkbox" id="' . $tableId . '-checkbox"' . ($checked ? ' checked="checked"' : '') . '
00990                              onclick="$(\'' . $tableId . '\').select(\'input[type=checkbox]\').invoke(\'setValue\', $(this).checked);" />
00991                         </td>
00992                         <td nowrap="nowrap"><label for="' . $tableId . '-checkbox" style="cursor:pointer"><strong>select/deselect all</strong></label></td>
00993                     </tr>';
00994             }
00995             foreach($arr as $key => $string)    {
00996                 $ico = '';
00997                 $warnings = array();
00998 
00999                 if ($iconDis)   {
01000                     if (preg_match('/^TRUNCATE/i',$string)) {
01001                         $ico.= '<img src="'.$this->backPath.'gfx/icon_warning.gif" width="18" height="16" align="top" alt="" /><strong> </strong>';
01002                         $warnings['clear_table_info'] = 'Clearing the table is sometimes neccessary when adding new keys. In case of cache_* tables this should not hurt at all. However, use it with care.';
01003                     } elseif (stristr($string,' user_'))    {
01004                         $ico.= '<img src="'.$this->backPath.'gfx/icon_warning.gif" width="18" height="16" align="top" alt="" /><strong>(USER) </strong>';
01005                     } elseif (stristr($string,' app_')) {
01006                         $ico.= '<img src="'.$this->backPath.'gfx/icon_warning.gif" width="18" height="16" align="top" alt="" /><strong>(APP) </strong>';
01007                     } elseif (stristr($string,' ttx_') || stristr($string,' tx_'))  {
01008                         $ico.= '<img src="'.$this->backPath.'gfx/icon_warning.gif" width="18" height="16" align="top" alt="" /><strong>(EXT) </strong>';
01009                     }
01010                 }
01011                 $out[]='
01012                     <tr>
01013                         <td valign="top"><input type="checkbox" id="db-'.$key.'" name="'.$this->dbUpdateCheckboxPrefix.'['.$key.']" value="1"'.($checked?' checked="checked"':'').' /></td>
01014                         <td nowrap="nowrap"><label for="db-'.$key.'">'.nl2br($ico.htmlspecialchars($string)).'</label></td>
01015                     </tr>';
01016                 if (isset($currentValue[$key])) {
01017                     $out[]='
01018                     <tr>
01019                         <td valign="top"></td>
01020                         <td nowrap="nowrap" style="color:#666666;">'.nl2br((!$cVfullMsg?"Current value: ":"").'<em>'.$currentValue[$key].'</em>').'</td>
01021                     </tr>';
01022                 }
01023             }
01024             if (count($warnings)) {
01025                 $out[] = '
01026                     <tr>
01027                         <td valign="top"></td>
01028                         <td style="color:#666666;"><em>' . implode('<br />',$warnings) . '</em></td>
01029                     </tr>';
01030             }
01031 
01032             // Compile rows:
01033             $content = '
01034                 <!-- Update database fields / tables -->
01035                 <h3>'.$label.'</h3>
01036                 <table border="0" cellpadding="2" cellspacing="2" id="' . $tableId . '" class="update-db-fields">' . implode('', $out) . '
01037                 </table>';
01038         }
01039 
01040         return $content;
01041     }
01042 
01043     /**
01044      * Reads the field definitions for the input SQL-file string
01045      *
01046      * @param   string      Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
01047      * @return  array       Array with information about table.
01048      * @deprecated  since TYPO3 4.2, this function will be removed in TYPO3 4.5, use ->getFieldDefinitions_fileContent() instead!
01049      */
01050     function getFieldDefinitions_sqlContent($fileContent)   {
01051         t3lib_div::logDeprecatedFunction();
01052 
01053         return $this->getFieldDefinitions_fileContent($fileContent);
01054     }
01055 }
01056 
01057 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_install.php'])   {
01058     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_install.php']);
01059 }
01060 
01061 ?>

Generated on Sat Jul 24 04:17:17 2010 for TYPO3 API by  doxygen 1.4.7