* Added --online option to maintenance/findhooks.php to compare hooks with http://www.mediawiki.org/wiki/Manual:Hooks

* Renamed GetAvailableRights to UserGetAllRights in docs/hooks.txt
This commit is contained in:
Alexandre Emsenhuber 2008-05-09 16:22:33 +00:00
parent dee7ab1a1a
commit 5087bbbbc5
2 changed files with 15 additions and 7 deletions

View 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

View 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];
}