Issue Task Closed

#64589Cleanup ResourceFactory

Philipp Gampe 01/29/15, 13:53 updated 11/07/18, 23:01

Description

This is a list of problems I spotted while reviewing the ResourceFactory. Some issue might need own tickets, but some might just be easy cleanups.

Requires some thinking about the API.

typo3/sysext/core/Classes/Resource/ResourceFactory.php

general: clear local cache method (e.g. to save memory on bulk operations)
general: why are create object methods public?
78: creates a driver -> gets a driver
88: do not recreate instance of singleton
89: getDriverClass? what for?
105: getDefaultStorage should be a first class citizen of StorageRepository, Cache the result [O(n) instead of O(1)]
128: why $fileIdentifier handling in this function instead of a dedicated function? Used only 1 or 2 times in core, same for $recordData, at least cached, but that part is hard to miss in between all the unrelated code
167: createStorageObject inside a getter? -> move to own method, also gets rid of $recordData here
186: pointing to PATH_site/fileadmin? or fileadminDir
274: use API for delete clause
307: $storageConfiguration --> $storageConfiguration !== NULL
329: missing PhpDoc
372: (sting)$identifier !== ''
400: wtf has this to do with processed files? -> variant should not be findable in the repository
405: create inside a getter? really needed here?
446: strpos($input, ':') > 0 ??? === 1 instead?
450: after having extracted the storage uid already, why not using getFileObjectFromStorageAndIdentifier
451: move elseif up one level
467: use getFileObjectByStorageAndIdentifier() with storage 0 instead
470: same here
481: method should be moved near getFileObjectFromCombinedIdentifier()
509: same here
523: why does this method does not handle legacy paths?
543: remove $storage parameter, require to have $fileData['storage'] set instead, change exception accordingly
613: use API for delete clause

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.