I'm migrating from Vivvo CMS, and it also counts nodes just like Drupal.
- nid
- totalcount
- daycount
- timestamp (time of latest view)
So Id like to request the feature, to add this as optional. Should be easy I think.
I'm migrating from Vivvo CMS, and it also counts nodes just like Drupal.
- nid
- totalcount
- daycount
- timestamp (time of latest view)
So Id like to request the feature, to add this as optional. Should be easy I think.
Comments
Comment #1
Anonymous (not verified) commentedI added:
to node.migrate.inc in node_migrate_fields_node, but I think node_save() doesn't save these stats?
How to programmatically set a node's daycount?
Comment #2
Anonymous (not verified) commentedFound a workaround,
Add before
timer_stop('node_save'):With code from #1
Comment #3
mikeryanComment #4
StuartDH commentedHow do we get this to work in v2?...migrating statistics for each node into D7's node_counter table
It looks like I need to add something like the following to migrate/plugins/destinations/nodes.inc
but I don't know what to do wth #2 as node.migrate.inc isn't in v2 and timer_stop('node_save') doesn't appear to be in the migrate.module or any includes or plugins
Am I barking up the wrong tree? Should I be using a handler in a migration class to somehow expose the node_counter table to the node destination list, rather than hacking the module code?
Comment #5
mikeryanJust ignore all references to the Migrate V1 code - the node migration in Migrate V2 is in node.inc, and that's where writing the counters would be implemented.
Comment #6
mototribe commentedhi Mike,
I need to implement this too. Do you have a patch or more detailed instructions of where to add the code.
If you roll back and reimport a node wouldn't you have to manually remove any orphaned values from node_counter? Or does Drupal do an automatic garbage collection?
thanks!
Comment #7
mikeryanThe node counters are managed by the core statistics module, thus we only want to deal with them when it is enabled. The clean way to do this is to implement a new statistics.inc, similar to path.inc - it would add the fields as StuartDH suggests in its fields() methods, then you would implement a complete() handler to write the values to the node_counter table.
Comment #8
xandeadx commented+1 for feature
Comment #10
jordanmagnuson commentedI'd also love to know how to do this.
Comment #11
jordanmagnuson commentedHere's a statistics.inc that works for me. Maybe others can offer feedback/improvement?
Comment #12
jordanmagnuson commentedComment #13
mikeryanOK, will review the pasted code for Migrate 2.4. In the future, though, please attach a proper patch.
Thanks.
Comment #14
mikeryanCommitted to D6 and D7, with one key change - the values need to come from $node, not $row, to support migration from arbitrary sources (not just another Drupal installation).
Thanks.
Comment #15
jordanmagnuson commentedAh, okay. Thanks Mike. And next time I will attempt to submit a real patch!