diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2023-01-14 08:53:09 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2023-01-14 08:57:20 +0000 |
| commit | 8a0b11f9684477b3998805e81ab1de6c307e58cb (patch) | |
| tree | 9e73f322baf33b5b9517f3ecba22ac1aded78424 /app/Factories | |
| parent | 135987807fe8ebe1405d1232e24a04eddab6e577 (diff) | |
| download | webtrees-8a0b11f9684477b3998805e81ab1de6c307e58cb.tar.gz webtrees-8a0b11f9684477b3998805e81ab1de6c307e58cb.tar.bz2 webtrees-8a0b11f9684477b3998805e81ab1de6c307e58cb.zip | |
Fix: #4721 - concurrent edits can create duplicate XREFs
Diffstat (limited to 'app/Factories')
| -rw-r--r-- | app/Factories/XrefFactory.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/Factories/XrefFactory.php b/app/Factories/XrefFactory.php index ea627dc0db..639b51fb88 100644 --- a/app/Factories/XrefFactory.php +++ b/app/Factories/XrefFactory.php @@ -49,13 +49,12 @@ class XrefFactory implements XrefFactoryInterface protected function generate(string $prefix, string $suffix): string { // Lock the row, so that only one new XREF may be generated at a time. - DB::table('site_setting') + $num = (int) DB::table('site_setting') ->where('setting_name', '=', 'next_xref') ->lockForUpdate() - ->get(); + ->value('setting_value'); $increment = 1.0; - $num = (int) Site::getPreference('next_xref'); do { $num += (int) $increment; |
