stable

Clone or download

Read-only

request #13013: Internal Tuleap API should not expose multiple ways to work with DB transactions

There is currently multiple ways to achieve the same work with DB transactions. This contribution tries to clean that so contributors are naturally guided to the expected solution for the problem thay are trying to solve. As a result, you can end up in two cases: * you are working inside a \Tuleap\DB\DataAccessObject instance and needs to do some work protected by a transaction. For example, you want to delete/update rows according to some result you retrieve locally. You are expected to use what's being proposed by the object given by self->getDB(). * you are working elsewhere and have the need of rollback your DB updates if something goes wrong. For example, you want to rollback if a file is not written successfully. The use case might also to wrap some high level operations to ensure the end result is consistent. You are expected to use an instance of \Tuleap\DB\DBTransactionExecutor. No functionnal change is expected from this contribution. Change-Id: Ic1fbd43ebc99005e7dd9e7cd60f6012c37ee03e6

Modified Files

Name
M plugins/docman/include/REST/v1/DocmanFilesResource.php +6 −2 Go to diff View file
M plugins/docman/include/REST/v1/DocmanItemsResource.php +8 −3 Go to diff View file
M plugins/docman/include/Upload/Document/DocumentToUploadCreator.php +11 −5 Go to diff View file
M plugins/docman/include/Upload/Document/DocumentUploadFinisher.php +9 −2 Go to diff View file
M plugins/docman/include/Upload/Version/VersionToUploadCreator.php +12 −6 Go to diff View file
M plugins/docman/include/Upload/Version/VersionUploadFinisher.php +9 −1 Go to diff View file
M plugins/docman/include/docmanPlugin.class.php +5 −5 Go to diff View file
M plugins/docman/phpunit/Upload/Document/DocumentToUploadCreatorTest.php +7 −18 Go to diff View file
M plugins/docman/phpunit/Upload/Document/DocumentUploadFinisherTest.php +3 −9 Go to diff View file
M plugins/docman/phpunit/Upload/Version/VersionToUploadCreatorTest.php +6 −17 Go to diff View file
M plugins/docman/phpunit/Upload/Version/VersionUploadFinisherTest.php +2 −0 Go to diff View file
M plugins/gitlfs/include/LFSObject/LFSObjectRemover.php +12 −5 Go to diff View file
M plugins/gitlfs/include/Transfer/LFSTransferVerifier.php +12 −5 Go to diff View file
M plugins/gitlfs/include/gitlfsPlugin.class.php +6 −2 Go to diff View file
M plugins/gitlfs/phpunit/LFSObject/LFSObjectRemoverTest.php +20 −17 Go to diff View file
M plugins/gitlfs/phpunit/Transfer/LFSTransferVerifierTest.php +7 −17 Go to diff View file
M plugins/project_ownership/include/ProjectOwner/ProjectOwnerUpdater.php +13 −6 Go to diff View file
M plugins/project_ownership/include/REST/ProjectOwnershipResource.php +6 −1 Go to diff View file
M plugins/project_ownership/phpunit/ProjectOwner/ProjectOwnerUpdaterTest.php +5 −18 Go to diff View file
M plugins/timetracking/include/Timetracking/Time/TimetrackingReportDao.php +1 −1 Go to diff View file
M plugins/tracker/include/REST/v1/TrackersResource.class.php +5 −3 Go to diff View file
M plugins/tracker/include/REST/v1/Workflow/PostAction/PUTHandler.php +3 −3 Go to diff View file
M plugins/tracker/include/REST/v1/Workflow/TransitionPOSTHandler.php +3 −3 Go to diff View file
M plugins/tracker/include/REST/v1/Workflow/TransitionPatcher.php +3 −3 Go to diff View file
M plugins/tracker/include/REST/v1/Workflow/TransitionsResource.class.php +9 −6 Go to diff View file
M plugins/tracker/include/Workflow/PostAction/Update/Internal/SetDateValueRepository.php +10 −9 Go to diff View file
M plugins/tracker/include/Workflow/PostAction/Update/Internal/SetFloatValueRepository.php +10 −10 Go to diff View file
M plugins/tracker/include/Workflow/PostAction/Update/Internal/SetIntValueRepository.php +10 −8 Go to diff View file
M plugins/tracker/include/Workflow/PostAction/Update/PostActionCollectionUpdater.php +1 −1 Go to diff View file
M plugins/tracker/include/Workflow/Transition/Condition/ConditionsUpdater.php +1 −1 Go to diff View file
M plugins/tracker/include/Workflow/Transition/Update/TransitionReplicatorBuilder.php +6 −4 Go to diff View file
M plugins/tracker/phpunit/REST/v1/Workflow/TransitionPOSTHandlerTest.php +3 −11 Go to diff View file
M plugins/tracker/phpunit/REST/v1/Workflow/TransitionPatcherTest.php +2 −17 Go to diff View file
M plugins/tracker/phpunit/Tracker/Workflow/PostAction/Update/Internal/SetDateValueRepositoryTest.php +2 −14 Go to diff View file
M plugins/tracker/phpunit/Tracker/Workflow/PostAction/Update/Internal/SetFloatValueRepositoryTest.php +2 −13 Go to diff View file
M plugins/tracker/phpunit/Tracker/Workflow/PostAction/Update/Internal/SetIntValueRepositoryTest.php +2 −13 Go to diff View file
M plugins/tracker/phpunit/Tracker/Workflow/PostAction/Update/PostActionCollectionUpdaterTest.php +1 −1 Go to diff View file
R src/common/DB/TransactionExecutor.php Go to diff View file
A src/common/DB/DBTransactionExecutorWithConnection.php +42 −0 Go to diff View file
M src/common/DB/DataAccessObject.php +9 −21 Go to diff View file
M src/common/project/Admin/ProjectUGroup/DynamicUGroupMembersUpdater.php +14 −6 Go to diff View file
M src/common/project/UGroupManager.class.php +4 −1 Go to diff View file
M src/www/project/admin/editugroup.php +9 −2 Go to diff View file
A tests/lib/DB/DBTransactionExecutorPassthrough.php +33 −0 Go to diff View file
A tests/phpunit/common/DB/DBTransactionExecutorWithConnectionTest.php +48 −0 Go to diff View file
A tests/phpunit/common/DB/DataAccessObjectTest.php +66 −0 Go to diff View file
M tests/phpunit/common/Project/DynamicUGroupMembersUpdaterTest.php +14 −17 Go to diff View file
A tests/phpunit/tests/DB/DBTransactionExecutorPassthroughTest.php +51 −0 Go to diff View file