forked from leftypol/leftypol
ReportQueries.php: fix filterReports always returning valid reports
This commit is contained in:
parent
73b2bebe56
commit
02d181f7b8
1 changed files with 3 additions and 3 deletions
|
|
@ -89,7 +89,7 @@ class ReportQueries {
|
||||||
// Get the reports without a post.
|
// Get the reports without a post.
|
||||||
$invalid = [];
|
$invalid = [];
|
||||||
foreach ($raw_reports as $report) {
|
foreach ($raw_reports as $report) {
|
||||||
if (isset($report_posts[$report['board']][$report['post']])) {
|
if (!isset($report_posts[$report['board']][$report['post']])) {
|
||||||
$invalid[] = $report;
|
$invalid[] = $report;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ class ReportQueries {
|
||||||
$query = $this->pdo->prepare('SELECT `board`, `post`, `id` FROM `reports`');
|
$query = $this->pdo->prepare('SELECT `board`, `post`, `id` FROM `reports`');
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$raw_reports = $query->fetchAll(\PDO::FETCH_ASSOC);
|
$raw_reports = $query->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
$valid_reports = $this->filterReports($raw_reports, false, null);
|
$valid_reports = $this->filterReports($raw_reports, false);
|
||||||
$count = \count($valid_reports);
|
$count = \count($valid_reports);
|
||||||
|
|
||||||
return $count;
|
return $count;
|
||||||
|
|
@ -176,7 +176,7 @@ class ReportQueries {
|
||||||
$query = $this->pdo->prepare('SELECT `board`, `post`, `id` FROM `reports`');
|
$query = $this->pdo->prepare('SELECT `board`, `post`, `id` FROM `reports`');
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$raw_reports = $query->fetchAll(\PDO::FETCH_ASSOC);
|
$raw_reports = $query->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
$invalid_reports = $this->filterReports($raw_reports, true, null);
|
$invalid_reports = $this->filterReports($raw_reports, true);
|
||||||
|
|
||||||
foreach ($invalid_reports as $report) {
|
foreach ($invalid_reports as $report) {
|
||||||
$this->deleteReportImpl($report['board'], $report['post']);
|
$this->deleteReportImpl($report['board'], $report['post']);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue