Skip to content

Commit

Permalink
Revert "remove unneeded UpdateSpamCount class"
Browse files Browse the repository at this point in the history
This reverts commit 800c2ab.
  • Loading branch information
florianbrinkmann committed Jun 2, 2023
1 parent 433107b commit d45bbcb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/PostProcessors/UpdateSpamCount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace AntispamBee\PostProcessors;

use AntispamBee\GeneralOptions\Statistics;
use AntispamBee\Helpers\Settings;

/**
* Post Processor that is responsible for incrementing the spam count and updating the value.
*/
class UpdateSpamCount extends Base {

protected static $slug = 'asb-update-spam-count';

public static function process( $item ) {
if ( ! Settings::get_option( Statistics::get_option_name( Statistics::DASHBOARD_COUNT_OPTION ) ) ) {
return $item;
}

Settings::update_option(
'spam_count',
intval( Settings::get_option( 'spam_count', '' ) + 1 )
);

return $item;
}
}

2 changes: 2 additions & 0 deletions src/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use AntispamBee\PostProcessors\DeleteForReasons;
use AntispamBee\PostProcessors\SaveReason;
use AntispamBee\PostProcessors\SendEmail;
use AntispamBee\PostProcessors\UpdateSpamCount;
use AntispamBee\PostProcessors\UpdateSpamLog;
use AntispamBee\Rules\ApprovedEmail;
use AntispamBee\Rules\BBCode;
Expand Down Expand Up @@ -63,6 +64,7 @@ function init() {
DeleteForReasons::class,
SaveReason::class,
SendEmail::class,
UpdateSpamCount::class,
UpdateSpamLog::class,
// Rules
ApprovedEmail::class,
Expand Down

0 comments on commit d45bbcb

Please sign in to comment.