From 480ae6a7e3adc4d055c1b2d5bc64f235f7313c01 Mon Sep 17 00:00:00 2001 From: Huji Date: Mon, 11 Feb 2008 09:37:39 +0000 Subject: [PATCH] (bug 12301) Allow maintenance/findhooks.php to search hooks in multiple directories. Applying the patch created by Alexandre Emsenhuber (ialex) --- RELEASE-NOTES | 1 + maintenance/findhooks.php | 81 +++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 22f5280220..249f36b5b2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -380,6 +380,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN in parentheses after them claimed otherwise * (bug 12732) Fix installer and searching to handle built-in tsearch2 for Postgres. * (bug 12784) Change "bool" types to smallint to handle Postgres 8.3 strictness. +* (bug 12301) Allow maintenance/findhooks.php to search hooks in multiple directories. == Parser changes in 1.12 == diff --git a/maintenance/findhooks.php b/maintenance/findhooks.php index e116b834a4..8433571db6 100644 --- a/maintenance/findhooks.php +++ b/maintenance/findhooks.php @@ -15,22 +15,18 @@ * @copyright Copyright © Ashar voultoiz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later */ - + /** This is a command line script*/ include('commandLine.inc'); - - + + # GLOBALS - + $doc = $IP . '/docs/hooks.txt'; -$pathinc = $IP . '/includes/'; -$pathfile = $IP . '/includes/filerepo/LocalFile.php'; -$pathlang = $IP . '/languages/Language.php'; -$pathskin = $IP . '/skins/MonoBook.php'; - - +$pathinc = array( $IP.'/includes/', $IP.'/includes/api/', $IP.'/includes/filerepo/', $IP.'/languages/', $IP.'/maintenance/', $IP.'/skins/' ); + # FUNCTIONS - + /** * @return array of documented hooks */ @@ -41,7 +37,7 @@ function getHooksFromDoc() { preg_match_all( "/\n'(.*?)'/", $content, $m); return $m[1]; } - + /** * Get hooks from a PHP file * @param $file Full filename to the PHP file. @@ -53,7 +49,7 @@ function getHooksFromFile( $file ) { preg_match_all( '/wfRunHooks\(\s*([\'"])(.*?)\1/', $content, $m); return $m[2]; } - + /** * Get hooks from the source code. * @param $path Directory where the include files can be found @@ -71,7 +67,7 @@ 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. @@ -82,9 +78,13 @@ function getBadHooksFromFile( $file ) { $m = array(); # We want to skip the "function wfRunHooks()" one. :) preg_match_all( '/(?