* @file
* @ingroup Deployment
*/
-use Wikimedia\Rdbms\Field;
use Wikimedia\Rdbms\MySQLField;
use MediaWiki\MediaWikiServices;
'patch-fa_major_mime-chemical.sql' ],
// 1.25
- [ 'doUserNewTalkUseridUnsigned' ],
// note this patch covers other _comment and _description fields too
- [ 'modifyField', 'recentchanges', 'rc_comment', 'patch-editsummary-length.sql' ],
+ [ 'doExtendCommentLengths' ],
// 1.26
[ 'dropTable', 'hitcounter' ],
'patch-user_properties-fix-pk.sql' ],
[ 'addTable', 'comment', 'patch-comment-table.sql' ],
[ 'migrateComments' ],
+ [ 'renameIndex', 'l10n_cache', 'lc_lang_key', 'PRIMARY', false,
+ 'patch-l10n_cache-primary-key.sql' ],
+ [ 'doUnsignedSyncronisation' ],
];
}
global $IP;
if ( !$this->doTable( 'interwiki' ) ) {
- return true;
+ return;
}
if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
);
}
- protected function doUserNewTalkUseridUnsigned() {
- if ( !$this->doTable( 'user_newtalk' ) ) {
- return true;
- }
+ protected function doUnsignedSyncronisation() {
+ $sync = [
+ [ 'table' => 'bot_passwords', 'field' => 'bp_user' ],
+ [ 'table' => 'change_tag', 'field' => 'ct_log_id' ],
+ [ 'table' => 'change_tag', 'field' => 'ct_rev_id' ],
+ [ 'table' => 'page_restrictions', 'field' => 'pr_user' ],
+ [ 'table' => 'tag_summary', 'field' => 'ts_log_id' ],
+ [ 'table' => 'tag_summary', 'field' => 'ts_rev_id' ],
+ [ 'table' => 'user_newtalk', 'field' => 'user_id' ],
+ [ 'table' => 'user_properties', 'field' => 'up_user' ],
+ ];
- $info = $this->db->fieldInfo( 'user_newtalk', 'user_id' );
- if ( $info === false ) {
- return true;
- }
- if ( $info->isUnsigned() ) {
- $this->output( "...user_id is already unsigned int.\n" );
+ foreach ( $sync as $s ) {
+ if ( !$this->doTable( $s['table'] ) ) {
+ continue;
+ }
- return true;
+ $info = $this->db->fieldInfo( $s['table'], $s['field'] );
+ if ( $info === false ) {
+ continue;
+ }
+ $fullName = "{$s['table']}.{$s['field']}";
+ if ( $info->isUnsigned() ) {
+ $this->output( "...$fullName is already unsigned int.\n" );
+
+ continue;
+ }
+
+ $this->applyPatch(
+ "patch-{$s['table']}-{$s['field']}-unsigned.sql",
+ false,
+ "Making $fullName into an unsigned int"
+ );
}
- return $this->applyPatch(
- 'patch-user-newtalk-userid-unsigned.sql',
- false,
- 'Making user_id unsigned int'
- );
+ return true;
}
protected function doRevisionPageRevIndexNonUnique() {
);
}
+ 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;