From 5caaaca4ea4480c027fe3c3662db5784a38a60fe Mon Sep 17 00:00:00 2001
From: Xavier Perseguers <xavier@typo3.org>
Date: Thu, 20 Mar 2014 20:26:49 +0100
Subject: [PATCH] [TASK] Unify use of getter for $GLOBALS['TYPO3_DB']

Resolves: #57119
Releases: 6.2
Change-Id: I9be8b51fd695e2470e22fe084eeec507fd78f6f2
Reviewed-on: https://review.typo3.org/28578
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
---
 .../Collection/CategoryCollection.php         | 12 +--
 .../Collection/RecordCollectionRepository.php | 16 ++--
 .../CategoryBasedFileCollection.php           |  8 +-
 .../Resource/Index/FileIndexRepository.php    | 36 ++++-----
 .../Resource/Index/MetaDataRepository.php     | 14 ++--
 .../Processing/FileDeletionAspect.php         |  8 +-
 .../Collection/CategoryCollectionTest.php     |  2 +-
 .../AbstractDataHandlerActionTestCase.php     |  8 +-
 .../DataHandling/DataHandlerTest.php          |  8 +-
 .../DataHandling/IRRE/AbstractTestCase.php    |  6 +-
 .../sysext/core/Tests/FunctionalTestCase.php  | 12 +--
 .../RecordCollectionRepositoryTest.php        |  4 +-
 .../Tests/Functional/Persistence/AddTest.php  |  2 +-
 .../Functional/Persistence/RelationTest.php   | 80 +++++++++----------
 .../Collection/CategoryCollection.php         | 10 +--
 .../Controller/Action/AbstractAction.php      |  2 +-
 .../Controller/Action/Step/DatabaseData.php   |  6 +-
 .../Action/Step/DefaultConfiguration.php      |  2 +-
 .../Controller/Action/Tool/CleanUp.php        |  6 +-
 .../Action/Tool/ImportantActions.php          |  4 +-
 .../Controller/Action/Tool/UpgradeWizard.php  |  6 +-
 .../Classes/Service/ClearCacheService.php     |  4 +-
 22 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php b/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
index 19f1b316eeeb..59e0d0e76c0f 100644
--- a/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
+++ b/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
@@ -123,16 +123,16 @@ class CategoryCollection extends \TYPO3\CMS\Core\Collection\AbstractRecordCollec
 		// Assemble where clause
 		$where = 'AND ' . self::$storageTableName . '.uid = ' . (int)$this->getIdentifier();
 		// Add condition on tablenames fields
-		$where .= ' AND sys_category_record_mm.tablenames = ' . $this->getDatabase()->fullQuoteStr(
+		$where .= ' AND sys_category_record_mm.tablenames = ' . $this->getDatabaseConnection()->fullQuoteStr(
 			$this->getItemTableName(),
 			'sys_category_record_mm'
 		);
 		// Add condition on fieldname field
-		$where .= ' AND sys_category_record_mm.fieldname = ' . $this->getDatabase()->fullQuoteStr(
+		$where .= ' AND sys_category_record_mm.fieldname = ' . $this->getDatabaseConnection()->fullQuoteStr(
 			$this->getRelationFieldName(),
 			'sys_category_record_mm'
 		);
-		$resource = $this->getDatabase()->exec_SELECT_mm_query(
+		$resource = $this->getDatabaseConnection()->exec_SELECT_mm_query(
 			$this->getItemTableName() . '.*',
 			self::$storageTableName,
 			'sys_category_record_mm',
@@ -140,10 +140,10 @@ class CategoryCollection extends \TYPO3\CMS\Core\Collection\AbstractRecordCollec
 			$where
 		);
 		if ($resource) {
-			while ($record = $this->getDatabase()->sql_fetch_assoc($resource)) {
+			while ($record = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) {
 				$relatedRecords[] = $record;
 			}
-			$this->getDatabase()->sql_free_result($resource);
+			$this->getDatabaseConnection()->sql_free_result($resource);
 		}
 		return $relatedRecords;
 	}
@@ -286,7 +286,7 @@ class CategoryCollection extends \TYPO3\CMS\Core\Collection\AbstractRecordCollec
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
diff --git a/typo3/sysext/core/Classes/Collection/RecordCollectionRepository.php b/typo3/sysext/core/Classes/Collection/RecordCollectionRepository.php
index 1ba8390d975b..2c3993f8529c 100644
--- a/typo3/sysext/core/Classes/Collection/RecordCollectionRepository.php
+++ b/typo3/sysext/core/Classes/Collection/RecordCollectionRepository.php
@@ -59,7 +59,7 @@ class RecordCollectionRepository {
 	 */
 	public function findByUid($uid) {
 		$result = NULL;
-		$data = $this->getDatabase()->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . (int)$uid . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table));
+		$data = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . (int)$uid . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table));
 		if ($data !== NULL) {
 			$result = $this->createDomainObject($data);
 		}
@@ -83,7 +83,7 @@ class RecordCollectionRepository {
 	 */
 	public function findByTableName($tableName) {
 		$conditions = array(
-			$this->tableField . '=' . $this->getDatabase()->fullQuoteStr($tableName, $this->table)
+			$this->tableField . '=' . $this->getDatabaseConnection()->fullQuoteStr($tableName, $this->table)
 		);
 		return $this->queryMultipleRecords($conditions);
 	}
@@ -96,7 +96,7 @@ class RecordCollectionRepository {
 	 */
 	public function findByType($type) {
 		$conditions = array(
-			$this->typeField . '=' . $this->getDatabase()->fullQuoteStr($type, $this->table)
+			$this->typeField . '=' . $this->getDatabaseConnection()->fullQuoteStr($type, $this->table)
 		);
 		return $this->queryMultipleRecords($conditions);
 	}
@@ -110,8 +110,8 @@ class RecordCollectionRepository {
 	 */
 	public function findByTypeAndTableName($type, $tableName) {
 		$conditions = array(
-			$this->typeField . '=' . $this->getDatabase()->fullQuoteStr($type, $this->table),
-			$this->tableField . '=' . $this->getDatabase()->fullQuoteStr($tableName, $this->table)
+			$this->typeField . '=' . $this->getDatabaseConnection()->fullQuoteStr($type, $this->table),
+			$this->tableField . '=' . $this->getDatabaseConnection()->fullQuoteStr($tableName, $this->table)
 		);
 		return $this->queryMultipleRecords($conditions);
 	}
@@ -123,7 +123,7 @@ class RecordCollectionRepository {
 	 * @return void
 	 */
 	public function deleteByUid($uid) {
-		$this->getDatabase()->exec_UPDATEquery($this->table, 'uid=' . (int)$uid, array('deleted' => 1, 'tstamp' => $GLOBALS['EXEC_TIME']));
+		$this->getDatabaseConnection()->exec_UPDATEquery($this->table, 'uid=' . (int)$uid, array('deleted' => 1, 'tstamp' => $GLOBALS['EXEC_TIME']));
 	}
 
 	/**
@@ -139,7 +139,7 @@ class RecordCollectionRepository {
 		} else {
 			$conditionsWhereClause = '1=1';
 		}
-		$data = $this->getDatabase()->exec_SELECTgetRows('*', $this->table, $conditionsWhereClause . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table));
+		$data = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $this->table, $conditionsWhereClause . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table));
 		if ($data !== NULL) {
 			$result = $this->createMultipleDomainObjects($data);
 		}
@@ -182,7 +182,7 @@ class RecordCollectionRepository {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
diff --git a/typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php b/typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php
index 86bb0df8eaa7..731a779c7174 100644
--- a/typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php
+++ b/typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php
@@ -60,7 +60,7 @@ class CategoryBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\Ab
 	 */
 	public function loadContents() {
 
-		$resource = $this->getDatabase()->exec_SELECT_mm_query(
+		$resource = $this->getDatabaseConnection()->exec_SELECT_mm_query(
 			'sys_file_metadata.file',
 			'sys_category',
 			'sys_category_record_mm',
@@ -71,10 +71,10 @@ class CategoryBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\Ab
 
 		$resourceFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
 		if ($resource) {
-			while (($record = $this->getDatabase()->sql_fetch_assoc($resource)) !== FALSE) {
+			while (($record = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) !== FALSE) {
 				$this->add($resourceFactory->getFileObject((int)$record['file']));
 			}
-			$this->getDatabase()->sql_free_result($resource);
+			$this->getDatabaseConnection()->sql_free_result($resource);
 		}
 	}
 
@@ -83,7 +83,7 @@ class CategoryBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\Ab
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
diff --git a/typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php b/typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
index 8028c3f5a010..1715656bda84 100644
--- a/typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
+++ b/typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
@@ -62,7 +62,7 @@ class FileIndexRepository implements SingletonInterface {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
@@ -103,7 +103,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return array|boolean
 	 */
 	public function findOneByUid($fileUid) {
-		$row = $this->getDatabase()->exec_SELECTgetSingleRow(
+		$row = $this->getDatabaseConnection()->exec_SELECTgetSingleRow(
 			implode(',', $this->fields),
 			$this->table,
 			'uid=' . (int)$fileUid
@@ -135,10 +135,10 @@ class FileIndexRepository implements SingletonInterface {
 	 * @internal only for use from FileRepository
 	 */
 	public function findOneByStorageUidAndIdentifierHash($storageUid, $identifierHash) {
-		$row = $this->getDatabase()->exec_SELECTgetSingleRow(
+		$row = $this->getDatabaseConnection()->exec_SELECTgetSingleRow(
 			implode(',', $this->fields),
 			$this->table,
-			sprintf('storage=%u AND identifier_hash=%s', (int)$storageUid, $this->getDatabase()->fullQuoteStr($identifierHash, $this->table))
+			sprintf('storage=%u AND identifier_hash=%s', (int)$storageUid, $this->getDatabaseConnection()->fullQuoteStr($identifierHash, $this->table))
 		);
 		return is_array($row) ? $row : FALSE;
 	}
@@ -168,10 +168,10 @@ class FileIndexRepository implements SingletonInterface {
 		if (!preg_match('/^[0-9a-f]{40}$/i', $hash)) {
 			return array();
 		}
-		$resultRows = $this->getDatabase()->exec_SELECTgetRows(
+		$resultRows = $this->getDatabaseConnection()->exec_SELECTgetRows(
 			implode(',', $this->fields),
 			$this->table,
-			'sha1=' . $this->getDatabase()->fullQuoteStr($hash, $this->table)
+			'sha1=' . $this->getDatabaseConnection()->fullQuoteStr($hash, $this->table)
 		);
 		return $resultRows;
 	}
@@ -183,10 +183,10 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return array|NULL
 	 */
 	public function findByFolder(\TYPO3\CMS\Core\Resource\Folder $folder) {
-		$resultRows = $this->getDatabase()->exec_SELECTgetRows(
+		$resultRows = $this->getDatabaseConnection()->exec_SELECTgetRows(
 			implode(',', $this->fields),
 			$this->table,
-			'folder_hash = ' . $this->getDatabase()->fullQuoteStr($folder->getHashedIdentifier(), $this->table) .
+			'folder_hash = ' . $this->getDatabaseConnection()->fullQuoteStr($folder->getHashedIdentifier(), $this->table) .
 				' AND storage  = ' . (int)$folder->getStorage()->getUid(),
 			'',
 			'',
@@ -233,8 +233,8 @@ class FileIndexRepository implements SingletonInterface {
 	protected function insertRecord(array $data) {
 		$data = array_intersect_key($data, array_flip($this->fields));
 		$data['tstamp'] = time();
-		$this->getDatabase()->exec_INSERTquery($this->table, $data);
-		$data['uid'] = $this->getDatabase()->sql_insert_id();
+		$this->getDatabaseConnection()->exec_INSERTquery($this->table, $data);
+		$data['uid'] = $this->getDatabaseConnection()->sql_insert_id();
 		$this->emitRecordCreated($data);
 		return $data['uid'];
 	}
@@ -245,7 +245,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return boolean
 	 */
 	public function hasIndexRecord(File $file) {
-		return $this->getDatabase()->exec_SELECTcountRows('uid', $this->table, $this->getWhereClauseForFile($file)) >= 1;
+		return $this->getDatabaseConnection()->exec_SELECTcountRows('uid', $this->table, $this->getWhereClauseForFile($file)) >= 1;
 	}
 
 	/**
@@ -262,7 +262,7 @@ class FileIndexRepository implements SingletonInterface {
 		}
 		if (count($updateRow) > 0) {
 			$updateRow['tstamp'] = time();
-			$this->getDatabase()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow);
+			$this->getDatabaseConnection()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow);
 			$this->emitRecordUpdated(array_intersect_key($file->getProperties(), array_flip($this->fields)));
 		}
 	}
@@ -275,7 +275,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return array
 	 */
 	public function findInStorageWithIndexOutstanding(\TYPO3\CMS\Core\Resource\ResourceStorage $storage, $limit = -1) {
-		return $this->getDatabase()->exec_SELECTgetRows(
+		return $this->getDatabaseConnection()->exec_SELECTgetRows(
 			implode(',', $this->fields),
 			$this->table,
 			'tstamp > last_indexed AND storage = ' . (int)$storage->getUid(),
@@ -297,7 +297,7 @@ class FileIndexRepository implements SingletonInterface {
 		array_walk($uidList, 'intval');
 		$uidList = array_unique($uidList);
 
-		return $this->getDatabase()->exec_SELECTgetRows(
+		return $this->getDatabaseConnection()->exec_SELECTgetRows(
 			implode(',', $this->fields),
 			$this->table,
 			'storage = ' . (int)$storage->getUid() . ' AND uid NOT IN (' . implode(',', $uidList) . ')'
@@ -311,7 +311,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return void
 	 */
 	public function updateIndexingTime($fileUid) {
-		$this->getDatabase()->exec_UPDATEquery($this->table, 'uid = ' . (int)$fileUid, array('last_indexed' => time()));
+		$this->getDatabaseConnection()->exec_UPDATEquery($this->table, 'uid = ' . (int)$fileUid, array('last_indexed' => time()));
 	}
 
 	/**
@@ -321,7 +321,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return void
 	 */
 	public function markFileAsMissing($fileUid) {
-		$this->getDatabase()->exec_UPDATEquery($this->table, 'uid = ' . (int)$fileUid, array('missing' => 1));
+		$this->getDatabaseConnection()->exec_UPDATEquery($this->table, 'uid = ' . (int)$fileUid, array('missing' => 1));
 	}
 
 	/**
@@ -338,7 +338,7 @@ class FileIndexRepository implements SingletonInterface {
 			$where = sprintf(
 				'storage=%u AND identifier=%s',
 				(int)$file->getStorage()->getUid(),
-				$this->getDatabase()->fullQuoteStr($file->_getPropertyRaw('identifier'), $this->table)
+				$this->getDatabaseConnection()->fullQuoteStr($file->_getPropertyRaw('identifier'), $this->table)
 			);
 		}
 		return $where;
@@ -351,7 +351,7 @@ class FileIndexRepository implements SingletonInterface {
 	 * @return void
 	 */
 	public function remove($fileUid) {
-		$this->getDatabase()->exec_DELETEquery($this->table, 'uid=' . (int)$fileUid);
+		$this->getDatabaseConnection()->exec_DELETEquery($this->table, 'uid=' . (int)$fileUid);
 		$this->emitRecordDeleted($fileUid);
 	}
 
diff --git a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
index 5c3533d11045..52afc0720117 100644
--- a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
+++ b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
@@ -56,7 +56,7 @@ class MetaDataRepository implements SingletonInterface {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
@@ -82,7 +82,7 @@ class MetaDataRepository implements SingletonInterface {
 		if ($uid <= 0) {
 			throw new \RuntimeException('Metadata can only be retrieved for indexed files.', 1381590731);
 		}
-		$record = $this->getDatabase()->exec_SELECTgetSingleRow('*', $this->tableName, 'file = ' . $uid . $this->getGeneralWhereClause());
+		$record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', $this->tableName, 'file = ' . $uid . $this->getGeneralWhereClause());
 
 		if ($record === FALSE) {
 			$record = $this->createMetaDataRecord($uid);
@@ -118,9 +118,9 @@ class MetaDataRepository implements SingletonInterface {
 			'cruser_id' => TYPO3_MODE == 'BE' ? $GLOBALS['BE_USER']->user['uid'] : 0
 		);
 		$emptyRecord = array_merge($emptyRecord, $additionalFields);
-		$this->getDatabase()->exec_INSERTquery($this->tableName, $emptyRecord);
+		$this->getDatabaseConnection()->exec_INSERTquery($this->tableName, $emptyRecord);
 		$record = $emptyRecord;
-		$record['uid'] = $this->getDatabase()->sql_insert_id();
+		$record['uid'] = $this->getDatabaseConnection()->sql_insert_id();
 
 		$this->emitRecordCreated($record);
 
@@ -137,7 +137,7 @@ class MetaDataRepository implements SingletonInterface {
 	 */
 	public function update($fileUid, array $data) {
 		if (count($this->tableFields) === 0) {
-			$this->tableFields = $this->getDatabase()->admin_get_fields($this->tableName);
+			$this->tableFields = $this->getDatabaseConnection()->admin_get_fields($this->tableName);
 		}
 		$updateRow = array_intersect_key($data, $this->tableFields);
 		if (array_key_exists('uid', $updateRow)) {
@@ -146,7 +146,7 @@ class MetaDataRepository implements SingletonInterface {
 		$row = $this->findByFileUid($fileUid);
 		if (count($updateRow) > 0) {
 			$updateRow['tstamp'] = time();
-			$this->getDatabase()->exec_UPDATEquery($this->tableName, 'uid = ' . (int)$row['uid'], $updateRow);
+			$this->getDatabaseConnection()->exec_UPDATEquery($this->tableName, 'uid = ' . (int)$row['uid'], $updateRow);
 
 			$this->emitRecordUpdated(array_merge($row, $updateRow));
 		}
@@ -159,7 +159,7 @@ class MetaDataRepository implements SingletonInterface {
 	 * @return void
 	 */
 	public function removeByFileUid($fileUid) {
-		$this->getDatabase()->exec_DELETEquery($this->tableName, 'file=' . (int)$fileUid);
+		$this->getDatabaseConnection()->exec_DELETEquery($this->tableName, 'file=' . (int)$fileUid);
 		$this->emitRecordDeleted($fileUid);
 	}
 
diff --git a/typo3/sysext/core/Classes/Resource/Processing/FileDeletionAspect.php b/typo3/sysext/core/Classes/Resource/Processing/FileDeletionAspect.php
index 231c0565d0f6..4f293138b4d3 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/FileDeletionAspect.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/FileDeletionAspect.php
@@ -75,7 +75,7 @@ class FileDeletionAspect {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
@@ -94,13 +94,13 @@ class FileDeletionAspect {
 			$this->getMetaDataRepository()->removeByFileUid($fileObject->getUid());
 
 			// remove all references
-			$this->getDatabase()->exec_DELETEquery(
+			$this->getDatabaseConnection()->exec_DELETEquery(
 				'sys_file_reference',
 				'uid_local=' . (int)$fileObject->getUid() . ' AND table_local = \'sys_file\''
 			);
 
 		} elseif ($fileObject instanceof ProcessedFile) {
-			$this->getDatabase()->exec_DELETEquery('sys_file_processedfile', 'uid=' . (int)$fileObject->getUid());
+			$this->getDatabaseConnection()->exec_DELETEquery('sys_file_processedfile', 'uid=' . (int)$fileObject->getUid());
 		}
 	}
 
@@ -116,7 +116,7 @@ class FileDeletionAspect {
 		$metadataProperties = $fileObject->_getMetaData();
 
 		$metaDataUid = isset($metadataProperties['_ORIG_uid']) ? $metadataProperties['_ORIG_uid'] : $metadataProperties['uid'];
-		$this->getDatabase()->exec_DELETEquery(
+		$this->getDatabaseConnection()->exec_DELETEquery(
 			'sys_category_record_mm',
 			'uid_foreign=' . (int)$metaDataUid . ' AND tablenames = \'sys_file_metadata\''
 		);
diff --git a/typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php b/typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php
index e51c028814b9..f1c743ac3a24 100644
--- a/typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php
+++ b/typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php
@@ -74,7 +74,7 @@ class CategoryCollectionTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 */
 	public function setUp() {
 		parent::setUp();
-		$this->database = $this->getDatabase();
+		$this->database = $this->getDatabaseConnection();
 		$this->fixture = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Category\\Collection\\CategoryCollection', $this->tableName);
 		$this->collectionRecord = array(
 			'uid' => 0,
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
index bd69b370d54c..bf70b3f45722 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
@@ -122,11 +122,11 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
 
 		foreach ($dataSet->getTableNames() as $tableName) {
 			foreach ($dataSet->getElements($tableName) as $element) {
-				$this->getDatabase()->exec_INSERTquery(
+				$this->getDatabaseConnection()->exec_INSERTquery(
 					$tableName,
 					$element
 				);
-				$sqlError = $this->getDatabase()->sql_error();
+				$sqlError = $this->getDatabaseConnection()->sql_error();
 				if (!empty($sqlError)) {
 					$this->fail('SQL Error for table "' . $tableName . '": ' . LF . $sqlError);
 				}
@@ -207,7 +207,7 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
 		if ($this->expectedErrorLogEntries === NULL) {
 			return;
 		}
-		$errorLogEntries = $this->getDatabase()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)');
+		$errorLogEntries = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)');
 		$actualErrorLogEntries = count($errorLogEntries);
 		if ($actualErrorLogEntries === $this->expectedErrorLogEntries) {
 			$this->assertSame($this->expectedErrorLogEntries, $actualErrorLogEntries);
@@ -230,7 +230,7 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
 	protected function getAllRecords($tableName, $hasUidField = FALSE) {
 		$allRecords = array();
 
-		$records = $this->getDatabase()->exec_SELECTgetRows(
+		$records = $this->getDatabaseConnection()->exec_SELECTgetRows(
 			'*',
 			$tableName,
 			'1=1',
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php
index 468a83b74ea6..5a585a590beb 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php
@@ -69,7 +69,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 
 		$this->assertGreaterThanOrEqual(1, $uid);
 
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		$row = $database->exec_SELECTgetSingleRow('*', 'tt_content', 'uid = ' . $uid);
 		$this->assertNotEmpty($row);
 
@@ -103,7 +103,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$uid = $dataHandler->copyMappingArray_merged['tt_content'][$originalRecordId];
 		$this->assertGreaterThanOrEqual(2, $uid);
 
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		$row = $database->exec_SELECTgetSingleRow('*', 'tt_content', 'uid = ' . $uid);
 		$this->assertNotEmpty($row);
 
@@ -118,7 +118,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 */
 	public function canCopyPasteTtContent() {
 		$this->importDataSet(dirname(__FILE__) . '/../Fixtures/tt_content.xml');
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 
 		$dataHandler = $this->getDataHandler();
 		$originalRecordId  = 1;
@@ -171,7 +171,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 */
 	public function canCutPasteTtContent() {
 		$this->importDataSet(dirname(__FILE__) . '/../Fixtures/tt_content.xml');
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 
 		$dataHandler = $this->getDataHandler();
 		$originalRecordId  = 1;
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/IRRE/AbstractTestCase.php b/typo3/sysext/core/Tests/Functional/DataHandling/IRRE/AbstractTestCase.php
index 6c8ebe06edf0..890133e539e6 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/IRRE/AbstractTestCase.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/IRRE/AbstractTestCase.php
@@ -152,7 +152,7 @@ abstract class AbstractTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
 	protected function getLastLogEntryMessage() {
 		$message = '';
 
-		$logEntries = $this->getDatabase()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)', '', '', 1);
+		$logEntries = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)', '', '', 1);
 
 		if (is_array($logEntries) && count($logEntries)) {
 			$message = $logEntries[0]['details'];
@@ -183,7 +183,7 @@ abstract class AbstractTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
 	 * @return array
 	 */
 	protected function getAllRecords($table, $indexField = 'uid') {
-		return $this->getDatabase()->exec_SELECTgetRows('*', $table, '1=1', '', '', '', $indexField);
+		return $this->getDatabaseConnection()->exec_SELECTgetRows('*', $table, '1=1', '', '', '', $indexField);
 	}
 
 	/**
@@ -377,7 +377,7 @@ abstract class AbstractTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
 	 * @return array
 	 */
 	protected function getLogEntries() {
-		return $this->getDatabase()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)');
+		return $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)');
 	}
 
 	/**
diff --git a/typo3/sysext/core/Tests/FunctionalTestCase.php b/typo3/sysext/core/Tests/FunctionalTestCase.php
index a558e2f661e5..c53acd1efc71 100644
--- a/typo3/sysext/core/Tests/FunctionalTestCase.php
+++ b/typo3/sysext/core/Tests/FunctionalTestCase.php
@@ -224,7 +224,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
@@ -237,7 +237,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 	 */
 	protected function setUpBackendUserFromFixture($userUid) {
 		$this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml');
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		$userRow = $database->exec_SELECTgetSingleRow('*', 'be_users', 'uid = ' . $userUid);
 
 		/** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
@@ -277,7 +277,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 			);
 		}
 
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 
 		$xml = simplexml_load_file($path);
 		$foreignKeys = array();
@@ -324,7 +324,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 	 */
 	protected function setUpFrontendRootPage($pageId, array $typoScriptFiles = array()) {
 		$pageId = (int)$pageId;
-		$page = $this->getDatabase()->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $pageId);
+		$page = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $pageId);
 
 		if (empty($page)) {
 			$this->fail('Cannot set up frontend root page "' . $pageId . '"');
@@ -334,7 +334,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 			'is_siteroot' => 1
 		);
 
-		$this->getDatabase()->exec_UPDATEquery('pages', 'uid=' . $pageId, $pagesFields);
+		$this->getDatabaseConnection()->exec_UPDATEquery('pages', 'uid=' . $pageId, $pagesFields);
 
 		$templateFields = array(
 			'pid' => $pageId,
@@ -348,7 +348,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
 			$templateFields['config'] .= '<INCLUDE_TYPOSCRIPT: source="FILE:' . $typoScriptFile . '">' . LF;
 		}
 
-		$this->getDatabase()->exec_INSERTquery('sys_template', $templateFields);
+		$this->getDatabaseConnection()->exec_INSERTquery('sys_template', $templateFields);
 	}
 
 	/**
diff --git a/typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php b/typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php
index 09462356b931..dbb1744cfc14 100644
--- a/typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php
+++ b/typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php
@@ -67,8 +67,8 @@ class RecordCollectionRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 			'TYPO3\\CMS\\Core\\Database\\DatabaseConnection',
 			array('exec_UPDATEquery', 'exec_SELECTgetSingleRow', 'exec_SELECTgetRows', 'fullQuoteStr')
 		);
-		$this->fixture = $this->getMock('TYPO3\\CMS\\Core\\Collection\\RecordCollectionRepository', array('getDatabase'));
-		$this->fixture->expects($this->any())->method('getDatabase')->will($this->returnValue($this->databaseMock));
+		$this->fixture = $this->getMock('TYPO3\\CMS\\Core\\Collection\\RecordCollectionRepository', array('getDatabaseConnection'));
+		$this->fixture->expects($this->any())->method('getDatabaseConnection')->will($this->returnValue($this->databaseMock));
 		$this->testTableName = uniqid('tx_testtable');
 	}
 
diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/AddTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/AddTest.php
index de3c3fdcf976..bdb874e4211c 100644
--- a/typo3/sysext/extbase/Tests/Functional/Persistence/AddTest.php
+++ b/typo3/sysext/extbase/Tests/Functional/Persistence/AddTest.php
@@ -77,7 +77,7 @@ class AddTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$this->blogRepository->add($newBlog);
 		$this->persistentManager->persistAll();
 
-		$newBlogCount = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_blog', 'title = \'' . $newBlogTitle . '\'');
+		$newBlogCount = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_blog', 'title = \'' . $newBlogTitle . '\'');
 		$this->assertSame(1, $newBlogCount);
 	}
 }
diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php
index 1795c5a6b5fd..1918b7e9fe68 100644
--- a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php
+++ b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php
@@ -78,7 +78,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function attachPostToBlogAtTheEnd() {
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
 		$newPostTitle = 'sdufhisdhuf';
@@ -90,10 +90,10 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$this->blog->addPost($newPost);
 		$this->updateAndPersistBlog();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame(($this->numberOfRecordsInFixture + 1), $countPosts);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
 		$this->assertSame($newPostTitle, $post['title']);
 		$this->assertSame((string)($this->numberOfRecordsInFixture), $post['sorting']);
 	}
@@ -104,10 +104,10 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function removeLastPostFromBlog() {
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
 		$this->assertEquals(10, $post['sorting']);
 
 		$posts = $this->blog->getPosts();
@@ -119,13 +119,13 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$this->blog->removePost($latestPost);
 		$this->updateAndPersistBlog();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
 		$this->assertEquals(($this->numberOfRecordsInFixture - 1), $countPosts);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('uid', 'tx_blogexample_domain_model_post', 'uid =' . $latestPost->getUid() . ' AND deleted=0');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'tx_blogexample_domain_model_post', 'uid =' . $latestPost->getUid() . ' AND deleted=0');
 		$this->assertSame(NULL, $post['uid']);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
 		$this->assertSame('Post9', $post['title']);
 		$this->assertSame('9', $post['sorting']);
 	}
@@ -136,7 +136,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function addPostToBlogInTheMiddle() {
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
 		$posts = clone $this->blog->getPosts();
@@ -156,16 +156,16 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		}
 		$this->updateAndPersistBlog();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post',  'deleted=0');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post',  'deleted=0');
 		$this->assertSame(($this->numberOfRecordsInFixture + 1), $countPosts);
 
 		//last post
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog =' . $this->blog->getUid(), '', 'sorting DESC');
 		$this->assertSame('Post10', $post['title']);
 		$this->assertSame('11', $post['sorting']);
 
 		// check sorting of the post added in the middle
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'uid=' . ($this->numberOfRecordsInFixture + 1));
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'uid=' . ($this->numberOfRecordsInFixture + 1));
 		$this->assertSame($newPostTitle, $post['title']);
 		$this->assertSame('6', $post['sorting']);
 	}
@@ -176,7 +176,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function removeMiddlePostFromBlog() {
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
 		$posts = clone $this->blog->getPosts();
@@ -189,10 +189,10 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		}
 		$this->updateAndPersistBlog();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
 		$this->assertSame(($this->numberOfRecordsInFixture - 1), $countPosts);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid(), '', 'sorting DESC');
 		$this->assertSame('Post10', $post['title']);
 		$this->assertSame('10', $post['sorting']);
 	}
@@ -203,7 +203,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function movePostFromEndToTheMiddle() {
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
 		$posts = clone $this->blog->getPosts();
@@ -225,14 +225,14 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		}
 		$this->updateAndPersistBlog();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_post', 'deleted=0');
 		$this->assertSame($this->numberOfRecordsInFixture, $countPosts);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid(), '', 'sorting DESC');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,sorting', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid(), '', 'sorting DESC');
 		$this->assertSame('Post9', $post['title']);
 		$this->assertSame('10', $post['sorting']);
 
-		$post = $this->getDatabase()->exec_SELECTgetSingleRow('title,uid', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid().' AND sorting=6');
+		$post = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('title,uid', 'tx_blogexample_domain_model_post', 'blog ='.$this->blog->getUid().' AND sorting=6');
 		$this->assertSame('MOVED POST Post10', $post['title']);
 		$this->assertSame('10', $post['uid']);
 	}
@@ -243,7 +243,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function attachTagToPostAtTheEnd() {
-		$count = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
+		$count = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
 		$this->assertSame(10, $count);
 
 		$newTagTitle = 'sdufhisdhuf';
@@ -256,10 +256,10 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$count = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
+		$count = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
 		$this->assertSame(11, $count);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
 		$this->assertSame('11', $tag['uid_foreign']);
 	}
 
@@ -270,7 +270,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public  function removeLastTagFromPost() {
-		$count = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
+		$count = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag');
 		$this->assertSame(10, $count);
 
 		$postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
@@ -286,13 +286,13 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$countPosts = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag', 'deleted=0' );
+		$countPosts = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_tag', 'deleted=0' );
 		$this->assertEquals(10, $countPosts);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
 		$this->assertSame('9', $tag['uid_foreign']);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND uid_foreign='.$latestTag->getUid());
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND uid_foreign='.$latestTag->getUid());
 		$this->assertSame(NULL, $tag['uid_foreign']);
 	}
 
@@ -302,7 +302,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public  function addTagToPostInTheMiddle() {
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(10, $countTags);
 
 		$postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
@@ -323,13 +323,13 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(11, $countTags);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
 		$this->assertSame('10', $tag['uid_foreign']);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting=6');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting=6');
 		$this->assertSame('11', $tag['uid_foreign']);
 	}
 
@@ -340,7 +340,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function removeMiddleTagFromPost() {
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(10, $countTags);
 
 		$postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
@@ -357,14 +357,14 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(9, $countTags);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign,sorting', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign,sorting', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
 		$this->assertSame('10', $tag['uid_foreign']);
 		$this->assertSame('10', $tag['sorting']);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting=5');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting=5');
 		$this->assertSame(NULL, $tag['uid_foreign']);
 	}
 
@@ -374,7 +374,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function moveTagFromEndToTheMiddle() {
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(10, $countTags);
 
 		$postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
@@ -401,15 +401,15 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$countTags = $this->getDatabase()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
+		$countTags = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_post_tag_mm', 'uid_local=1');
 		$this->assertSame(10, $countTags);
 
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign,sorting', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign,sorting', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid(), '', 'sorting DESC');
 		$this->assertSame('9', $tag['uid_foreign']);
 		$this->assertSame('10', $tag['sorting']);
 
 		$sorting = '6';
-		$tag = $this->getDatabase()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting='.$sorting);
+		$tag = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid_foreign', 'tx_blogexample_post_tag_mm', 'uid_local ='.$post->getUid().' AND sorting='.$sorting);
 		$this->assertSame('10', $tag['uid_foreign']);
 	}
 
@@ -419,7 +419,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 	 * @test
 	 */
 	public function timestampFieldIsUpdatedOnPostSave() {
-		$rawPost = $this->getDatabase()->exec_SELECTgetSingleRow('*', 'tx_blogexample_domain_model_post', 'uid=1');
+		$rawPost = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'tx_blogexample_domain_model_post', 'uid=1');
 
 		$postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
 		$post = $postRepository->findByUid(1);
@@ -428,7 +428,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 		$postRepository->update($post);
 		$this->persistentManager->persistAll();
 
-		$rawPost2 = $this->getDatabase()->exec_SELECTgetSingleRow('*', 'tx_blogexample_domain_model_post', 'uid=1');
+		$rawPost2 = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'tx_blogexample_domain_model_post', 'uid=1');
 		$this->assertTrue($rawPost2['tstamp'] > $rawPost['tstamp']);
 	}
 
diff --git a/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php b/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
index db7682f5dacc..152b5793e117 100644
--- a/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
+++ b/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
@@ -99,12 +99,12 @@ class CategoryCollection extends \TYPO3\CMS\Core\Category\Collection\CategoryCol
 		// Assemble where clause
 		$where = 'AND ' . self::$storageTableName . '.uid = ' . (int)$this->getIdentifier();
 		// Add condition on tablenames fields
-		$where .= ' AND sys_category_record_mm.tablenames = ' . $this->getDatabase()->fullQuoteStr(
+		$where .= ' AND sys_category_record_mm.tablenames = ' . $this->getDatabaseConnection()->fullQuoteStr(
 			$this->getItemTableName(),
 			'sys_category_record_mm'
 		);
 		// Add condition on fieldname field
-		$where .= ' AND sys_category_record_mm.fieldname = ' . $this->getDatabase()->fullQuoteStr(
+		$where .= ' AND sys_category_record_mm.fieldname = ' . $this->getDatabaseConnection()->fullQuoteStr(
 			$this->getRelationFieldName(),
 			'sys_category_record_mm'
 		);
@@ -126,7 +126,7 @@ class CategoryCollection extends \TYPO3\CMS\Core\Category\Collection\CategoryCol
 			$where .= ' AND (' . $languageCondition . ')';
 		}
 		// Get the related records from the database
-		$resource = $this->getDatabase()->exec_SELECT_mm_query(
+		$resource = $this->getDatabaseConnection()->exec_SELECT_mm_query(
 			$this->getItemTableName() . '.*',
 			self::$storageTableName,
 			'sys_category_record_mm',
@@ -135,7 +135,7 @@ class CategoryCollection extends \TYPO3\CMS\Core\Category\Collection\CategoryCol
 		);
 
 		if ($resource) {
-			while ($record = $this->getDatabase()->sql_fetch_assoc($resource)) {
+			while ($record = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) {
 				// Overlay the record for workspaces
 				$this->getFrontendObject()->sys_page->versionOL(
 					$this->getItemTableName(),
@@ -159,7 +159,7 @@ class CategoryCollection extends \TYPO3\CMS\Core\Category\Collection\CategoryCol
 					$relatedRecords[] = $record;
 				}
 			}
-			$this->getDatabase()->sql_free_result($resource);
+			$this->getDatabaseConnection()->sql_free_result($resource);
 		}
 		return $relatedRecords;
 	}
diff --git a/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php b/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
index 01f7032ae53b..c7a36c2b3627 100644
--- a/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
+++ b/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
@@ -249,7 +249,7 @@ abstract class AbstractAction implements ActionInterface {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		static $database;
 		if (!is_object($database)) {
 			/** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
index a94f5e189820..6d3af1a39d93 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
@@ -73,7 +73,7 @@ class DatabaseData extends AbstractStepAction {
 			'tstamp' => $GLOBALS['EXEC_TIME'],
 			'crdate' => $GLOBALS['EXEC_TIME']
 		);
-		$this->getDatabase()->exec_INSERTquery('be_users', $adminUserFields);
+		$this->getDatabaseConnection()->exec_INSERTquery('be_users', $adminUserFields);
 
 		// Set password as install tool password
 		$configurationManager->setLocalConfigurationValueByPath('BE/installToolPassword', $hashedPassword);
@@ -88,7 +88,7 @@ class DatabaseData extends AbstractStepAction {
 	 */
 	public function needsExecution() {
 		$result = FALSE;
-		$existingTables = $this->getDatabase()->admin_get_tables();
+		$existingTables = $this->getDatabaseConnection()->admin_get_tables();
 		if (count($existingTables) === 0) {
 			$result = TRUE;
 		}
@@ -116,7 +116,7 @@ class DatabaseData extends AbstractStepAction {
 		$this->loadExtLocalconfDatabaseAndExtTables();
 
 		// Import database data
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		/** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */
 		$schemaMigrationService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
 		/** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */
diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
index 6528e3eec4a6..af0105588e65 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
@@ -45,7 +45,7 @@ class DefaultConfiguration extends AbstractStepAction {
 
 			// update the admin backend user to show the distribution management on login
 			$adminUserFirstLogin = array('startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List');
-			$this->getDatabase()->exec_UPDATEquery(
+			$this->getDatabaseConnection()->exec_UPDATEquery(
 					'be_users',
 					'admin=1',
 					array('uc' => serialize($adminUserFirstLogin))
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php b/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
index 9781263c2fd2..e10cf8878ea8 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
@@ -117,7 +117,7 @@ class CleanUp extends Action\AbstractAction {
 				'description' => 'Login process key storage'
 			),
 		);
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		$allTables = array_keys($database->admin_get_tables());
 		$tables = array();
 		foreach ($tableCandidates as $candidate) {
@@ -136,7 +136,7 @@ class CleanUp extends Action\AbstractAction {
 	 */
 	protected function clearSelectedTables() {
 		$clearedTables = array();
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		foreach ($this->postValues['values'] as $tableName => $selected) {
 			if ($selected == 1) {
 				$database->exec_TRUNCATEquery($tableName);
@@ -162,7 +162,7 @@ class CleanUp extends Action\AbstractAction {
 	 * @return \TYPO3\CMS\Install\Status\StatusInterface
 	 */
 	protected function resetBackendUserUc() {
-		$database = $this->getDatabase();
+		$database = $this->getDatabaseConnection();
 		$database->exec_UPDATEquery('be_users', '', array('uc' => ''));
 		/** @var \TYPO3\CMS\Install\Status\OkStatus $message */
 		$message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\OkStatus');
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php b/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
index dacc47aff258..55aa71011291 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
@@ -87,7 +87,7 @@ class ImportantActions extends Action\AbstractAction {
 			->assign('databaseHost', $GLOBALS['TYPO3_CONF_VARS']['DB']['host'])
 			->assign('databasePort', $GLOBALS['TYPO3_CONF_VARS']['DB']['port'])
 			->assign('databaseSocket', $GLOBALS['TYPO3_CONF_VARS']['DB']['socket'])
-			->assign('databaseNumberOfTables', count($this->getDatabase()->admin_get_tables()))
+			->assign('databaseNumberOfTables', count($this->getDatabaseConnection()->admin_get_tables()))
 			->assign('extensionCompatibilityTesterProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTester.txt')
 			->assign('extensionCompatibilityTesterErrorProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTesterErrors.json');
 
@@ -211,7 +211,7 @@ class ImportantActions extends Action\AbstractAction {
 			$message->setTitle('Administrator user not created');
 			$message->setMessage('Password must be at least eight characters long.');
 		} else {
-			$database = $this->getDatabase();
+			$database = $this->getDatabaseConnection();
 			$userExists = $database->exec_SELECTcountRows(
 				'uid',
 				'be_users',
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
index deec18a0cb5b..a1378569cc4c 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
@@ -167,7 +167,7 @@ class UpgradeWizard extends Action\AbstractAction {
 	 * @return \TYPO3\CMS\Install\Status\StatusInterface
 	 */
 	protected function performUpdate() {
-		$this->getDatabase()->store_lastBuiltQuery = TRUE;
+		$this->getDatabaseConnection()->store_lastBuiltQuery = TRUE;
 
 		$wizardIdentifier = $this->postValues['values']['identifier'];
 		$className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$wizardIdentifier];
@@ -219,7 +219,7 @@ class UpgradeWizard extends Action\AbstractAction {
 
 		$this->view->assign('wizardData', $wizardData);
 
-		$this->getDatabase()->store_lastBuiltQuery = FALSE;
+		$this->getDatabaseConnection()->store_lastBuiltQuery = FALSE;
 
 		// Next update wizard, if available
 		$nextUpgradeWizard = $this->getNextUpgradeWizardInstance($updateObject);
@@ -313,7 +313,7 @@ class UpgradeWizard extends Action\AbstractAction {
 	 *
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabase() {
+	protected function getDatabaseConnection() {
 		return $GLOBALS['TYPO3_DB'];
 	}
 }
diff --git a/typo3/sysext/install/Classes/Service/ClearCacheService.php b/typo3/sysext/install/Classes/Service/ClearCacheService.php
index ff7245c43090..e1ced75b2ad5 100644
--- a/typo3/sysext/install/Classes/Service/ClearCacheService.php
+++ b/typo3/sysext/install/Classes/Service/ClearCacheService.php
@@ -64,7 +64,7 @@ class ClearCacheService {
 		$bootstrap->reinitializeClassLoaderAndCachesAndPackageManagement();
 
 		// Get all table names starting with 'cf_' and truncate them
-		$database = $this->getDatabaseInstance();
+		$database = $this->getDatabaseConnection();
 		$tables = $database->admin_get_tables();
 		foreach ($tables as $table) {
 			$tableName = $table['Name'];
@@ -102,7 +102,7 @@ class ClearCacheService {
 	 * @TODO: This method is a copy from AbstractAction. Review them and extract to service
 	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
 	 */
-	protected function getDatabaseInstance() {
+	protected function getDatabaseConnection() {
 		static $database;
 		if (!is_object($database)) {
 			/** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
-- 
GitLab