Merge "Add semantic tags to license info text"
[lhc/web/wiklou.git] / includes / installer / MysqlUpdater.php
index bcc2705..bc7725e 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup Deployment
  */
 use Wikimedia\Rdbms\MySQLField;
+use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\MediaWikiServices;
 
 /**
@@ -328,6 +329,12 @@ 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' ],
                ];
        }
 
@@ -530,25 +537,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';