[TASK] Small cleanup in Typo3DatabaseBackend 46/19446/2
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 30 Mar 2013 13:11:12 +0000 (14:11 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 30 Mar 2013 13:23:36 +0000 (14:23 +0100)
Long lines for database queries are not too long anymore.

Change-Id: I2bfbeb9e5e375c43483af9b3d33264a23a4c6adc
Resolves: #46804
Releases: 6.1
Reviewed-on: https://review.typo3.org/19446
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php

index 935944b..a1cc48a 100644 (file)
@@ -134,7 +134,10 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
        public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {
                $this->throwExceptionIfFrontendDoesNotExist();
                if (!is_string($data)) {
-                       throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException('The specified data is of type "' . gettype($data) . '" but a string is expected.', 1236518298);
+                       throw new \TYPO3\CMS\Core\Cache\Exception\InvalidDataException(
+                               'The specified data is of type "' . gettype($data) . '" but a string is expected.',
+                               1236518298
+                       );
                }
                if (is_null($lifetime)) {
                        $lifetime = $this->defaultLifetime;
@@ -176,7 +179,11 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
        public function get($entryIdentifier) {
                $this->throwExceptionIfFrontendDoesNotExist();
 
-               $cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('content', $this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' AND ' . $this->notExpiredStatement);
+               $cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                       'content',
+                       $this->cacheTable,
+                       'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' AND ' . $this->notExpiredStatement
+               );
                if (is_array($cacheEntry)) {
                        $cacheEntry = $cacheEntry['content'];
                }
@@ -195,7 +202,11 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
        public function has($entryIdentifier) {
                $this->throwExceptionIfFrontendDoesNotExist();
                $hasEntry = FALSE;
-               $cacheEntries = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' AND ' . $this->notExpiredStatement);
+               $cacheEntries = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
+                       '*',
+                       $this->cacheTable,
+                       'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' AND ' . $this->notExpiredStatement
+               );
                if ($cacheEntries >= 1) {
                        $hasEntry = TRUE;
                }
@@ -212,8 +223,14 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
        public function remove($entryIdentifier) {
                $this->throwExceptionIfFrontendDoesNotExist();
                $entryRemoved = FALSE;
-               $res = $GLOBALS['TYPO3_DB']->exec_DELETEquery($this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable));
-               $GLOBALS['TYPO3_DB']->exec_DELETEquery($this->tagsTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->tagsTable));
+               $res = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
+                       $this->cacheTable,
+                       'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable)
+               );
+               $GLOBALS['TYPO3_DB']->exec_DELETEquery(
+                       $this->tagsTable,
+                       'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->tagsTable)
+               );
                if ($GLOBALS['TYPO3_DB']->sql_affected_rows($res) == 1) {
                        $entryRemoved = TRUE;
                }
@@ -229,7 +246,12 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
        public function findIdentifiersByTag($tag) {
                $this->throwExceptionIfFrontendDoesNotExist();
                $cacheEntryIdentifiers = array();
-               $cacheEntryIdentifierRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($this->identifierField, $this->tableList, $this->tagsTable . '.tag = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tag, $this->tagsTable) . ' AND ' . $this->tableJoin . ' AND ' . $this->notExpiredStatement, $this->identifierField);
+               $cacheEntryIdentifierRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       $this->identifierField,
+                       $this->tableList,
+                       $this->tagsTable . '.tag = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tag, $this->tagsTable) . ' AND ' . $this->tableJoin . ' AND ' . $this->notExpiredStatement,
+                       $this->identifierField
+               );
                foreach ($cacheEntryIdentifierRows as $cacheEntryIdentifierRow) {
                        $cacheEntryIdentifiers[$cacheEntryIdentifierRow['identifier']] = $cacheEntryIdentifierRow['identifier'];
                }
@@ -377,5 +399,4 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 
 }
 
-
 ?>
\ No newline at end of file