-
Notifications
You must be signed in to change notification settings - Fork 906
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
DevTools Require - Validate credentials #3843
Conversation
[ci skip] [skip ci]
[ci skip] [skip ci]
@promatik please take a look at this reply I've added the code here that I used to log the error into a custom log file, not sure if it's 100% worth or we simply log in the default user channel, but I think it's safer and 100% guaranteed that the error would be in that file and the logger is built on run-time so no need to be correctly configured in the app confg(). I think this is the only place where we need to write to the file? Since we catch the credentials error. a possible network error, and this "composer error" is the last we need to catch right ? About the display, I am just saving Let me know, |
…b.com/Laravel-Backpack/CRUD into devtools-require-validate-credentials
To sum up; |
The inspection completed: 506 Issues, 81 Patches |
I'll merge this as soon as it has @pxpm 's green light. |
@pxpm heads-up - this is waiting for your green light. |
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.
Sorry for taking a bit of time to come back here.
After review I think we still have something to address here.
- new laravel instalation
- require backpack/crud --prefer-source
- change to this branch and run the command
My guess is that composer is not really using the values we provide but a cached version otherwise the password worng
would have not worked.
Next all of the steps above but I clear composer cache before:
Fine .. I guess .. until I try again: php artisan backpack:install
No asking about devtools instalation ? Hum .. Somehow vendor/backpack/devtools
exists as an empty folder. I manually delete it and run the command. Gave the correct credentials and everything worked.
Went back to the project where I am running old dbal version, run the command and as expected it failed! (very nicely @promatik 👍 ), just a minor issue I found is that the command would retry again when failing, and I don't think that should happen because it's not something that is going to be "fixable" on a second try.
So I think there are two things that we need to address here, the composer cache and the check if package exists in the Install
command of Backpack Crud.
if (! file_exists('vendor/backpack/devtools')) { //we need a different way to check here, probably check if the service provider exists or something ?
$this->box('Did you know about Backpack DevTools?');
....
}
}
Let me know @promatik
Pedro
Good catch @pxpm ! My thoughts on this:
|
Hi @pxpm! Great review 🙌 Ok, the first issue, about credentials, I think we can't do much about it, here is the process flow;
I think there are 2 possible scenarios for your case;
If case 2 is happening, DevTools will never know which credentials were used, and in case the local Regarding problem 2, yes, that is an "unfixable" error, and that's why I added this code; if (strpos($buffer, 'Your requirements could not be resolved') !== false) {
$this->progressBar->advance();
$this->error($buffer);
$process->stop(0);
} Note the
Regarding problem 3, it doesn't happen to me! what a crappy situation 😅
I'll update you as soon as possible ✌ |
Guys... could you please remind me... why did we decide to do this? Why do we need to move the user&pass prompt from Composer's screen to our own screen, and validate it? The first post doesn't really say that, nor do the replies. And stupid old me doesn't remember. Thanks! |
@tabacitu because some errors if not handled would produce "silent" instalation fails, like, for example a conflicting version in your composer.json when trying to install devtools. 👍 |
Closing in favor of #4559 which will get merged soon |
I don't think this tackles this issue? Does it? Is by sending users to check logs? |
@pxpm this code was mainly moved from this PR to to #4559. Although this (now #4559) doesn't cover every possible error, it is better to have an installer than don't have it 🤷♂️ We may fix errors we (and devs) find from now on, but I think it may be a work in progress ... |
Got it 👍 |
This is the result;
This was a lot of work, because DevTools was always installing, even after removing the credencials and my private key (to avoid installing from source), composer has some kind of cache of my key (?🤷♂️).
I had to test this on Windows linux subsystem.
Sorry for the huge amount of changes, not great for code review, but I had to separate everything in functions to avoid code repetition.