コード例 #1
0
ファイル: DatabaseError.php プロジェクト: Tjorriemorrie/app
 /**
  * Construct a database error
  * @param $db DatabaseBase object which threw the error
  * @param $error String A simple error message to be used for debugging
  */
 function __construct(DatabaseBase &$db, $error)
 {
     global $wgDBcluster;
     $this->db = $db;
     parent::__construct($error);
     $isMaster = !is_null($db->getLBInfo('master'));
     // Wikia change - @author macbre - MAIN-2304
     \Wikia\Logger\WikiaLogger::instance()->error('DBError', ['name' => $db->getDBname(), 'cluster' => $wgDBcluster, 'server' => $db->getServer(), 'server_role' => $isMaster ? 'master' : 'slave', 'errno' => $db->lastErrno(), 'err' => $db->lastError(), 'exception' => $this]);
 }
コード例 #2
0
 /**
  * @param $params array
  */
 function __construct($params)
 {
     $this->db = $params['connection'];
     parent::__construct(array('servers' => array(array('type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1))));
 }
コード例 #3
0
 /**
  * @param array $params
  */
 public function __construct(array $params)
 {
     $this->db = $params['connection'];
     parent::__construct(['servers' => [['type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1]], 'trxProfiler' => $this->trxProfiler]);
     if (isset($params['readOnlyReason'])) {
         $this->db->setLBInfo('readOnlyReason', $params['readOnlyReason']);
     }
 }