Skip to content

[5.x] Allow notification to expire - #25892

Merged
chippison merged 17 commits into
5.x-devfrom
notification-expiry-date-5x
Dec 1, 2026
Merged

chippison merged 17 commits into
5.x-devfrom
notification-expiry-date-5x

Conversation

@chippison

@chippison chippison commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #25830 to 5.x-dev, for 5.14.4. Stacked on #25891 and has to be merged after it.

Changes from the original: Notification::$expiresAt has a @var int|null docblock instead of the ?int type, for PHP 7.2. The separate-process test drops @preserveGlobalState disabled, because on PHP 8.5+ php-di 6 prints deprecations in the child process and PHPUnit fails the test. #25830 is not merged yet, so this follows it if it changes.

DEV-21141

Microsoft 365 stops accepting SMTP password logins by default at the end of December 2026. After that date, the warning added in #25891 would be stale. This PR lets a notification carry an expiry time, then sets the end of December 2026 as the expiry for that warning.

It is stacked on #25891 and has to be merged after it.

Changes

  • New Piwik\Notification::$expiresAt property, typed ?int: a Unix timestamp from which the notification is no longer shown. It defaults to null, which means the notification never expires, so existing notifications behave as before.
  • Notification\Manager::notify() doesn't post a notification that has already expired, and returns false for it. If a notification with the same id was posted earlier, it is removed.
  • Notifications posted before they expired are removed from the session the next time notifications are shown.
  • The SMTP password login warning now expires at 2027-01-01 00:00 UTC.

Testing

  • Unit tests for the notification manager: posting before, at and after the expiry time, removing the earlier copy when an expired one is posted with the same id, and removing an expired notification from the session.
  • The warning's integration tests now fix the current time, check the expiry the warning sets, and confirm the warning is no longer shown from January 2027.
  • The warning's UI test skips itself from January 2027, because UI tests can't fix the current time.

Checklist
[✔] I have understood, reviewed, and tested all AI outputs before use
[✔] All AI instructions respect security, IP, and privacy rules

chippison and others added 4 commits December 1, 2026 16:26
Backport of #25723. Typed properties, named arguments and the never and mixed types are rewritten for PHP 7.2.
Backport of #25724. Leaves out the 6.x-only mailSettingsUpdated event, adds the General_InvalidValueForParameter text 5.x lacked, and moves the specs to jest.
Backport of #25819. Leaves out the 6.x-only mailSettingsUpdated event and moves the specs to jest.
Backport of #25830. expiresAt is a docblock-typed property for PHP 7.2.
@chippison chippison added this to the 5.14.4 milestone Dec 1, 2026
chippison and others added 7 commits December 1, 2026 17:07
…shot

Http::sendHttpRequestBy no longer declares @throws, so the CliMulti entry no longer matches. The screenshot shows the new [mail] oauth settings.
cancel() only unsets the session key when it is set, and the tests keep global state so php-di's deprecations stay hidden on PHP 8.5+.
With it disabled, php-di 6 deprecations fail the separate process on PHP 8.5+.
innocraft-automation and others added 3 commits December 1, 2026 04:28
…-login-retirement-warning-5x

# Conflicts:
#	plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.js
#	plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.min.js
@tzi
tzi marked this pull request as ready for review December 1, 2026 19:31
@tzi
tzi requested a review from a team December 1, 2026 19:31

@tzi tzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not blocking: #25830 got a few changes after review, and this backport doesn't have them yet:

  1. "Stop building the SMTP warning once it has expired": the EXPIRY_DATE constant, and the !Date::now()->isEarlier(...) check in the condition that calls self::cancel().
  2. Its test, testDoesNotRememberTheWarningAsShownFromJanuary2027.
  3. "Mark the SMTP warning class as internal and temporary": the @internal tag on SmtpBasicAuthRetirementNotification.
  4. The shorter CHANGELOG.md entry: "Piwik\Notification::$expiresAt: a Unix timestamp from which the notification is no longer shown."

Without 1, from January 2027 notifyIfNeeded() still builds the whole warning on every admin page. notify() then drops it, but shown is still set in the session, although nothing was posted.

Could we bring these over? For the test in a separate process, @preserveGlobalState disabled can be left out, like in ManagerTest.

From January 2027 the warning is skipped before it is built, and the session no longer remembers it as shown. The changelog entry only describes the new property.
It is to be removed after December 2026.
Base automatically changed from smtp-password-login-retirement-warning-5x to 5.x-dev December 1, 2026 22:45
…y-date-5x

# Conflicts:
#	CHANGELOG.md
#	core/ExceptionHandler.php
#	core/Mail/Transport.php
#	plugins/CoreAdminHome/SmtpBasicAuthRetirementNotification.php
#	plugins/CoreAdminHome/tests/Integration/SmtpBasicAuthRetirementNotificationTest.php
#	plugins/CoreAdminHome/tests/UI/SmtpBasicAuthRetirementNotification_spec.js
#	tests/PHPUnit/Integration/Mail/TransportTest.php
@chippison
chippison requested a review from tzi December 1, 2026 23:04
@chippison
chippison merged commit f92e995 into 5.x-dev Dec 1, 2026
172 checks passed
@chippison
chippison deleted the notification-expiry-date-5x branch December 1, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants