-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate install_files scripts to PHP and add more config to .env
#1361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I am in favor of the PR. I added some remarks and suggestions, but nothing severe.
scripts/install_files.php
Outdated
copy('scripts/post-merge', '.git/hooks/post-merge'); | ||
|
||
echo "\n${ORANGE}To disable the call of composer and migration on pull add$NO_COLOR\n"; | ||
echo "${ORANGE}a file named '.NO_AUTO_COMPOSER_MIGRATE' in this directory.$NO_COLOR\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is for the whole script not just this line. I am not sure, if this script works nicely on Windows. Obviously, nobody has ever being bothered by this question, because the old file was a .sh
-script which obviously has never been working with Windows.
But now, after the script has become runnable for Windows we should maybe also ensure that it runs nicely. Here are the two things, I am not sure about:
- We use
\n
as the new line character. PHP offers the constantPHP_EOL
which is\n\r
on Windows, because Windows needs an additional carriage return. However, I do not know if this is only required for text files our for output to the command line, too. I would suspect the letter, because the programmer cannot know if the STDOUT targets the screen or is redirected to a file. So probably, we should usePHP_EOL
. - I am not sure, if Windows can handle the ANSI escape sequence and color codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested, but Windows seems to support ANSI. See https://gist.github.com/mlocati/fdabcaeb8071d5c75a2d51712db24011 for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Then we can keep the color codes. I feared that Windows would get confused in such a way that it would totally break console output. Glad to hear that it is the other way around!
But I still believe we need PHP_EOL
instead of \n
.
Moreover, another thought crossed my mind. I somehow remember that you figured out that the ANSI color codes are either only supported by echo
or by printf
. I don't remember what script you repaired and what the correct solution was, but have you checked that?
Co-authored-by: Matthias Nagel <matthias.h.nagel@posteo.de>
Co-authored-by: Matthias Nagel <matthias.h.nagel@posteo.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think it's worth adding some of the missing variables to the example .env
, so that users know what's available.
I wouldn't add them to |
LycheeOrg/LycheeOrg.github.io#56 (comment)
|
I understand this and agree with you, but I wouldn't add the experimental/advanced settings to the example. And the non-experimental are all available there already. |
Looking again at the list, I think I mostly agree. At which point it doesn't need to be in this PR. FWIW, the one that caught my eye was |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested but looks good.
Allow to change some config options via
.env
and migrate theinstall_files
to PHP (see #1323 (comment)). Also fixes a deprecation.