diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /maintenance/findHooks.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'maintenance/findHooks.php')
-rw-r--r-- | maintenance/findHooks.php | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index 5996fd3a..cb582857 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -12,7 +12,7 @@ * * Any instance of wfRunHooks that doesn't meet these parameters will be noted. * - * Copyright © Ashar Voultoiz + * Copyright © Antoine Musso * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ * * @file * @ingroup Maintenance - * @author Ashar Voultoiz <hashar at free dot fr> + * @author Antoine Musso <hashar at free dot fr> */ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); @@ -59,6 +59,7 @@ class FindHooks extends Maintenance { $IP . '/includes/actions/', $IP . '/includes/api/', $IP . '/includes/cache/', + $IP . '/includes/context/', $IP . '/includes/db/', $IP . '/includes/diff/', $IP . '/includes/filerepo/', @@ -106,6 +107,29 @@ class FindHooks extends Maintenance { */ private function getHooksFromDoc( $doc ) { if ( $this->hasOption( 'online' ) ) { + return $this->getHooksFromOnlineDoc( ); + } else { + return $this->getHooksFromLocalDoc( $doc ); + } + } + + /** + * Get hooks from a local file (for example docs/hooks.txt) + * @param $doc string: filename to look in + * @return array of documented hooks + */ + private function getHooksFromLocalDoc( $doc ) { + $m = array(); + $content = file_get_contents( $doc ); + preg_match_all( "/\n'(.*?)'/", $content, $m ); + return array_unique( $m[1] ); + } + + /** + * Get hooks from www.mediawiki.org using the API + * @return array of documented hooks + */ + private function getHooksFromOnlineDoc( ) { // All hooks $allhookdata = Http::get( 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:MediaWiki_hooks&cmlimit=500&format=php' ); $allhookdata = unserialize( $allhookdata ); @@ -129,12 +153,6 @@ class FindHooks extends Maintenance { } } return array_diff( $allhooks, $removed ); - } else { - $m = array(); - $content = file_get_contents( $doc ); - preg_match_all( "/\n'(.*?)'/", $content, $m ); - return array_unique( $m[1] ); - } } /** |