Skip to content

Commit

Permalink
# [MEDIUM] Repeated emails for WordPress plugin updates
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas K. Dionysopoulos <nicholas@akeeba.com>
  • Loading branch information
nikosdion committed Aug 19, 2024
1 parent 54d96bd commit 30ecee9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Akeeba Panopticon 1.2.2
+ Optional environment variables-only configuration of containerized Panopticon [gh-696]
+ Clear the cache when relinking a site to Akeeba Backup
~ Do not log CMS Update Found more than once per version
# [MEDIUM] Repeated emails for WordPress plugin updates
# [LOW] Wrong lang string used in WordPress plugin/theme update emails
# [LOW] PHP warnings running Connection Doctor on WordPress sites
# [LOW] Wrong "email" label on Backup options [gh-771]
Expand Down
3 changes: 2 additions & 1 deletion src/Task/PluginUpdatesDirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ function ($item) use (
}

// Skip plugin / theme if its new version is the same we last saw trying to update it.
$lastSeenVersion = $lastSeenVersions[$item->extension_id] ?? null;
$key = $sysConfigModel->getExtensionShortname($item->type, $item->element, $item->folder, $item->client_id);
$lastSeenVersion = $lastSeenVersions[$key] ?? null;

if ($lastSeenVersion !== null && $lastSeenVersion == $newVersion)
{
Expand Down
21 changes: 18 additions & 3 deletions src/Task/PluginsUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,26 @@ private function recordLastSeenVersion(Site $site, string $softwareId): void
function (Site $site) use ($softwareId) {
$siteConfig = $site->getConfig() ?? new Registry();
$lastSeenVersions = $siteConfig->get('director.pluginupdates.lastSeen', []) ?: [];
$lastSeenVersions = is_object($lastSeenVersions) ? (array) $lastSeenVersions
$lastSeenVersions = is_object($lastSeenVersions)
? (array) $lastSeenVersions
: $lastSeenVersions;
$lastSeenVersions = is_array($lastSeenVersions) ? $lastSeenVersions : [];
$lastSeenVersions = is_array($lastSeenVersions)
? $lastSeenVersions
: [];
$extensions = (array) $siteConfig->get('extensions.list');
$extensionItem = $extensions[$softwareId] ?? null;
$sysConfigModel = $this->container->mvcFactory->makeTempModel('Sysconfig');
$extensionItem = array_reduce(
$extensions,
fn(?object $carry, object $e) => $carry
?? (
($sysConfigModel->getExtensionShortname(
$e->type, $e->element, $e->folder, $e->client_id
) === $softwareId)
? $e
: null
),
null
);
$latestVersion = $extensionItem?->version?->new;
$lastSeenVersions[$softwareId] = $latestVersion;

Expand Down

0 comments on commit 30ecee9

Please sign in to comment.