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

Fixed issue #18961: {SURVEYURL} didn't work with plugin using cli event #3454

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

gabrieljenik
Copy link
Collaborator

Please consider the following when reviewing:
Had to add these to the config:

As this is only required when running ConsoleApplication, maybe there is the need of having specific config for console?

Copy link
Collaborator

@Shnoulle Shnoulle left a comment

Choose a reason for hiding this comment

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

No issue in code (seems cool) BUT : seems not related to the issue.

@Shnoulle
Copy link
Collaborator

No issue in code (seems cool) BUT : seems not related to the issue.

OK, totally related to this issue. More clear now.

@Shnoulle Shnoulle changed the title Fixed issue #18961: {SURVEYURL} not complete URL Fixed issue #18961: {SURVEYURL} didn't work with plugin using cli event Sep 20, 2023
@Shnoulle Shnoulle added Code review done Version checked for code issue without testing and removed Needs code review labels Sep 20, 2023
@Shnoulle
Copy link
Collaborator

My own test

Checked with no update on sendMail Cron

With 55d9eda (parent of 3c70454 ) :

  • OK with only sendMailCron config

* @return string the relative or the configured public URL for the application
*/
public function getPublicBaseUrl($absolute = false)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it broke with current sendMailCron because there are no use of $baseUrl = CWebApplication::getBaseUrl($absolute); ? unsure ?

@gabrieljenik
Copy link
Collaborator Author

Depends on what KO means or how it fails.
Still, if running from CLI, there is now way the app to know a full url, as the related variables on SERVER/REQUEST are not set. The app has no clue about the domain when called from CLI.

@Shnoulle
Copy link
Collaborator

Still, if running from CLI, there is now way the app to know a full url, as the related variables on SERVER/REQUEST are not set. The app has no clue about the domain when called from CLI.

senfMailCron plugin didn't work with the new version, need update. Before 3c70454 it work.

sendMailCron use Yii

Your solution disable this usage. I really think it must allow it … (but i'm not the tester)

@maziminke have other plugins to send email via CLI.

@gabrieljenik
Copy link
Collaborator Author

Your solution disable this usage.

Please don't blame on me. Not fair to blame.

Also

  • I just ported code or adapted prior code.
  • 3c70454 is not my code.

@Shnoulle
Copy link
Collaborator

Your solution disable this usage.

Please don't blame on me. Not fair to blame.

Yes, sorry … i didn't want to blame you.

I mean : the current fix didn't allow usage of Yii1 internal function.

I just ported code or adapted prior code.

Looking at the difference : seems the new updated version (current PR) didn't use Yii::app()->getBaseUrl(true); but it's here … i don't understand …

@gabrieljenik
Copy link
Collaborator Author

I mean : the current fix didn't allow usage of Yii1 internal function.

Host Info could be something to enhance the url methods added on Application component/trait.

@mbischof
Copy link
Contributor

see https://www.yiiframework.com/doc/api/1.1/CUrlManager#baseUrl-detail
urlManager has an entry in application/config/config.php, so imho there is no need for an extra publicurl setting

@Shnoulle
Copy link
Collaborator

urlManager has an entry in application/config/config.php, so imho there is no need for an extra publicurl setting

Yes, BUT : some user need only publicurl, admin user access with limesurvey.intra/admin . with baseUrl : you set ALL url using the server, for example css link use absolute url.

It's not the same objective here. publicurl used ONLY for survey link or other publi link. Not for css, js etc …

Copy link
Collaborator

@Shnoulle Shnoulle left a comment

Choose a reason for hiding this comment

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

Place for the Trait

@@ -0,0 +1,44 @@
<?php

trait LSApplicationTrait
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not related to model … core/Traits seem better

@tiborpacalat tiborpacalat added Tested OK This PR has been tested by QA and works as expected and removed Needs testing labels Nov 29, 2023
@tiborpacalat tiborpacalat merged commit 9d4abed into 5.x Nov 29, 2023
9 checks passed
@tiborpacalat tiborpacalat deleted the bug/18961--SURVEYURL-not-complete-URL branch November 29, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code review done Version checked for code issue without testing Tested OK This PR has been tested by QA and works as expected
Projects
None yet
5 participants