Hi,
There might be a compatibility issue with the VBO module.
Steps to reproduce on a clean drupal install:
1 - Install/Enable node expire module (rules and entity modules required)
2 - In module options, select "Trigger "Content Expired" event every cron run when the node is expired"
3 - Enable node expiry for content type "article"
4 - Install/Enable VBO module (views, ctools modules required)
5 - Create a new view page
- format: table
- fields: Content title
Bulk operations: Content
- selected bulk operations: publish content, unpublish content
6 - Create multiple nodes "article" (at least 2)
7 - Go to the view page
8 - Select at least 2 articles
9 - Execute an operation
10 - Obtain the attached error:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=5&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2' for key 'PRIMARY': INSERT INTO {node_expire} (nid, expire, expired, lastnotify) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => 2145934800 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 0 ) in drupal_write_record() (line 7166 of /var/www/newdrupal/includes/common.inc).
The error does not appear if you change the node expire module config to "legacy mode".
Hope that will help you.
Thank you
Kind Regards
Gabriel
| Comment | File | Size | Author |
|---|---|---|---|
| Capture.PNG | 27.07 KB | gabyyy |
Comments
Comment #1
Nafes commentedThanks Gabriel!
I will check it.
Kind regards,
Nik
Comment #2
Nafes commentedGabriel,
I was able to reproduce the issue. The reason of the issue is that VBO changes on-a-fly the $node object to a most generic one without expiry information and Node Expire module tries to insert a new record instead of update an existing one.
In Legacy mode the record is always inserted, that's why there is no issue in that mode. But this approach requires to delete the previous record, if it exists, and valuable information is lost. I would not recommend Legacy mode for new sites development.
Expiry information in the presence of VBO can be found in $node->original instead of $node. For a quick fix just change line 121 in the file ...\node_expire\node_expire.nodeapi.inc
from
if (isset($node->expired)) {
to
if (isset($node->original->expired)) {
This works for me. After additional testing I will include the change to a new release. If you will have some issues, please let me know.
Kind regards,
Nik
Comment #3
Nafes commentedComment #6
Nafes commentedQuick fix presented in #2 just prevents crash but does not solve all the problems. Node expiry data still can be lost on VBO usage. For full solution use Node expire release 7.x-1.1.