|
MediaWiki
REL1_23
|
Maintenance script to check syntax of all PHP files in MediaWiki. More...


Public Member Functions | |
| __construct () | |
| execute () | |
| 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) | |
| getGitModifiedFiles ($path) | |
| Returns a list of tracked files in a Git work tree differing from the master branch. | |
| isSuitableFile ($file) | |
| Returns true if $file is of a type we can check. | |
Private Attributes | |
| $mFiles = array() | |
| $mIgnorePaths = array() | |
Maintenance script to check syntax of all PHP files in MediaWiki.
Definition at line 31 of file checkSyntax.php.
Reimplemented from Maintenance.
Definition at line 37 of file checkSyntax.php.
References Maintenance\addOption().
| CheckSyntax::addDirectoryContent | ( | $ | dir | ) | [private] |
Add all suitable files in given directory or its subdirectories to the file list.
| $dir | String: directory to process |
Definition at line 264 of file checkSyntax.php.
References $dir, $file, as, and isSuitableFile().
Referenced by addFileOrDir(), and buildFileList().
| CheckSyntax::addFileOrDir | ( | $ | path | ) | [private] |
Add given file to file list, or, if it's a directory, add its content.
| $path | string |
Definition at line 248 of file checkSyntax.php.
References $path, and addDirectoryContent().
Referenced by addPath().
| CheckSyntax::addPath | ( | $ | path | ) | [private] |
Add given path to file list, searching it in include path if needed.
| $path | string |
Definition at line 238 of file checkSyntax.php.
References $IP, $path, addFileOrDir(), and global.
Referenced by buildFileList().
| CheckSyntax::buildFileList | ( | ) | [private] |
Build the list of files we'll check for syntax errors.
Definition at line 79 of file checkSyntax.php.
References $dirs, $f, $file, $files, $IP, $path, addDirectoryContent(), addPath(), array(), as, Maintenance\error(), getGitModifiedFiles(), Maintenance\getOption(), global, Maintenance\hasOption(), isSuitableFile(), Maintenance\output(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by execute().
| CheckSyntax::checkEvilToken | ( | $ | file, |
| $ | tokens, | ||
| $ | evilToken, | ||
| $ | desc | ||
| ) | [private] |
Definition at line 356 of file checkSyntax.php.
References $file, array(), and Maintenance\output().
Referenced by checkForMistakes().
| CheckSyntax::checkFileWithCli | ( | $ | file | ) | [private] |
Check a file for syntax errors using php -l.
| $file | String Path to a file to check for syntax errors |
Definition at line 310 of file checkSyntax.php.
References $file, $res, Maintenance\output(), and wfEscapeShellArg().
Referenced by execute().
| CheckSyntax::checkFileWithParsekit | ( | $ | file | ) | [private] |
Check a file for syntax errors using Parsekit.
Shamelessly stolen from tools/lint.php by TimStarling
| $file | String Path to a file to check for syntax errors |
Definition at line 282 of file checkSyntax.php.
References $error, $file, $ret, array(), as, and Maintenance\output().
Referenced by execute().
| 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.
| $file | String String Path to a file to check for errors |
Definition at line 327 of file checkSyntax.php.
References $file, array(), as, checkEvilToken(), and checkRegex().
Referenced by execute().
| CheckSyntax::checkRegex | ( | $ | file, |
| $ | text, | ||
| $ | regex, | ||
| $ | desc | ||
| ) | [private] |
Definition at line 344 of file checkSyntax.php.
References $file, array(), and Maintenance\output().
Referenced by checkForMistakes().
Reimplemented from Maintenance.
Definition at line 52 of file checkSyntax.php.
References $f, as, buildFileList(), checkFileWithCli(), checkFileWithParsekit(), checkForMistakes(), Maintenance\hasOption(), and Maintenance\output().
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
Reimplemented from Maintenance.
Definition at line 48 of file checkSyntax.php.
References Maintenance\DB_NONE.
| CheckSyntax::getGitModifiedFiles | ( | $ | path | ) | [private] |
Returns a list of tracked files in a Git work tree differing from the master branch.
| $path | string: Path to the repository |
Definition at line 165 of file checkSyntax.php.
References $output, $path, $retval, array(), Maintenance\error(), global, wfEscapeShellArg(), and wfShellExec().
Referenced by buildFileList().
| CheckSyntax::isSuitableFile | ( | $ | file | ) | [private] |
Returns true if $file is of a type we can check.
| $file | string |
Definition at line 218 of file checkSyntax.php.
References $ext, $file, array(), and as.
Referenced by addDirectoryContent(), and buildFileList().
| CheckSyntax::$mFailures = array() |
Definition at line 34 of file checkSyntax.php.
CheckSyntax::$mFiles = array() [private] |
Definition at line 34 of file checkSyntax.php.
CheckSyntax::$mIgnorePaths = array() [private] |
Definition at line 35 of file checkSyntax.php.
| CheckSyntax::$mNoStyleCheckPaths = array() |
Definition at line 35 of file checkSyntax.php.
| CheckSyntax::$mWarnings = array() |
Definition at line 34 of file checkSyntax.php.