Review main Merged

57167[TASK] Remove static method variables

Christian Kuhn CR +2 V +2 Hard +255 −116 updated 06/10/18, 14:42

Commit message

Static method variables are even more pita than static class
variables, especially if their state is created from db rows
or path information: It is nearly impossible to get rid of
this state at a later point again, even reflection does not
help here.

The patch abandons all 'static $foo' method variables from
the system, using these strategies:

* Remove some entirely which were used as first level cache
  and only cache-away simple non db related code structures.
* Switch some to use cache framework cache_runtime instead
  which can be evicted easily.
* Use class properties in some cases instead.

Review

  • Code review CR +2
    • Andreas Kienast +2
    • Anja Leichsenring +1
  • Verified V +2
    • Andreas Kienast +2
    • Anja Leichsenring +1
    • TYPO3com +1 CI

Issues 1

Files 26

Show 6 more files

Review log 1115

  1. Christian Kuhn uploaded patch set 1 06/10/18, 12:57

  2. TYPO3com voted on patch set 1 V -1 06/10/18, 12:57 Completed build in 12s on Sun, 10 Jun, 02:57 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24279

  3. Christian Kuhn uploaded patch set 2 06/10/18, 12:58

  4. Christian Kuhn commented on patch set 2 CR -1 06/10/18, 13:01

    AbstractTreeView.php:1024

    note this is a slight change in behavior: the deprecation will now be thrown once per instance. guess that is ok since the treeView classes are usually only instantiated once.
  5. TYPO3com voted on patch set 2 V -1 06/10/18, 13:06 Completed build in 08m 00s on Sun, 10 Jun, 03:06 PM Test Summary: 92 of 32948 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24280

  6. Christian Kuhn commented on patch set 2 06/10/18, 13:17

    PreviewProcessing.php:251

    i'm removing this since the init() method is actually not very expensive, and we've done a similar change some weeks ago at a similar place already, too.

    LocalImageProcessor.php:162

    i'm removing this since the init() method is actually not very expensive, and we've done a similar change some weeks ago at a similar place already, too.

    ResourceStorage.php:2747

    note $uniqueNamePrefix has always been empty string, so the if below can be removod. the static $maxNumber can be simply made a standard non static var.

    PathUtility.php:377

    really, there is zero need to "cache away" a strlen() call ... -> dropped this "cache".

    ClickEnlargeViewHelper.php:94

    there is absolutely no reason to make the TypoScriptService a pseudo singleton here. it also has no constructor and no internal state, so just makeInstance() it again if requested.

    EidUtility.php:105

    that's ok, even in the eid scope caches are fully initialized.

    FileContentParser.php:717

    switching this to a class property is ok since this protected method is always called twice with second call true as argument on the same class instance.

    Indexer.php:963

    well, there is just no reason to have this static ..

    DeletedRecordsCommand.php:253

    i decided to remove that cache since this CLI does tons of db calls and just calling that loop over TCA multiple times is clearly not a performance issue since the exec time is lost elsewhere anyway.

    WorkspaceVersionRecordsCommand.php:686

    i decided to remove that cache since this CLI does tons of db calls and just calling that loop over TCA multiple times is clearly not a performance issue since the exec time is lost elsewhere anyway.
  7. Christian Kuhn uploaded patch set 3 06/10/18, 13:17

  8. Christian Kuhn voted on patch set 3 CR -1 06/10/18, 13:23

  9. TYPO3com voted on patch set 3 V -1 06/10/18, 13:25 Completed build in 08m 10s on Sun, 10 Jun, 03:25 PM Test Summary: 92 of 32948 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24281

  10. Christian Kuhn uploaded patch set 4 06/10/18, 13:32

  11. TYPO3com voted on patch set 4 V +1 06/10/18, 13:40 Completed build in 08m 47s on Sun, 10 Jun, 03:40 PM Test Summary: 32698 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24282

  12. Anja Leichsenring voted on patch set 4 V +1 CR +1 06/10/18, 14:06

  13. Andreas Kienast voted on patch set 4 V +2 CR +1 06/10/18, 14:42

  14. Andreas Kienast voted on patch set 4 CR +2 06/10/18, 14:42

  15. Andreas Kienast merged patch set 5 06/10/18, 14:42