Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
LoggingSelectQueryBuilder
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 1
2
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 */
20
21namespace MediaWiki\Logging;
22
23use Wikimedia\Rdbms\IReadableDatabase;
24use Wikimedia\Rdbms\SelectQueryBuilder;
25
26/**
27 * Help and centralize querying logging table.
28 *
29 * @since 1.41
30 */
31class LoggingSelectQueryBuilder extends SelectQueryBuilder {
32
33    /**
34     * @internal use DatabaseLogEntry::newSelectQueryBuilder() instead.
35     * @param IReadableDatabase $db
36     */
37    public function __construct( IReadableDatabase $db ) {
38        parent::__construct( $db );
39        $this->select( [
40            'log_id', 'log_type', 'log_action', 'log_timestamp',
41            'log_namespace', 'log_title', // unused log_page
42            'log_params', 'log_deleted',
43            'user_id',
44            'user_name',
45            'log_actor',
46            'log_user' => 'logging_actor.actor_user',
47            'log_user_text' => 'logging_actor.actor_name',
48            'log_comment_text' => 'comment_log_comment.comment_text',
49            'log_comment_data' => 'comment_log_comment.comment_data',
50            'log_comment_cid' => 'comment_log_comment.comment_id',
51        ] )
52            ->from( 'logging' )
53            ->join( 'actor', 'logging_actor', 'actor_id=log_actor' )
54            ->leftJoin( 'user', null, 'user_id=logging_actor.actor_user' )
55            ->join(
56                'comment',
57                'comment_log_comment',
58                'comment_log_comment.comment_id = log_comment_id'
59            );
60    }
61
62}