MediaWiki  1.23.15
DatabaseMysqlBase.php
Go to the documentation of this file.
1 <?php
32 abstract class DatabaseMysqlBase extends DatabaseBase {
34  protected $lastKnownSlavePos;
35 
37  protected $mFakeSlaveLag = null;
38 
39  protected $mFakeMaster = false;
40 
44  function getType() {
45  return 'mysql';
46  }
47 
56  function open( $server, $user, $password, $dbName ) {
57  global $wgAllDBsAreLocalhost, $wgSQLMode;
58  wfProfileIn( __METHOD__ );
59 
60  # Debugging hack -- fake cluster
61  if ( $wgAllDBsAreLocalhost ) {
62  $realServer = 'localhost';
63  } else {
64  $realServer = $server;
65  }
66  $this->close();
67  $this->mServer = $server;
68  $this->mUser = $user;
69  $this->mPassword = $password;
70  $this->mDBname = $dbName;
71 
72  wfProfileIn( "dbconnect-$server" );
73 
74  # The kernel's default SYN retransmission period is far too slow for us,
75  # so we use a short timeout plus a manual retry. Retrying means that a small
76  # but finite rate of SYN packet loss won't cause user-visible errors.
77  $this->mConn = false;
78  $this->installErrorHandler();
79  try {
80  $this->mConn = $this->mysqlConnect( $realServer );
81  } catch ( Exception $ex ) {
82  wfProfileOut( "dbconnect-$server" );
83  wfProfileOut( __METHOD__ );
84  $this->restoreErrorHandler();
85  throw $ex;
86  }
87  $error = $this->restoreErrorHandler();
88 
89  wfProfileOut( "dbconnect-$server" );
90 
91  # Always log connection errors
92  if ( !$this->mConn ) {
93  if ( !$error ) {
94  $error = $this->lastError();
95  }
96  wfLogDBError( "Error connecting to {$this->mServer}: $error" );
97  wfDebug( "DB connection error\n" .
98  "Server: $server, User: $user, Password: " .
99  substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
100 
101  wfProfileOut( __METHOD__ );
102 
103  $this->reportConnectionError( $error );
104  }
105 
106  if ( $dbName != '' ) {
108  $success = $this->selectDB( $dbName );
110  if ( !$success ) {
111  wfLogDBError( "Error selecting database $dbName on server {$this->mServer}" );
112  wfDebug( "Error selecting database $dbName on server {$this->mServer} " .
113  "from client host " . wfHostname() . "\n" );
114 
115  wfProfileOut( __METHOD__ );
116 
117  $this->reportConnectionError( "Error selecting database $dbName" );
118  }
119  }
120 
121  // Tell the server what we're communicating with
122  if ( !$this->connectInitCharset() ) {
123  $this->reportConnectionError( "Error setting character set" );
124  }
125 
126  // Set SQL mode, default is turning them all off, can be overridden or skipped with null
127  if ( is_string( $wgSQLMode ) ) {
128  $mode = $this->addQuotes( $wgSQLMode );
129  // Use doQuery() to avoid opening implicit transactions (DBO_TRX)
130  $success = $this->doQuery( "SET sql_mode = $mode", __METHOD__ );
131  if ( !$success ) {
132  wfLogDBError( "Error setting sql_mode to $mode on server {$this->mServer}" );
133  wfProfileOut( __METHOD__ );
134  $this->reportConnectionError( "Error setting sql_mode to $mode" );
135  }
136  }
137 
138  $this->mOpened = true;
139  wfProfileOut( __METHOD__ );
140 
141  return true;
142  }
143 
148  protected function connectInitCharset() {
149  global $wgDBmysql5;
150 
151  if ( $wgDBmysql5 ) {
152  // Tell the server we're communicating with it in UTF-8.
153  // This may engage various charset conversions.
154  return $this->mysqlSetCharset( 'utf8' );
155  } else {
156  return $this->mysqlSetCharset( 'binary' );
157  }
158  }
159 
167  abstract protected function mysqlConnect( $realServer );
168 
175  abstract protected function mysqlSetCharset( $charset );
176 
181  function freeResult( $res ) {
182  if ( $res instanceof ResultWrapper ) {
183  $res = $res->result;
184  }
186  $ok = $this->mysqlFreeResult( $res );
188  if ( !$ok ) {
189  throw new DBUnexpectedError( $this, "Unable to free MySQL result" );
190  }
191  }
192 
199  abstract protected function mysqlFreeResult( $res );
200 
206  function fetchObject( $res ) {
207  if ( $res instanceof ResultWrapper ) {
208  $res = $res->result;
209  }
211  $row = $this->mysqlFetchObject( $res );
213 
214  $errno = $this->lastErrno();
215  // Unfortunately, mysql_fetch_object does not reset the last errno.
216  // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
217  // these are the only errors mysql_fetch_object can cause.
218  // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
219  if ( $errno == 2000 || $errno == 2013 ) {
220  throw new DBUnexpectedError(
221  $this,
222  'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() )
223  );
224  }
225 
226  return $row;
227  }
228 
235  abstract protected function mysqlFetchObject( $res );
236 
242  function fetchRow( $res ) {
243  if ( $res instanceof ResultWrapper ) {
244  $res = $res->result;
245  }
247  $row = $this->mysqlFetchArray( $res );
249 
250  $errno = $this->lastErrno();
251  // Unfortunately, mysql_fetch_array does not reset the last errno.
252  // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
253  // these are the only errors mysql_fetch_array can cause.
254  // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
255  if ( $errno == 2000 || $errno == 2013 ) {
256  throw new DBUnexpectedError(
257  $this,
258  'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() )
259  );
260  }
261 
262  return $row;
263  }
264 
271  abstract protected function mysqlFetchArray( $res );
272 
278  function numRows( $res ) {
279  if ( $res instanceof ResultWrapper ) {
280  $res = $res->result;
281  }
283  $n = $this->mysqlNumRows( $res );
285 
286  // Unfortunately, mysql_num_rows does not reset the last errno.
287  // We are not checking for any errors here, since
288  // these are no errors mysql_num_rows can cause.
289  // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
290  // See https://bugzilla.wikimedia.org/42430
291  return $n;
292  }
293 
300  abstract protected function mysqlNumRows( $res );
301 
306  function numFields( $res ) {
307  if ( $res instanceof ResultWrapper ) {
308  $res = $res->result;
309  }
310 
311  return $this->mysqlNumFields( $res );
312  }
313 
320  abstract protected function mysqlNumFields( $res );
321 
327  function fieldName( $res, $n ) {
328  if ( $res instanceof ResultWrapper ) {
329  $res = $res->result;
330  }
331 
332  return $this->mysqlFieldName( $res, $n );
333  }
334 
342  abstract protected function mysqlFieldName( $res, $n );
343 
350  public function fieldType( $res, $n ) {
351  if ( $res instanceof ResultWrapper ) {
352  $res = $res->result;
353  }
354 
355  return $this->mysqlFieldType( $res, $n );
356  }
357 
365  abstract protected function mysqlFieldType( $res, $n );
366 
372  function dataSeek( $res, $row ) {
373  if ( $res instanceof ResultWrapper ) {
374  $res = $res->result;
375  }
376 
377  return $this->mysqlDataSeek( $res, $row );
378  }
379 
387  abstract protected function mysqlDataSeek( $res, $row );
388 
392  function lastError() {
393  if ( $this->mConn ) {
394  # Even if it's non-zero, it can still be invalid
396  $error = $this->mysqlError( $this->mConn );
397  if ( !$error ) {
398  $error = $this->mysqlError();
399  }
401  } else {
402  $error = $this->mysqlError();
403  }
404  if ( $error ) {
405  $error .= ' (' . $this->mServer . ')';
406  }
407 
408  return $error;
409  }
410 
417  abstract protected function mysqlError( $conn = null );
418 
426  function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
427  return $this->nativeReplace( $table, $rows, $fname );
428  }
429 
442  public function estimateRowCount( $table, $vars = '*', $conds = '',
443  $fname = __METHOD__, $options = array()
444  ) {
445  $options['EXPLAIN'] = true;
446  $res = $this->select( $table, $vars, $conds, $fname, $options );
447  if ( $res === false ) {
448  return false;
449  }
450  if ( !$this->numRows( $res ) ) {
451  return 0;
452  }
453 
454  $rows = 1;
455  foreach ( $res as $plan ) {
456  $rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero
457  }
458 
459  return $rows;
460  }
461 
467  function fieldInfo( $table, $field ) {
468  $table = $this->tableName( $table );
469  $res = $this->query( "SELECT * FROM $table LIMIT 1", __METHOD__, true );
470  if ( !$res ) {
471  return false;
472  }
473  $n = $this->mysqlNumFields( $res->result );
474  for ( $i = 0; $i < $n; $i++ ) {
475  $meta = $this->mysqlFetchField( $res->result, $i );
476  if ( $field == $meta->name ) {
477  return new MySQLField( $meta );
478  }
479  }
480 
481  return false;
482  }
483 
491  abstract protected function mysqlFetchField( $res, $n );
492 
502  function indexInfo( $table, $index, $fname = __METHOD__ ) {
503  # SHOW INDEX works in MySQL 3.23.58, but SHOW INDEXES does not.
504  # SHOW INDEX should work for 3.x and up:
505  # http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html
506  $table = $this->tableName( $table );
507  $index = $this->indexName( $index );
508 
509  $sql = 'SHOW INDEX FROM ' . $table;
510  $res = $this->query( $sql, $fname );
511 
512  if ( !$res ) {
513  return null;
514  }
515 
516  $result = array();
517 
518  foreach ( $res as $row ) {
519  if ( $row->Key_name == $index ) {
520  $result[] = $row;
521  }
522  }
523 
524  return empty( $result ) ? false : $result;
525  }
526 
531  function strencode( $s ) {
532  $sQuoted = $this->mysqlRealEscapeString( $s );
533 
534  if ( $sQuoted === false ) {
535  $this->ping();
536  $sQuoted = $this->mysqlRealEscapeString( $s );
537  }
538 
539  return $sQuoted;
540  }
541 
548  public function addIdentifierQuotes( $s ) {
549  // Characters in the range \u0001-\uFFFF are valid in a quoted identifier
550  // Remove NUL bytes and escape backticks by doubling
551  return '`' . str_replace( array( "\0", '`' ), array( '', '``' ), $s ) . '`';
552  }
553 
558  public function isQuotedIdentifier( $name ) {
559  return strlen( $name ) && $name[0] == '`' && substr( $name, -1, 1 ) == '`';
560  }
561 
565  function ping() {
566  $ping = $this->mysqlPing();
567  if ( $ping ) {
568  return true;
569  }
570 
571  $this->closeConnection();
572  $this->mOpened = false;
573  $this->mConn = false;
574  $this->open( $this->mServer, $this->mUser, $this->mPassword, $this->mDBname );
575 
576  return true;
577  }
578 
584  abstract protected function mysqlPing();
585 
591  public function setFakeSlaveLag( $lag ) {
592  $this->mFakeSlaveLag = $lag;
593  }
594 
600  public function setFakeMaster( $enabled = true ) {
601  $this->mFakeMaster = $enabled;
602  }
603 
611  function getLag() {
612  if ( !is_null( $this->mFakeSlaveLag ) ) {
613  wfDebug( "getLag: fake slave lagged {$this->mFakeSlaveLag} seconds\n" );
614 
615  return $this->mFakeSlaveLag;
616  }
617 
618  return $this->getLagFromSlaveStatus();
619  }
620 
624  function getLagFromSlaveStatus() {
625  $res = $this->query( 'SHOW SLAVE STATUS', __METHOD__ );
626  if ( !$res ) {
627  return false;
628  }
629  $row = $res->fetchObject();
630  if ( !$row ) {
631  return false;
632  }
633  if ( strval( $row->Seconds_Behind_Master ) === '' ) {
634  return false;
635  } else {
636  return intval( $row->Seconds_Behind_Master );
637  }
638  }
639 
645  function getLagFromProcesslist() {
646  wfDeprecated( __METHOD__, '1.19' );
647  $res = $this->query( 'SHOW PROCESSLIST', __METHOD__ );
648  if ( !$res ) {
649  return false;
650  }
651  # Find slave SQL thread
652  foreach ( $res as $row ) {
653  /* This should work for most situations - when default db
654  * for thread is not specified, it had no events executed,
655  * and therefore it doesn't know yet how lagged it is.
656  *
657  * Relay log I/O thread does not select databases.
658  */
659  if ( $row->User == 'system user' &&
660  $row->State != 'Waiting for master to send event' &&
661  $row->State != 'Connecting to master' &&
662  $row->State != 'Queueing master event to the relay log' &&
663  $row->State != 'Waiting for master update' &&
664  $row->State != 'Requesting binlog dump' &&
665  $row->State != 'Waiting to reconnect after a failed master event read' &&
666  $row->State != 'Reconnecting after a failed master event read' &&
667  $row->State != 'Registering slave on master'
668  ) {
669  # This is it, return the time (except -ve)
670  if ( $row->Time > 0x7fffffff ) {
671  return false;
672  } else {
673  return $row->Time;
674  }
675  }
676  }
677 
678  return false;
679  }
680 
691  function masterPosWait( DBMasterPos $pos, $timeout ) {
692  if ( $this->lastKnownSlavePos && $this->lastKnownSlavePos->hasReached( $pos ) ) {
693  return '0'; // http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html
694  }
695 
696  wfProfileIn( __METHOD__ );
697  # Commit any open transactions
698  $this->commit( __METHOD__, 'flush' );
699 
700  if ( !is_null( $this->mFakeSlaveLag ) ) {
701  $wait = intval( ( $pos->pos - microtime( true ) + $this->mFakeSlaveLag ) * 1e6 );
702 
703  if ( $wait > $timeout * 1e6 ) {
704  wfDebug( "Fake slave timed out waiting for $pos ($wait us)\n" );
705  wfProfileOut( __METHOD__ );
706 
707  return -1;
708  } elseif ( $wait > 0 ) {
709  wfDebug( "Fake slave waiting $wait us\n" );
710  usleep( $wait );
711  wfProfileOut( __METHOD__ );
712 
713  return 1;
714  } else {
715  wfDebug( "Fake slave up to date ($wait us)\n" );
716  wfProfileOut( __METHOD__ );
717 
718  return 0;
719  }
720  }
721 
722  # Call doQuery() directly, to avoid opening a transaction if DBO_TRX is set
723  $encFile = $this->addQuotes( $pos->file );
724  $encPos = intval( $pos->pos );
725  $sql = "SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)";
726  $res = $this->doQuery( $sql );
727 
728  $status = false;
729  if ( $res && $row = $this->fetchRow( $res ) ) {
730  $status = $row[0]; // can be NULL, -1, or 0+ per the MySQL manual
731  if ( ctype_digit( $status ) ) { // success
732  $this->lastKnownSlavePos = $pos;
733  }
734  }
735 
736  wfProfileOut( __METHOD__ );
737 
738  return $status;
739  }
740 
746  function getSlavePos() {
747  if ( !is_null( $this->mFakeSlaveLag ) ) {
748  $pos = new MySQLMasterPos( 'fake', microtime( true ) - $this->mFakeSlaveLag );
749  wfDebug( __METHOD__ . ": fake slave pos = $pos\n" );
750 
751  return $pos;
752  }
753 
754  $res = $this->query( 'SHOW SLAVE STATUS', 'DatabaseBase::getSlavePos' );
755  $row = $this->fetchObject( $res );
756 
757  if ( $row ) {
758  $pos = isset( $row->Exec_master_log_pos )
759  ? $row->Exec_master_log_pos
760  : $row->Exec_Master_Log_Pos;
761 
762  return new MySQLMasterPos( $row->Relay_Master_Log_File, $pos );
763  } else {
764  return false;
765  }
766  }
767 
773  function getMasterPos() {
774  if ( $this->mFakeMaster ) {
775  return new MySQLMasterPos( 'fake', microtime( true ) );
776  }
777 
778  $res = $this->query( 'SHOW MASTER STATUS', 'DatabaseBase::getMasterPos' );
779  $row = $this->fetchObject( $res );
780 
781  if ( $row ) {
782  return new MySQLMasterPos( $row->File, $row->Position );
783  } else {
784  return false;
785  }
786  }
787 
792  function useIndexClause( $index ) {
793  return "FORCE INDEX (" . $this->indexName( $index ) . ")";
794  }
795 
799  function lowPriorityOption() {
800  return 'LOW_PRIORITY';
801  }
802 
806  public function getSoftwareLink() {
807  // MariaDB includes its name in its version string (sent when the connection is opened),
808  // and this is how MariaDB's version of the mysql command-line client identifies MariaDB
809  // servers (see the mariadb_connection() function in libmysql/libmysql.c).
810  $version = $this->getServerVersion();
811  if ( strpos( $version, 'MariaDB' ) !== false || strpos( $version, '-maria-' ) !== false ) {
812  return '[{{int:version-db-mariadb-url}} MariaDB]';
813  }
814 
815  // Percona Server's version suffix is not very distinctive, and @@version_comment
816  // doesn't give the necessary info for source builds, so assume the server is MySQL.
817  // (Even Percona's version of mysql doesn't try to make the distinction.)
818  return '[{{int:version-db-mysql-url}} MySQL]';
819  }
820 
824  public function setSessionOptions( array $options ) {
825  if ( isset( $options['connTimeout'] ) ) {
826  $timeout = (int)$options['connTimeout'];
827  $this->query( "SET net_read_timeout=$timeout" );
828  $this->query( "SET net_write_timeout=$timeout" );
829  }
830  }
831 
837  public function streamStatementEnd( &$sql, &$newLine ) {
838  if ( strtoupper( substr( $newLine, 0, 9 ) ) == 'DELIMITER' ) {
839  preg_match( '/^DELIMITER\s+(\S+)/', $newLine, $m );
840  $this->delimiter = $m[1];
841  $newLine = '';
842  }
843 
844  return parent::streamStatementEnd( $sql, $newLine );
845  }
846 
855  public function lockIsFree( $lockName, $method ) {
856  $lockName = $this->addQuotes( $lockName );
857  $result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method );
858  $row = $this->fetchObject( $result );
859 
860  return ( $row->lockstatus == 1 );
861  }
862 
869  public function lock( $lockName, $method, $timeout = 5 ) {
870  $lockName = $this->addQuotes( $lockName );
871  $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method );
872  $row = $this->fetchObject( $result );
873 
874  if ( $row->lockstatus == 1 ) {
875  return true;
876  } else {
877  wfDebug( __METHOD__ . " failed to acquire lock\n" );
878 
879  return false;
880  }
881  }
882 
890  public function unlock( $lockName, $method ) {
891  $lockName = $this->addQuotes( $lockName );
892  $result = $this->query( "SELECT RELEASE_LOCK($lockName) as lockstatus", $method );
893  $row = $this->fetchObject( $result );
894 
895  return ( $row->lockstatus == 1 );
896  }
897 
905  public function lockTables( $read, $write, $method, $lowPriority = true ) {
906  $items = array();
907 
908  foreach ( $write as $table ) {
909  $tbl = $this->tableName( $table ) .
910  ( $lowPriority ? ' LOW_PRIORITY' : '' ) .
911  ' WRITE';
912  $items[] = $tbl;
913  }
914  foreach ( $read as $table ) {
915  $items[] = $this->tableName( $table ) . ' READ';
916  }
917  $sql = "LOCK TABLES " . implode( ',', $items );
918  $this->query( $sql, $method );
919 
920  return true;
921  }
922 
927  public function unlockTables( $method ) {
928  $this->query( "UNLOCK TABLES", $method );
929 
930  return true;
931  }
932 
939  public function getSearchEngine() {
940  return 'SearchMySQL';
941  }
942 
947  public function setBigSelects( $value = true ) {
948  if ( $value === 'default' ) {
949  if ( $this->mDefaultBigSelects === null ) {
950  # Function hasn't been called before so it must already be set to the default
951  return;
952  } else {
954  }
955  } elseif ( $this->mDefaultBigSelects === null ) {
956  $this->mDefaultBigSelects = (bool)$this->selectField( false, '@@sql_big_selects' );
957  }
958  $encValue = $value ? '1' : '0';
959  $this->query( "SET sql_big_selects=$encValue", __METHOD__ );
960  }
961 
973  function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) {
974  if ( !$conds ) {
975  throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' );
976  }
977 
978  $delTable = $this->tableName( $delTable );
979  $joinTable = $this->tableName( $joinTable );
980  $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar ";
981 
982  if ( $conds != '*' ) {
983  $sql .= ' AND ' . $this->makeList( $conds, LIST_AND );
984  }
985 
986  return $this->query( $sql, $fname );
987  }
988 
997  public function upsert( $table, array $rows, array $uniqueIndexes,
998  array $set, $fname = __METHOD__
999  ) {
1000  if ( !count( $rows ) ) {
1001  return true; // nothing to do
1002  }
1003 
1004  if ( !is_array( reset( $rows ) ) ) {
1005  $rows = array( $rows );
1006  }
1007 
1008  $table = $this->tableName( $table );
1009  $columns = array_keys( $rows[0] );
1010 
1011  $sql = "INSERT INTO $table (" . implode( ',', $columns ) . ') VALUES ';
1012  $rowTuples = array();
1013  foreach ( $rows as $row ) {
1014  $rowTuples[] = '(' . $this->makeList( $row ) . ')';
1015  }
1016  $sql .= implode( ',', $rowTuples );
1017  $sql .= " ON DUPLICATE KEY UPDATE " . $this->makeList( $set, LIST_SET );
1018 
1019  return (bool)$this->query( $sql, $fname );
1020  }
1021 
1027  function getServerUptime() {
1028  $vars = $this->getMysqlStatus( 'Uptime' );
1029 
1030  return (int)$vars['Uptime'];
1031  }
1032 
1038  function wasDeadlock() {
1039  return $this->lastErrno() == 1213;
1040  }
1041 
1047  function wasLockTimeout() {
1048  return $this->lastErrno() == 1205;
1049  }
1050 
1057  function wasErrorReissuable() {
1058  return $this->lastErrno() == 2013 || $this->lastErrno() == 2006;
1059  }
1060 
1066  function wasReadOnlyError() {
1067  return $this->lastErrno() == 1223 ||
1068  ( $this->lastErrno() == 1290 && strpos( $this->lastError(), '--read-only' ) !== false );
1069  }
1070 
1078  function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = __METHOD__ ) {
1079  $tmp = $temporary ? 'TEMPORARY ' : '';
1080  $newName = $this->addIdentifierQuotes( $newName );
1081  $oldName = $this->addIdentifierQuotes( $oldName );
1082  $query = "CREATE $tmp TABLE $newName (LIKE $oldName)";
1083 
1084  return $this->query( $query, $fname );
1085  }
1086 
1094  function listTables( $prefix = null, $fname = __METHOD__ ) {
1095  $result = $this->query( "SHOW TABLES", $fname );
1096 
1097  $endArray = array();
1098 
1099  foreach ( $result as $table ) {
1100  $vars = get_object_vars( $table );
1101  $table = array_pop( $vars );
1102 
1103  if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
1104  $endArray[] = $table;
1105  }
1106  }
1107 
1108  return $endArray;
1109  }
1110 
1116  public function dropTable( $tableName, $fName = __METHOD__ ) {
1117  if ( !$this->tableExists( $tableName, $fName ) ) {
1118  return false;
1119  }
1120 
1121  return $this->query( "DROP TABLE IF EXISTS " . $this->tableName( $tableName ), $fName );
1122  }
1123 
1127  protected function getDefaultSchemaVars() {
1128  $vars = parent::getDefaultSchemaVars();
1129  $vars['wgDBTableOptions'] = str_replace( 'TYPE', 'ENGINE', $GLOBALS['wgDBTableOptions'] );
1130  $vars['wgDBTableOptions'] = str_replace(
1131  'CHARSET=mysql4',
1132  'CHARSET=binary',
1133  $vars['wgDBTableOptions']
1134  );
1135 
1136  return $vars;
1137  }
1138 
1145  function getMysqlStatus( $which = "%" ) {
1146  $res = $this->query( "SHOW STATUS LIKE '{$which}'" );
1147  $status = array();
1148 
1149  foreach ( $res as $row ) {
1150  $status[$row->Variable_name] = $row->Value;
1151  }
1152 
1153  return $status;
1154  }
1155 
1165  public function listViews( $prefix = null, $fname = __METHOD__ ) {
1166 
1167  if ( !isset( $this->allViews ) ) {
1168 
1169  // The name of the column containing the name of the VIEW
1170  $propertyName = 'Tables_in_' . $this->mDBname;
1171 
1172  // Query for the VIEWS
1173  $result = $this->query( 'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' );
1174  $this->allViews = array();
1175  while ( ( $row = $this->fetchRow( $result ) ) !== false ) {
1176  array_push( $this->allViews, $row[$propertyName] );
1177  }
1178  }
1179 
1180  if ( is_null( $prefix ) || $prefix === '' ) {
1181  return $this->allViews;
1182  }
1183 
1184  $filteredViews = array();
1185  foreach ( $this->allViews as $viewName ) {
1186  // Does the name of this VIEW start with the table-prefix?
1187  if ( strpos( $viewName, $prefix ) === 0 ) {
1188  array_push( $filteredViews, $viewName );
1189  }
1190  }
1191 
1192  return $filteredViews;
1193  }
1194 
1203  public function isView( $name, $prefix = null ) {
1204  return in_array( $name, $this->listViews( $prefix ) );
1205  }
1206 }
1207 
1212 class MySQLField implements Field {
1215 
1216  function __construct( $info ) {
1217  $this->name = $info->name;
1218  $this->tablename = $info->table;
1219  $this->default = $info->def;
1220  $this->max_length = $info->max_length;
1221  $this->nullable = !$info->not_null;
1222  $this->is_pk = $info->primary_key;
1223  $this->is_unique = $info->unique_key;
1224  $this->is_multiple = $info->multiple_key;
1225  $this->is_key = ( $this->is_pk || $this->is_unique || $this->is_multiple );
1226  $this->type = $info->type;
1227  $this->binary = isset( $info->binary ) ? $info->binary : false;
1228  }
1229 
1233  function name() {
1234  return $this->name;
1235  }
1236 
1240  function tableName() {
1241  return $this->tableName;
1242  }
1243 
1247  function type() {
1248  return $this->type;
1249  }
1250 
1254  function isNullable() {
1255  return $this->nullable;
1256  }
1257 
1258  function defaultValue() {
1259  return $this->default;
1260  }
1261 
1265  function isKey() {
1266  return $this->is_key;
1267  }
1268 
1272  function isMultipleKey() {
1273  return $this->is_multiple;
1274  }
1275 
1276  function isBinary() {
1277  return $this->binary;
1278  }
1281 class MySQLMasterPos implements DBMasterPos {
1283  public $file;
1286  public $pos;
1287 
1288  function __construct( $file, $pos ) {
1289  $this->file = $file;
1290  $this->pos = $pos;
1291  }
1292 
1293  function __toString() {
1294  // e.g db1034-bin.000976/843431247
1295  return "{$this->file}/{$this->pos}";
1296  }
1301  protected function getCoordinates() {
1302  $m = array();
1303  if ( preg_match( '!\.(\d+)/(\d+)$!', (string)$this, $m ) ) {
1304  return array( (int)$m[1], (int)$m[2] );
1305  }
1307  return false;
1308  }
1309 
1310  function hasReached( MySQLMasterPos $pos ) {
1311  $thisPos = $this->getCoordinates();
1312  $thatPos = $pos->getCoordinates();
1313 
1314  return ( $thisPos && $thatPos && $thisPos >= $thatPos );
1315  }
1316 }
DatabaseMysqlBase\masterPosWait
masterPosWait(DBMasterPos $pos, $timeout)
Wait for the slave to catch up to a given master position.
Definition: DatabaseMysqlBase.php:689
DatabaseBase\tableName
tableName( $name, $format='quoted')
Format a table name ready for use in constructing an SQL query.
Definition: Database.php:2197
DatabaseMysqlBase
Database abstraction object for MySQL.
Definition: DatabaseMysqlBase.php:32
DatabaseMysqlBase\streamStatementEnd
streamStatementEnd(&$sql, &$newLine)
Definition: DatabaseMysqlBase.php:835
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
DatabaseBase\reportConnectionError
reportConnectionError( $error='Unknown error')
Definition: Database.php:949
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
DatabaseMysqlBase\fieldName
fieldName( $res, $n)
Definition: DatabaseMysqlBase.php:325
DatabaseMysqlBase\listViews
listViews( $prefix=null, $fname=__METHOD__)
Lists VIEWs in the database.
Definition: DatabaseMysqlBase.php:1163
DatabaseMysqlBase\getMasterPos
getMasterPos()
Get the position of the master from SHOW MASTER STATUS.
Definition: DatabaseMysqlBase.php:771
DatabaseMysqlBase\listTables
listTables( $prefix=null, $fname=__METHOD__)
List all tables on the database.
Definition: DatabaseMysqlBase.php:1092
DatabaseMysqlBase\lowPriorityOption
lowPriorityOption()
Definition: DatabaseMysqlBase.php:797
MySQLField\isNullable
isNullable()
Definition: DatabaseMysqlBase.php:1252
Field
Base for all database-specific classes representing information about database fields.
Definition: DatabaseUtility.php:69
DatabaseMysqlBase\getSoftwareLink
getSoftwareLink()
Definition: DatabaseMysqlBase.php:804
DatabaseBase\$mDefaultBigSelects
$mDefaultBigSelects
Definition: Database.php:251
DatabaseMysqlBase\mysqlNumFields
mysqlNumFields( $res)
Get number of fields in result.
DatabaseMysqlBase\mysqlFetchArray
mysqlFetchArray( $res)
Fetch a result row as an associative and numeric array.
MySQLField\$is_multiple
$is_multiple
Definition: DatabaseMysqlBase.php:1211
DatabaseBase\makeList
makeList( $a, $mode=LIST_COMMA)
Makes an encoded list of strings from an array.
Definition: Database.php:1992
DatabaseMysqlBase\duplicateTableStructure
duplicateTableStructure( $oldName, $newName, $temporary=false, $fname=__METHOD__)
Definition: DatabaseMysqlBase.php:1076
DatabaseBase\close
close()
Closes a database connection.
Definition: Database.php:914
DatabaseBase\query
query( $sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
Definition: Database.php:1001
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
$n
$n
Definition: RandomTest.php:76
DatabaseBase\$allViews
string[] $allViews
Definition: Database.php:309
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
DatabaseMysqlBase\mysqlFreeResult
mysqlFreeResult( $res)
Free result memory.
DatabaseMysqlBase\numFields
numFields( $res)
Definition: DatabaseMysqlBase.php:304
DatabaseMysqlBase\mysqlConnect
mysqlConnect( $realServer)
Open a connection to a MySQL server.
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:35
DatabaseType\getServerVersion
getServerVersion()
A string describing the current software version, like from mysql_get_server_info().
wfHostname
wfHostname()
Fetch server name for use in error reporting etc.
Definition: GlobalFunctions.php:1833
DatabaseMysqlBase\estimateRowCount
estimateRowCount( $table, $vars=' *', $conds='', $fname=__METHOD__, $options=array())
Estimate rows in dataset Returns estimated count, based on EXPLAIN output Takes same arguments as Dat...
Definition: DatabaseMysqlBase.php:440
DatabaseMysqlBase\mysqlFetchField
mysqlFetchField( $res, $n)
Get column information from a result.
$s
$s
Definition: mergeMessageFileList.php:156
DatabaseMysqlBase\useIndexClause
useIndexClause( $index)
Definition: DatabaseMysqlBase.php:790
DatabaseMysqlBase\setSessionOptions
setSessionOptions(array $options)
Definition: DatabaseMysqlBase.php:822
DBMasterPos
An object representing a master or slave position in a replicated setup.
Definition: DatabaseUtility.php:323
DatabaseMysqlBase\isQuotedIdentifier
isQuotedIdentifier( $name)
Definition: DatabaseMysqlBase.php:556
DatabaseMysqlBase\wasLockTimeout
wasLockTimeout()
Determines if the last failure was due to a lock timeout.
Definition: DatabaseMysqlBase.php:1045
MySQLMasterPos\hasReached
hasReached(MySQLMasterPos $pos)
Definition: DatabaseMysqlBase.php:1306
LIST_AND
const LIST_AND
Definition: Defines.php:203
MySQLField\$is_pk
$is_pk
Definition: DatabaseMysqlBase.php:1211
DatabaseBase\doQuery
doQuery( $sql)
The DBMS-dependent part of query()
DatabaseBase\tableExists
tableExists( $table, $fname=__METHOD__)
Query whether a given table exists.
Definition: Database.php:1790
DatabaseMysqlBase\replace
replace( $table, $uniqueIndexes, $rows, $fname=__METHOD__)
Definition: DatabaseMysqlBase.php:424
DatabaseMysqlBase\getMysqlStatus
getMysqlStatus( $which="%")
Get status information from SHOW STATUS in an associative array.
Definition: DatabaseMysqlBase.php:1143
DatabaseMysqlBase\indexInfo
indexInfo( $table, $index, $fname=__METHOD__)
Get information about an index into an object Returns false if the index does not exist.
Definition: DatabaseMysqlBase.php:500
DatabaseMysqlBase\getDefaultSchemaVars
getDefaultSchemaVars()
Definition: DatabaseMysqlBase.php:1125
DatabaseMysqlBase\mysqlSetCharset
mysqlSetCharset( $charset)
Set the character set of the MySQL link.
DatabaseMysqlBase\mysqlPing
mysqlPing()
Ping a server connection or reconnect if there is no connection.
file
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition: hooks.txt:93
DatabaseBase\indexName
indexName( $index)
Get the name of an index in a given table.
Definition: Database.php:2456
DatabaseMysqlBase\fieldInfo
fieldInfo( $table, $field)
Definition: DatabaseMysqlBase.php:465
DatabaseBase\addQuotes
addQuotes( $s)
Adds quotes and backslashes.
Definition: Database.php:2477
MySQLField\isBinary
isBinary()
Definition: DatabaseMysqlBase.php:1274
$success
$success
Definition: Utf8Test.php:91
DatabaseBase\selectField
selectField( $table, $var, $cond='', $fname=__METHOD__, $options=array())
A SELECT wrapper which returns a single field from a single result row.
Definition: Database.php:1281
DatabaseMysqlBase\getSlavePos
getSlavePos()
Get the position of the master from SHOW SLAVE STATUS.
Definition: DatabaseMysqlBase.php:744
DatabaseBase\$mDBname
$mDBname
Definition: Database.php:237
DatabaseMysqlBase\connectInitCharset
connectInitCharset()
Set the character set information right after connection.
Definition: DatabaseMysqlBase.php:146
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
DatabaseMysqlBase\mysqlNumRows
mysqlNumRows( $res)
Get number of rows in result.
DatabaseBase\select
select( $table, $vars, $conds='', $fname=__METHOD__, $options=array(), $join_conds=array())
Execute a SELECT query constructed using the various parameters provided.
Definition: Database.php:1575
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
MySQLField\$nullable
$nullable
Definition: DatabaseMysqlBase.php:1211
MySQLField\type
type()
Definition: DatabaseMysqlBase.php:1245
DatabaseMysqlBase\freeResult
freeResult( $res)
Definition: DatabaseMysqlBase.php:179
MySQLMasterPos\$pos
int $pos
timestamp *
Definition: DatabaseMysqlBase.php:1282
DatabaseBase\restoreErrorHandler
restoreErrorHandler()
Definition: Database.php:884
MySQLField\isMultipleKey
isMultipleKey()
Definition: DatabaseMysqlBase.php:1270
DatabaseMysqlBase\getLagFromProcesslist
getLagFromProcesslist()
Definition: DatabaseMysqlBase.php:643
DatabaseMysqlBase\lastError
lastError()
Definition: DatabaseMysqlBase.php:390
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
LIST_SET
const LIST_SET
Definition: Defines.php:204
MySQLField\$tablename
$tablename
Definition: DatabaseMysqlBase.php:1211
DatabaseMysqlBase\mysqlFetchObject
mysqlFetchObject( $res)
Fetch a result row as an object.
DatabaseBase\nativeReplace
nativeReplace( $table, $rows, $fname)
REPLACE query wrapper for MySQL and SQLite, which have a native REPLACE statement.
Definition: Database.php:2687
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
DatabaseMysqlBase\$mFakeMaster
$mFakeMaster
Definition: DatabaseMysqlBase.php:37
MySQLField
Utility class.
Definition: DatabaseMysqlBase.php:1210
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
$columns
if(! $in) $columns
Definition: Utf8Test.php:50
DatabaseBase\selectDB
selectDB( $db)
Change the current database.
Definition: Database.php:2157
DBUnexpectedError
Definition: DatabaseError.php:438
DatabaseMysqlBase\addIdentifierQuotes
addIdentifierQuotes( $s)
MySQL uses backticks for identifier quoting instead of the sql standard "double quotes".
Definition: DatabaseMysqlBase.php:546
MySQLField\$is_unique
$is_unique
Definition: DatabaseMysqlBase.php:1211
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:188
DatabaseMysqlBase\unlock
unlock( $lockName, $method)
FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release...
Definition: DatabaseMysqlBase.php:888
DatabaseMysqlBase\$lastKnownSlavePos
MysqlMasterPos $lastKnownSlavePos
Definition: DatabaseMysqlBase.php:33
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
DatabaseMysqlBase\setBigSelects
setBigSelects( $value=true)
Definition: DatabaseMysqlBase.php:945
$ok
$ok
Definition: UtfNormalTest.php:71
MySQLMasterPos\$file
string $file
Definition: DatabaseMysqlBase.php:1280
DatabaseMysqlBase\getType
getType()
Definition: DatabaseMysqlBase.php:42
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:980
DatabaseMysqlBase\lock
lock( $lockName, $method, $timeout=5)
Definition: DatabaseMysqlBase.php:867
DatabaseMysqlBase\dataSeek
dataSeek( $res, $row)
Definition: DatabaseMysqlBase.php:370
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
DatabaseMysqlBase\deleteJoin
deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__)
DELETE where the condition is a join.
Definition: DatabaseMysqlBase.php:971
$value
$value
Definition: styleTest.css.php:45
wfLogDBError
wfLogDBError( $text)
Log for database errors.
Definition: GlobalFunctions.php:1134
DatabaseMysqlBase\getSearchEngine
getSearchEngine()
Get search engine class.
Definition: DatabaseMysqlBase.php:937
DatabaseBase
Database abstraction object.
Definition: Database.php:219
DatabaseMysqlBase\strencode
strencode( $s)
Definition: DatabaseMysqlBase.php:529
MySQLField\$default
$default
Definition: DatabaseMysqlBase.php:1211
MySQLField\$name
$name
Definition: DatabaseMysqlBase.php:1211
$version
$version
Definition: parserTests.php:86
MySQLField\$type
$type
Definition: DatabaseMysqlBase.php:1211
DatabaseMysqlBase\mysqlDataSeek
mysqlDataSeek( $res, $row)
Move internal result pointer.
DatabaseMysqlBase\getLagFromSlaveStatus
getLagFromSlaveStatus()
Definition: DatabaseMysqlBase.php:622
DatabaseMysqlBase\fetchRow
fetchRow( $res)
Definition: DatabaseMysqlBase.php:240
DatabaseMysqlBase\upsert
upsert( $table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__)
Definition: DatabaseMysqlBase.php:995
DatabaseMysqlBase\numRows
numRows( $res)
Definition: DatabaseMysqlBase.php:276
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
DatabaseMysqlBase\fetchObject
fetchObject( $res)
Definition: DatabaseMysqlBase.php:204
DatabaseBase\commit
commit( $fname=__METHOD__, $flush='')
Commits a transaction previously started using begin().
Definition: Database.php:3435
$password
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method & $password
Definition: hooks.txt:2708
DatabaseBase\installErrorHandler
installErrorHandler()
Definition: Database.php:875
DatabaseMysqlBase\wasReadOnlyError
wasReadOnlyError()
Determines if the last failure was due to the database being read-only.
Definition: DatabaseMysqlBase.php:1064
DatabaseType\lastErrno
lastErrno()
Get the last error number.
DatabaseMysqlBase\wasDeadlock
wasDeadlock()
Determines if the last failure was due to a deadlock.
Definition: DatabaseMysqlBase.php:1036
DatabaseMysqlBase\mysqlError
mysqlError( $conn=null)
Returns the text of the error message from previous MySQL operation.
DatabaseMysqlBase\setFakeSlaveLag
setFakeSlaveLag( $lag)
Set lag time in seconds for a fake slave.
Definition: DatabaseMysqlBase.php:589
DatabaseMysqlBase\getLag
getLag()
Returns slave lag.
Definition: DatabaseMysqlBase.php:609
DatabaseMysqlBase\mysqlFieldName
mysqlFieldName( $res, $n)
Get the name of the specified field in a result.
MySQLField\$max_length
$max_length
Definition: DatabaseMysqlBase.php:1211
DatabaseMysqlBase\open
open( $server, $user, $password, $dbName)
Definition: DatabaseMysqlBase.php:54
DatabaseMysqlBase\fieldType
fieldType( $res, $n)
mysql_field_type() wrapper
Definition: DatabaseMysqlBase.php:348
DatabaseMysqlBase\unlockTables
unlockTables( $method)
Definition: DatabaseMysqlBase.php:925
MySQLMasterPos\__construct
__construct( $file, $pos)
Definition: DatabaseMysqlBase.php:1284
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
DatabaseMysqlBase\$mFakeSlaveLag
null int $mFakeSlaveLag
Definition: DatabaseMysqlBase.php:35
MySQLField\$binary
$binary
Definition: DatabaseMysqlBase.php:1211
DatabaseBase\closeConnection
closeConnection()
Closes underlying database connection.
$wait
$wait
Definition: styleTest.css.php:46
DatabaseMysqlBase\setFakeMaster
setFakeMaster( $enabled=true)
Make this connection a fake master.
Definition: DatabaseMysqlBase.php:598
MySQLField\defaultValue
defaultValue()
Definition: DatabaseMysqlBase.php:1256
MySQLMasterPos
Definition: DatabaseMysqlBase.php:1279
$vars
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:1684
DatabaseMysqlBase\dropTable
dropTable( $tableName, $fName=__METHOD__)
Definition: DatabaseMysqlBase.php:1114
$error
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Definition: hooks.txt:2584
MySQLField\$is_key
$is_key
Definition: DatabaseMysqlBase.php:1211
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
DatabaseMysqlBase\mysqlFieldType
mysqlFieldType( $res, $n)
Get the type of the specified field in a result.
MySQLField\tableName
tableName()
Definition: DatabaseMysqlBase.php:1238
MySQLMasterPos\__toString
__toString()
Definition: DatabaseMysqlBase.php:1289
$res
$res
Definition: database.txt:21
MySQLField\name
name()
Definition: DatabaseMysqlBase.php:1231
DatabaseMysqlBase\wasErrorReissuable
wasErrorReissuable()
Determines if the last query error was something that should be dealt with by pinging the connection ...
Definition: DatabaseMysqlBase.php:1055
DatabaseMysqlBase\isView
isView( $name, $prefix=null)
Differentiates between a TABLE and a VIEW.
Definition: DatabaseMysqlBase.php:1201
MySQLField\__construct
__construct( $info)
Definition: DatabaseMysqlBase.php:1214
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
MySQLMasterPos\getCoordinates
getCoordinates()
Definition: DatabaseMysqlBase.php:1297
ResultWrapper
Result wrapper for grabbing data queried by someone else.
Definition: DatabaseUtility.php:99
DatabaseMysqlBase\getServerUptime
getServerUptime()
Determines how long the server has been up.
Definition: DatabaseMysqlBase.php:1025
DatabaseMysqlBase\lockIsFree
lockIsFree( $lockName, $method)
Check to see if a named lock is available.
Definition: DatabaseMysqlBase.php:853
MySQLField\isKey
isKey()
Definition: DatabaseMysqlBase.php:1263
DatabaseMysqlBase\lockTables
lockTables( $read, $write, $method, $lowPriority=true)
Definition: DatabaseMysqlBase.php:903
DatabaseMysqlBase\ping
ping()
Definition: DatabaseMysqlBase.php:563