From: Alexandre Emsenhuber Date: Fri, 9 May 2008 16:22:33 +0000 (+0000) Subject: * Added --online option to maintenance/findhooks.php to compare hooks with http:... X-Git-Tag: 1.31.0-rc.0~47776 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=5087bbbbc5b21f9f2a64ea4321aa940bdc07fcca;p=lhc%2Fweb%2Fwiklou.git * Added --online option to maintenance/findhooks.php to compare hooks with mediawiki.org/wiki/Manual:Hooks * Renamed GetAvailableRights to UserGetAllRights in docs/hooks.txt --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 5b02bfff47..bf8b39653f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/maintenance/findhooks.php b/maintenance/findhooks.php index ade6bbd92e..b24e9617d9 100644 --- a/maintenance/findhooks.php +++ b/maintenance/findhooks.php @@ -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]; }