Merge "Add PreferencesFormPreSave hook"
[lhc/web/wiklou.git] / maintenance / findHooks.php
index 74eb971..32ecb1d 100644 (file)
@@ -42,6 +42,11 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class FindHooks extends Maintenance {
+       /*
+        * Hooks that are ignored
+        */
+       protected static $ignore = array( 'testRunLegacyHooks' );
+
        public function __construct() {
                parent::__construct();
                $this->mDescription = 'Find hooks that are undocumented, missing, or just plain wrong';
@@ -143,7 +148,7 @@ class FindHooks extends Maintenance {
        private function getHooksFromLocalDoc( $doc ) {
                        $m = array();
                        $content = file_get_contents( $doc );
-                       preg_match_all( "/\n'(.*?)'/", $content, $m );
+                       preg_match_all( "/\n'(.*?)':/", $content, $m );
                        return array_unique( $m[1] );
        }
 
@@ -255,8 +260,11 @@ class FindHooks extends Maintenance {
                if ( $sort ) {
                        asort( $arr );
                }
+
                foreach ( $arr as $v ) {
-                       $this->output( "$msg: $v\n" );
+                       if ( !in_array( $v, self::$ignore ) ) {
+                               $this->output( "$msg: $v\n" );
+                       }
                }
        }
 }