MediaWiki REL1_35
ProtectedTitlesPager.php
Go to the documentation of this file.
1<?php
26
30 public $mForm;
31
35 public $mConds;
36
38 private $level;
39
41 private $namespace;
42
52 public function __construct( $form, $conds, $type, $level, $namespace,
53 $sizetype = '', $size = 0
54 ) {
55 $this->mForm = $form;
56 $this->mConds = $conds;
57 $this->level = $level;
58 $this->namespace = $namespace;
59 parent::__construct( $form->getContext() );
60 }
61
62 protected function getStartBody() {
63 # Do a link batch query
64 $this->mResult->seek( 0 );
65 $lb = new LinkBatch;
66
67 foreach ( $this->mResult as $row ) {
68 $lb->add( $row->pt_namespace, $row->pt_title );
69 }
70
71 $lb->execute();
72
73 return '';
74 }
75
79 public function getTitle() {
80 return $this->mForm->getPageTitle();
81 }
82
83 public function formatRow( $row ) {
84 return $this->mForm->formatRow( $row );
85 }
86
90 public function getQueryInfo() {
91 $conds = $this->mConds;
92 $conds[] = 'pt_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
93 ' OR pt_expiry IS NULL';
94 if ( $this->level ) {
95 $conds['pt_create_perm'] = $this->level;
96 }
97
98 if ( $this->namespace !== null ) {
99 $conds[] = 'pt_namespace=' . $this->mDb->addQuotes( $this->namespace );
100 }
101
102 return [
103 'tables' => 'protected_titles',
104 'fields' => [ 'pt_namespace', 'pt_title', 'pt_create_perm',
105 'pt_expiry', 'pt_timestamp' ],
106 'conds' => $conds
107 ];
108 }
109
110 public function getIndexField() {
111 return 'pt_timestamp';
112 }
113}
IndexPager with an alphabetic list and a formatted navigation bar Stable to extend.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition LinkBatch.php:35
add( $ns, $dbkey)
formatRow( $row)
Returns an HTML string representing the result row $row.
SpecialProtectedtitles $mForm
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
__construct( $form, $conds, $type, $level, $namespace, $sizetype='', $size=0)
getIndexField()
Returns the name of the index field.
A special page that list protected titles from creation.