Closed joergRossdeutscher closed 4 years ago
If a user change something on the script and after that it doesn't work, i guess it's up to everyone to fix the problem self. I have added some spaces and some page breaks after ?>, but the script works furthermore without issues. So a reproduction from 'cannot modify header information - headers already sent' was not possible with that changes there.
Sorry dont know what that means. Im no Github Pro.
For 1.: Your code, your rules — I am fine with that. I am a pro developer and just suggest what's common best practice nowadays, and that's not to use closing tags.
For 2.: I'll try to explain this better. You have an idea what your user does: He downloads your code from Github to his computer, then makes the changes in the config, then uploads it with a ftp client to his shared server.
This may happen often, but this is not the usual way anymore in 2020. People just login to their server per ssh, go to the target folder and type "git clone https://github.com/gitman328/youtube-upload-mail-reminder.git“ , then edit the config directly there and done. No code on the local PC.
Whenever you release an update, I again just login per ssh, type “git pull“ and done. That's the usual way to deal with not packaged php code.
This will not work if users and you edit the same file. This happens with the config file. It can't be updated, because both sides changed it.
So, it's usually best practice to do it this way:
Since you already “made the mistake“ adding the config to the repo it's not solvable with that names anymore, however, with changed names it can be fixed.
Difficult to explain. I'll try in non technical terms: You never add files to a git repo that are expected to be changed by the user. Because this breaks working with git. You ask your users to make a copy and exclude that copy from git.
In file config.php there will no furthermore changes will made.
You should omit the closing ?> tag from config.php. If users accidently add whitespace there, this will early start an http stream, a very difficult to solve error. (Google for "cannot modify header information - headers already sent" to see the sad victims of this problem)
You should name the default config file “config_DIST.php“ and tell users to edit a copy. If users do a “git clone“ directly on the servers cli, they have to change a file that is part of the repo. Then add “config.php“ to a new .gitignore file.