MediaWiki  master
LocalSerialProvider.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
16  private $lb;
17 
25  public function __construct( $config, ILoadBalancer $lb ) {
26  parent::__construct( $config );
27  $this->lb = $lb;
28  }
29 
30  protected function getDB() {
31  return $this->lb->getConnectionRef(
32  DB_PRIMARY,
33  [],
34  false,
35  // So that startAtomic() will start a commit, reducing lock time.
36  // Without this flag, the transaction will be open until the start
37  // of request shutdown. This could be omitted to reduce the
38  // connection overhead, with numShards tuned upwards to compensate.
40  );
41  }
42 
43  protected function getTableName() {
44  return 'user_autocreate_serial';
45  }
46 }
Base class for serial acquisition code shared between core and CentralAuth.
A serial provider which allocates IDs from the local database, or from a shared database if $wgShared...
This class is a delegate to ILBFactory for a given database cluster.
const CONN_TRX_AUTOCOMMIT
Yield a tracked autocommit-mode handle (reuse existing ones)
const DB_PRIMARY
Definition: defines.php:28