[TYPO3-dev] locking of records

Bernhard Kraft kraftb at kraftb.at
Mon Jan 30 00:37:55 CET 2006


Ernesto Baschny [cron IT] wrote:


> This is not really a serial number, since its not increased on each save

wrong.

the tstamp get's incremented on each save. crdate doesn't.

> and has a granuarity of seconds. So saves going on at the same second
> aren't going to be consistency checked. It shouldn't happen on human
> updates (loading the data, looking at it, changing and saving it back
> takes more than a second), but might be a problem if we have scripts
> updating the data at the same time.

Pherhaps have something like that:


if ($row['tstamp'].'|'.$GLOBALS['BE_USER']->user['uid'] != $sentCompVal) {
  // don't write changes
} else {
  // write changes
}


so the problem you noted: same record updated in the same second
will only occur if this is be done by the same user ...

I know many people are using the same User for different "real" persons ....
this can be a problem ...


The way to go would be to create a "unique" value for the "compareValue" based
on
1. database row tstamp
2. a unique identifier of the BE-users browser session (it should also work
- meaning: don't save - if one user uses two windows to edit the same record.
on saving the second one it should reject)

ok ... i think I've got it ...

you would need to create a <input type="hidden"> field in every TCEform but ONLY if
it is not already there ... by filling the field with an unquie md5hash (random) you
generate a unique ID for every t3lib_tceforms "session".


beer from .... ah sorry ... greets from Fiesch,
Bernhard




More information about the TYPO3-dev mailing list