Skip to content

Update the code to not use trigger error or error log in production #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DenisFlorin
Copy link
Contributor

No description provided.

@DenisFlorin
Copy link
Contributor Author

The Plugin Check https://wordpress.org/plugins/plugin-check/ reports the following messages:

Type Code Message
WARNING WordPress.PHP.DevelopmentFunctions.error_log_trigger_error trigger_error() found. Debug code should not normally be used in production.
WARNING WordPress.PHP.DevelopmentFunctions.error_log_error_log error_log() found. Debug code should not normally be used in production.

flock( $gitium_lock_handle, LOCK_UN );
fclose( $gitium_lock_handle );
}
endif;

// Merges the commits with remote and pushes them back
function gitium_merge_and_push( $commits ) {
global $git;
global $git;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the indentation is inconsistent.

if ( $git->is_dirty() && $git->add() > 0 ) {
$commit = $git->commit( $commitmsg );
if ( ! $commit ) {
wp_die( 'Error: Could not commit local changes.', 'Gitium Error', [ 'response' => 500 ] );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wp_die( 'Error: Could not commit local changes.', 'Gitium Error', [ 'response' => 500 ] );
wp_die( 'Could not commit local changes.', 'Gitium Error', [ 'response' => 500 ] );


if ( ! gitium_merge_and_push( $commits ) ) {
$error = $git->get_last_error();
wp_die( 'Error: Merge & push failed. ' . ( is_string( $error ) ? $error : '' ), 'Gitium Error', [ 'response' => 500 ] );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wp_die( 'Error: Merge & push failed. ' . ( is_string( $error ) ? $error : '' ), 'Gitium Error', [ 'response' => 500 ] );
wp_die( 'Merge & push failed. ' . ( is_string( $error ) ? $error : '' ), 'Gitium Error', [ 'response' => 500 ] );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants