* @copyright Copyright © Ashar voultoiz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later
*/
-
+
/** This is a command line script*/
include('commandLine.inc');
-
-
+
# GLOBALS
-
+
$doc = $IP . '/docs/hooks.txt';
$pathinc = array( $IP.'/includes/', $IP.'/includes/api/', $IP.'/includes/filerepo/', $IP.'/languages/', $IP.'/maintenance/', $IP.'/skins/' );
-
+
# FUNCTIONS
-
+
/**
* @return array of documented hooks
*/
preg_match_all( "/\n'(.*?)'/", $content, $m);
return $m[1];
}
-
+
/**
* Get hooks from a PHP file
* @param $file Full filename to the PHP file.
preg_match_all( '/wfRunHooks\(\s*([\'"])(.*?)\1/', $content, $m);
return $m[2];
}
-
+
/**
* Get hooks from the source code.
* @param $path Directory where the include files can be found
}
return $hooks;
}
-
+
/**
* Get bad hooks (where the hook name could not be determined) from a PHP file
* @param $file Full filename to the PHP file.
}
return $list;
}
-
+
/**
* Get bad hooks from the source code.
* @param $path Directory where the include files can be found
}
return $hooks;
}
-
+
/**
* Nicely output the array
* @param $msg A message to show before the value
if($sort) asort($arr);
foreach($arr as $v) echo "$msg: $v\n";
}
-
-
+
# MAIN
-
+
$documented = getHooksFromDoc($doc);
$potential = array();
$bad = array();
$potential = array_merge( $potential, getHooksFromPath( $dir ) );
$bad = array_merge( $bad, getBadHooksFromPath( $dir ) );
}
-
+
$potential = array_unique( $potential );
$bad = array_unique( $bad );
$todo = array_diff( $potential, $documented );
$deprecated = array_diff( $documented, $potential );
-
+
// let's show the results:
printArray('undocumented', $todo );
printArray('not found', $deprecated );