From: Aryeh Gregor Date: Tue, 4 Dec 2007 02:08:45 +0000 (+0000) Subject: maintenance/findhooks.php should find and report wfRunHooks() instances that it can... X-Git-Tag: 1.31.0-rc.0~50566 X-Git-Url: https://git.cyclocoop.org/%20%27.%28%24debut%20%20%20%24par_page%29.%27?a=commitdiff_plain;h=70014f3f731f58cff1c45fae27b41b8f57009928;p=lhc%2Fweb%2Fwiklou.git maintenance/findhooks.php should find and report wfRunHooks() instances that it can't understand, instead of ignoring them. Lousy cut-and-paste job, but who cares, it's like 100 lines anyway. --- diff --git a/maintenance/findhooks.php b/maintenance/findhooks.php index e51626c2b7..0240b63155 100644 --- a/maintenance/findhooks.php +++ b/maintenance/findhooks.php @@ -7,6 +7,8 @@ * - 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. * + * Any instance of wfRunHooks that doesn't meet these parameters will be noted. + * * @addtogroup Maintenance * * @author Ashar Voultoiz @@ -38,7 +40,7 @@ function getHooksFromDoc() { } /** - * Get hooks from a php file + * Get hooks from a PHP file * @param $file Full filename to the PHP file. * @return array of hooks found. */ @@ -67,6 +69,37 @@ function getHooksFromPath( $path ) { return $hooks; } +/** + * Get bad hooks (where the hook name could not be determined) from a PHP file + * @param $file Full filename to the PHP file. + * @return array of bad wfRunHooks() lines + */ +function getBadHooksFromFile( $file ) { + $content = file_get_contents( $file ); + $m = array(); + # We want to skip the "function wfRunHooks()" one. :) + preg_match_all( '/(?