X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FMysqlUpdater.php;h=44086a125e02bc1b792d53c6f53b12de8108efc0;hb=153ad6a2c8610df3d9763fd2e1bb67d345c10231;hp=556d0d5388aadc6e2ebc75aba24b36968ca1fcb7;hpb=3df3b575c6617df64ec98533cc7141bd2314e274;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 556d0d5388..44086a125e 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' ], @@ -329,6 +329,13 @@ class MysqlUpdater extends DatabaseUpdater { [ 'renameIndex', 'l10n_cache', 'lc_lang_key', 'PRIMARY', false, 'patch-l10n_cache-primary-key.sql' ], [ 'doUnsignedSyncronisation' ], + + // 1.31 + [ 'addTable', 'slots', 'patch-slots.sql' ], + [ 'addTable', 'content', 'patch-content.sql' ], + [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ], + [ 'addTable', 'content_models', 'patch-content_models.sql' ], + [ 'migrateArchiveText' ], ]; } @@ -531,25 +538,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'; @@ -878,7 +872,8 @@ class MysqlUpdater extends DatabaseUpdater { $this->applyPatch( 'patch-templatelinks.sql', false, "Creating templatelinks table" ); $this->output( "Populating...\n" ); - if ( wfGetLB()->getServerCount() > 1 ) { + $services = MediaWikiServices::getInstance(); + if ( $services->getDBLoadBalancer()->getServerCount() > 1 ) { // Slow, replication-friendly update $res = $this->db->select( 'pagelinks', [ 'pl_from', 'pl_namespace', 'pl_title' ], [ 'pl_namespace' => NS_TEMPLATE ], __METHOD__ ); @@ -886,7 +881,7 @@ class MysqlUpdater extends DatabaseUpdater { foreach ( $res as $row ) { $count = ( $count + 1 ) % 100; if ( $count == 0 ) { - $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $lbFactory = $services->getDBLoadBalancerFactory(); $lbFactory->waitForReplication( [ 'wiki' => wfWikiID() ] ); } $this->db->insert( 'templatelinks',