Localhost in email sent

Hi,

When OJS send a second email (reminder) for a review, we can see in the body a hyperlink that start wrongly with http://localhost…:

The email template is: REVIEW_REQUEST_REMIND_AUTO_ONECLICK

Variables are:

Hyperlien de la soumission: <a href="{$submissionReviewUrl}">{$submissionReviewUrl}</a><br />

And it displays like this: http://localhost/index.php/revue-t/login/resetPassword/doctorno?confirm=e8171e774a43ae8d38a1fe6c6133cd70ee940891c172d445ceae6fd3a7ed4e25%3A1490182246

Even the hyperlink journal title in the footer (this one is not from the email) of the email is wrongly set to:

http://localhost/index.php/index

Other emails are fine (no localhost thing). In config.inc.php base_url is correctly set.

We are on OJS 3.0.1

Any advice ?

Pierre

Are you using cron job to send those reminders?

Edit: if it is connected to using cron, then see here Error in email with subject Automated Submission Review Reminder - #16 by ajnyga especially the answer from @ctgraham. I switched to using Acron so I have no current knowledge on how this is working in OJS3 right now.

Yes.

For all reminder email.

The first one sent is REVIEW_REMIND and hyperlinks in it are OK. It’s the second one REVIEW_REQUEST_REMIND_AUTO_ONECLICK that contains wrong hyperlinks.

Hi,

REVIEW_REMIND is sent manually by the editor, right? That is different from REVIEW_REMIND_AUTO which is sent using a task.

The automatic reminders are sent here https://github.com/pkp/pkp-lib/blob/master/classes/task/ReviewReminder.inc.php#L74-L85
The same code is creating the submissionReviewUrl variable for both REVIEW_REMIND_AUTO and REVIEW_REQUEST_REMIND_AUTO.

I would still guess that problem is with the cron job. We had similar problems in December when we were still using OJS2. With OJS3 I have only used Acron.

I’m running the crontab and loging any errors with:

php /var/www/html/mydomain/tools/runScheduledTasks.php >/tmp/job-alheure-ojs.log 2>&1

In the log I can see:

PHP Fatal error: Call to undefined method ScheduledTaskTool::ScheduledTaskTool() in /var/www/html/edition-test.uqam.ca/tools/runScheduledTasks.php on line 28

And that just reminded me that I’ve seen this on my production machine and corrected it accordingly to Fix the modern constructor sytnax call for ScheduledTaskTool by kasioumis · Pull Request #1123 · pkp/ojs · GitHub but seem to forget to transfer the patch on the test server :unamused:

We’ll see if that correct the ‘localhost’ hyperlink in email reminder…

Hi @pnault,

Just to add to @ajnyga’s excellent advice – make sure also that your base_url setting in config.inc.php is correct.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,

After doing some tests and reading some posts, I decided to deactivated the acron plugin mainly for this reason: [quote=“ctgraham, post:15, topic:25320”]
Note that if no one browses your site on a particular day, Acron will not be able to run any scheduled tasks on that day
[/quote]

Also, there was some inconsistency in the display of the submission links in the email sent that I could not explain: sometimes I would get the “localhost” mention, other time I had the IP address of the server and finally the right DNS.

For the crontab, I read the docs/README and this excellent post: Any howto "crontab" somewhere? - #3 by marc. To solve the problem I had with localhost I found this [quote=“ctgraham, post:14, topic:8972, full:true”]
For anyone else who stumbles on this topic, I want to note that we had trouble calling the crontabs via an absolute pathname (for example, 0 0 * * * php /www/journal1/tools/runScheduledTasks.php). In particular, scheduled tasks which depend on calculating a journal base_url (like the PLN) were unable to accurately do so. A more reliable method (but maybe not perfect) is to cd to the OJS root directory and to run the command from there with a relative path (for example, 0 0 * * * cd /www/journal1/; php tools/runScheduledTasks.php).
[/quote]

For anyone who might be interested, I added to apache crontab for each job running in MySQL table schedule_tasks:

0 * * * * cd /var/www/html/www.root.folder; php tools/runScheduledTasks.php > /tmp/job-alheure-ojs.log 2>&1
0 * * * * cd /var/www/html/www.root.folder; php tools/runScheduledTasks.php lib/pkp/plugins/generic/usageStats/scheduledTasks.xml > /tmp/job-alheure-ojs-usageStats.log 2>&1
0 * * * * cd /var/www/html/www.root.folder; php tools/runScheduledTasks.php plugins/importexport/crossref/scheduledTasks.xml > /tmp/job-alheure-ojs-crossref.log 2>&1
0 * * * * cd /var/www/html/www.root.folder; php tools/runScheduledTasks.php plugins/importexport/datacite/scheduledTasks.xml > /tmp/job-alheure-ojs-datacite.log 2>&1
0 * * * * cd /var/www/html/www.root.folder; php tools/runScheduledTasks.php plugins/importexport/medra/scheduledTasks.xml > /tmp/job-alheure-ojs-medra.log 2>&1

Emails are now sent with the hostname in the URL, jobs run smoothly at pace I decided.
End of the story.

1 Like