MediaWiki master
ArchiveSelectQueryBuilder.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Revision;
22
25
32
37 public function __construct( IReadableDatabase $db ) {
38 parent::__construct( $db );
39
40 $this->select( [
41 'ar_id',
42 'ar_page_id',
43 'ar_namespace',
44 'ar_title',
45 'ar_rev_id',
46 'ar_timestamp',
47 'ar_minor_edit',
48 'ar_deleted',
49 'ar_len',
50 'ar_parent_id',
51 'ar_sha1',
52 'ar_actor',
53 'ar_user' => 'archive_actor.actor_user',
54 'ar_user_text' => 'archive_actor.actor_name',
55 ] )
56 ->from( 'archive' )
57 ->join( 'actor', 'archive_actor', 'actor_id=ar_actor' );
58 }
59
65 public function joinComment() {
66 $this->fields( [
67 'ar_comment_text' => 'comment_ar_comment.comment_text',
68 'ar_comment_data' => 'comment_ar_comment.comment_data',
69 'ar_comment_cid' => 'comment_ar_comment.comment_id',
70 ] );
71 $this->join( 'comment', "comment_ar_comment", 'comment_ar_comment.comment_id = ar_comment_id' );
72 return $this;
73 }
74}
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.
IReadableDatabase IReadableDatabase $db
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.