Re: [Tiki-devel] BASE URL in console context

Jonny Bradley via TikiWiki-devel <[email protected]>
Newsgroups gmane.comp.cms.tiki.devel
Message-ID <[email protected]>
Hi Adrien

I've found an example (in my email bin) from dev and i see the problem on the first link to the wiki page, but the link to the plugins page seems ok (html source with some inline styling and noise cleaned up)

> Plugin html is pending approval on <a href="engli" class="" title="engli">engli</a>
> 
> See all the pending plugins in the <a href="https://dev.tiki.org/tiki-plugins.php">plugin approval page</a>


Which is a little odd - but i'm not sure what triggered these emails, console or the act of saving the page... so whatever the case was here it looks like \smarty_function_object_link doesn't work, but the global $base_url did? Either way they should be consistent.

Looking at https://gitlab.com/tikiwiki/tiki/-/merge_requests/2373/diffs i am a little confused - you seem to be fetching data from a field called `base_url` in table `tiki_plugin_security` but i don't see that here or created in the MR. You also set a pref `base_url` which surely is superfluous? I'm not sure we need a new field in the database for this.

I'm sure there is a pref for the site url to use when a console command is running, ok, here it is, called fallbackBaseUrl (introduced in https://gitlab.com/tikiwiki/tiki/-/commit/0ef12f6c) which looks like the one to use i think.

Does that help?

jonny



> On 24 Mar 2023, at 21:06, Adrien Maloba <[email protected]> wrote:
> 
> Hi all, 
> 
> When receiving an email that asks for approval of the PluginApproval in a wiki page, you will notice that the links that lead to the page where the change is pending approval and the link that leads to the list of other pages pending approval do not lead to the correct pages in 2 cases:
> - When the email is opened in another web client than Tiki Webmail
> - When the sending of emails is triggered by a command in console mode.
> 
> The problem is that the global variable $base_url is not correct when launching the command in console, there is no HTTP_HOST or SERVER_NAME variables coming from the environment.
> 
> Following a recommendation from Victor, to solve the problem, I added a line of code that allows to store the Base URL in the preferences table before using it when approval emails are sent.
> 
> Maybe you have already encountered some difficulties to access the URL Base in console.
> Please, do you have any ideas, suggestions on how we can exploit this preference? Maybe you have helpful insights on how to do it as a generic Tiki feature.
> 
> Here https://gitlab.com/tikiwiki/tiki/-/merge_requests/2373 the link of merge request about the incorrect links in email.
> 
> Attached is a screenshot that shows an example email.
> 
> Thank you!
> <links.png>_______________________________________________
> TikiWiki-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.