Class: depcheck
Version: 1.0.1 4/12/2015
Copyright 2015 Wagon Trader, All Rights Reserved
Description:
This class will parse any specified file for deprecated PHP functions and report findings.
Files:
depcheck.class.php - Main class
depcheck.csv - CSV file containing deprecated function data
depcheck.php - Simple application script
all.php - example file to check multiple files in specified folder and sub folders
depcheck.css - styles used in all.php file
(files all.php and depcheck.css provided by Gerry Danen)
/extended_sql folder contains all document check with results saved to database files provided by Tony Russo
/cli_batch folder contains command line batch processing files provided by Han Velthuis
Installation:
Upload files to a web accessible location on your server (eg. public_html)
Note: By default the class is configured to find the CSV file in the same location as the class file.
Configuration:
The class if configured to work with most server configurations. You can change the following settings in the class should you need to...
$docRoot - You may specify your full path to the document root here, or leave blank to use the server specified path.
$depFile - You may specify the CSV file containing deprecated functions here
$depFileHeader - Specify true or false if the CSV file contains header info in its first line.
Usage:
Using included script depcheck.php
This script expects the file you want to be checked to be in the URI as a key/value pair of f=[filename]. The filename must also include any folders off of the document root. For example, you would point your browser to...
depcheck.php?f=folder/file.php
By default, this script will limit the results up to and including your currently installed version of PHP. If you want to check the file against all deprecated functions in the CSV file then change the line...
$dpc = new depcheck($fileName);
to
$dpc = new depcheck($fileName,true);
Creating your own script
Refer to class for instructions on using methods
Working with the deprecated functions CSV file
You can add, remove or change any row of data in this file to keep it up to date.
The comma separated values are in this order...
"[function]","[replacement function]",[major version],[minor version],[release version]
Note that the versions are the PHP version when the function became deprecated.
Changelog
1.0.2
Added all sql extension files. Provided by Tony Russo
Added command line batch processing in folder cli_batch. Provided by Han Velthuis
1.0.1
included files all.php and depcheck.css - multiple file checker provided by Gerry Danen
fixed bug where false postive reported when non depricated function ends with same text of depricated function name
added logic to skip line if commented with //
added class property depFlag which will be set to true if deprecated functions are found in checked file
|