r61259 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61258‎ | r61259 | r61260 >
Date:17:23, 19 January 2010
Author:reedy
Status:ok
Tags:
Comment:
Move position of $prlevel array stripping, and check isset

action=query&list=allpages&apfrom=B&apprtype=edit

Gave

Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /home/reedy/mediawiki/trunk/phase3/includes/api/ApiQueryAllpages.php on line 99
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllpages.php
@@ -95,10 +95,13 @@
9696 $this->addWhere( 'pr_expiry>' . $db->addQuotes( $db->timestamp() ) );
9797 $this->addWhereFld( 'pr_type', $params['prtype'] );
9898
99 - // Remove the empty string and '*' from the prlevel array
100 - $prlevel = array_diff( $params['prlevel'], array( '', '*' ) );
101 - if ( !empty( $prlevel ) )
102 - $this->addWhereFld( 'pr_level', $prlevel );
 99+ if ( isset ( $params['prlevel'] ) ) {
 100+ // Remove the empty string and '*' from the prlevel array
 101+ $prlevel = array_diff( $params['prlevel'], array( '', '*' ) );
 102+
 103+ if ( !empty( $prlevel ) )
 104+ $this->addWhereFld( 'pr_level', $prlevel );
 105+ }
103106 if ( $params['prfiltercascade'] == 'cascading' )
104107 $this->addWhereFld( 'pr_cascade', 1 );
105108 else if ( $params['prfiltercascade'] == 'noncascading' )

Status & tagging log