r39290 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39289‎ | r39290 | r39291 >
Date:15:40, 13 August 2008
Author:demon
Status:old
Tags:
Comment:
(bug 15141) - Give "cascadeonly" checkbox on Special:ProtectedPages.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1227,6 +1227,7 @@
12281228 'protectedpages',
12291229 'protectedpages-indef',
12301230 'protectedpages-summary',
 1231+ 'protectedpages-cascade',
12311232 'protectedpagestext',
12321233 'protectedpagesempty',
12331234 'protectedtitles',
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php
@@ -32,10 +32,11 @@
3333 $size = $wgRequest->getIntOrNull( 'size' );
3434 $NS = $wgRequest->getIntOrNull( 'namespace' );
3535 $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0;
 36+ $cascadeOnly = $wgRequest->getBool('cascadeonly') ? 1 : 0;
3637
37 - $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly );
 38+ $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly );
3839
39 - $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly ) );
 40+ $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
4041
4142 if ( $pager->getNumRows() ) {
4243 $s = $pager->getNavigationBar();
@@ -111,10 +112,11 @@
112113 * @param $level string
113114 * @param $minsize int
114115 * @param $indefOnly bool
 116+ * @param $cascadeOnly bool
115117 * @return string Input form
116118 * @private
117119 */
118 - protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly ) {
 120+ protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) {
119121 global $wgScript;
120122 $title = SpecialPage::getTitleFor( 'ProtectedPages' );
121123 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
@@ -126,6 +128,7 @@
127129 $this->getLevelMenu( $level ) . " \n" .
128130 "<br /><span style='white-space: nowrap'>&nbsp;&nbsp;" .
129131 $this->getExpiryCheck( $indefOnly ) . "&nbsp;\n" .
 132+ $this->getCascadeCheck( $cascadeOnly ) . "&nbsp;\n" .
130133 $this->getSizeLimit( $sizetype, $size ) . "&nbsp;\n" .
131134 "</span>" .
132135 "&nbsp;" . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
@@ -153,6 +156,14 @@
154157 return
155158 Xml::checkLabel( wfMsg('protectedpages-indef'), 'indefonly', 'indefonly', $indefOnly ) . "\n";
156159 }
 160+
 161+ /**
 162+ * @return string Formatted HTML
 163+ */
 164+ protected function getCascadeCheck( $cascadeOnly ) {
 165+ return
 166+ Xml::checkLabel( wfMsg('protectedpages-cascade'), 'cascadeonly', 'cascadeonly', $cascadeOnly ) . "\n";
 167+ }
157168
158169 /**
159170 * @return string Formatted HTML
@@ -237,7 +248,8 @@
238249 public $mForm, $mConds;
239250 private $type, $level, $namespace, $sizetype, $size, $indefonly;
240251
241 - function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0, $indefonly=false ) {
 252+ function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='',
 253+ $size=0, $indefonly = false, $cascadeonly = false ) {
242254 $this->mForm = $form;
243255 $this->mConds = $conds;
244256 $this->type = ( $type ) ? $type : 'edit';
@@ -246,6 +258,7 @@
247259 $this->sizetype = $sizetype;
248260 $this->size = intval($size);
249261 $this->indefonly = (bool)$indefonly;
 262+ $this->cascadeonly = (bool)$cascadeonly;
250263 parent::__construct();
251264 }
252265
@@ -281,6 +294,9 @@
282295 if( $this->indefonly ) {
283296 $conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL";
284297 }
 298+ if ( $this->cascadeonly ) {
 299+ $conds[] = "pr_cascade = '1'";
 300+ }
285301
286302 if( $this->level )
287303 $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1945,6 +1945,7 @@
19461946 'protectedpages' => 'Protected pages',
19471947 'protectedpages-indef' => 'Indefinite protections only',
19481948 'protectedpages-summary' => '', # do not translate or duplicate this message to other languages
 1949+'protectedpages-cascade' => 'Cascading protections only',
19491950 'protectedpagestext' => 'The following pages are protected from moving or editing',
19501951 'protectedpagesempty' => 'No pages are currently protected with these parameters.',
19511952 'protectedtitles' => 'Protected titles',
Index: trunk/phase3/RELEASE-NOTES
@@ -76,6 +76,8 @@
7777 * (bug 15127) Work around minor display glitch in Opera.
7878 * By default, reject file uploads that look like ZIP files, to avoid the
7979 so-called GIFAR vulnerability.
 80+* (bug 15141) Give ability to only list protected pages with the cascading
 81+ option enabled on Special:ProtectedPages
8082
8183 === Bug fixes in 1.14 ===
8284

Status & tagging log