1

A Drupal security question:

Assuming some people have admin access to your site. How could you know if and how much text they changed in any of the nodes of your site? I'm not talking about going to admin/content and see if some nodes are "Updated" but I'm asking about a way to see change in the number of text bytes; A good example to such tracking would be the Wikipedia article tracking system --- Each time a Wikipedian article changes, you could see the number of bytes changed in it --- If someone adds 219 bytes of text to it, it will be seen in green in the famous "View history" tab. If someone deletes 12 bytes of text from it, it will be seen in red (See attached image from the "View history" tab of a typical wikipedian article to understand me better).

I try to understand if there is a similar mechanism in Drupal that I could use to track byte changes in the nodes of my site, in case someone else enters as admin and change the text of some pages.


enter image description here

3

Yes, all one needs to do is look at the field_data_body table and compare the byte count of body_value between revisions to get this information.

In fact, this would probably make a good patch for the Diff module which alters the node Revisions tab to an interface pretty similar to MediaWiki. The only thing missing is the core of your question, a comparison of byte count between revisions.

2
  • wow, well, since I'm but a humble JS student still studying differences between properties, methods, functions, loops, etc, and have yet to learn PHP I should ask if you have an option to patch that? (assuming it's a simple task to set the module to show bytes instead of words?), In any case I guess I should (at least for now) use it in it's default way --- that is, word difference comparisons.
    – user16289
    Oct 1 '15 at 8:16
  • Drupal answers isn't a write your code service, but I can point you in the right direction; the function diff_node_revisions() is where this happens in the diff.pages.inc include file. The $node->nid & $revision->vid, $revision->current_vid variables are available to use with db_query() to retrieve the column data. All that remains is to use the PHP strlen to count and figure out the byte difference. If you're looking to get your feet wet with module development this could be nice mini project.
    – Shawn Conn
    Oct 1 '15 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy