* Added --online option to maintenance/findhooks.php to compare hooks with http:...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 9 May 2008 16:22:33 +0000 (16:22 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 9 May 2008 16:22:33 +0000 (16:22 +0000)
* Renamed GetAvailableRights to UserGetAllRights in docs/hooks.txt

docs/hooks.txt
maintenance/findhooks.php

index 5b02bff..bf8b396 100644 (file)
@@ -469,7 +469,7 @@ $isbn: ISBN to show information for
 $output: OutputPage object in use
 
 'BrokenLink': Before the HTML is created for a broken (i.e. red) link
-&$this: Linker instance
+&$linker: Linker instance
 $nt: the page title
 $query: the URL query string passed in
 &$u: the URL of this link
@@ -613,9 +613,6 @@ $fileVersions: array of undeleted versions. Empty if all versions were restored
 $user: user who performed the undeletion
 $reason: reason
 
-'GetAvailableRights': after calculating a list of all available rights
-&$rights: Array of rights, which may be added to.
-
 'GetBlockedStatus': after loading blocking status of an user from the database
 $user: user (object) being checked
 
@@ -1148,6 +1145,9 @@ $template: SimpleTemplate instance for the form
 $user: User to get groups for
 &$groups: Current effective groups
 
+'UserGetAllRights': after calculating a list of all available rights
+&$rights: Array of rights, which may be added to.
+
 'UserGetEmail': called when getting an user email address
 $user: User object
 &$email: email, change this to override local email
index ade6bbd..b24e961 100644 (file)
@@ -7,6 +7,9 @@
  * - hooks names in hooks.txt are at the beginning of a line and single quoted.
  * - hooks names in code are the first parameter of wfRunHooks.
  *
+ * if --online option is passed, the script will compare the hooks in the code
+ * with the ones at http://www.mediawiki.org/wiki/Manual:Hooks
+ *
  * Any instance of wfRunHooks that doesn't meet these parameters will be noted.
  *
  * @addtogroup Maintenance
@@ -30,10 +33,15 @@ $pathinc = array( $IP.'/includes/', $IP.'/includes/api/', $IP.'/includes/filerep
  * @return array of documented hooks
  */
 function getHooksFromDoc() {
-       global $doc;
-       $content = file_get_contents( $doc );
+       global $doc, $options;
        $m = array();
-       preg_match_all( "/\n'(.*?)'/", $content, $m);
+       if( isset( $options['online'] ) ){
+               $content = Http::get( 'http://www.mediawiki.org/w/index.php?title=Manual:Hooks&action=raw' );
+               preg_match_all( '/\[\[\/([a-zA-Z0-9-_:]+)\|/', $content, $m );
+       } else {
+               $content = file_get_contents( $doc );
+               preg_match_all( "/\n'(.*?)'/", $content, $m );
+       }
        return $m[1];
 }