MediaWiki  REL1_19
CheckSyntax Class Reference
Inheritance diagram for CheckSyntax:
Collaboration diagram for CheckSyntax:

List of all members.

Public Member Functions

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

Public Attributes

 $mFailures = array()
 $mNoStyleCheckPaths = array()
 $mWarnings = array()

Private Member Functions

 addDirectoryContent ($dir)
 Add all suitable files in given directory or its subdirectories to the file list.
 addFileOrDir ($path)
 Add given file to file list, or, if it's a directory, add its content.
 addPath ($path)
 Add given path to file list, searching it in include path if needed.
 buildFileList ()
 Build the list of files we'll check for syntax errors.
 checkEvilToken ($file, $tokens, $evilToken, $desc)
 checkFileWithCli ($file)
 Check a file for syntax errors using php -l.
 checkFileWithParsekit ($file)
 Check a file for syntax errors using Parsekit.
 checkForMistakes ($file)
 Check a file for non-fatal coding errors, such as byte-order marks in the beginning or pointless ?> closing tags at the end.
 checkRegex ($file, $text, $regex, $desc)
 isSuitableFile ($file)
 Returns true if $file is of a type we can check.

Private Attributes

 $mFiles = array()
 $mIgnorePaths = array()

Detailed Description

Definition at line 26 of file checkSyntax.php.


Constructor & Destructor Documentation

Default constructor.

Children should call this *first* if implementing their own constructors

Reimplemented from Maintenance.

Definition at line 32 of file checkSyntax.php.

References Maintenance\addOption().

Here is the call graph for this function:


Member Function Documentation

CheckSyntax::addDirectoryContent ( dir) [private]

Add all suitable files in given directory or its subdirectories to the file list.

Parameters:
$dirString: directory to process

Definition at line 215 of file checkSyntax.php.

References $dir, $file, and isSuitableFile().

Referenced by addFileOrDir(), and buildFileList().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::addFileOrDir ( path) [private]

Add given file to file list, or, if it's a directory, add its content.

Parameters:
$pathstring
Returns:
bool

Definition at line 199 of file checkSyntax.php.

References $path, and addDirectoryContent().

Referenced by addPath().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::addPath ( path) [private]

Add given path to file list, searching it in include path if needed.

Parameters:
$pathstring
Returns:
bool

Definition at line 189 of file checkSyntax.php.

References $IP, $path, and addFileOrDir().

Referenced by buildFileList().

Here is the call graph for this function:

Here is the caller graph for this function:

Build the list of files we'll check for syntax errors.

Definition at line 74 of file checkSyntax.php.

References $f, $file, $IP, $matches, $output, $path, addDirectoryContent(), addPath(), Maintenance\error(), Maintenance\getOption(), Maintenance\hasOption(), isSuitableFile(), Maintenance\output(), wfEscapeShellArg(), wfRestoreWarnings(), wfShellExec(), and wfSuppressWarnings().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::checkEvilToken ( file,
tokens,
evilToken,
desc 
) [private]

Definition at line 306 of file checkSyntax.php.

References $file, and Maintenance\output().

Referenced by checkForMistakes().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::checkFileWithCli ( file) [private]

Check a file for syntax errors using php -l.

Parameters:
$fileString Path to a file to check for syntax errors
Returns:
boolean

Definition at line 261 of file checkSyntax.php.

References $file, $res, Maintenance\output(), and wfEscapeShellArg().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::checkFileWithParsekit ( file) [private]

Check a file for syntax errors using Parsekit.

Shamelessly stolen from tools/lint.php by TimStarling

Parameters:
$fileString Path to a file to check for syntax errors
Returns:
boolean

Definition at line 233 of file checkSyntax.php.

References $file, and Maintenance\output().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::checkForMistakes ( file) [private]

Check a file for non-fatal coding errors, such as byte-order marks in the beginning or pointless ?> closing tags at the end.

Parameters:
$fileString String Path to a file to check for errors
Returns:
boolean

Definition at line 278 of file checkSyntax.php.

References $file, checkEvilToken(), and checkRegex().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

CheckSyntax::checkRegex ( file,
text,
regex,
desc 
) [private]

Definition at line 294 of file checkSyntax.php.

References $file, and Maintenance\output().

Referenced by checkForMistakes().

Here is the call graph for this function:

Here is the caller graph for this function:

Do the actual work.

All child classes will need to implement this

Reimplemented from Maintenance.

Definition at line 47 of file checkSyntax.php.

References $f, buildFileList(), checkFileWithCli(), checkFileWithParsekit(), checkForMistakes(), Maintenance\hasOption(), and Maintenance\output().

Here is the call graph for this function:

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:
Integer

Reimplemented from Maintenance.

Definition at line 43 of file checkSyntax.php.

References Maintenance\DB_NONE.

CheckSyntax::isSuitableFile ( file) [private]

Returns true if $file is of a type we can check.

Parameters:
$filestring
Returns:
bool

Definition at line 171 of file checkSyntax.php.

References $ext, and $file.

Referenced by addDirectoryContent(), and buildFileList().

Here is the caller graph for this function:


Member Data Documentation

CheckSyntax::$mFailures = array()

Definition at line 29 of file checkSyntax.php.

CheckSyntax::$mFiles = array() [private]

Definition at line 29 of file checkSyntax.php.

CheckSyntax::$mIgnorePaths = array() [private]

Definition at line 30 of file checkSyntax.php.

CheckSyntax::$mNoStyleCheckPaths = array()

Definition at line 30 of file checkSyntax.php.

CheckSyntax::$mWarnings = array()

Definition at line 29 of file checkSyntax.php.


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