$IP . '/includes/revisiondelete/',
$IP . '/includes/search/',
$IP . '/includes/site/',
+ $IP . '/includes/skins/',
$IP . '/includes/specialpage/',
$IP . '/includes/specials/',
$IP . '/includes/upload/',
$IP . '/tests/',
$IP . '/tests/parser/',
$IP . '/tests/phpunit/suites/',
- $IP . '/skins/',
- $IP . '/skins/MonoBook/',
- $IP . '/skins/Vector/',
);
foreach ( $pathinc as $dir ) {
/**
* Get the hook documentation, either locally or from MediaWiki.org
- * @return Array of documented hooks
+ * @param string $doc
+ * @return array Array of documented hooks
*/
private function getHooksFromDoc( $doc ) {
if ( $this->hasOption( 'online' ) ) {
/**
* Get hooks from a local file (for example docs/hooks.txt)
* @param string $doc Filename to look in
- * @return Array of documented hooks
+ * @return array Array of documented hooks
*/
private function getHooksFromLocalDoc( $doc ) {
$m = array();
/**
* Get hooks from www.mediawiki.org using the API
- * @return Array of documented hooks
+ * @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 ) );
+ $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 );
}
/**
* Get hooks from a PHP file
* @param string $file Full filename to the PHP file.
- * @return Array of hooks found.
+ * @return array Array of hooks found
*/
private function getHooksFromFile( $file ) {
$content = file_get_contents( $file );
/**
* Get hooks from the source code.
* @param string $path Directory where the include files can be found
- * @return Array of hooks found.
+ * @return array Array of hooks found
*/
private function getHooksFromPath( $path ) {
$hooks = array();
/**
* Get bad hooks (where the hook name could not be determined) from a PHP file
* @param string $file Full filename to the PHP file.
- * @return Array of bad wfRunHooks() lines
+ * @return array Array of bad wfRunHooks() lines
*/
private function getBadHooksFromFile( $file ) {
$content = file_get_contents( $file );
/**
* Get bad hooks from the source code.
* @param string $path Directory where the include files can be found
- * @return Array of bad wfRunHooks() lines
+ * @return array Array of bad wfRunHooks() lines
*/
private function getBadHooksFromPath( $path ) {
$hooks = array();