some time ago I realized that SilverStripe calls multiple times the same function. E.g.
Place a onBeforeWrite function to your Page class and put 'print('Hello World');' (or even mail()) in it and save.
Examining the response in firebug will reveal 'Hello World' at least 2 times in the server response. Why? I saved only once, so it should be onBeforeWrite once too. When pressing save & publish, 'Hello World' appears 3 times in the response. Is this by Design? It looks like a waste of resources if it's executed twice, instead of once.