diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /maintenance/findHooks.php | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'maintenance/findHooks.php')
-rw-r--r-- | maintenance/findHooks.php | 56 |
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 ); } /** |