diff --git a/inc/Data/ReportQueries.php b/inc/Data/ReportQueries.php index 3c58d945..23bec8e9 100644 --- a/inc/Data/ReportQueries.php +++ b/inc/Data/ReportQueries.php @@ -200,11 +200,11 @@ class ReportQueries { * @param int $id The report id. */ public function deleteById(int $id) { - // The caller may actually delete a valid post, so we need to invalidate the cache. - $this->cache->delete(self::CACHE_KEY); $query = $this->pdo->prepare("DELETE FROM `reports` WHERE `id` = :id"); $query->bindValue(':id', $id, \PDO::PARAM_INT); $query->execute(); + // The caller may actually delete a valid post, so we need to invalidate the cache. + $this->cache->delete(self::CACHE_KEY); } /** @@ -213,11 +213,11 @@ class ReportQueries { * @param int $ip The reporter ip. */ public function deleteByIp(string $ip) { - // The caller may actually delete a valid post, so we need to invalidate the cache. - $this->cache->delete(self::CACHE_KEY); $query = $this->pdo->prepare("DELETE FROM `reports` WHERE `ip` = :ip"); $query->bindValue(':ip', $ip); $query->execute(); + // The caller may actually delete a valid post, so we need to invalidate the cache. + $this->cache->delete(self::CACHE_KEY); } /**