$conds[] = ActorMigration::newMigration()->getWhere(
$this->mDb, 'rc_user', User::newFromName( $user->getText(), false ), false
)['conds'];
- } elseif ( User::groupHasPermission( '*', 'createpage' ) &&
- $this->opts->getValue( 'hideliu' )
- ) {
+ } elseif ( $this->canAnonymousUsersCreatePages() && $this->opts->getValue( 'hideliu' ) ) {
# If anons cannot make new pages, don't "exclude logged in users"!
$conds[] = ActorMigration::newMigration()->isAnon( $rcQuery['fields']['rc_user'] );
}
return $info;
}
+ private function canAnonymousUsersCreatePages() {
+ $pm = MediaWikiServices::getInstance()->getPermissionManager();
+ return ( $pm->groupHasPermission( '*', 'createpage' ) ||
+ $pm->groupHasPermission( '*', 'createtalk' )
+ );
+ }
+
// Based on ContribsPager.php
function getNamespaceCond() {
$namespace = $this->opts->getValue( 'namespace' );
$eq_op = $invert ? '!=' : '=';
$bool_op = $invert ? 'AND' : 'OR';
+ $selectedNS = $this->mDb->addQuotes( $namespace );
if ( !$associated ) {
- return [ "rc_namespace $eq_op " . $this->mDb->addQuotes( $namespace ) ];
+ return [ "rc_namespace $eq_op $selectedNS" ];
}
- $associatedNS = MediaWikiServices::getInstance()->getNamespaceInfo()->getAssociated( $namespace );
+ $associatedNS = $this->mDb->addQuotes(
+ MediaWikiServices::getInstance()->getNamespaceInfo()->getAssociated( $namespace )
+ );
return [
- "rc_namespace $eq_op " . $this->mDb->addQuotes( $namespace ) .
+ "rc_namespace $eq_op $selectedNS " .
$bool_op .
- " rc_namespace $eq_op " . $this->mDb->addQuotes( $associatedNS )
+ " rc_namespace $eq_op $associatedNS"
];
}