Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


brion at wikimedia

May 17, 2008, 9:10 AM

Post #1 of 5 (135 views)
Permalink
Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes

aaron[at]svn.wikimedia.org wrote:
> $limit = $wgRequest->getInt( 'limit', 50 );
> + global $wgFeedLimit;
> + if( $limit > $wgFeedLimit ) {
> + $limit = $wgFeedLimit;
> + }

This is a good candidate for refactoring into a common function...

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


dan_the_man at telus

May 17, 2008, 9:31 AM

Post #2 of 5 (131 views)
Permalink
Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes [In reply to]

Something like a evil step brother to wfSetVar and wfSetBit?

function wfSetVarIf( &$dest, $source, $condition = '!=' ) {
$temp = $dest;
if ( !is_null( $source ) ) {
$set = false;
switch($condition) {
case '!=':if($dest != $source) $dest = $source;break;
case '>':if($dest > $source) $dest = $source;break;
case '>=':if($dest >= $source) $dest = $source;break;
case '<':if($dest < $source) $dest = $source;break;
case '<=':if($dest <= $source) $dest = $source;break;
}
}
return $temp;
}

wfSetVarIf( $limit, $wgFeedLimit, '>' );

~Daniel Friesen(Dantman) of:
-The Gaiapedia (http://gaia.wikia.com)
-Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG)
-and Wiki-Tools.com (http://wiki-tools.com)

Brion Vibber wrote:
> aaron[at]svn.wikimedia.org wrote:
>
>> $limit = $wgRequest->getInt( 'limit', 50 );
>> + global $wgFeedLimit;
>> + if( $limit > $wgFeedLimit ) {
>> + $limit = $wgFeedLimit;
>> + }
>>
>
> This is a good candidate for refactoring into a common function...
>
> -- brion
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l[at]lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

May 17, 2008, 11:50 AM

Post #3 of 5 (131 views)
Permalink
Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes [In reply to]

DanTMan wrote:
> Something like a evil step brother to wfSetVar and wfSetBit?

Nope, more like a nice feed-specific version of
WebRequest::getLimitOffset() so the limit checks don't have to be
duplicated in fifty places.

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


wiki at jeltezeilstra

May 18, 2008, 7:47 AM

Post #4 of 5 (120 views)
Permalink
Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes [In reply to]

Op Saturday 17 May 2008 18:10:58 schreef Brion Vibber:
> aaron[at]svn.wikimedia.org wrote:
> > $limit = $wgRequest->getInt( 'limit', 50 );
> > + global $wgFeedLimit;
> > + if( $limit > $wgFeedLimit ) {
> > + $limit = $wgFeedLimit;
> > + }
>
> This is a good candidate for refactoring into a common function...

How about $limit = min( $limit, $wgFeedLimit ); or $limit = min(
$wgRequest->getInt( 'limit', 50 ), $wgFeedLimit ); ?

Jelte

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jschulz_4587 at msn

May 18, 2008, 9:26 AM

Post #5 of 5 (119 views)
Permalink
Re: [MediaWiki-CVS] SVN: [34942] trunk/phase3/includes [In reply to]

Sounds good to me.


Jelte-2 wrote:
>
> Op Saturday 17 May 2008 18:10:58 schreef Brion Vibber:
>> aaron[at]svn.wikimedia.org wrote:
>> > $limit = $wgRequest->getInt( 'limit', 50 );
>> > + global $wgFeedLimit;
>> > + if( $limit > $wgFeedLimit ) {
>> > + $limit = $wgFeedLimit;
>> > + }
>>
>> This is a good candidate for refactoring into a common function...
>
> How about $limit = min( $limit, $wgFeedLimit ); or $limit = min(
> $wgRequest->getInt( 'limit', 50 ), $wgFeedLimit ); ?
>
> Jelte
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l[at]lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
>

--
View this message in context: http://www.nabble.com/Re%3A--MediaWiki-CVS--SVN%3A--34942--trunk-phase3-includes-tp17293407p17304784.html
Sent from the Wikipedia Developers mailing list archive at Nabble.com.


_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.