Skip to content

Commit

Permalink
+ Clear the cache when relinking a site to Akeeba Backup
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 d9568ce commit 26c5af1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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
# [LOW] Wrong lang string used in WordPress plugin/theme update emails
# [LOW] PHP warnings running Connection Doctor on WordPress sites
Expand Down
16 changes: 16 additions & 0 deletions src/Controller/Trait/AkeebaBackupIntegrationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

namespace Akeeba\Panopticon\Controller\Trait;

use Akeeba\Panopticon\Library\Cache\CallbackController;
use Akeeba\Panopticon\Model\Reports;
use Akeeba\Panopticon\Model\Site;
use Awf\Uri\Uri;
use Exception;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Contracts\Cache\CacheInterface;
use Throwable;

Expand Down Expand Up @@ -337,6 +339,20 @@ function (Site $model)
{
$dirty = $model->testAkeebaBackupConnection(true);

$container = $this->getContainer();
/** @var FilesystemAdapter $pool */
$pool = $container->cacheFactory->pool('akeebabackup');

for ($from = 0; $from < 1000; $from += 10)
{
foreach ([0, 1, 5, 10, 15, 20, 50, 100, 200, 300, 400, 500] as $limit)
{
$pool->delete(sprintf('backupList-%d-%d-%d', $model->id, $from, $limit));
}
}

$pool->delete(sprintf('profilesList-%d', $model->id));

if (!$dirty)
{
// This short-circuits saveSite(), telling it to save nothing.
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Akeeba\Panopticon\Task\RefreshSiteInfo;
use Akeeba\Panopticon\Task\Trait\ApiRequestTrait;
use Akeeba\Panopticon\Task\Trait\JsonSanitizerTrait;
use Akeeba\Panopticon\Task\Trait\SaveSiteTrait;
use Awf\Container\Container;
use Awf\Date\Date;
use Awf\Mvc\DataModel;
Expand Down Expand Up @@ -71,6 +72,7 @@ class Site extends DataModel
use CmsFamilyFilterSeparatorTrait;
use SiteTestConnectionJoomlaTrait;
use SiteTestConnectionWPTrait;
use SaveSiteTrait;

/**
* Represents the configuration for a site as a Registry object.
Expand Down

0 comments on commit 26c5af1

Please sign in to comment.