Skip to content
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

[fix] Do not create .htaccess with Nginx #223

Closed
wants to merge 2 commits into from
Closed

[fix] Do not create .htaccess with Nginx #223

wants to merge 2 commits into from

Conversation

magikcypress
Copy link

@magikcypress magikcypress commented Apr 23, 2017

It's probably a good patch, but it is to discuss this issue #222

Copy link
Member

@rugk rugk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first thanks for your first-time contribution to this project! 🎉 👍
So welcome to this project, hopefully you'll like it.

I think the idea is general is good. Let's see what @elrido says…

if ($writtenBytes === false || $writtenBytes < 19) {
throw new Exception('unable to write to file ' . $file, 11);
}
if ((strncmp("Apache", $_SERVER['SERVER_SOFTWARE'],6) == 0) or defined('_SERVER_APACHE')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _SERVER_APACHE meant as a way to circumvent this check for admins? If so I'd say this should maybe better be a configuration variable… If not then is this really an official variable set by Apache?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you're welcome 👍

It's not official variable, this variable may call like this define('_SERVER_APACHE', 'false');

Yes, it seems interesting to put it in the configuration, but I do not know how to do it the best.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests fail due to the missing check if the key SERVER_SOFTWARE exists. Also we need to add tests that mocks the existence of that variable emulating both an apache and non-apache environments to ensure the .htaccess files get created in Apache and not in others.

I can look into writing these tests later some time during this week.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elrido What do you say about the environmental variable in general? I'd say changing it to a config option is better…

@magikcypress If you want to see how to add a config option, in this commit a config option was added.

@magikcypress
Copy link
Author

Sorry, this PR is dirty !
The best is to create a new PR?

@@ -3,9 +3,6 @@
; An explanation of each setting can be find online at https://github.com/PrivateBin/PrivateBin/wiki/Configuration.

[main]
; (optional) set a project name to be displayed on the website
; name = "PrivateBin"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge the current master into your project. You've accidentally reverted some commits/code changes we did in the master branch recently.

@rugk
Copy link
Member

rugk commented Apr 25, 2017

No, that's not necessary. A quick fix could be to just run git pull https://github.com/PrivateBin/PrivateBin in the repo and it should merge the master into it.
Just keep your fingers crossed in order not to have to manually correct any conflicts… 😉

A proper fix would be to update your master branch on GitHub either by GitHub's GUI or by using the cli and doing basically the same as above, but in the master branch.
See https://help.github.com/articles/merging-an-upstream-repository-into-your-fork/

@magikcypress
Copy link
Author

My bad ! I could not do it ! Sorry, I tried to merge the master on patch-1 :(

git clone --branch patch-1 git@github.com:magikcypress/PrivateBin.git
git pull https://github.com/PrivateBin/PrivateBin
git merge master

My merge doesn't work, and my changes are not made !?

You have a idea ?

@rugk
Copy link
Member

rugk commented Apr 26, 2017

After git pull the changes should already be merged. No "merge master" is necessary afterwards anymore. Usually a git push afterwards should publish the changes.

@magikcypress
Copy link
Author

I managed to catch up with my mistakes ?!

@rugk
Copy link
Member

rugk commented Apr 27, 2017

Thanks for these changes (especially fixing the indentation), but it seems your changes still revert some commits in the master branch…

Either follow this guide again or – if it is easier for you – create a new PR.

PS: For easy and always correct indentation you can use http://editorconfig.org/ – we support it.

@magikcypress
Copy link
Author

magikcypress commented Apr 27, 2017

I will create a new PR tomorrow.
Github is my worst enemy at the moment ;)

@rugk
Copy link
Member

rugk commented Apr 28, 2017

😄
Yeah, no problem. You'll learn it. 👍

@rugk
Copy link
Member

rugk commented Apr 28, 2017

BTW when creating a new PR you can add a string in order to (automatically) let issues close when a PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants