Update for the actor table change
Core change I8d825eb0 begins the process of changing core database tables from using xx_user and xx_user_text fields to using xx_actor. This updates the extension to continue to function during and after the transition. Bug: T167246 Change-Id: Ic06c15c262bc47b66ace76207d77a76f46be305e
This commit is contained in:
@@ -37,28 +37,47 @@ class ULSCompactLinksDisablePref extends Maintenance {
|
|||||||
|
|
||||||
$lastUserId = $this->getOption( 'continue', 0 );
|
$lastUserId = $this->getOption( 'continue', 0 );
|
||||||
|
|
||||||
|
if ( class_exists( ActorMigration::class ) ) {
|
||||||
|
$actorQuery = ActorMigration::newMigration()->getJoin( 'rev_user' );
|
||||||
|
$revUser = $actorQuery['fields']['rev_user'];
|
||||||
|
} else {
|
||||||
|
$actorQuery = [
|
||||||
|
'tables' => [],
|
||||||
|
'joins' => [],
|
||||||
|
];
|
||||||
|
$revUser = 'rev_user';
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$tables = [ 'revision', 'user_properties', 'user_groups' ];
|
$tables = array_merge(
|
||||||
$fields = [ 'rev_user', 'isbot' => 'ug_group', 'hasbeta' => 'up_value' ];
|
[ 'revision' ],
|
||||||
|
$actorQuery['tables'],
|
||||||
|
[ 'user_properties', 'user_groups' ]
|
||||||
|
);
|
||||||
|
$fields = [
|
||||||
|
'user' => $revUser,
|
||||||
|
'isbot' => 'ug_group',
|
||||||
|
'hasbeta' => 'up_value'
|
||||||
|
];
|
||||||
$conds = [
|
$conds = [
|
||||||
'rev_timestamp > ' . $dbr->timestamp( 20170101000000 ),
|
'rev_timestamp > ' . $dbr->timestamp( 20170101000000 ),
|
||||||
"rev_user > $lastUserId"
|
"$revUser > $lastUserId"
|
||||||
];
|
];
|
||||||
$options = [
|
$options = [
|
||||||
'GROUP BY' => 'rev_user',
|
'GROUP BY' => $revUser,
|
||||||
'ORDER BY' => 'rev_user',
|
'ORDER BY' => 'user',
|
||||||
'LIMIT' => $this->mBatchSize,
|
'LIMIT' => $this->mBatchSize,
|
||||||
];
|
];
|
||||||
$joins = [
|
$joins = [
|
||||||
'user_properties' => [
|
'user_properties' => [
|
||||||
'LEFT OUTER JOIN',
|
'LEFT OUTER JOIN',
|
||||||
"rev_user = up_user AND up_property = 'uls-compact-links' AND up_value = 1"
|
"$revUser = up_user AND up_property = 'uls-compact-links' AND up_value = 1"
|
||||||
],
|
],
|
||||||
'user_groups' => [
|
'user_groups' => [
|
||||||
'LEFT OUTER JOIN',
|
'LEFT OUTER JOIN',
|
||||||
"rev_user = ug_user AND ug_group = 'bot'"
|
"$revUser = ug_user AND ug_group = 'bot'"
|
||||||
]
|
]
|
||||||
];
|
] + $actorQuery['joins'];
|
||||||
|
|
||||||
if ( !$this->really ) {
|
if ( !$this->really ) {
|
||||||
echo "\n\n" .
|
echo "\n\n" .
|
||||||
@@ -71,7 +90,7 @@ class ULSCompactLinksDisablePref extends Maintenance {
|
|||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
|
|
||||||
foreach ( $results as $row ) {
|
foreach ( $results as $row ) {
|
||||||
$lastUserId = $row->rev_user;
|
$lastUserId = $row->user;
|
||||||
if ( $row->isbot === 'bot' || $row->hasbeta !== null ) {
|
if ( $row->isbot === 'bot' || $row->hasbeta !== null ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -87,7 +106,7 @@ class ULSCompactLinksDisablePref extends Maintenance {
|
|||||||
|
|
||||||
$disabled++;
|
$disabled++;
|
||||||
// If we ever need to revert, print the affected user ids
|
// If we ever need to revert, print the affected user ids
|
||||||
$this->output( $row->rev_user . " ", 'userids' );
|
$this->output( $row->user . " ", 'userids' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->output( "Disabled compact-language-links for $disabled users.\n" );
|
$this->output( "Disabled compact-language-links for $disabled users.\n" );
|
||||||
|
|||||||
Reference in New Issue
Block a user