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...
Create and track the database connections and transactions for a given database cluster.
const CONN_TRX_AUTOCOMMIT
DB handle should have DBO_TRX disabled and the caller will leave it as such.
const DB_PRIMARY
Definition: defines.php:28