MediaWiki master
ArchiveSelectQueryBuilder.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Revision;
8
11
18
23 public function __construct( IReadableDatabase $db ) {
24 parent::__construct( $db );
25
26 $this->select( [
27 'ar_id',
28 'ar_page_id',
29 'ar_namespace',
30 'ar_title',
31 'ar_rev_id',
32 'ar_timestamp',
33 'ar_minor_edit',
34 'ar_deleted',
35 'ar_len',
36 'ar_parent_id',
37 'ar_actor',
38 'ar_user' => 'archive_actor.actor_user',
39 'ar_user_text' => 'archive_actor.actor_name',
40 ] )
41 ->from( 'archive' )
42 ->join( 'actor', 'archive_actor', 'actor_id=ar_actor' );
43 }
44
50 public function joinComment() {
51 $this->fields( [
52 'ar_comment_text' => 'comment_ar_comment.comment_text',
53 'ar_comment_data' => 'comment_ar_comment.comment_data',
54 'ar_comment_cid' => 'comment_ar_comment.comment_id',
55 ] );
56 $this->join( 'comment', "comment_ar_comment", 'comment_ar_comment.comment_id = ar_comment_id' );
57 return $this;
58 }
59}
Help and centralize querying archive table.
joinComment()
Join the query with comment table and several fields to allow easier query.
join( $table, $alias=null, $conds=[])
Inner join a table or group of tables.
Build SELECT queries with a fluent interface.
select( $fields)
Add a field or an array of fields to the query.
fields( $fields)
Add a field or an array of fields to the query.
A database connection without write operations.