Skip to content

Commit

Permalink
Fix wrongful error after clearing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Ugoku committed Jul 16, 2024
1 parent fdf3b51 commit 93b9cd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Unreleased
* Fix wrongful error after clearing cache

## 6.1.5 (2024-07-16)
* Fix programme of multi-day package

Expand Down
5 changes: 4 additions & 1 deletion src/Transient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ class Transient
private const BASE = 'recras_';

/**
* Delete a transient. Returns 0 for success, 1 for error for easy error counting
* Delete a transient. Returns 0 for success/not existing, 1 for error for easy error counting
*/
public function delete(string $name): int
{
if (!$this->get($name)) {
return 0;
}
return (delete_transient(self::BASE . $name) ? 0 : 1);
}

Expand Down
6 changes: 3 additions & 3 deletions src/admin/cache.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
if (isset($_GET['msg'])) {
//if ($_GET['msg'] === 'success') {
if ($_GET['msg'] === 'success') {
?>
<div class="updated notice">
<p><?php _e('The cache was cleared.'); ?></p>
</div>
<?php
/*} elseif ($_GET['msg'] === 'error') {
} elseif ($_GET['msg'] === 'error') {
?>
<div class="error notice">
<p><?php _e('The selected cache could not be cleared. This could be an error, or there could be nothing to clear.'); ?></p>
</div>
<?php
}*/
}
}
?>

Expand Down

0 comments on commit 93b9cd8

Please sign in to comment.