From: Kunal Mehta Date: Mon, 25 Aug 2014 05:15:05 +0000 (-0700) Subject: findHooks: Exit with a status code of 1 if issues are found X-Git-Tag: 1.31.0-rc.0~10718 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=8fb5c380bdd33445545a2ac3902644c643a1838f;p=lhc%2Fweb%2Fwiklou.git findHooks: Exit with a status code of 1 if issues are found This will make it easier to have something automated run the script since it can check the exit code of the script so see if any issues were found. Also fixed the printing of "Looks good!", which wasn't happening if a hook was being ignored. The check for ignoring was moved up and out of the print logic. Change-Id: I683a131a804d4fac9a21f386b2756e050219d392 --- diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index 34146793d2..114366bca6 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -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 ); } } @@ -290,9 +292,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" ); } } }