X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiHelp.php;h=d94132a59d9498c3ba60bda8de56e138fd8620d4;hb=53f96171cccb378824f8708c3fe41cfb0fcdd62e;hp=d16fd29a96d0d4ba658feca809b077cf82e960f2;hpb=ff442ae79f1960730b8e5f5761f0d0ca591030ef;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index d16fd29a96..d94132a59d 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -1,9 +1,8 @@ @gmail.com * @@ -19,15 +18,12 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html + * + * @file */ -if ( !defined( 'MEDIAWIKI' ) ) { - // Eclipse helper - will be ignored in production - require_once( 'ApiBase.php' ); -} - /** * This is a simple class to handle action=help * @@ -45,13 +41,13 @@ class ApiHelp extends ApiBase { public function execute() { // Get parameters $params = $this->extractRequestParams(); - + if ( !isset( $params['modules'] ) && !isset( $params['querymodules'] ) ) { $this->dieUsage( '', 'help' ); } - + $this->getMain()->setHelp(); - + $result = $this->getResult(); $queryObj = new ApiQuery( $this->getMain(), 'query' ); $r = array(); @@ -79,27 +75,32 @@ class ApiHelp extends ApiBase { } $module = new $qmodArr[$qm]( $this, $qm ); $type = $queryObj->getModuleType( $qm ); - + if ( $type === null ) { $r[] = array( 'name' => $qm, 'missing' => '' ); continue; } - + $r[] = $this->buildModuleHelp( $module, $type ); } } $result->setIndexedTagName( $r, 'module' ); $result->addValue( null, $this->getModuleName(), $r ); } - + + /** + * @param $module ApiBase + * @param $type String What type of request is this? e.g. action, query, list, prop, meta, format + * @return string + */ private function buildModuleHelp( $module, $type ) { $msg = ApiMain::makeHelpMsgHeader( $module, $type ); - + $msg2 = $module->makeHelpMsg(); if ( $msg2 !== false ) { $msg .= $msg2; } - + return $msg; } @@ -110,7 +111,7 @@ class ApiHelp extends ApiBase { public function isReadMode() { return false; } - + public function getAllowedParams() { return array( 'modules' => array( @@ -130,19 +131,29 @@ class ApiHelp extends ApiBase { } public function getDescription() { - return array( - 'Display this help screen. Or the help screen for the specified module' - ); + return 'Display this help screen. Or the help screen for the specified module'; } - - protected function getExamples() { + + public function getExamples() { return array( 'Whole help page:', ' api.php?action=help', - 'Module help page:', + 'Module (action) help page:', ' api.php?action=help&modules=protect', - 'Query modules help page:', + 'Query (list) modules help page:', ' api.php?action=help&querymodules=categorymembers', + 'Query (prop) modules help page:', + ' api.php?action=help&querymodules=info', + 'Query (meta) modules help page:', + ' api.php?action=help&querymodules=siteinfo', + ); + } + + public function getHelpUrls() { + return array( + 'https://www.mediawiki.org/wiki/API:Main_page', + 'https://www.mediawiki.org/wiki/API:FAQ', + 'https://www.mediawiki.org/wiki/API:Quick_start_guide', ); }