Skip to content

[5.4] Fix invalid URL in Update Notification email when triggered via CLI#47303

Open
Reda-Muhamed wants to merge 2 commits intojoomla:5.4-devfrom
Reda-Muhamed:5.4-dev
Open

[5.4] Fix invalid URL in Update Notification email when triggered via CLI#47303
Reda-Muhamed wants to merge 2 commits intojoomla:5.4-devfrom
Reda-Muhamed:5.4-dev

Conversation

@Reda-Muhamed
Copy link

Summary of Changes

When the Update Notification task (plg_task_updatenotification) is triggered via the CLI without a --live-site parameter, Uri::base() inherently falls back to https://joomla.invalid/set/by/console/application/. Because the plugin emails this raw output, it results in broken, confusing links for the user.

This PR adds a safe language string fallback for the CLI environment. If the URL contains joomla.invalid, the email will securely instruct the user to log in to their Administrator dashboard to apply the update, rather than sending a broken link.

Testing Instructions

  1. Ensure the System - Joomla! Update Notification plugin and its associated Scheduled Task are published.
  2. Trigger the task via the CLI using its Task ID: php cli/joomla.php scheduler:run -i 3
  3. (Note: To fully trigger the email generation locally, the test environment must have a pending Joomla update available so the script does not exit early).
  4. Observe the generated email body or URL variables.

Actual result BEFORE applying this Pull Request

The email body contains broken placeholder links:
URL: https://joomla.invalid/set/by/console/application/
Link: https://joomla.invalid/set/by/console/application/administrator/index.php?option=com_joomlaupdate

Expected result AFTER applying this Pull Request

The email body provides a clean, instructional fallback using the new language strings:
URL: URL unavailable (Run via CLI without --live-site)
Link: Please log in to your site Administrator dashboard to apply this update.

Link to documentations

No documentation changes required.

Fixes #47256

@alikon
Copy link
Contributor

alikon commented Mar 5, 2026

i don't think this is a solution

@Reda-Muhamed
Copy link
Author

i don't think this is a solution

My main thought is that the CLI environment natively doesn't know the live site URL. If we rely on forcing users to manually add the --live-site parameter, we are completely trusting their input. If they forget it, or type an invalid domain by mistake, the system will still generate and email a broken link.
​I added this string as a safe fallback so the user always gets a clear, instructional email instead of a joomla.invalid link.
​How would you prefer to solve the root cause here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators PR-5.4-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[5.x] wrong email text if update notification task is runned from cron/cli

3 participants