(bug 15706) Empty values for apprtype and apprlevel are now silently ignored rather than causing an exception

This commit is contained in:
Roan Kattouw 2008-09-25 14:50:09 +00:00
parent b3d5508c10
commit 352d3f6dfb
2 changed files with 6 additions and 3 deletions

View file

@ -271,6 +271,8 @@ The following extensions are migrated into MediaWiki 1.14:
* action=protect checks for invalid protection types and levels
* (bug 15673) Added indentation to format=wddxfm output and improved built-in
WDDX formatter to resemble PHP's more
* (bug 15706) Empty values for apprtype and apprlevel are now silently ignored
rather than causing an exception
=== Languages updated in 1.14 ===

View file

@ -79,14 +79,15 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
}
// Page protection filtering
if (isset ($params['prtype'])) {
if (!empty ($params['prtype'])) {
$this->addTables('page_restrictions');
$this->addWhere('page_id=pr_page');
$this->addWhere('pr_expiry>' . $db->addQuotes($db->timestamp()));
$this->addWhereFld('pr_type', $params['prtype']);
$prlevel = $params['prlevel'];
if (!is_null($prlevel) && $prlevel != '' && $prlevel != '*')
// Remove the empty string and '*' from the prlevel array
$prlevel = array_diff($params['prlevel'], array('', '*'));
if (!empty($prlevel))
$this->addWhereFld('pr_level', $prlevel);
$this->addOption('DISTINCT');