Skip to content

Commit

Permalink
Merge pull request #104 from boxuk/transient-expiration
Browse files Browse the repository at this point in the history
[FIX] Set expiry for site transient
  • Loading branch information
jdamner authored May 19, 2023
2 parents ac1f267 + 8f25e01 commit e345a7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Util/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ function get_muloader_key(string $mudir = WPMU_PLUGIN_DIR): string
if ($old_key) {
delete_site_transient($old_key);
}
set_site_transient('lkw_mu_loader_key', $key);
// Set the key to expire in a day, just so if the md5 scan matches
// new plugins will eventually be loaded
set_site_transient('lkw_mu_loader_key', $key, 60 * 60 * 24);
}
return $key;
}
2 changes: 1 addition & 1 deletion tests/Util/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function test_get_muloader_key_different(): void
]);
WP_Mock::userFunction('set_site_transient', [
'times' => 1,
'args' => [ 'lkw_mu_loader_key', $this->key ]
'args' => [ 'lkw_mu_loader_key', $this->key, 60 * 60 * 24 ]
]);
// Run the test
$result = Util\get_muloader_key();
Expand Down

0 comments on commit e345a7d

Please sign in to comment.