From 70014f3f731f58cff1c45fae27b41b8f57009928 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 4 Dec 2007 02:08:45 +0000 Subject: [PATCH] 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. --- maintenance/findhooks.php | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) 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( '/(?