Instead of depending on MySql syntax to get the current unix_timestamp, use Drupal::time() service.

2 reasons:

1) The current method will not work if you are using SqlLite3 or PostgreSQL because of mysql query syntax.

2) date format doesn't account for the users local time settings.

Comments

Bcwald created an issue. See original summary.

Bcwald’s picture

StatusFileSize
new1.72 KB
Bcwald’s picture

StatusFileSize
new1.83 KB

Updated patch to use placeholders inside the query.

Bcwald’s picture

StatusFileSize
new1.82 KB

syntax fix...

samuel.mortenson’s picture

Status: Active » Fixed
  1. +++ b/src/Plugin/Block/ModerationDashboardActivity.php
    @@ -4,6 +4,7 @@ namespace Drupal\moderation_dashboard\Plugin\Block;
    +use Drupal\Component\Datetime;
    

    Unused class.

  2. +++ b/src/Plugin/Block/ModerationDashboardActivity.php
    @@ -21,9 +22,11 @@ class ModerationDashboardActivity extends BlockBase {
    +    $results1 = $database->query("select revision_uid as uid,count(*) as count from {node_revision} where revision_timestamp >= :request_time_sub_month group by revision_uid", [':request_time_sub_month' => $request_time_sub_month])
    

    Should use single quotes.

Fixed these nitpicks on commit. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.