summaryrefslogtreecommitdiff
path: root/maintenance/findHooks.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
commit1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch)
treef1fdd326034e05177596851be6a7127615d81498 /maintenance/findHooks.php
parent9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff)
parentf6d65e533c62f6deb21342d4901ece24497b433e (diff)
Merge commit 'f6d65'
# Conflicts: # skins/ArchLinux/ArchLinux.php
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 );
}
/**