[BUGFIX] Warnings in BE when using "Update reference index"
authorDmitry Dulepov <dmitry@typo3.org>
Wed, 23 Nov 2011 13:24:12 +0000 (15:24 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Tue, 29 Nov 2011 08:45:25 +0000 (09:45 +0100)
If the table exists in $TCA but does not exist in the database,
"Update reference index" in "Tools">"DB Check" will throw
warnings. Implement a check and a descriptive error message in
the system log.

Change-Id: I29bca987a7897530a383b30b19bd8cfa008afd57
Resolves: #21590
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/6874
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/class.t3lib_refindex.php

index 39c94b3..fcff03b 100644 (file)
@@ -869,11 +869,17 @@ class t3lib_refindex {
 
                        // Traverse all tables:
                foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
+                               // Traverse all records in tables, including deleted records:
+                       $allRecs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $tableName, '1=1');
+                       if (!is_array($allRecs)) {
+                                       // Table exists in $TCA but does not exist in the database
+                               t3lib_div::sysLog(sprintf('Table "%s" exists in $TCA but does not exist in the database. You should run the Database Analyzer in the Install Tool to fix this.', $tableName), 'core', t3lib_div::SYSLOG_SEVERITY_ERROR);
+                               continue;
+                       }
+
                        $tableNames[] = $tableName;
                        $tableCount++;
 
-                               // Traverse all records in tables, including deleted records:
-                       $allRecs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $tableName, '1=1'); //.t3lib_BEfunc::deleteClause($tableName)
                        $uidList = array(0);
                        foreach ($allRecs as $recdat) {
                                $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');