forked from leftypol/leftypol
ReportQueries.php: delete then invalidate cache
This commit is contained in:
parent
f29f626eb1
commit
b5622e20c5
1 changed files with 4 additions and 4 deletions
|
@ -200,11 +200,11 @@ class ReportQueries {
|
||||||
* @param int $id The report id.
|
* @param int $id The report id.
|
||||||
*/
|
*/
|
||||||
public function deleteById(int $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 = $this->pdo->prepare("DELETE FROM `reports` WHERE `id` = :id");
|
||||||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||||
$query->execute();
|
$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.
|
* @param int $ip The reporter ip.
|
||||||
*/
|
*/
|
||||||
public function deleteByIp(string $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 = $this->pdo->prepare("DELETE FROM `reports` WHERE `ip` = :ip");
|
||||||
$query->bindValue(':ip', $ip);
|
$query->bindValue(':ip', $ip);
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
// The caller may actually delete a valid post, so we need to invalidate the cache.
|
||||||
|
$this->cache->delete(self::CACHE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue