# Determine existing default character set
if ( $conn->tableExists( "revision", __METHOD__ ) ) {
- $revision = $conn->buildLike( $this->getVar( 'wgDBprefix' ) . 'revision' );
- $res = $conn->query( "SHOW TABLE STATUS $revision", __METHOD__ );
+ $revision = $this->escapeLikeInternal( $this->getVar( 'wgDBprefix' ) . 'revision', '\\' );
+ $res = $conn->query( "SHOW TABLE STATUS LIKE '$revision'", __METHOD__ );
$row = $conn->fetchObject( $res );
if ( !$row ) {
$this->parent->showMessage( 'config-show-table-status' );
$wgDBpassword = $this->getVar( '_InstallPassword' );
}
+ /**
+ * @param string $s
+ * @return string
+ */
+ protected function escapeLikeInternal( $s, $escapeChar = '`' ) {
+ return str_replace( [ $escapeChar, '%', '_' ],
+ [ "{$escapeChar}{$escapeChar}", "{$escapeChar}%", "{$escapeChar}_" ],
+ $s );
+ }
+
/**
* Get a list of storage engines that are available and supported
*