[FEATURE] Lazy database connection 25/19525/13
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 2 Apr 2013 23:00:59 +0000 (01:00 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 14 Apr 2013 08:42:29 +0000 (10:42 +0200)
commitc0727f78c17b3e01033466b55b44ca3862e70745
treeb16c83f98dc338f5e2b1c597d429d908e2552c05
parentf86060fd299bf874bf8f182b82cb14eb58819c4a
[FEATURE] Lazy database connection

The patch implements "lazy" database connection, a connection
will be established by database connection class on demand.

Bootstrap now just sets credentials of the database connection
class after LocalConfiguration file was read, but does not
initialize the connection on its own anymore.

* Separation of concerns - Bootstrap does not take care of connection
  initialization, the db class will handle it on its own if needed.
* Database connection class got setters for options and credentials,
  it knows the details and can create, sleep and wake up a connection.
* Tests do not need to take care of a special db connection backup
  anymore, mocking / serializing $GLOBALS['TYPO3_DB'] and connection
  is handled by the class automatically.
* eID scripts do not need to call connectDB() anymore: The according
  method in eid handling is obsolete and developers do not need to
  think about it anymore.
* Simplification of bootstrap cross-dependencies.

With the patch only the frontend explicitly calls connectDB(). This
cannot be changed by this patch and needs some more thoughts.

Exception and logging handling is not fully cleaned up and should
be done at a later point. Still, the patch should be fully backward
compatible and dbal should work too, if related patch is applied.

After mysqli switch, main method connectDB() now handles different
port settings correctly and fixes the related issue.

Change-Id: Id977228a525dc2c80085ad21c78a7b7d4044160e
Resolves: #46880
Related: #46825
Releases: 6.1
Reviewed-on: https://review.typo3.org/19525
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
25 files changed:
typo3/cli_dispatch.phpsh
typo3/init.php
typo3/install/index.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Database/DatabaseConnection.php
typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php
typo3/sysext/core/Classes/Error/ErrorHandler.php
typo3/sysext/core/Tests/BaseTestCase.php
typo3/sysext/core/Tests/Integrity/IntegrityTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php
typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Unit/Database/PreparedStatementTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseTest.php
typo3/sysext/core/Tests/Unit/RegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Service/IndexerServiceTest.php
typo3/sysext/felogin/Tests/Unit/Controller/FrontendLoginControllerTest.php
typo3/sysext/frontend/Classes/Controller/ExtDirectEidController.php
typo3/sysext/frontend/Classes/Controller/ShowImageController.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Utility/EidUtility.php
typo3/sysext/install/Classes/Installer.php
typo3/sysext/install/Classes/Sql/SchemaMigrator.php
typo3/sysext/openid/Classes/OpenidEid.php
typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php