dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f44b02d
)
findhooks.php: also check for Hooks::run, not just wfRunHooks. Hooks class has existe...
author
Jack Phoenix
<ashley@users.mediawiki.org>
Tue, 22 Mar 2011 20:44:26 +0000
(20:44 +0000)
committer
Jack Phoenix
<ashley@users.mediawiki.org>
Tue, 22 Mar 2011 20:44:26 +0000
(20:44 +0000)
maintenance/findhooks.php
patch
|
blob
|
history
diff --git
a/maintenance/findhooks.php
b/maintenance/findhooks.php
index
ee007ce
..
5c180be
100644
(file)
--- a/
maintenance/findhooks.php
+++ b/
maintenance/findhooks.php
@@
-39,8
+39,8
@@
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class FindHooks extends Maintenance {
public function __construct() {
parent::__construct();
class FindHooks extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
"Find hooks that are undocumented, missing, or just plain wrong"
;
- $this->addOption( 'online', 'Check against
mediaw
iki.org hook documentation' );
+ $this->mDescription =
'Find hooks that are undocumented, missing, or just plain wrong'
;
+ $this->addOption( 'online', 'Check against
MediaW
iki.org hook documentation' );
}
public function getDbType() {
}
public function getDbType() {
@@
-91,11
+91,13
@@
class FindHooks extends Maintenance {
$this->printArray( 'Unclear hook calls', $bad );
if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 )
$this->printArray( 'Unclear hook calls', $bad );
if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 )
+ {
$this->output( "Looks good!\n" );
$this->output( "Looks good!\n" );
+ }
}
/**
}
/**
- * Get the hook documentation, either locally or from
mediaw
iki.org
+ * Get the hook documentation, either locally or from
MediaW
iki.org
* @return array of documented hooks
*/
private function getHooksFromDoc( $doc ) {
* @return array of documented hooks
*/
private function getHooksFromDoc( $doc ) {
@@
-139,7
+141,7
@@
class FindHooks extends Maintenance {
private function getHooksFromFile( $file ) {
$content = file_get_contents( $file );
$m = array();
private function getHooksFromFile( $file ) {
$content = file_get_contents( $file );
$m = array();
- preg_match_all( '/
wfRunHooks
\(\s*([\'"])(.*?)\1/', $content, $m );
+ preg_match_all( '/
(wfRunHooks|Hooks\:\:run)
\(\s*([\'"])(.*?)\1/', $content, $m );
return $m[2];
}
return $m[2];
}
@@
-201,15
+203,19
@@
class FindHooks extends Maintenance {
/**
* Nicely output the array
/**
* Nicely output the array
- * @param $msg
A
message to show before the value
- * @param $arr An array
- * @param $sort Boolean
: whet
er to sort the array (Default: true)
+ * @param $msg
String: a
message to show before the value
+ * @param $arr A
rray: a
n array
+ * @param $sort Boolean
: wheth
er to sort the array (Default: true)
*/
private function printArray( $msg, $arr, $sort = true ) {
*/
private function printArray( $msg, $arr, $sort = true ) {
- if ( $sort ) asort( $arr );
- foreach ( $arr as $v ) $this->output( "$msg: $v\n" );
+ if ( $sort ) {
+ asort( $arr );
+ }
+ foreach ( $arr as $v ) {
+ $this->output( "$msg: $v\n" );
+ }
}
}
}
}
-$maintClass =
"FindHooks"
;
+$maintClass =
'FindHooks'
;
require_once( RUN_MAINTENANCE_IF_MAIN );
require_once( RUN_MAINTENANCE_IF_MAIN );