[BUGFIX] File list breaks with DBAL 18/39318/2
authorXavier Perseguers <xavier@typo3.org>
Thu, 7 May 2015 07:42:53 +0000 (09:42 +0200)
committerXavier Perseguers <xavier@typo3.org>
Thu, 7 May 2015 08:20:32 +0000 (10:20 +0200)
Unsupported double quotes used in database statements.

Change-Id: I8461d1d3acc57a3d543dbdf1d6450d2513eb661d
Releases: master, 6.2
Resolves: #66825
Reviewed-on: http://review.typo3.org/39318
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php
typo3/sysext/filelist/Classes/FileList.php

index 1c591ee..169529b 100644 (file)
@@ -350,11 +350,14 @@ class ExtendedFileUtility extends BasicFileUtility {
                if ($fileObject instanceof File) {
                        // check if the file still has references
                        // Exclude sys_file_metadata records as these are no use references
-                       $refIndexRecords = $this->getDatabaseConnection()->exec_SELECTgetRows(
+                       $databaseConnection = $this->getDatabaseConnection();
+                       $table = 'sys_refindex';
+                       $refIndexRecords = $databaseConnection->exec_SELECTgetRows(
                                '*',
-                               'sys_refindex',
-                               'deleted=0 AND ref_table="sys_file" AND ref_uid=' . (int)$fileObject->getUid()
-                               . ' AND tablename != "sys_file_metadata"'
+                               $table,
+                               'deleted=0 AND ref_table=' . $databaseConnection->fullQuoteStr('sys_file', $table)
+                                       . ' AND ref_uid=' . (int)$fileObject->getUid()
+                                       . ' AND tablename != ' . $databaseConnection->fullQuoteStr('sys_file_metadata', $table)
                        );
                        $deleteFile = TRUE;
                        if (count($refIndexRecords) > 0) {
index 8106d47..0c718d4 100644 (file)
@@ -947,10 +947,15 @@ class FileList extends AbstractRecordList {
                }
                // Look up the file in the sys_refindex.
                // Exclude sys_file_metadata records as these are no use references
-               $referenceCount = $this->getDatabaseConnection()->exec_SELECTcountRows(
+               $databaseConnection = $this->getDatabaseConnection();
+               $table = 'sys_refindex';
+               $referenceCount = $databaseConnection->exec_SELECTcountRows(
                        '*',
-                       'sys_refindex',
-                       'ref_table=\'sys_file\' AND ref_uid = ' . (int)$fileOrFolderObject->getUid() . ' AND deleted=0 AND tablename != "sys_file_metadata"'
+                       $table,
+                       'ref_table=' . $databaseConnection->fullQuoteStr('sys_file', $table)
+                               . ' AND ref_uid=' . (int)$fileOrFolderObject->getUid()
+                               . ' AND deleted=0' .
+                               . ' AND tablename != ' . $databaseConnection->fullQuoteStr('sys_file_metadata', $table)
                );
                return $this->generateReferenceToolTip($referenceCount, '\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
        }