(bug 15141) - Give "cascadeonly" checkbox on Special:ProtectedPages.
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 13 Aug 2008 15:40:47 +0000 (15:40 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 13 Aug 2008 15:40:47 +0000 (15:40 +0000)
RELEASE-NOTES
includes/specials/SpecialProtectedpages.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index bedac2d..5344cc0 100644 (file)
@@ -76,6 +76,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 15127) Work around minor display glitch in Opera.
 * By default, reject file uploads that look like ZIP files, to avoid the 
   so-called GIFAR vulnerability.
+* (bug 15141) Give ability to only list protected pages with the cascading
+  option enabled on Special:ProtectedPages
 
 === Bug fixes in 1.14 ===
 
index 3025c05..073309b 100644 (file)
@@ -32,10 +32,11 @@ class ProtectedPagesForm {
                $size = $wgRequest->getIntOrNull( 'size' );
                $NS = $wgRequest->getIntOrNull( 'namespace' );
                $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0;
+               $cascadeOnly = $wgRequest->getBool('cascadeonly') ? 1 : 0;
 
-               $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly );
+               $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly );
 
-               $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly ) );
+               $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
 
                if ( $pager->getNumRows() ) {
                        $s = $pager->getNavigationBar();
@@ -111,10 +112,11 @@ class ProtectedPagesForm {
         * @param $level string
         * @param $minsize int
         * @param $indefOnly bool
+        * @param $cascadeOnly bool
         * @return string Input form
         * @private
         */
-       protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly ) {
+       protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) {
                global $wgScript;
                $title = SpecialPage::getTitleFor( 'ProtectedPages' );
                return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
@@ -126,6 +128,7 @@ class ProtectedPagesForm {
                        $this->getLevelMenu( $level ) . "&nbsp;\n" .
                        "<br /><span style='white-space: nowrap'>&nbsp;&nbsp;" .
                        $this->getExpiryCheck( $indefOnly ) . "&nbsp;\n" .
+                       $this->getCascadeCheck( $cascadeOnly ) . "&nbsp;\n" .
                        $this->getSizeLimit( $sizetype, $size ) . "&nbsp;\n" .
                        "</span>" .
                        "&nbsp;" . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
@@ -153,6 +156,14 @@ class ProtectedPagesForm {
                return
                        Xml::checkLabel( wfMsg('protectedpages-indef'), 'indefonly', 'indefonly', $indefOnly ) . "\n";
        }
+       
+       /**
+        * @return string Formatted HTML
+        */
+       protected function getCascadeCheck( $cascadeOnly ) {
+               return
+                       Xml::checkLabel( wfMsg('protectedpages-cascade'), 'cascadeonly', 'cascadeonly', $cascadeOnly ) . "\n";
+       }
 
        /**
         * @return string Formatted HTML
@@ -237,7 +248,8 @@ class ProtectedPagesPager extends AlphabeticPager {
        public $mForm, $mConds;
        private $type, $level, $namespace, $sizetype, $size, $indefonly;
 
-       function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0, $indefonly=false ) {
+       function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', 
+                                                       $size=0, $indefonly = false, $cascadeonly = false ) {
                $this->mForm = $form;
                $this->mConds = $conds;
                $this->type = ( $type ) ? $type : 'edit';
@@ -246,6 +258,7 @@ class ProtectedPagesPager extends AlphabeticPager {
                $this->sizetype = $sizetype;
                $this->size = intval($size);
                $this->indefonly = (bool)$indefonly;
+               $this->cascadeonly = (bool)$cascadeonly;
                parent::__construct();
        }
 
@@ -281,6 +294,9 @@ class ProtectedPagesPager extends AlphabeticPager {
                if( $this->indefonly ) {
                        $conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL";
                }
+               if ( $this->cascadeonly ) {
+                       $conds[] = "pr_cascade = '1'";
+               }
 
                if( $this->level )
                        $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
index 93286d6..3a1d1ce 100644 (file)
@@ -1945,6 +1945,7 @@ Each row contains links to the first and second redirect, as well as the target
 'protectedpages'                  => 'Protected pages',
 'protectedpages-indef'            => 'Indefinite protections only',
 'protectedpages-summary'          => '', # do not translate or duplicate this message to other languages
+'protectedpages-cascade'          => 'Cascading protections only',
 'protectedpagestext'              => 'The following pages are protected from moving or editing',
 'protectedpagesempty'             => 'No pages are currently protected with these parameters.',
 'protectedtitles'                 => 'Protected titles',
index 7b13710..9a7ac6d 100644 (file)
@@ -1227,6 +1227,7 @@ $wgMessageStructure = array(
                'protectedpages',
                'protectedpages-indef',
                'protectedpages-summary',
+               'protectedpages-cascade',
                'protectedpagestext',
                'protectedpagesempty',
                'protectedtitles',