Review main Abandoned

39152[CLEANUP] Remove code duplications

Michael Oehlhof CR 0 V 0 Normal +57 −110 updated 05/06/15, 20:11

Commit message

Move the function getButtons() and
the variables $moduleName and $pageinfo
to sysext/backend/Classes/Module/BaseScriptClass.php

Remove the function and variables from
sysext/func/Classes/Controller/PageFunctionsController.php and
sysext/info/Classes/Controller/InfoModuleController.php

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 3

Review log 13

  1. Michael Oehlhof uploaded patch set 1 05/01/15, 12:15

  2. Markus Klein updated the commit message in patch set 2 05/01/15, 13:36

  3. Markus Klein updated the commit message in patch set 3 05/01/15, 13:37

  4. Markus Klein commented on patch set 3 05/01/15, 13:39

    just a nitpick

    BaseScriptClass.php:380

    shorten namespace please
  5. Michael Oehlhof uploaded patch set 4 05/01/15, 15:02

  6. Markus Klein voted on patch set 4 CR +1 05/01/15, 15:49

  7. Michael Oehlhof uploaded patch set 5 05/06/15, 17:22

  8. Michael Oehlhof commented on patch set 5 05/06/15, 17:25

    Resolved the merge conflict.
  9. Christian Kuhn commented on patch set 5 05/06/15, 18:26

    Ok, the patch looks technically ok. Still, BaseScriptClass is a main class that lots of "old" modules extend from. getButtons() is basically a local method that is implemented by lots of those extending classes to create a set of icons in the doc header. Usually, only the local class knows which buttons shuold be there, so imho it does not make that much sense to move the method up just for the sake of this single code duplication. I'm not sure if we should pick this patch. What do others think about that?
  10. Markus Klein commented on patch set 5 05/06/15, 19:19

    BaseScriptClass.php:185

    Reading this again I see a risk actually. If an extending class has this as protected member this will break now! (making a public member protected in the subclass does not work)
  11. Michael Oehlhof commented on patch set 5 05/06/15, 19:33

    Maybe we can add parameter to getButtons() to make it usable for all or most of the other 22 descend classes. Or we can call the parent function inside the getButtons() of the subclasses to set the buttons that are the same in all sub classes (view, shortcut) and than add the individual stuff.

    BaseScriptClass.php:185 Reply

    OK, this is the case in TaskModuleController. Change it to protected in BaseClass should avoid the break.
  12. Christian Kuhn commented on patch set 5 CR -1 05/06/15, 19:41

    Talked with Markus again. We think it does not make too much sense to fiddle much in this area: The BaseScriptClass will fall sooner or later anyway, and this getButtons() thing isn't very smart either. We think it makes much more sense to move more modules to an extbase controller and to not put much energy into this old codebase.
  13. Michael Oehlhof abandoned the change 05/06/15, 20:11

    I agree with your comments.