Review main Merged

45933[TASK] Make a resource storage driver accessible

Bernhard Kraft CR +2 V +2 Easy +1 −1 updated 01/21/16, 14:35

Commit message

The method "getDriver" of a resource storage is not public. This
inhibits any extension (even core extensions like import/export) to
perform actions which are custom for a special type of driver. Of
course it makes sense to obfuscate the driver layer to most
applications and extensions, but in some cases it is handy
to directly talk to a driver.

Review

  • Code review CR +2
    • Anja Leichsenring +2
    • Markus Klein +1
  • Verified V +2
    • Anja Leichsenring +2
    • Markus Klein +1

Issues 1

Files 1

Review log 16

  1. Bernhard Kraft uploaded patch set 1 01/15/16, 12:31

  2. Georg Ringer wrote 01/15/16, 12:40

    Patch set 2: Commit message was updated.
  3. Markus Klein wrote 01/15/16, 12:43

    Patch set 3: Commit message was updated.
  4. Markus Klein commented on patch set 3 CR +1 V +1 01/15/16, 12:43

    Ok from my side.
  5. Anja Leichsenring voted on patch set 3 CR +2 V +2 01/15/16, 12:49

  6. Gerrit merged patch set 3 01/15/16, 12:49

  7. Nicole Hummel commented on patch set 4 01/20/16, 09:29

    Post -2 IMHO all methods defined in the driver interface can be reached with the current resource methods. Which function do you use directly through the getDriver() function? You can't know which driver was chosen by the admin for a storage. Unfortunately even the forge ticket doesn't give a valid example where this is needed.
  8. Helmut Hummel commented on patch set 4 01/20/16, 10:27

    Post -2 as well. This opens a can of worms and allows hacks which will render different storage/driver types void when we introduce specific code paths for different drivers. Besides that, we have already the public method StorageRepository::findByStorageType, which already enables an "okish" way to differentiate different Drivers/Storages
  9. Nicole Hummel commented on patch set 4 01/20/16, 11:22

    Reverted This patchset was reverted in change: I7700860a4a8fbcea3f1ee85d914b3a012d498daf
  10. Bernhard Kraft commented on patch set 4 01/21/16, 13:35

    Example: A local resource using the local driver does not expose the "absoluteBasePath" (https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php#l35) and thus an error message in the import/export hast to just display the relative path instead of the full path of the directory which an integrator has to create (https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/impexp/Classes/Import.php#l388). Of course this depends on the resource being a local storage. But currently the import/export module will import all files to the default local-only storage by default (except for some cases). So the import/export module already DOES some special handling for local storages/drivers (which isn't built on my code :)
  11. Bernhard Kraft commented on patch set 4 01/21/16, 13:37

    In fact I am quite against keeping many variables/classes protected. I had an argue about this on the code sprint. In my eyes TYPO3 is not only a ready-to-use CMS but also a web coding framework. So the APIs have to be as open as necessary to allow developing and extending existing functionality. But it seems I am alone with this point of view.
  12. Bernhard Kraft commented on patch set 4 01/21/16, 13:39

    Of course it would be nice to have something like "protected-for-others-but-public-for-native-code" but such a thing isn't supported by PHP currently - in fact I know no other language which would allow this. Of course it would always be possible to have some access-facet-classes.
  13. Nicole Hummel commented on patch set 4 01/21/16, 14:00

    Not sure if I understand your problem, but the basePath within the storage configuration is the absolute path!?
  14. Nicole Hummel commented on patch set 4 01/21/16, 14:05

    And either the configuration pathType is relative, you have to add PATH_site to get an absolute path.
  15. Bernhard Kraft commented on patch set 4 01/21/16, 14:34

    My intention was to avoid code duplication of "calculateBasePath": https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php#l148 Of course you could craft together the absolute path with the information from the storage record - everything is possible ... If you and others have the opinion the current situation is fine it is of no concern to me. Well - Not "no concern" but I do not feel I should be a person to decide this. It was just a patch proposal and I am fine with abandoning this patch.
  16. Bernhard Kraft commented on patch set 4 01/21/16, 14:35

    Additionally this case didn't really come a long and hard way :| ... So just abandon it.