Review main Merged

51331[FEATURE] Allow to override PATH_site via environment variables

Benni Mack CR +2 V +2 Easy +39 −5 updated 03/30/17, 13:26

Commit message

In order to make it possible to call TYPO3 from outside the document
root (e.g. CLI binaries) the patch allows to set TYPO3_PATH_ROOT via
environment variables.

This way it is possible to call binaries / external applications that
use the TYPO3 system environment builder.

The env variables are already set via the TYPO3 Console composer
plugin, and could also be incorporated in the composer-plugin of
the TYPO3 Core.

Review

  • Code review CR +2
    • Benni Mack +2
    • Claus Due +1
    • Helmut Hummel +1
    • Susi Moog +1
  • Verified V +2
    • Benni Mack +2
    • Claus Due +1
    • Helmut Hummel +1
    • Susi Moog +1
    • TYPO3com +1 CI

Issues 2

Files 4

Review log 2939

Show 914 earlier messages
  1. Benni Mack uploaded patch set 1 01/16/17, 20:35

  2. TYPO3com voted on patch set 1 V +1 01/16/17, 20:41 Completed build in 05m 36s on Mon, 16 Jan, 09:41 PM Test Summary: 54939 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6713

  3. Georg Ringer commented on patch set 1 01/17/17, 06:52

    SystemEnvironmentBuilder.php:171

    should we do a ltrim here just to be sure that we don'T end up with 2 /?
  4. Helmut Hummel uploaded patch set 2 01/17/17, 09:46

  5. Helmut Hummel commented on patch set 2 01/17/17, 09:48

    SystemEnvironmentBuilder.php:172

    we may not want to expose this constant

    SystemEnvironmentBuilder.php:180

    same here
  6. TYPO3com voted on patch set 2 V -1 01/17/17, 09:52 Completed build in 05m 36s on Tue, 17 Jan, 10:52 AM Test Summary: 126 of 54969 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6730

  7. Helmut Hummel uploaded patch set 3 01/18/17, 00:39

  8. TYPO3com voted on patch set 3 V -1 01/18/17, 00:44 Completed build in 04m 36s on Wed, 18 Jan, 01:44 AM Test Summary: 126 of 54981 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6755

  9. Benni Mack uploaded patch set 4 03/27/17, 18:31

  10. TYPO3com voted on patch set 4 V -1 03/27/17, 18:39 Completed build in 07m 55s on Mon, 27 Mar, 08:39 PM Test Summary: 126 of 56526 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9682

  11. Benni Mack commented on patch set 4 03/28/17, 20:19

    looks like bamboo needs to be adapted for this change as well... will check with Lolli.
  12. Benni Mack updated the commit message in patch set 5 03/28/17, 20:30

  13. TYPO3com voted on patch set 5 V -1 03/28/17, 20:38 Completed build in 08m 11s on Tue, 28 Mar, 10:38 PM Test Summary: 126 of 56528 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9832

  14. Christian Kuhn rebased onto patch set 6 03/28/17, 20:51

  1. TYPO3com voted on patch set 6 V -1 03/28/17, 21:13 Completed build in 21m 12s on Tue, 28 Mar, 11:13 PM Test Summary: 126 of 56528 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9835

  2. Benni Mack uploaded patch set 7 03/28/17, 23:44

  3. TYPO3com voted on patch set 7 V -1 03/28/17, 23:54 Completed build in 09m 07s on Wed, 29 Mar, 01:54 AM Test Summary: 126 of 56528 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9854

  4. Benni Mack commented on patch set 8 03/29/17, 13:25

    Published edit on patch set 7.
  5. TYPO3com voted on patch set 8 V -1 03/29/17, 13:32 Completed build in 07m 01s on Wed, 29 Mar, 03:32 PM Test Summary: 3 of 56528 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9902

  6. TYPO3com voted on patch set 8 V +1 03/29/17, 13:57 Completed build in 39m 21s on Wed, 29 Mar, 03:57 PM Test Summary: 56519 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9902

  7. Claus Due commented on patch set 8 CR +1 03/29/17, 14:04

    Code looks good to me - too short on time to test right now but will give it a whirl asap - but maybe you can clarify and save me some time on testing: if I define TYPO3_PATH_ROOT in my apache virtual host and then move the entire root folder to another location (that I also set as cms-package-dir), is TYPO3 expected to work with source in any location?
  8. Benni Mack commented on patch set 8 03/29/17, 14:05

    running in composer mode or not?
  9. Claus Due commented on patch set 8 03/29/17, 14:06

    Always in composer mode here :)
  10. Benni Mack commented on patch set 8 03/29/17, 14:07

    Then I'd assume that the TYPO3 composer installer overrides that information from your apache configuration... does that answer your question? because I did not fully get your use-case.
  11. Claus Due commented on patch set 8 03/29/17, 14:11

    Thanks, that gives me a specific thing to test for. Will follow up with what I find - right now I have to go :/
  12. Benni Mack commented on patch set 8 03/29/17, 14:27

    btw... main benefit is for composer setups --- because having this in the webserver configuration does not work for CLI commands (that's where the benefit is ;))
  13. Claus Due commented on patch set 8 03/29/17, 21:12

    Some system info: * I use "web-dir" (set to web/) * I use "cms-package-dir" (set to vendor/typo3/cms) I have two different outcomes: macbook:trunk.namelesscoder.net claus$ TYPO3_PATH_ROOT=/Users/claus/Sites/trunk.namelesscoder.net/ ./vendor/bin/typo3 /Users/claus/Sites/trunk.namelesscoder.net/macbook:trunk.namelesscoder.net claus$ TYPO3_PATH_ROOT=/Users/claus/Sites/trunk.namelesscoder.net/ ./vendor/bin/typo3 Calculated absolute path to typo3/sysext directory does not exist. ... And: macbook:trunk.namelesscoder.net claus$ TYPO3_PATH_ROOT=/Users/claus/Sites/trunk.namelesscoder.net/web/ ./vendor/bin/typo3 help Uncaught TYPO3 Exception #1476107295: PHP Warning: Invalid argument supplied for foreach() in /Users/claus/Repositories/TYPO3.CMS/typo3/sysext/core/Classes/Utility/RootlineUtility.php line 287 thrown in file /Users/claus/Repositories/TYPO3.CMS/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 112 The thing is, I would expect to set TYPO3_PATH_ROOT not to the document root but to the folder containing the "vendor" directory, but perhaps I misunderstand that? In any case: * With "web-dir" and this ENV set to value of DOCUMENT_ROOT on CLI, commands work (TYPO3 is bootstrapped but another error is yielded) * With "web-dir" and without this ENV the resolving of typo3 folder fails as echoed above. I just don't know if that's a "+1 verified" or "-1 failed", I guess that depends on whether you're supposed to set this to the DOCUMENT_ROOT or to the folder containing "vendor" folder. If it is the latter, I'm guessing the value of "web-dir" should be appended to the value of TYPO3_PATH_ROOT?
  14. Benni Mack updated the commit message in patch set 9 03/30/17, 12:33

  15. Benni Mack commented on patch set 9 03/30/17, 12:34

    Main idea for now TYPO3_PATH_ROOT = PATH_site for now.
  16. TYPO3com voted on patch set 9 V +1 03/30/17, 12:44 Completed build in 10m 32s on Thu, 30 Mar, 02:44 PM Test Summary: 56531 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9959

  17. Claus Due commented on patch set 9 03/30/17, 12:52

    Isn't that what TYPO3_PATH_WEB is for? I'm a little confused by this - I really thought the intention was to provide some way to say "this is where my project root folder is - this is where you find my root composer.json file". But the way you describe it, it's the exact same thing as TYPO3_PATH_WEB?
  18. Susi Moog voted on patch set 9 CR +1 V +1 03/30/17, 12:55

  19. Benni Mack commented on patch set 9 03/30/17, 12:59

    PATH_site is where TYPO3 currently (!) knows where to start looking for typo3conf/ fileadmin/ whatever. that is the main point of this patch, to allow scripts from the outside to have this NOT determined anymore (again: mainly it solves the CLI problem we currently face). Main problem currently is that TYPO3 does not know the difference between "this is my web directory" and "this is my TYPO3 base folder where typo3temp, typo3conf etc resides". This is VERY hard to solve currently. So, in the future, and not within this change at all, we *could* use the TYPO3_PATH_WEB variable to point to a different entrypoint for your frontend, backend, whatever, where your public resources reside. This is something completely different to what this patch and change achieves and not really thought-through what implications this would have, also for the non-composer-mode.
  20. Helmut Hummel commented on patch set 9 03/30/17, 13:04

    TYPO3_PATH_WEB currently is only used in testing context and yes, indeed for the same thing. Currently in TYPO3, we do not distinguish between application root and web root. This is the first step to clearly define names for different things (application root vs. web root), even if the values currently match. Doing so we have three things right now: composer root : TYPO3_PATH_COMPOSER_ROOT TYPO3 root: TYPO3_PATH_ROOT document root: TYPO3_PATH_WEB Currently TYPO3 does not know about composer root at all, and we should keep it like that for now. Also webroot and site root are the same: TYPO3_PATH_ROOT=TYPO3_PATH_WEB=PATH_site For the typo3 binary to run we need to set the PATH_site to a value, which isn't know at TYPO3 runtime, as there are too many ways the directories might be structured. but we know it on composer build time. We store this value then so we can access it when we include the vendor/autoload.php. We decided to name it TYPO3_PATH_ROOT as this is the best matching name we could come up with. in the future TYPO3_PATH_ROOT should be equal to TYPO3_PATH_COMPOSER_ROOT and TYPO3_PATH_WEB should be a directory with only public assets in it and the PHP entry scripts
  21. Helmut Hummel voted on patch set 9 CR +1 V +1 03/30/17, 13:05

  22. Claus Due commented on patch set 9 CR +1 V +1 03/30/17, 13:16

    > in the future TYPO3_PATH_ROOT should be equal to TYPO3_PATH_COMPOSER_ROOT and TYPO3_PATH_WEB should be a directory with only public assets in it and the PHP entry scripts Thanks Helmut - that explains it. In that case, it's a verified +1 ;)
  23. Benni Mack commented on patch set 9 03/30/17, 13:25

    Thanks for the questions, discussions and clarifications!!!
  24. Benni Mack voted on patch set 9 CR +2 V +2 03/30/17, 13:26

  25. Gerrit merged patch set 9 03/30/17, 13:26