X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQuerySearch.php;h=034983026fbda278d4eaacba21d8b9839534485d;hb=97e9c1e0b4b366c0b8b44b254acee12749020ba4;hp=ed6c3cb6191d7ef1427c99b571e664c969138cd5;hpb=bf99725d8db8e842be3d920be43726425e26631e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index ed6c3cb619..034983026f 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -4,7 +4,7 @@ * * Created on July 30, 2007 * - * Copyright © 2007 Yuri Astrakhan @gmail.com + * Copyright © 2007 Yuri Astrakhan "@gmail.com" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,6 +93,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } if ( is_null( $matches ) ) { $this->dieUsage( "{$what} search is disabled", "search-{$what}-disabled" ); + } elseif ( $matches instanceof Status && !$matches->isGood() ) { + $this->dieUsage( $matches->getWikiText(), 'search-error' ); } $apiResult = $this->getResult(); @@ -168,7 +170,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } } if ( isset( $prop['hasrelated'] ) && $result->hasRelated() ) { - $vals['hasrelated'] = ""; + $vals['hasrelated'] = ''; } // Add item to results and see whether it fits @@ -205,7 +207,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { ApiBase::PARAM_REQUIRED => true ), 'namespace' => array( - ApiBase::PARAM_DFLT => 0, + ApiBase::PARAM_DFLT => NS_MAIN, ApiBase::PARAM_TYPE => 'namespace', ApiBase::PARAM_ISMULTI => true, ), @@ -345,6 +347,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { return array_merge( parent::getPossibleErrors(), array( array( 'code' => 'search-text-disabled', 'info' => 'text search is disabled' ), array( 'code' => 'search-title-disabled', 'info' => 'title search is disabled' ), + array( 'code' => 'search-error', 'info' => 'search error has occurred' ), ) ); } @@ -359,8 +362,4 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Search'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } }