From 77a9a35c7896fd082d010f7631107971ebb6430f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 21 Mar 2007 21:07:15 +0000 Subject: [PATCH] *Instead of sorting on size, add a min size option to preserves the time-order --- includes/SpecialProtectedpages.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php index d7d914d652..26c421248b 100644 --- a/includes/SpecialProtectedpages.php +++ b/includes/SpecialProtectedpages.php @@ -24,11 +24,12 @@ class ProtectedPagesForm { $type = $wgRequest->getVal( 'type' ); $level = $wgRequest->getVal( 'level' ); + $minsize = $wgRequest->getIntOrNull( 'minsize' ); $NS = $wgRequest->getIntOrNull( 'namespace' ); - $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS ); + $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $minsize ); - $wgOut->addHTML( $this->showOptions( $NS, $type, $level ) ); + $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $minsize ) ); if ( $pager->getNumRows() ) { $s = $pager->getNavigationBar(); @@ -89,11 +90,11 @@ class ProtectedPagesForm { * @param $namespace int * @param $type string * @param $level string + * @param $minsize int * @private */ - function showOptions( $namespace, $type, $level ) { + function showOptions( $namespace, $type='edit', $level, $minsize ) { global $wgScript; - $type = ( $type ) ? $type : 'edit'; $action = htmlspecialchars( $wgScript ); $title = SpecialPage::getTitleFor( 'ProtectedPages' ); $special = htmlspecialchars( $title->getPrefixedDBkey() ); @@ -103,7 +104,8 @@ class ProtectedPagesForm { Xml::hidden( 'title', $special ) . "\n" . $this->getNamespaceMenu( $namespace ) . "\n" . $this->getTypeMenu( $type ) . "\n" . - $this->getLevelMenu( $level ) . "\n" . + $this->getLevelMenu( $level ) . "
\n" . + $this->getSizeLimit( $minsize ) . "\n" . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . ""; } @@ -111,7 +113,16 @@ class ProtectedPagesForm { function getNamespaceMenu( $namespace=NULL ) { return "" . HTMLnamespaceselector($namespace, ''); } - + + /** + * @return string Formatted HTML + * @private + */ + function getSizeLimit( $minsize=0 ) { + $out = Xml::input('minsize', 9, $minsize, array( 'id' => 'minsize' ) ); + return ": " . $out; + } + /** * @return string Formatted HTML * @private @@ -180,12 +191,13 @@ class ProtectedPagesForm { class ProtectedPagesPager extends ReverseChronologicalPager { public $mForm, $mConds; - function __construct( $form, $conds = array(), $type, $level, $namespace ) { + function __construct( $form, $conds = array(), $type, $level, $namespace, $minsize ) { $this->mForm = $form; $this->mConds = $conds; $this->type = ( $type ) ? $type : 'edit'; $this->level = $level; $this->namespace = $namespace; + $this->minsize = intval($minsize); parent::__construct(); } @@ -214,6 +226,7 @@ class ProtectedPagesPager extends ReverseChronologicalPager { $conds = $this->mConds; $conds[] = 'pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() ); $conds[] = 'page_id=pr_page'; + $conds[] = 'page_len>=' . $this->minsize; $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type ); if ( $this->level ) $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level ); @@ -228,7 +241,7 @@ class ProtectedPagesPager extends ReverseChronologicalPager { } function getIndexField() { - return 'page_len'; + return 'pr_id'; } } -- 2.20.1