Gathering and logging data from a plugin: how to do it without race conditions?

You can create a lock by using flock on one of your existing files (or create a special one fo this. Get the lock before you start the canculation and release it after the result was stored.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)