Inherits Maintenance.
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 | |
| buildFileList () | |
| Build the list of files we'll check for syntax errors. | |
| isSuitableFile ($file) | |
| Returns true if $file is of a type we can check. | |
| addPath ($path) | |
| Add given path to file list, searching it in include path if needed. | |
| addFileOrDir ($path) | |
| Add given file to file list, or, if it's a directory, add its content. | |
| addDirectoryContent ($dir) | |
| Add all suitable files in given directory or its subdirectories to the file list. | |
| checkFileWithParsekit ($file) | |
| Check a file for syntax errors using Parsekit. | |
| checkFileWithCli ($file) | |
| Check a file for syntax errors using php -l. | |
| 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) | |
Private Attributes | |
| $mFiles = array() | |
| $mFailures = array() | |
| $mWarnings = array() | |
| $mIgnorePaths = array() | |
| $mNoStyleCheckPaths = array() | |
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
Definition at line 25 of file checkSyntax.php.
| CheckSyntax::__construct | ( | ) |
Default constructor.
Children should call this if implementing their own constructors
Reimplemented from Maintenance.
Definition at line 31 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 204 of file checkSyntax.php.
References 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.
Definition at line 188 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.
Definition at line 180 of file checkSyntax.php.
References $IP, $path, and addFileOrDir().
Referenced by buildFileList().
| CheckSyntax::buildFileList | ( | ) | [private] |
Build the list of files we'll check for syntax errors.
Definition at line 73 of file checkSyntax.php.
References $dirs, $IP, $output, $path, addDirectoryContent(), addPath(), Maintenance::error(), Maintenance::getOption(), Maintenance::hasOption(), Maintenance::output(), wfEscapeShellArg(), and wfShellExec().
Referenced by execute().
| 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 250 of file checkSyntax.php.
References $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 222 of file checkSyntax.php.
References 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 267 of file checkSyntax.php.
References checkRegex().
Referenced by execute().
| CheckSyntax::checkRegex | ( | $ | file, | |
| $ | text, | |||
| $ | regex, | |||
| $ | desc | |||
| ) | [private] |
Definition at line 281 of file checkSyntax.php.
References Maintenance::output().
Referenced by checkForMistakes().
| CheckSyntax::execute | ( | ) |
Do the actual work.
All child classes will need to implement this
Reimplemented from Maintenance.
Definition at line 46 of file checkSyntax.php.
References buildFileList(), checkFileWithCli(), checkFileWithParsekit(), checkForMistakes(), Maintenance::hasOption(), and Maintenance::output().
| CheckSyntax::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
Reimplemented from Maintenance.
Definition at line 42 of file checkSyntax.php.
References Maintenance::DB_NONE.
| CheckSyntax::isSuitableFile | ( | $ | file | ) | [private] |
Returns true if $file is of a type we can check.
Definition at line 165 of file checkSyntax.php.
References $ext.
Referenced by addDirectoryContent().
CheckSyntax::$mFailures = array() [private] |
Definition at line 28 of file checkSyntax.php.
CheckSyntax::$mFiles = array() [private] |
Definition at line 28 of file checkSyntax.php.
CheckSyntax::$mIgnorePaths = array() [private] |
Definition at line 29 of file checkSyntax.php.
CheckSyntax::$mNoStyleCheckPaths = array() [private] |
Definition at line 29 of file checkSyntax.php.
CheckSyntax::$mWarnings = array() [private] |
Definition at line 28 of file checkSyntax.php.
1.5.9