MediaWiki master
TransactionIdentifier.php
Go to the documentation of this file.
1<?php
20namespace Wikimedia\Rdbms;
21
22use Stringable;
23
30class TransactionIdentifier implements Stringable {
32 private $id = '';
33
34 public function __construct() {
35 static $nextId;
36 $nextId = ( $nextId !== null ? $nextId++ : mt_rand() ) % 0xffff;
37 $this->id = sprintf( '%06x', mt_rand( 0, 0xffffff ) ) . sprintf( '%04x', $nextId );
38 }
39
40 public function __toString() {
41 return $this->id;
42 }
43}
Class used for token representing identifiers for atomic transactions from IDatabase instances.