-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Refactor of paths detection #36
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
Conversation
Hello everyone, I'm aware you're not accepting contributions from the public, but i want to share my 5 cents, and you're free to reject these changes. Following there is a list of the changes and the motivations for each one: 1) Maybe it's better to ensure the current directory is always the FC path 2) is_dir checks both relative and absolute paths so we only need to check if the $system_path and $application_folder are valid directories and then save the constant using realpath 3) realpath(__DIR__) is redundant because as far as i know __DIR__ === realpath(__DIR__) 4) I'm removing the check of application folder inside the system folder because it's an unnecessary operation, since it could be done setting the $application_folder variable to 'system/application'; 5) There's no need to replace the directory separators before apply a realpath because the substitution is provided by realpath itself (maybe is it there for the realpath's caching features?)
First off, thanks. I hadn't taken the time to look through this logic, yet, but had largely just copied it from CI3. Looks like there is definitely some logic in here that's not needed, like the application directory inside of system folder, which can be simplified or removed. Some of them, though, I get the feeling there was a reason at one time, but some of those issues might have been resolved in newer versions of PHP.
@narfbg Do you have any idea about the validity or necessity of these, especially 2 and 5? |
|
Are your 1 and 2 supposed to match up with the above numbering system, or just general points? If they are supposed to match up, then this is what I was taking 2 to refer to. |
Huh ... that's Markdown's fault. I wrote 2 and 5 respectively. |
Ah, that makes more sense then. And 5 has been a recent change, IIRC. This code came directly from CI3 originally. Good to know we can clean that up a little, though. |
Not directly ... you've made some modifications to it and 5 is part of them. :) |
Oh, that's right. Realpath wasn't used there and I had a brainfart one night thinking that might help improve the realpath caching of files so scattered a few likely useless realpath's around. :) |
Oh didn't know 5 was already fixed in the official repo. So for 3, unless i'm missing some edge cases i'm not aware of, DIR should always exists. Anyway no probs for me in leaving it at his place. I'm referring to For 2 I'll research more this evening if you feel it requires modifications. |
Perform a realpath check just before any is_dir to ensure the application and system path have executable permissions
} | ||
else | ||
// Are the system and application paths correct? | ||
if ( ! realpath($system_path) OR ! is_dir($system_path)) |
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.
Added this to ensure $system_path (and $application_folder below) have executable permissions
I'm going to go ahead and merge this for now. Firing up Parallels to be able to check it out under Windows, also. This is something we'll need to keep an eye on, but I do like the simplifications. Thanks. |
Hello everyone, I'm aware you're not accepting contributions from the public, but i want to share my 5 cents, and you're free to reject these changes. Following there is a list of the changes and the motivations for each one: