Add-on Name: Core Compare Tool
Version: 0.4.0
Updated: 03/17/2021
Supports CE Phoenix: >= 1.0.7.5
Supports OS Commerce: >= 2.3.4.0
Description of Add-on
This admin tool will allow you to download a copy of the core version you are using and compare it to your installed version. It will then outline:
- Added Files
- Changed Files
- Deleted Files
You can also remove cores as you upgrade.
Screenshot(s)
Change Log
- 0.4.0 (03/14/2021)
- Added logic to handle the rebranding of Phoenix so that files are not considered altered due to copyright message and comment blocks changing in files.
- 0.3.1 (03/17/2021)
- Fixed error being thrown in settings page
- 0.3.0 (03/14/2021)
- Added extra logic required for Phoenix >= 1.0.8.0
- 0.2.0 (03/04/2021)
- Adjusted code to handle latest Phoenix Core Changes
- 0.1.6 (02/05/2021)
- Fixed issue with file compare and line endings
- 0.1.5 (09/09/2020)
- Code cleanup
- Added settings page
- Added exclude directories option to ignore certain folders
- 0.1.4 (09/02/2020)
- Changed exec() to use scandir() for directories
- Fixed error as there was a single <? short tag in code
- Fixed some syntax issues that created errors in earlier versions of PHP 7
- 0.1.3 (08/27/2020)
- Fixed some layout issues in Google Chrome for table formatting
- 0.1.2 (08/22/2020)
- Added replace feature for missing or altered files to revert them to core version
- 0.1.1 (08/20/2020)
- removed this tool from Zipur Toolbox and made it a stand alone tool
- 0.1.0 (08/06/2020)
- Initial Release
Download(s)
You can now download this addon from the Phoenix Cart Forum Addons Library
https://phoenixcart.org/forum/app.php/addons/free_addon/core_compare_tool/
I usually have some “garbage” files like *.php.orig, when testing things. I made the changes below to only compare php, css and js files.
//VMN Added endsWith
function endsWith($string, $endString)
{
$len = strlen($endString);
if ($len == 0) {
return true;
}
return (substr($string, -$len) === $endString);
}
//VMN Added endsWith
/** Create a nested array from a directory root
*
* @param $path
* @param array $ignorefolders
* @param int $type
* @param false $convertadmin
*/
function zipGetDirArray( $path, $ignorefolders = [], $type = 0, $convertadmin = false ) {
global $installedfiles, $cleancorefiles, $version, $customadminpath;
$files = scandir( $path );
foreach ( $files as $file ) {
if ( $file == ‘.’ || $file == ‘..’ ) {
//do nothing
} else if ( is_dir( $path . ‘/’ . $file ) ) {
if ( ( in_array( basename( $file ), $ignorefolders ) ) ) {
//do nothing for ignored folders
} else {
zipGetDirArray( $path . ‘/’ . $file, $ignorefolders, $type, $convertadmin );
}
} else {
if ( ( in_array( basename( $file ), $ignorefolders ) ) ) {
//do nothing for ignored files
} else {
//VMN only check php, css and js files
if ( endsWith( $file, ‘.php’ ) || endsWith( $file, ‘.css’ ) || endsWith( $file, ‘.js’ ) ) {
if ( empty( $type ) ) {
$keypath = $path . ‘/’ . $file;
$keypath = str_replace( DIR_FS_CATALOG, ”, $keypath );
if ( $convertadmin ) {
$keypath = preg_replace( ‘/^\/’ . $customadminpath . ‘/’, ‘/admin’, $keypath, 1 );
}
$installedfiles[ $keypath ] = hash_file( ‘md5’, $path . ‘/’ . $file );
} else if ( $type == 1 ) {
$keypath = $path . ‘/’ . $file;
$ospath = ( zipCheckIfPhoenix() ) ? ‘CE-Phoenix-‘ : ‘oscommerce-‘;
$ospath2 = ( zipCheckIfPhoenix() ) ? ” : ‘/catalog’;
$keypath = str_replace( DIR_FS_ADMIN . ‘clean_core/’ . $ospath . trim( $version ) . $ospath2, ”, $keypath );
$keypath = preg_replace( ‘/^\/admin/’, ‘/’ . $customadminpath . ”, $keypath, 1 );
$cleancorefiles[ $keypath ] = hash_file( ‘md5’, $path . ‘/’ . $file );
} else if ( $type == 2 ) {
//ignore any non-php files for catching patch versions
if ( strpos( $file, ‘.php’ ) !== false ) {
$keypath = $path . ‘/’ . $file;
$cleancorefiles[] = $keypath;
}
}
December 3, 2020 at 3:42 am}
//VMN only check php, css and js files
}
}
}
}
I’ll leave the comment here. I may add some extra functionality to ignore files of specified types. Me personally, I want to see all differences, including test files.
December 4, 2020 at 12:30 pmThis solves the problem, at least in my OpenSuse. Run the command below in the unzipped update package root directory before applying the updates.
dos2unix –keepdate $(find . -type f -name “*.php”)
December 3, 2020 at 2:51 amDoes not seem to give correct results, if Phoenix update zip has been used. The update zip files seem to come from a Windows environment. Thus, the files do not match against the full package.
December 2, 2020 at 11:47 amI have noticed that recently. It never used to do that. I also use *nix, so I am seeing the same result. It hashes the files to make the compare. I will see about changing line endings in files in the clean_core to solve the issue.
December 2, 2020 at 11:57 amHi and thanks for this addon.
I could not set exclude folders without the following fix:
in the function zipurRow:
//VMNif ( $rowdata[0][‘text’] !== ” ) {
if (isset($rowdata[1][‘text’]) && $rowdata[1][‘text’] !== ” ) {
$rightdata .= $rowdata[1][‘text’];
December 2, 2020 at 7:33 am}
//VMNif ( $rowdata[1][‘text’] !== ” ) {
if (isset( $rowdata[1][‘field’]) && $rowdata[1][‘field’] !== ” ) {
$rightdata .= $rowdata[1][‘field’];
}
What version of the tool are you using? I dont have a function zipurRow in this tool?
December 4, 2020 at 12:37 pm