dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Follow up 9ef34a2f1d0: fix NewPagesPager "hide registered users" option
[lhc/web/wiklou.git]
/
includes
/
specials
/
pagers
/
NewPagesPager.php
diff --git
a/includes/specials/pagers/NewPagesPager.php
b/includes/specials/pagers/NewPagesPager.php
index
8131671
..
1db32e6
100644
(file)
--- a/
includes/specials/pagers/NewPagesPager.php
+++ b/
includes/specials/pagers/NewPagesPager.php
@@
-68,9
+68,7
@@
class NewPagesPager extends ReverseChronologicalPager {
$conds[] = ActorMigration::newMigration()->getWhere(
$this->mDb, 'rc_user', User::newFromName( $user->getText(), false ), false
)['conds'];
$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'] );
}
# If anons cannot make new pages, don't "exclude logged in users"!
$conds[] = ActorMigration::newMigration()->isAnon( $rcQuery['fields']['rc_user'] );
}
@@
-123,6
+121,13
@@
class NewPagesPager extends ReverseChronologicalPager {
return $info;
}
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' );
// Based on ContribsPager.php
function getNamespaceCond() {
$namespace = $this->opts->getValue( 'namespace' );
@@
-137,15
+142,18
@@
class NewPagesPager extends ReverseChronologicalPager {
$eq_op = $invert ? '!=' : '=';
$bool_op = $invert ? 'AND' : 'OR';
$eq_op = $invert ? '!=' : '=';
$bool_op = $invert ? 'AND' : 'OR';
+ $selectedNS = $this->mDb->addQuotes( $namespace );
if ( !$associated ) {
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 [
return [
- "rc_namespace $eq_op
" . $this->mDb->addQuotes( $namespace )
.
+ "rc_namespace $eq_op
$selectedNS "
.
$bool_op .
$bool_op .
- " rc_namespace $eq_op
" . $this->mDb->addQuotes( $associatedNS )
+ " rc_namespace $eq_op
$associatedNS"
];
}
];
}