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

VUFIND-1680 / phpCas 1.6 update #3550

Merged
merged 8 commits into from Apr 3, 2024

Conversation

mathieugrimault
Copy link
Contributor

Add phpCas/service_base_url parameter
Change phpCas logging

see : https://openlibraryfoundation.atlassian.net/browse/VUFIND-1680

Add phpCas/service_base_url parameter
Change phpCas logging

see : https://openlibraryfoundation.atlassian.net/browse/VUFIND-1680
Add phpCas/service_base_url parameter
Change phpCas logging

see : https://openlibraryfoundation.atlassian.net/browse/VUFIND-1680
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @mathieugrimault! See below for a few suggestions. Also note that there's a small style issue you can automatically fix by running composer fix and committing the resulting changes.

module/VuFind/src/VuFind/Auth/CAS.php Outdated Show resolved Hide resolved
module/VuFind/src/VuFind/Auth/CAS.php Outdated Show resolved Hide resolved
} elseif (isset($this->getConfig()->Site->url)) {
// fallback method
$service_base_url = [
parse_url($this->getConfig()->Site->url, PHP_URL_SCHEME) . '://' .
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth calling parse_url just once and then processing the array it returns? Seems like that might be more efficient. Also, do we need to assemble this a little more carefully (e.g. checking whether some components are missing)? In particular, if there is a port number, do we need to add a ':' in front of it? I think parse_url just returns an integer in that situation.

Copy link
Member

Choose a reason for hiding this comment

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

Another possibility might be to use a regular expression to extract the beginning of the URL, if that's easier than messing with parse_url.

@mathieugrimault
Copy link
Contributor Author

mathieugrimault commented Apr 3, 2024

Thanks, @mathieugrimault! See below for a few suggestions. Also note that there's a small style issue you can automatically fix by running composer fix and committing the resulting changes.

I suppose composer fix is vendor/bin/php-cs-fixer fix module/VuFind/src/VuFind/Auth/ ? It does nothing :/

Ok with vendor/bin/phing php-cs-fixer

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks again for the work on this, @mathieugrimault! Since I can't test this for real, I decided to write some unit tests to cover various scenarios in configuration processing. This revealed a few minor bugs. I have refactored the code to make testing easier, and I have fixed the bugs (mainly related to missing elements in the parse_url return array) in the refactored code.

Can you please test this revised version and make sure it works correctly in your real-world scenario? Once you confirm that it is working (and if you approve of my changes), please let me know and I can merge the PR.

@mathieugrimault
Copy link
Contributor Author

Thanks Demain !
All tests are OK, you can merge.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks again, @mathieugrimault -- merging now!

@demiankatz demiankatz merged commit 9c09a50 into vufind-org:release-9.1 Apr 3, 2024
7 checks passed
@demiankatz demiankatz added this to the 9.1.2 milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants