summaryrefslogtreecommitdiff
path: root/maintenance/findHooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/findHooks.php')
-rw-r--r--maintenance/findHooks.php56
1 files changed, 30 insertions, 26 deletions
diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php
index 36760d7e..5cf45367 100644
--- a/maintenance/findHooks.php
+++ b/maintenance/findHooks.php
@@ -91,6 +91,7 @@ class FindHooks extends Maintenance {
$IP . '/includes/jobqueue/',
$IP . '/includes/json/',
$IP . '/includes/logging/',
+ $IP . '/includes/mail/',
$IP . '/includes/media/',
$IP . '/includes/page/',
$IP . '/includes/parser/',
@@ -163,36 +164,39 @@ class FindHooks extends Maintenance {
* @return array 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'
+ $allhooks = $this->getHooksFromOnlineDocCategory( 'MediaWiki_hooks' );
+ $removed = $this->getHooksFromOnlineDocCategory( 'Removed_hooks' );
+ return array_diff( $allhooks, $removed );
+ }
+
+ /**
+ * @param string $title
+ * @return array
+ */
+ private function getHooksFromOnlineDocCategory( $title ) {
+ $params = array(
+ 'action' => 'query',
+ 'list' => 'categorymembers',
+ 'cmtitle' => "Category:$title",
+ 'cmlimit' => 500,
+ 'format' => 'json',
+ 'continue' => '',
);
- $allhookdata = unserialize( $allhookdata );
- $allhooks = array();
- foreach ( $allhookdata['query']['categorymembers'] as $page ) {
- $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
- if ( $found ) {
- $hook = str_replace( ' ', '_', $matches[1] );
- $allhooks[] = $hook;
+
+ $retval = array();
+ while ( true ) {
+ $json = Http::get( wfAppendQuery( 'http://www.mediawiki.org/w/api.php', $params ), array(), __METHOD__ );
+ $data = FormatJson::decode( $json, true );
+ foreach ( $data['query']['categorymembers'] as $page ) {
+ if ( preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $m ) ) {
+ $retval[] = str_replace( ' ', '_', $m[1] );
+ }
}
- }
- // Removed hooks
- $oldhookdata = Http::get(
- 'http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&'
- . 'cmtitle=Category:Removed_hooks&cmlimit=500&format=php'
- );
- $oldhookdata = unserialize( $oldhookdata );
- $removed = array();
- foreach ( $oldhookdata['query']['categorymembers'] as $page ) {
- $found = preg_match( '/Manual\:Hooks\/([a-zA-Z0-9- :]+)/', $page['title'], $matches );
- if ( $found ) {
- $hook = str_replace( ' ', '_', $matches[1] );
- $removed[] = $hook;
+ if ( !isset( $data['continue'] ) ) {
+ return $retval;
}
+ $params = array_replace( $params, $data['continue'] );
}
-
- return array_diff( $allhooks, $removed );
}
/**