I'm currently getting an error when I unstall:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO {rules_config} (name, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => rules_fastly_purge_comment [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => fastly ) in drupal_write_record() (line 7170 of /usr/share/nginx/html/***/includes/common.inc).

All seems fine afterwards, until I try to clear the cache, when I get:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO {rules_config} (name, status, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => rules_fastly_purge_comment [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => fastly ) in drupal_write_record() (line 7170 of /usr/share/nginx/html/***/includes/common.inc).

Thanks...

CommentFileSizeAuthor
#3 fastly-default-rules-2223265-3.patch3.18 KBshevchess

Comments

shevchess’s picture

I can't reproduce the issue. Each time I re-install the module, default rules are created properly in rules_config db table and there are no any error messages.
Did you try it out with latest stable releases of Rules and Entity API modules?

Probably, the error occurs because of comma in the rules config label:
"LABEL" : "Purge Fastly cache when a comment is created, updated or deleted."
but I am not sure since it works fine for me and exported rules have valid json.

  $configs['rules_fastly_purge_comment'] = rules_import('{ "rules_fastly_purge_comment" : {
      "LABEL" : "Purge Fastly cache when a comment is created, updated or deleted.",
      "PLUGIN" : "reaction rule",
      "OWNER" : "rules",
      "TAGS" : [ "fastly" ],
      "REQUIRES" : [ "rules", "fastly", "comment" ],
      "ON" : { "comment_update" : [], "comment_delete" : [], "comment_insert" : [] },
      "DO" : [
        { "fastly_rules_action_purge_by_urls" : { "urls" : "comment\/[comment:cid]\r\nnode\/[comment:node:nid]\r\n[site:url]" } }
      ]
    }
  }');
jdcollier’s picture

Hmm ... same happening here. I removed the comma from the labels just to see if that did anything, but the issue remains. I've tried both branches and they have the same issue.

I have also ensured that entity is updated and I even switched to the dev branch of Rules to ensure I had the very latest.

I still get this error message and the cache is not able to clear.

shevchess’s picture

Status: Active » Needs review
StatusFileSize
new3.18 KB

There is only one reason when I can reproduce the issue. This is when the core Comment module is turned off on the site.
Most likely the core Comment module is disabled on your site.
I have added a patch to fix the issue.

jdcollier’s picture

It is ... I use a Facebook comment module. I will test this patch. Thank you so much!

jdcollier’s picture

This worked beautifully!

shevchess’s picture

Status: Needs review » Reviewed & tested by the community
Ryan Richards’s picture

Pulled in the patch and tried it out. Works great for me. Out of curiosity at what point should we merge this in?

  • Commit bb6dc03 on 7.x-1.x authored by Dmitriy Ivanov, committed by vasike:
    Issue #2223265 by jonnyj, Dmitriy Ivanov, jdcollier, Ryan Richards,...
vasike’s picture

Status: Reviewed & tested by the community » Fixed

Patch for #3 commited.
i think we can close this.

Thanks to all

Status: Fixed » Closed (fixed)

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