| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
namespace MediaWiki\Revision; |
| 22 |
|
| 23 |
use Wikimedia\Rdbms\IReadableDatabase; |
| 24 |
use Wikimedia\Rdbms\SelectQueryBuilder; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
class ArchiveSelectQueryBuilder extends SelectQueryBuilder { |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 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 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 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 |
} |