Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.55% covered (success)
96.55%
28 / 29
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
DeletedContribsPager
100.00% covered (success)
100.00%
28 / 28
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
1
 getRevisionQuery
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 getExtraSortFields
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIndexField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup Pager
20 */
21
22namespace MediaWiki\Pager;
23
24use MediaWiki\Cache\LinkBatchFactory;
25use MediaWiki\CommentFormatter\CommentFormatter;
26use MediaWiki\Context\IContextSource;
27use MediaWiki\HookContainer\HookContainer;
28use MediaWiki\Linker\LinkRenderer;
29use MediaWiki\Revision\RevisionStore;
30use MediaWiki\Title\NamespaceInfo;
31use MediaWiki\User\UserFactory;
32use MediaWiki\User\UserIdentity;
33use Wikimedia\Rdbms\IConnectionProvider;
34
35/**
36 * @ingroup Pager
37 */
38class DeletedContribsPager extends ContributionsPager {
39    /**
40     * @param HookContainer $hookContainer
41     * @param LinkRenderer $linkRenderer
42     * @param IConnectionProvider $dbProvider
43     * @param RevisionStore $revisionStore
44     * @param NamespaceInfo $namespaceInfo
45     * @param CommentFormatter $commentFormatter
46     * @param LinkBatchFactory $linkBatchFactory
47     * @param UserFactory $userFactory
48     * @param IContextSource $context
49     * @param array $options
50     * @param UserIdentity $target
51     */
52    public function __construct(
53        HookContainer $hookContainer,
54        LinkRenderer $linkRenderer,
55        IConnectionProvider $dbProvider,
56        RevisionStore $revisionStore,
57        NamespaceInfo $namespaceInfo,
58        CommentFormatter $commentFormatter,
59        LinkBatchFactory $linkBatchFactory,
60        UserFactory $userFactory,
61        IContextSource $context,
62        array $options,
63        $target
64    ) {
65        $options['isArchive'] = true;
66
67        parent::__construct(
68            $linkRenderer,
69            $linkBatchFactory,
70            $hookContainer,
71            $revisionStore,
72            $namespaceInfo,
73            $commentFormatter,
74            $userFactory,
75            $context,
76            $options,
77            $target
78        );
79
80        $this->revisionIdField = 'ar_rev_id';
81        $this->revisionParentIdField = 'ar_parent_id';
82        $this->revisionTimestampField = 'ar_timestamp';
83        $this->revisionLengthField = 'ar_len';
84        $this->revisionDeletedField = 'ar_deleted';
85        $this->revisionMinorField = 'ar_minor_edit';
86        $this->userNameField = 'ar_user_text';
87        $this->pageNamespaceField = 'ar_namespace';
88        $this->pageTitleField = 'ar_title';
89    }
90
91    /**
92     * @inheritDoc
93     */
94    protected function getRevisionQuery() {
95        $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $this->getDatabase() )
96            ->joinComment()
97            ->where( [ 'actor_name' => $this->target ] );
98
99        return $queryBuilder->getQueryInfo();
100    }
101
102    /**
103     * @return string[]
104     */
105    protected function getExtraSortFields() {
106        return [ 'ar_id' ];
107    }
108
109    public function getIndexField() {
110        return 'ar_timestamp';
111    }
112}
113
114/**
115 * Retain the old class name for backwards compatibility.
116 * @deprecated since 1.41
117 */
118class_alias( DeletedContribsPager::class, 'DeletedContribsPager' );