[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)
committerGeorg Ringer <mail@ringerge.org>
Sun, 18 Dec 2011 07:03:43 +0000 (08:03 +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: Iba80d74659cd9c0d168434f999cb9a281a9ba3f0
Resolves: #21590
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7109
Reviewed-by: Mario Rimann
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
t3lib/class.t3lib_refindex.php

index 36cebb6..b5a9860 100644 (file)
@@ -908,11 +908,17 @@ class t3lib_refindex {
 
                        // Traverse all tables:
                foreach ($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 = $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');