Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
av3nger committed Nov 9, 2023
1 parent f87086f commit f4d8e2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/traits/trait-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,20 @@ public function get_slug(): string {
*/
public function is_set_up(): bool {
if ( get_option( 'cf-images-auth-error', false ) ) {
do_action( 'cf_images_log', 'Option cf-images-auth-error is present in the database: %s', get_option( 'cf-images-auth-error', false ) );
return false;
}

$saved = filter_input( INPUT_GET, 'saved', FILTER_VALIDATE_BOOLEAN );
$config_written = get_option( 'cf-images-config-written', false );
$defines_found = defined( 'CF_IMAGES_ACCOUNT_ID' ) && defined( 'CF_IMAGES_KEY_TOKEN' );

return ( $config_written && $saved ) || $defines_found;
$is_set_up = ( $config_written && $saved ) || $defines_found;
if ( ! $is_set_up ) {
do_action( 'cf_images_log', 'Plugin is not setup. Defines status: %s, config written: %s', $defines_found, $config_written );
}

return $is_set_up;
}

/**
Expand Down

0 comments on commit f4d8e2a

Please sign in to comment.