Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
= 1.8 =
- Fixed a bug where the verify checksums command fails even when it should succeed.

= 1.7 =
- Fixed a bug that sometimes causes the form ID to be stored as a string.

Expand Down
4 changes: 2 additions & 2 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Gravity Forms CLI
Plugin URI: https://gravityforms.com
Description: Manage Gravity Forms with the WP CLI.
Version: 1.7
Version: 1.8
Author: Rocketgenius
Author URI: https://gravityforms.com
License: GPL-2.0+
Expand All @@ -30,7 +30,7 @@
defined( 'ABSPATH' ) || defined( 'WP_CLI' ) || die();

// Defines the current version of the CLI add-on
define( 'GF_CLI_VERSION', '1.7' );
define( 'GF_CLI_VERSION', '1.8' );

define( 'GF_CLI_MIN_GF_VERSION', '1.9.17.8' );

Expand Down
12 changes: 8 additions & 4 deletions includes/class-gf-cli-tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,20 @@ public function verify_checksums( $args, $assoc_args ) {

$has_errors = false;
foreach ( $checksums as $checksum_string ) {
$checksum = substr( $checksum_string, 0, 32 );
$file = str_replace( $checksum . ' ', '', $checksum_string );
list( $checksum, $file ) = explode( ' ', $checksum_string );
$path = GFCommon::get_base_path() . DIRECTORY_SEPARATOR . $file;
if ( ! file_exists( $path ) ) {
WP_CLI::warning( "File doesn't exist: {$file}" );
$has_errors = true;
continue;
}
$md5_file = md5_file( $path );
if ( $md5_file !== $checksum ) {
$hashed_file = '';
if ( strlen( $checksum ) === 32 ) {
$hashed_file = md5_file( $path );
} elseif ( strlen( $checksum ) === 40 ) {
$hashed_file = sha1_file( $path );
}
if ( $hashed_file !== $checksum ) {
WP_CLI::warning( "File doesn't verify against checksum: {$file}" );
$has_errors = true;
}
Expand Down