* @file
* @ingroup Deployment
*/
-use Wikimedia\Rdbms\Field;
use Wikimedia\Rdbms\MySQLField;
+use Wikimedia\Rdbms\IDatabase;
use MediaWiki\MediaWikiServices;
/**
[ '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' ],
) );
}
$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';