Feature #6681

Make the php cli executable configurable for the flow3 command

Added by Thomas Fritz over 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-03-03
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Core
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 8
PHP Version: Complexity:
Has patch:

Description

The Path to the php binary should be configurable outside of the flow3 command line tool to allow an easy update of the flow3 cli tool.
It should also be possible to configure some extra parameters for the cli. For example a path to the configuration file (php.ini)

feature_6681.diff Magnifier - Readymade Solution (2.6 kB) Thomas Fritz, 2010-03-04 17:45


Related issues

related to TYPO3.Flow - Feature #4426: Provide Windows compatible version of the FLOW3 Command L... Resolved
related to TYPO3.Flow - Feature #4469: Implement a central command line controller Resolved 2009-09-07

Associated revisions

Revision f0b83cc6
Added by Karsten Dambekalns over 5 years ago

[+FEATURE] FLOW3 (Core): The flow3 hell script now uses the PHP binary specified in the PHP environment variable, resolves #6681.
[~TASK] FLOW3: Some SVN property maintenance.

Revision 9afe1e33
Added by Karsten Dambekalns over 5 years ago

[+FEATURE] FLOW3 (Core): The flow3 hell script now uses the PHP binary specified in the PHP environment variable, resolves #6681.
[~TASK] FLOW3: Some SVN property maintenance.

Revision 06a00c44
Added by Karsten Dambekalns over 5 years ago

[+FEATURE] FLOW3 (Core): Made the flow3 shell script configurable regarding PHP binary, context and paths used through Configuration/flow3.sh. Resolves #6681. T3BOARD10 Bug Auction.
[+BUGFIX] FLOW3 (Core): Two compliance fixes to flow3.sh, fixes #6693, fixes #6694. T3BOARD10 Bug Auction bonus fixes. :)

History

#1 Updated by Bastian Waidelich over 5 years ago

I agree. Currently the paths are configured inside the batch script itself which is not the optimal solution.
I think, a nice way to do this would be to extract the configuration lines to a new file (e.g. flow3config.default) and copy the contents to a file flow3config (if it does not yet exist) which will be included by the script. flow3config should then be added to svn ignore list of course.

In the Windows batch version (that I'm currently working on) that could look something like

...
IF NOT EXIST flow3config.bat COPY flow3config.default.bat config.bat
CALL flow3config.bat
...

Anyone knows the Unix pendant for this?

#2 Updated by Karsten Dambekalns over 5 years ago

  • Category changed from Environment to Core
  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns

#3 Updated by Karsten Dambekalns over 5 years ago

  • Target version set to 1.0 alpha 8

#4 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3903.

#5 Updated by Thomas Fritz over 5 years ago

Karsten Dambekalns wrote:

Applied in changeset r3903.

Sorry, but i do not see how this resolves the issue?

Why not check if a config file is available and source it if available?

#!/bin/bash

PHP="/usr/bin/env php";
# Other variables with their default values

# So the configfile can override all default variables.
CONFIGFILE="$(dirname $0)/Configuration/flow3.sh";
if [ -f "$CONFIGFILE" ]; then
    source $CONFIGFILE
fi

Bastian Waidelich wrote:

Anyone knows the Unix pendant for this?

source "PATH_TO_FILE" 

#or

. "PATH_TO_FILE" 

#6 Updated by Karsten Dambekalns over 5 years ago

Thomas Fritz wrote:

Karsten Dambekalns wrote:

Applied in changeset r3903.

Sorry, but i do not see how this resolves the issue?

Why not check if a config file is available and source it if available?

Why a configuration file? On most systems I'd expect to by the system PHP binary the "right" one anyway. If not, just call

PHP=/usr/local/freaky-php/bin/php ./flow3 ...
or export the variable if you use it more often.

Honestly, a config file seems like overkill to me.

#7 Updated by Thomas Fritz over 5 years ago

Karsten Dambekalns wrote:

Thomas Fritz wrote:

Karsten Dambekalns wrote:

Applied in changeset r3903.

Sorry, but i do not see how this resolves the issue?

Why not check if a config file is available and source it if available?

Why a configuration file? On most systems I'd expect to by the system PHP binary the "right" one anyway.

Thats not the case on shared hosted systems. And the path is not mandatory anyway.

If not, just call
[...] or export the variable if you use it more often.

That looks and feels very clumsy. What if there is a /usr/bin/php available and the right one would be a different one. When more than one developer uses the flow3 script everyone has to know which one to use and can not call flow3 directly. And if one calls it directly this could trigger an error then.

Honestly, a config file seems like overkill to me.

Why is an optional config file an overkill? FLOW3 is in every way convenient and configurable but not in this case?

A config file is easier to create in an automated build script as exporting ENV Variables with path. And it is more flexible if one would need more configuration values in its shell scripts.

#8 Updated by Karsten Dambekalns over 5 years ago

Environment variables are IMHO the most common way to solve those issues. I would always prefer that way to having to create a config file. So, if anyone comes up with a good reason and a readymade solution to this, fine. I won't work on this issues more, as I consider it fixed. Sorry ;)

And, by the way, FLOW3 tries not to be configurable wherever possible.

#9 Updated by Thomas Fritz over 5 years ago

I uploaded a patch with my suggested solution.
I have also added a FLOW3_DEBUG flag which is of course not needed to get this working.

The script now recognizes Environment variables if they are set or exported already. If not set they gets initialized with useful default values.
Then the script checks if a config File is available and sources it. The content of the config file is free and will override any yet existend variables or functions at this time.

The patch also fixes #6693 and #6694

#10 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from Resolved to Accepted

#11 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from Accepted to Resolved

As of r3916:
[+FEATURE] FLOW3 (Core): Made the flow3 shell script configurable regarding PHP binary, context and paths used through Configuration/flow3.sh. Resolves #6681. T3BOARD10 Bug Auction.
[+BUGFIX] FLOW3 (Core): Two compliance fixes to flow3.sh, fixes #6693, fixes #6694. T3BOARD10 Bug Auction bonus fixes. :)

Also available in: Atom PDF