Index: trunk/phase3/maintenance/findhooks.php |
— | — | @@ -39,8 +39,8 @@ |
40 | 40 | class FindHooks extends Maintenance { |
41 | 41 | public function __construct() { |
42 | 42 | parent::__construct(); |
43 | | - $this->mDescription = "Find hooks that are undocumented, missing, or just plain wrong"; |
44 | | - $this->addOption( 'online', 'Check against mediawiki.org hook documentation' ); |
| 43 | + $this->mDescription = 'Find hooks that are undocumented, missing, or just plain wrong'; |
| 44 | + $this->addOption( 'online', 'Check against MediaWiki.org hook documentation' ); |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getDbType() { |
— | — | @@ -91,11 +91,13 @@ |
92 | 92 | $this->printArray( 'Unclear hook calls', $bad ); |
93 | 93 | |
94 | 94 | if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 ) |
| 95 | + { |
95 | 96 | $this->output( "Looks good!\n" ); |
| 97 | + } |
96 | 98 | } |
97 | 99 | |
98 | 100 | /** |
99 | | - * Get the hook documentation, either locally or from mediawiki.org |
| 101 | + * Get the hook documentation, either locally or from MediaWiki.org |
100 | 102 | * @return array of documented hooks |
101 | 103 | */ |
102 | 104 | private function getHooksFromDoc( $doc ) { |
— | — | @@ -139,7 +141,7 @@ |
140 | 142 | private function getHooksFromFile( $file ) { |
141 | 143 | $content = file_get_contents( $file ); |
142 | 144 | $m = array(); |
143 | | - preg_match_all( '/wfRunHooks\(\s*([\'"])(.*?)\1/', $content, $m ); |
| 145 | + preg_match_all( '/(wfRunHooks|Hooks\:\:run)\(\s*([\'"])(.*?)\1/', $content, $m ); |
144 | 146 | return $m[2]; |
145 | 147 | } |
146 | 148 | |
— | — | @@ -201,15 +203,19 @@ |
202 | 204 | |
203 | 205 | /** |
204 | 206 | * Nicely output the array |
205 | | - * @param $msg A message to show before the value |
206 | | - * @param $arr An array |
207 | | - * @param $sort Boolean : wheter to sort the array (Default: true) |
| 207 | + * @param $msg String: a message to show before the value |
| 208 | + * @param $arr Array: an array |
| 209 | + * @param $sort Boolean: whether to sort the array (Default: true) |
208 | 210 | */ |
209 | 211 | private function printArray( $msg, $arr, $sort = true ) { |
210 | | - if ( $sort ) asort( $arr ); |
211 | | - foreach ( $arr as $v ) $this->output( "$msg: $v\n" ); |
| 212 | + if ( $sort ) { |
| 213 | + asort( $arr ); |
| 214 | + } |
| 215 | + foreach ( $arr as $v ) { |
| 216 | + $this->output( "$msg: $v\n" ); |
| 217 | + } |
212 | 218 | } |
213 | 219 | } |
214 | 220 | |
215 | | -$maintClass = "FindHooks"; |
| 221 | +$maintClass = 'FindHooks'; |
216 | 222 | require_once( RUN_MAINTENANCE_IF_MAIN ); |