FindHooks Class Reference

Simple script that try to find documented hook and hooks actually in the code and show what's missing. More...

Inherits Maintenance.

List of all members.

Public Member Functions

 __construct ()
 Default constructor.
 getDbType ()
 Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB.
 execute ()
 Do the actual work.

Private Member Functions

 getHooksFromDoc ($doc)
 Get the hook documentation, either locally or from mediawiki.org.
 getHooksFromFile ($file)
 Get hooks from a PHP file.
 getHooksFromPath ($path)
 Get hooks from the source code.
 getBadHooksFromFile ($file)
 Get bad hooks (where the hook name could not be determined) from a PHP file.
 getBadHooksFromPath ($path)
 Get bad hooks from the source code.
 printArray ($msg, $arr, $sort=true)
 Nicely output the array.


Detailed Description

Simple script that try to find documented hook and hooks actually in the code and show what's missing.

This script assumes that:

if --online option is passed, the script will compare the hooks in the code with the ones at http://www.mediawiki.org/wiki/Manual:Hooks

Any instance of wfRunHooks that doesn't meet these parameters will be noted.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Author:
Ashar Voultoiz <hashar@altern.org> Copyright © Ashar voultoiz http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later

Definition at line 39 of file findhooks.php.


Constructor & Destructor Documentation

FindHooks::__construct (  ) 

Default constructor.

Children should call this if implementing their own constructors

Reimplemented from Maintenance.

Definition at line 40 of file findhooks.php.

References Maintenance::addOption().


Member Function Documentation

FindHooks::execute (  ) 

Do the actual work.

All child classes will need to implement this

Reimplemented from Maintenance.

Definition at line 50 of file findhooks.php.

References $IP, getBadHooksFromPath(), getHooksFromDoc(), getHooksFromPath(), Maintenance::output(), and printArray().

FindHooks::getBadHooksFromFile ( file  )  [private]

Get bad hooks (where the hook name could not be determined) from a PHP file.

Parameters:
$file Full filename to the PHP file.
Returns:
array of bad wfRunHooks() lines

Definition at line 163 of file findhooks.php.

Referenced by getBadHooksFromPath().

FindHooks::getBadHooksFromPath ( path  )  [private]

Get bad hooks from the source code.

Parameters:
$path Directory where the include files can be found
Returns:
array of bad wfRunHooks() lines

Definition at line 180 of file findhooks.php.

References $path, and getBadHooksFromFile().

Referenced by execute().

FindHooks::getDbType (  ) 

Does the script need different DB access? By default, we give Maintenance scripts normal rights to the DB.

Sometimes, a script needs admin rights access for a reason and sometimes they want no access. Subclasses should override and return one of the following values, as needed: Maintenance::DB_NONE - For no DB access at all Maintenance::DB_STD - For normal DB access, default Maintenance::DB_ADMIN - For admin DB access

Returns:
int

Reimplemented from Maintenance.

Definition at line 46 of file findhooks.php.

References Maintenance::DB_NONE.

FindHooks::getHooksFromDoc ( doc  )  [private]

Get the hook documentation, either locally or from mediawiki.org.

Returns:
array of documented hooks

Definition at line 95 of file findhooks.php.

References $page, Http::get(), and Maintenance::hasOption().

Referenced by execute().

FindHooks::getHooksFromFile ( file  )  [private]

Get hooks from a PHP file.

Parameters:
$file Full filename to the PHP file.
Returns:
array of hooks found.

Definition at line 133 of file findhooks.php.

Referenced by getHooksFromPath().

FindHooks::getHooksFromPath ( path  )  [private]

Get hooks from the source code.

Parameters:
$path Directory where the include files can be found
Returns:
array of hooks found.

Definition at line 145 of file findhooks.php.

References $path, and getHooksFromFile().

Referenced by execute().

FindHooks::printArray ( msg,
arr,
sort = true 
) [private]

Nicely output the array.

Parameters:
$msg A message to show before the value
$arr An array
$sort Boolean : wheter to sort the array (Default: true)

Definition at line 200 of file findhooks.php.

References Maintenance::output().

Referenced by execute().


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:38 2011 for MediaWiki by  doxygen 1.5.9