X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FMysqlUpdater.php;h=466ad0f0748422b380639e58da9af459333d4502;hb=f1bbd1ad401dfcb837e93ccf473345eecbcab3db;hp=2abc6b61db62016d41a009726fb4261085e06074;hpb=971a50c4f3c61fb3a4bec60cd712317bb8ddcb9a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 2abc6b61db..466ad0f074 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -20,8 +20,8 @@ * @file * @ingroup Deployment */ -use Wikimedia\Rdbms\Field; use Wikimedia\Rdbms\MySQLField; +use Wikimedia\Rdbms\IDatabase; use MediaWiki\MediaWikiServices; /** @@ -83,7 +83,7 @@ class MysqlUpdater extends DatabaseUpdater { [ 'doUserUniqueUpdate' ], [ 'doUserGroupsUpdate' ], [ 'addField', 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ], - [ 'addTable', 'user_newtalk', 'patch-usernewtalk2.sql' ], + [ 'addTable', 'user_newtalk', 'patch-usernewtalk.sql' ], [ 'addTable', 'transcache', 'patch-transcache.sql' ], [ 'addField', 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ], @@ -267,7 +267,7 @@ class MysqlUpdater extends DatabaseUpdater { // 1.25 // note this patch covers other _comment and _description fields too - [ 'modifyField', 'recentchanges', 'rc_comment', 'patch-editsummary-length.sql' ], + [ 'doExtendCommentLengths' ], // 1.26 [ 'dropTable', 'hitcounter' ], @@ -390,7 +390,7 @@ class MysqlUpdater extends DatabaseUpdater { global $IP; if ( !$this->doTable( 'interwiki' ) ) { - return true; + return; } if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) { @@ -531,25 +531,12 @@ class MysqlUpdater extends DatabaseUpdater { ) ); } $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE "; - $firstCond = true; + $dupeTitles = []; foreach ( $duplicate as $ns => $titles ) { - if ( $firstCond ) { - $firstCond = false; - } else { - $sql .= ' OR '; - } - $sql .= "( cur_namespace = {$ns} AND cur_title in ("; - $first = true; - foreach ( $titles as $t ) { - if ( $first ) { - $sql .= $this->db->addQuotes( $t ); - $first = false; - } else { - $sql .= ', ' . $this->db->addQuotes( $t ); - } - } - $sql .= ") ) \n"; + $dupeTitles[] = "( cur_namespace = {$ns} AND cur_title in (" + . $this->db->makeList( $titles ) . ") ) \n"; } + $sql .= $this->db->makeList( $dupeTitles, IDatabase::LIST_OR ); # By sorting descending, the most recent entry will be the first in the list. # All following entries will be deleted by the next while-loop. $sql .= 'ORDER BY cur_namespace, cur_title, cur_timestamp DESC'; @@ -1181,6 +1168,22 @@ class MysqlUpdater extends DatabaseUpdater { ); } + protected function doExtendCommentLengths() { + $table = $this->db->tableName( 'revision' ); + $res = $this->db->query( "SHOW COLUMNS FROM $table LIKE 'rev_comment'" ); + $row = $this->db->fetchObject( $res ); + + if ( $row && ( $row->Type !== "varbinary(767)" || $row->Default !== "" ) ) { + $this->applyPatch( + 'patch-editsummary-length.sql', + false, + 'Extending edit summary lengths (and setting defaults)' + ); + } else { + $this->output( '...comment fields are up to date' ); + } + } + public function getSchemaVars() { global $wgDBTableOptions;