FU r106752: use "media-" instead of "images-" in container names. Long live books...
[lhc/web/wiklou.git] / includes / api / ApiHelp.php
index d16fd29..d94132a 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-
 /**
- * Created on Sep 6, 2006
  *
- * API for MediaWiki 1.8+
+ *
+ * Created on Sep 6, 2006
  *
  * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  *
  * 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',
                );
        }