Merge "Fixes related to WikiPage::triggerOpportunisticLinksUpdate()"
[lhc/web/wiklou.git] / maintenance / findHooks.php
index 3414679..0925406 100644 (file)
@@ -122,9 +122,9 @@ class FindHooks extends Maintenance {
                }
 
                $potential = array_unique( $potential );
-               $bad = array_unique( $bad );
-               $todo = array_diff( $potential, $documented );
-               $deprecated = array_diff( $documented, $potential );
+               $bad = array_diff( array_unique( $bad ), self::$ignore );
+               $todo = array_diff( $potential, $documented, self::$ignore );
+               $deprecated = array_diff( $documented, $potential, self::$ignore );
 
                // let's show the results:
                $this->printArray( 'Undocumented', $todo );
@@ -133,6 +133,8 @@ class FindHooks extends Maintenance {
 
                if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 ) {
                        $this->output( "Looks good!\n" );
+               } else {
+                       $this->error( 'The script finished with errors.', 1 );
                }
        }
 
@@ -188,7 +190,11 @@ class FindHooks extends Maintenance {
 
                $retval = array();
                while ( true ) {
-                       $json = Http::get( wfAppendQuery( 'http://www.mediawiki.org/w/api.php', $params ), array(), __METHOD__ );
+                       $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 ) ) {
@@ -290,9 +296,7 @@ class FindHooks extends Maintenance {
                }
 
                foreach ( $arr as $v ) {
-                       if ( !in_array( $v, self::$ignore ) ) {
-                               $this->output( "$msg: $v\n" );
-                       }
+                       $this->output( "$msg: $v\n" );
                }
        }
 }