MediaWiki  1.34.0
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  function getTitle() {
80  return $this->mForm->getPageTitle();
81  }
82 
83  function formatRow( $row ) {
84  return $this->mForm->formatRow( $row );
85  }
86 
90  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  function getIndexField() {
111  return 'pt_timestamp';
112  }
113 }
ProtectedTitlesPager\getTitle
getTitle()
Definition: ProtectedTitlesPager.php:79
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:34
LinkBatch\add
add( $ns, $dbkey)
Definition: LinkBatch.php:83
AlphabeticPager
IndexPager with an alphabetic list and a formatted navigation bar.
Definition: AlphabeticPager.php:28
SpecialProtectedtitles
A special page that list protected titles from creation.
Definition: SpecialProtectedtitles.php:29
ProtectedTitlesPager\getIndexField
getIndexField()
This function should be overridden to return the name of the index fi- eld.
Definition: ProtectedTitlesPager.php:110
ProtectedTitlesPager\getStartBody
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
Definition: ProtectedTitlesPager.php:62
ProtectedTitlesPager\getQueryInfo
getQueryInfo()
Definition: ProtectedTitlesPager.php:90
ProtectedTitlesPager\formatRow
formatRow( $row)
Abstract formatting function.
Definition: ProtectedTitlesPager.php:83
ProtectedTitlesPager\$namespace
int null $namespace
Definition: ProtectedTitlesPager.php:41
ProtectedTitlesPager
Definition: ProtectedTitlesPager.php:25
ProtectedTitlesPager\$level
string null $level
Definition: ProtectedTitlesPager.php:38
ProtectedTitlesPager\$mConds
array $mConds
Definition: ProtectedTitlesPager.php:35
ProtectedTitlesPager\$mForm
SpecialProtectedtitles $mForm
Definition: ProtectedTitlesPager.php:30
ProtectedTitlesPager\__construct
__construct( $form, $conds, $type, $level, $namespace, $sizetype='', $size=0)
Definition: ProtectedTitlesPager.php:52
$type
$type
Definition: testCompression.php:48