MediaWiki master
TransactionIdentifier.php
Go to the documentation of this file.
1<?php
6namespace Wikimedia\Rdbms;
7
8use Stringable;
9
16class TransactionIdentifier implements Stringable {
18 private $id = '';
19
20 public function __construct() {
21 static $nextId;
22 $nextId = ( $nextId !== null ? $nextId++ : mt_rand() ) % 0xffff;
23 $this->id = sprintf( '%06x', mt_rand( 0, 0xffffff ) ) . sprintf( '%04x', $nextId );
24 }
25
26 public function __toString() {
27 return $this->id;
28 }
29}
Class used for token representing identifiers for atomic transactions from IDatabase instances.