X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FMysqlInstaller.php;h=cbb79f8df3acaa35660d03cc8af16358a81a595d;hb=bb866e75d0c6e7e47f59371fd5b9e37fc6e66fc8;hp=09051f410d2fffc0e65adbeb2979a41d75a8de53;hpb=5747ee5b934af55db9a7cf25119f6af7f7694c71;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 09051f410d..cbb79f8df3 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -179,8 +179,8 @@ class MysqlInstaller extends DatabaseInstaller { # 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' ); @@ -221,6 +221,16 @@ class MysqlInstaller extends DatabaseInstaller { $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 * @@ -574,7 +584,7 @@ class MysqlInstaller extends DatabaseInstaller { // If we couldn't create for some bizzare reason and the // user probably doesn't exist, skip the grant $this->db->rollback( __METHOD__ ); - $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() ); + $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getMessage() ); } } } else { @@ -594,7 +604,7 @@ class MysqlInstaller extends DatabaseInstaller { $this->db->commit( __METHOD__ ); } catch ( DBQueryError $dqe ) { $this->db->rollback( __METHOD__ ); - $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() ); + $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getMessage() ); } }