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    public function __construct(
40        HookContainer $hookContainer,
41        LinkRenderer $linkRenderer,
42        IConnectionProvider $dbProvider,
43        RevisionStore $revisionStore,
44        NamespaceInfo $namespaceInfo,
45        CommentFormatter $commentFormatter,
46        LinkBatchFactory $linkBatchFactory,
47        UserFactory $userFactory,
48        IContextSource $context,
49        array $options,
50        UserIdentity $target
51    ) {
52        $options['isArchive'] = true;
53
54        parent::__construct(
55            $linkRenderer,
56            $linkBatchFactory,
57            $hookContainer,
58            $revisionStore,
59            $namespaceInfo,
60            $commentFormatter,
61            $userFactory,
62            $context,
63            $options,
64            $target
65        );
66
67        $this->revisionIdField = 'ar_rev_id';
68        $this->revisionParentIdField = 'ar_parent_id';
69        $this->revisionTimestampField = 'ar_timestamp';
70        $this->revisionLengthField = 'ar_len';
71        $this->revisionDeletedField = 'ar_deleted';
72        $this->revisionMinorField = 'ar_minor_edit';
73        $this->userNameField = 'ar_user_text';
74        $this->pageNamespaceField = 'ar_namespace';
75        $this->pageTitleField = 'ar_title';
76    }
77
78    /**
79     * @inheritDoc
80     */
81    protected function getRevisionQuery() {
82        $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $this->getDatabase() )
83            ->joinComment()
84            ->where( [ 'actor_name' => $this->target ] );
85
86        return $queryBuilder->getQueryInfo();
87    }
88
89    /**
90     * @return string[]
91     */
92    protected function getExtraSortFields() {
93        return [ 'ar_id' ];
94    }
95
96    public function getIndexField() {
97        return 'ar_timestamp';
98    }
99}
100
101/**
102 * Retain the old class name for backwards compatibility.
103 * @deprecated since 1.41
104 */
105class_alias( DeletedContribsPager::class, 'DeletedContribsPager' );