46 private $groupPermissionsLookup;
52 private $linkBatchFactory;
55 private $namespaceInfo;
78 $this->groupPermissionsLookup = $groupPermissionsLookup;
79 $this->hookRunner =
new HookRunner( $hookContainer );
80 $this->linkBatchFactory = $linkBatchFactory;
81 $this->namespaceInfo = $namespaceInfo;
92 $username = $this->opts->getValue(
'username' );
93 $user = Title::makeTitleSafe(
NS_USER, $username );
95 $size = abs( intval( $this->opts->getValue(
'size' ) ) );
97 if ( $this->opts->getValue(
'size-mode' ) ===
'max' ) {
98 $conds[] =
'page_len <= ' . $size;
100 $conds[] =
'page_len >= ' . $size;
105 $conds[
'actor_name'] = $user->getText();
106 } elseif ( $this->canAnonymousUsersCreatePages() && $this->opts->getValue(
'hideliu' ) ) {
107 # If anons cannot make new pages, don't "exclude logged in users"!
108 $conds[
'actor_user'] =
null;
111 $conds = array_merge( $conds, $this->getNamespaceCond() );
113 # If this user cannot see patrolled edits or they are off, don't do dumb queries!
114 if ( $this->opts->getValue(
'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
118 if ( $this->opts->getValue(
'hidebots' ) ) {
119 $conds[
'rc_bot'] = 0;
122 if ( $this->opts->getValue(
'hideredirs' ) ) {
123 $conds[
'page_is_redirect'] = 0;
127 $tables = array_merge( $rcQuery[
'tables'], [
'page' ] );
128 $fields = array_merge( $rcQuery[
'fields'], [
129 'length' =>
'page_len',
'rev_id' =>
'page_latest',
'page_namespace',
'page_title',
130 'page_content_model',
132 $join_conds = [
'page' => [
'JOIN',
'page_id=rc_cur_id' ] ] + $rcQuery[
'joins'];
134 $this->hookRunner->onSpecialNewpagesConditions(
135 $this, $this->opts, $conds, $tables, $fields, $join_conds );
142 'join_conds' => $join_conds
152 $this->opts[
'tagfilter']
158 private function canAnonymousUsersCreatePages() {
159 return $this->groupPermissionsLookup->groupHasPermission(
'*',
'createpage' ) ||
160 $this->groupPermissionsLookup->groupHasPermission(
'*',
'createtalk' );
164 private function getNamespaceCond() {
165 $namespace = $this->opts->getValue(
'namespace' );
166 if ( $namespace ===
'all' || $namespace ===
'' ) {
170 $namespace = intval( $namespace );
176 $invert = $this->opts->getValue(
'invert' );
177 $associated = $this->opts->getValue(
'associated' );
179 $eq_op = $invert ?
'!=' :
'=';
180 $bool_op = $invert ?
'AND' :
'OR';
183 $selectedNS =
$dbr->addQuotes( $namespace );
184 if ( !$associated ) {
185 return [
"rc_namespace $eq_op $selectedNS" ];
188 $associatedNS =
$dbr->addQuotes(
189 $this->namespaceInfo->getAssociated( $namespace )
192 "rc_namespace $eq_op $selectedNS " .
194 " rc_namespace $eq_op $associatedNS"
199 return [ [
'rc_timestamp',
'rc_id' ] ];
203 return $this->mForm->formatRow( $row );
207 # Do a batch existence check on pages
208 $linkBatch = $this->linkBatchFactory->newLinkBatch();
209 foreach ( $this->mResult as $row ) {
210 $linkBatch->add(
NS_USER, $row->rc_user_text );
212 $linkBatch->add( $row->page_namespace, $row->page_title );
214 $linkBatch->execute();
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
static getQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new recentchanges object.
A special page that list newly created pages.
getContext()
Gets the context this SpecialPage is executed in.