Wrap doesRecordExist in new method
At several places in the Datahandler class a call to doesRecordExist is followed immediately
with at call to BackendUtility::getRecordWSOL which then fetches the record.
Instead we wrap the functionality from doesRecordExist into a new method that returns
the row - with all the permissions checks performed.
Instead of calling BackendUtility::getRecordWSOL we add a new method
recordInfoWithPermissionCheck which returns the row instead of just true/false if
the record exists and is accessible. Afterwards the row is processed with a new method
getRecordWSOLWithRow which processes the just newly processed row.
The makes the flow simpler and saves an saves an sql-query - which will give a performance
enhancement when copying big sub-trees in the TYPO3 backend.
Updated by Kasper Ligaard over 4 years ago
The positive effect of fixing this is documented in https://docs.google.com/presentation/d/1Pcm8H2nJD_dyj9tqwkXkcKYbCRVCGGFFfk_gVnDhQ5g/edit#slide=id.g1cbe49000b_0_91, which was presented at the TYPO3 Code Sprint in late February 2017.